diff options
Diffstat (limited to 'libmate-desktop')
-rw-r--r-- | libmate-desktop/mate-colorbutton.c | 31 | ||||
-rw-r--r-- | libmate-desktop/mate-colorseldialog.c | 41 | ||||
-rw-r--r-- | libmate-desktop/mate-rr.c | 9 |
3 files changed, 57 insertions, 24 deletions
diff --git a/libmate-desktop/mate-colorbutton.c b/libmate-desktop/mate-colorbutton.c index 249860a..9596735 100644 --- a/libmate-desktop/mate-colorbutton.c +++ b/libmate-desktop/mate-colorbutton.c @@ -260,7 +260,10 @@ draw (GtkWidget *widget, { MateColorButton *color_button = MATE_COLOR_BUTTON (data); cairo_pattern_t *checkered; + GtkStyleContext *context; + GdkRGBA rgba; + mate_color_button_get_rgba (color_button, &rgba); if (mate_color_button_has_alpha (color_button)) { cairo_save (cr); @@ -278,21 +281,23 @@ draw (GtkWidget *widget, cairo_restore (cr); cairo_set_source_rgba (cr, - color_button->priv->color.red / 65535., - color_button->priv->color.green / 65535., - color_button->priv->color.blue / 65535., - color_button->priv->alpha / 65535.); + rgba.red, + rgba.green, + rgba.blue, + rgba.alpha); } else { - gdk_cairo_set_source_color (cr, &color_button->priv->color); + gdk_cairo_set_source_rgba (cr, &rgba); } cairo_paint (cr); if (!gtk_widget_is_sensitive (GTK_WIDGET (color_button))) { - gdk_cairo_set_source_color (cr, >k_widget_get_style (GTK_WIDGET(color_button))->bg[GTK_STATE_INSENSITIVE]); + context = gtk_widget_get_style_context (widget); + gtk_style_context_get_color (context, GTK_STATE_INSENSITIVE, &rgba); + gdk_cairo_set_source_rgba (cr, &rgba); checkered = mate_color_button_get_checkered (); cairo_mask (cr, checkered); cairo_pattern_destroy (checkered); @@ -402,7 +407,6 @@ mate_color_button_drag_data_get (GtkWidget *widget, static void mate_color_button_init (MateColorButton *color_button) { - GtkWidget *alignment; GtkWidget *frame; PangoLayout *layout; PangoRectangle rect; @@ -412,18 +416,17 @@ mate_color_button_init (MateColorButton *color_button) /* Create the widgets */ color_button->priv = mate_color_button_get_instance_private (color_button); - alignment = gtk_alignment_new (0.5, 0.5, 0.5, 1.0); - gtk_container_set_border_width (GTK_CONTAINER (alignment), 1); - gtk_container_add (GTK_CONTAINER (color_button), alignment); - gtk_widget_show (alignment); - frame = gtk_frame_new (NULL); + gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); + gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT); - gtk_container_add (GTK_CONTAINER (alignment), frame); + gtk_container_add (GTK_CONTAINER (color_button), frame); gtk_widget_show (frame); /* Just some widget we can hook to expose-event on */ - color_button->priv->draw_area = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + color_button->priv->draw_area = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_valign (color_button->priv->draw_area, GTK_ALIGN_CENTER); + gtk_widget_set_halign (color_button->priv->draw_area, GTK_ALIGN_CENTER); layout = gtk_widget_create_pango_layout (GTK_WIDGET (color_button), "Black"); pango_layout_get_pixel_extents (layout, NULL, &rect); diff --git a/libmate-desktop/mate-colorseldialog.c b/libmate-desktop/mate-colorseldialog.c index 2516be1..c947921 100644 --- a/libmate-desktop/mate-colorseldialog.c +++ b/libmate-desktop/mate-colorseldialog.c @@ -123,6 +123,23 @@ mate_color_selection_dialog_class_init (MateColorSelectionDialogClass *klass) G_PARAM_READABLE)); } +static GtkWidget* +mate_add_dialog_button (GtkDialog *dialog, + const char *label, + const char *icon, + GtkResponseType response) +{ + GtkWidget *widget; + GtkWidget *image; + + widget = gtk_button_new_with_mnemonic (label); + image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (widget), image); + gtk_dialog_add_action_widget (dialog, widget, response); + + return widget; +} + static void mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag) { @@ -142,21 +159,27 @@ mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag) gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (colorseldiag))), colorseldiag->colorsel); gtk_widget_show (colorseldiag->colorsel); - colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL); + colorseldiag->cancel_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag), + _("_Cancel"), + "gtk-cancel", + GTK_RESPONSE_CANCEL); - colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), - GTK_STOCK_OK, - GTK_RESPONSE_OK); + colorseldiag->ok_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag), + _("_OK"), + "gtk-ok", + GTK_RESPONSE_OK); + gtk_widget_set_can_default (colorseldiag->ok_button, TRUE); gtk_widget_grab_default (colorseldiag->ok_button); - colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), - GTK_STOCK_HELP, - GTK_RESPONSE_HELP); + colorseldiag->help_button = mate_add_dialog_button (GTK_DIALOG (colorseldiag), + _("Help"), + "help-browser", + GTK_RESPONSE_HELP); gtk_widget_hide (colorseldiag->help_button); + gtk_widget_show (colorseldiag->cancel_button); + gtk_widget_show (colorseldiag->ok_button); gtk_window_set_title (GTK_WINDOW (colorseldiag), _("Color Selection")); diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c index 19d25ca..e856399 100644 --- a/libmate-desktop/mate-rr.c +++ b/libmate-desktop/mate-rr.c @@ -1153,7 +1153,11 @@ get_property (Display *dpy, if (actual_type == XA_INTEGER && actual_format == 8) { +#ifdef GLIB_VERSION_2_68 + result = g_memdup2 (prop, nitems); +#else result = g_memdup (prop, nitems); +#endif if (len) *len = nitems; } @@ -1359,8 +1363,11 @@ output_copy (const MateRROutput *from) output->modes = (MateRRMode**) g_ptr_array_free (array, FALSE); output->edid_size = from->edid_size; +#ifdef GLIB_VERSION_2_68 + output->edid_data = g_memdup2 (from->edid_data, from->edid_size); +#else output->edid_data = g_memdup (from->edid_data, from->edid_size); - +#endif return output; } |