From 1019fcd2fc788b615ec0d25fe120cce4c7c13348 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 13 Jun 2012 01:13:50 +0200 Subject: shell: Use GdkRGBA for annotations Use the GdkRGBA API on EvAnnotation, and on GtkColorChooser. taken from: https://git.gnome.org/browse/evince/commit/?id=c523ef8 --- shell/ev-annotation-properties-dialog.c | 16 ++++++++-------- shell/ev-annotation-properties-dialog.h | 4 ++-- shell/ev-window.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/shell/ev-annotation-properties-dialog.c b/shell/ev-annotation-properties-dialog.c index 3c0efba6..a2815030 100644 --- a/shell/ev-annotation-properties-dialog.c +++ b/shell/ev-annotation-properties-dialog.c @@ -135,7 +135,7 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog GtkWidget *grid; GtkWidget *hbox; gchar *markup; - GdkColor color = { 0, 65535, 65535, 0 }; + const GdkRGBA yellow = { 1., 1., 0., 1. }; gtk_window_set_title (GTK_WINDOW (annot_dialog), _("Annotation Properties")); gtk_window_set_destroy_with_parent (GTK_WINDOW (annot_dialog), TRUE); @@ -181,7 +181,7 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1); gtk_widget_show (label); - annot_dialog->color = gtk_color_button_new_with_color (&color); + annot_dialog->color = gtk_color_button_new_with_rgba (&yellow); gtk_grid_attach (GTK_GRID (grid), annot_dialog->color, 1, 1, 1, 1); gtk_widget_set_hexpand (annot_dialog->color, TRUE); gtk_widget_show (annot_dialog->color); @@ -273,7 +273,7 @@ ev_annotation_properties_dialog_new_with_annotation (EvAnnotation *annot) const gchar *label; gdouble opacity; gboolean is_open; - GdkColor color; + GdkRGBA rgba; dialog = (EvAnnotationPropertiesDialog *)ev_annotation_properties_dialog_new (ev_annotation_get_annotation_type (annot)); dialog->annot = g_object_ref (annot); @@ -282,8 +282,8 @@ ev_annotation_properties_dialog_new_with_annotation (EvAnnotation *annot) if (label) gtk_entry_set_text (GTK_ENTRY (dialog->author), label); - ev_annotation_get_color (annot, &color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (dialog->color), &color); + ev_annotation_get_rgba (annot, &rgba); + gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->color), &rgba); opacity = ev_annotation_markup_get_opacity (EV_ANNOTATION_MARKUP (annot)); gtk_range_set_value (GTK_RANGE (dialog->opacity), opacity * 100); @@ -309,10 +309,10 @@ ev_annotation_properties_dialog_get_author (EvAnnotationPropertiesDialog *dialog } void -ev_annotation_properties_dialog_get_color (EvAnnotationPropertiesDialog *dialog, - GdkColor *color) +ev_annotation_properties_dialog_get_rgba (EvAnnotationPropertiesDialog *dialog, + GdkRGBA *rgba) { - gtk_color_button_get_color (GTK_COLOR_BUTTON (dialog->color), color); + gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog->color), rgba); } gdouble diff --git a/shell/ev-annotation-properties-dialog.h b/shell/ev-annotation-properties-dialog.h index f44c6505..75937f41 100644 --- a/shell/ev-annotation-properties-dialog.h +++ b/shell/ev-annotation-properties-dialog.h @@ -43,8 +43,8 @@ GtkWidget *ev_annotation_properties_dialog_new (EvAnno GtkWidget *ev_annotation_properties_dialog_new_with_annotation (EvAnnotation *annot); const gchar *ev_annotation_properties_dialog_get_author (EvAnnotationPropertiesDialog *dialog); -void ev_annotation_properties_dialog_get_color (EvAnnotationPropertiesDialog *dialog, - GdkColor *color); +void ev_annotation_properties_dialog_get_rgba (EvAnnotationPropertiesDialog *dialog, + GdkRGBA *rgba); gdouble ev_annotation_properties_dialog_get_opacity (EvAnnotationPropertiesDialog *dialog); gboolean ev_annotation_properties_dialog_get_popup_is_open (EvAnnotationPropertiesDialog *dialog); EvAnnotationTextIcon ev_annotation_properties_dialog_get_text_icon (EvAnnotationPropertiesDialog *dialog); diff --git a/shell/ev-window.c b/shell/ev-window.c index 066655d9..b82d137f 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -7052,7 +7052,7 @@ ev_view_popup_cmd_annot_properties (GtkAction *action, if (window->priv->document->iswebdocument == TRUE ) return; const gchar *author; - GdkColor color; + GdkRGBA rgba; gdouble opacity; gboolean popup_is_open; EvAnnotationPropertiesDialog *dialog; @@ -7075,8 +7075,8 @@ ev_view_popup_cmd_annot_properties (GtkAction *action, if (ev_annotation_markup_set_label (EV_ANNOTATION_MARKUP (annot), author)) mask |= EV_ANNOTATIONS_SAVE_LABEL; - ev_annotation_properties_dialog_get_color (dialog, &color); - if (ev_annotation_set_color (annot, &color)) + ev_annotation_properties_dialog_get_rgba (dialog, &rgba); + if (ev_annotation_set_rgba (annot, &rgba)) mask |= EV_ANNOTATIONS_SAVE_COLOR; opacity = ev_annotation_properties_dialog_get_opacity (dialog); -- cgit v1.2.1