[gnome-photos] selection-toolbar: Use a filled/unfilled icon for favorites



commit d701a156ddd456b45ee836eb75ee47b449c3db9a
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Thu Oct 22 20:04:27 2015 +0200

    selection-toolbar: Use a filled/unfilled icon for favorites
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751106

 src/photos-selection-toolbar.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 4bdb277..abb47c2 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -218,7 +218,7 @@ photos_selection_toolbar_set_item_visibility (PhotosSelectionToolbar *self)
   GList *apps = NULL;
   GList *l;
   GList *selection;
-  GtkStyleContext *context;
+  GtkWidget *image;
   gboolean has_selection;
   gboolean show_collection;
   gboolean show_favorite;
@@ -286,21 +286,20 @@ photos_selection_toolbar_set_item_visibility (PhotosSelectionToolbar *self)
   g_free (open_label);
   g_list_free_full (apps, g_free);
 
-  context = gtk_widget_get_style_context (priv->toolbar_favorite);
   if (show_favorite && fav_count == sel_length)
     {
       favorite_label = g_strdup (_("Remove from favorites"));
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toolbar_favorite), TRUE);
-      gtk_style_context_add_class (context, "photos-favorite");
+      image = gtk_image_new_from_icon_name (PHOTOS_ICON_FAVORITE_SYMBOLIC, GTK_ICON_SIZE_BUTTON);
     }
   else
     {
       favorite_label = g_strdup (_("Add to favorites"));
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toolbar_favorite), FALSE);
-      gtk_style_context_remove_class (context, "photos-favorite");
+      image = gtk_image_new_from_icon_name (PHOTOS_ICON_NOT_FAVORITE_SYMBOLIC, GTK_ICON_SIZE_BUTTON);
     }
 
-  gtk_widget_reset_style (priv->toolbar_favorite);
+  gtk_button_set_image (GTK_BUTTON (priv->toolbar_favorite), image);
   gtk_widget_set_tooltip_text (priv->toolbar_favorite, favorite_label);
   g_free (favorite_label);
 
@@ -430,7 +429,6 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
 {
   PhotosSelectionToolbarPrivate *priv;
   GApplication *app;
-  GtkWidget *image;
   GtkWidget *toolbar;
   PhotosSearchContextState *state;
 
@@ -445,9 +443,7 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
   toolbar = gtk_action_bar_new ();
   gtk_container_add (GTK_CONTAINER (self), toolbar);
 
-  image = gtk_image_new_from_icon_name (PHOTOS_ICON_FAVORITE_SYMBOLIC, GTK_ICON_SIZE_BUTTON);
   priv->toolbar_favorite = gtk_toggle_button_new ();
-  gtk_button_set_image (GTK_BUTTON (priv->toolbar_favorite), image);
   gtk_action_bar_pack_start (GTK_ACTION_BAR (toolbar), priv->toolbar_favorite);
   g_signal_connect (priv->toolbar_favorite,
                     "clicked",


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