[gthumb] destination button: specify the subfolder style in the css file



commit 5a2fd2db5d3ca11e60a20d00eaf7fa5ae86a22e8
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Nov 19 20:03:31 2013 +0100

    destination button: specify the subfolder style in the css file

 .../importer/gth-import-destination-button.c       |   76 +-------------------
 gthumb/resources/gthumb.css                        |   10 +++
 2 files changed, 12 insertions(+), 74 deletions(-)
---
diff --git a/extensions/importer/gth-import-destination-button.c 
b/extensions/importer/gth-import-destination-button.c
index 59d0984..07320ed 100644
--- a/extensions/importer/gth-import-destination-button.c
+++ b/extensions/importer/gth-import-destination-button.c
@@ -35,77 +35,9 @@ struct _GthImportDestinationButtonPrivate {
 
 
 static void
-_update_subfolder_label_color (GthImportDestinationButton *self)
-{
-       if (! gtk_widget_get_realized (GTK_WIDGET (self)))
-               return;
-
-       if ((gtk_widget_get_state_flags (self->priv->subfolder_label) & GTK_STATE_FLAG_INSENSITIVE) == 
GTK_STATE_FLAG_INSENSITIVE) {
-               gtk_label_set_attributes (GTK_LABEL (self->priv->subfolder_label), NULL);
-               gtk_widget_queue_resize (self->priv->subfolder_label);
-       }
-       else {
-               PangoAttrList  *attr_list;
-               PangoAttribute *attr;
-
-               attr_list = pango_attr_list_new ();
-               attr = pango_attr_foreground_new (45489, 13107, 1799);
-               pango_attr_list_insert (attr_list, attr);
-               gtk_label_set_attributes (GTK_LABEL (self->priv->subfolder_label), attr_list);
-               pango_attr_list_unref (attr_list);
-
-               /* FIXME: the color is NULL for some themes.
-               GdkColor *color;
-
-               color = NULL;
-               gtk_widget_style_get (GTK_WIDGET (self), "link-color", &color, NULL);
-               if (color != NULL) {
-                       PangoAttrList  *attr_list;
-                       PangoAttribute *attr;
-
-                       g_print ("(%" G_GUINT16_FORMAT ", %" G_GUINT16_FORMAT ", %" G_GUINT16_FORMAT ")\n", 
color->red, color->green, color->blue);
-
-                       attr_list = pango_attr_list_new ();
-                       attr = pango_attr_foreground_new (color->red, color->green, color->blue);
-                       pango_attr_list_insert (attr_list, attr);
-                       gtk_label_set_attributes (GTK_LABEL (self->priv->subfolder_label), attr_list);
-                       pango_attr_list_unref (attr_list);
-
-                       gdk_color_free (color);
-               }
-               else
-                       g_print ("no color\n");
-               */
-       }
-}
-
-
-static void
-gth_import_destination_button_realize (GtkWidget *widget)
-{
-       GTK_WIDGET_CLASS (gth_import_destination_button_parent_class)->realize (widget);
-       _update_subfolder_label_color (GTH_IMPORT_DESTINATION_BUTTON (widget));
-}
-
-
-static void
 gth_import_destination_button_class_init (GthImportDestinationButtonClass *klass)
 {
-       GtkWidgetClass *widget_class;
-
        g_type_class_add_private (klass, sizeof (GthImportDestinationButtonPrivate));
-
-       widget_class = (GtkWidgetClass*) klass;
-       widget_class->realize = gth_import_destination_button_realize;
-}
-
-
-static void
-subfolder_label_state_flags_changed_cb (GtkWidget     *widget,
-                                       GtkStateFlags  flags,
-                                       gpointer       user_data)
-{
-       _update_subfolder_label_color (GTH_IMPORT_DESTINATION_BUTTON (user_data));
 }
 
 
@@ -134,16 +66,12 @@ gth_import_destination_button_init (GthImportDestinationButton *self)
        gtk_box_pack_start (GTK_BOX (label_box), self->priv->destination_label, FALSE, FALSE, 0);
 
        self->priv->subfolder_label = gtk_label_new ("");
+       gtk_style_context_add_class (gtk_widget_get_style_context (self->priv->subfolder_label), 
"highlighted-text");
        gtk_label_set_ellipsize (GTK_LABEL (self->priv->subfolder_label), PANGO_ELLIPSIZE_END);
        gtk_misc_set_alignment (GTK_MISC (self->priv->subfolder_label), 0.0, 0.5);
 
        gtk_widget_show (self->priv->subfolder_label);
        gtk_box_pack_start (GTK_BOX (label_box), self->priv->subfolder_label, TRUE, TRUE, 0);
-
-       g_signal_connect (self->priv->subfolder_label,
-                         "state-flags-changed",
-                         G_CALLBACK (subfolder_label_state_flags_changed_cb),
-                         self);
 }
 
 
@@ -160,7 +88,7 @@ preferences_dialog_destination_changed_cb (GthImportPreferencesDialog *dialog,
                char *name;
 
                name = g_file_get_parse_name (destination);
-               gtk_image_set_from_icon_name(GTK_IMAGE (self->priv->destination_icon), "folder", 
GTK_ICON_SIZE_MENU);
+               gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->destination_icon), "folder-symbolic", 
GTK_ICON_SIZE_MENU);
                gtk_label_set_text (GTK_LABEL (self->priv->destination_label), name);
                g_free (name);
 
diff --git a/gthumb/resources/gthumb.css b/gthumb/resources/gthumb.css
index b54834d..ecb4e4e 100644
--- a/gthumb/resources/gthumb.css
+++ b/gthumb/resources/gthumb.css
@@ -68,3 +68,13 @@ GtkScrolledWindow.comment .scrollbar.slider:backdrop {
        background-color: @comment_bg_backdrop;
        color: #666666;
 }
+
+/* -- highlighed text on the destination button in the import dialog -- */
+
+GtkLabel.highlighted-text {
+       color: #8fb1e0;
+}
+
+GtkLabel.highlighted-text:backdrop {
+       color: #333333;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]