[gnome-photos] Use a filled/unfilled icon instead of colour to denote favorites



commit 2d3f5d00c34f23f81c74ce199ca80a2478a5f4be
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Mon Oct 12 20:32:00 2015 +0200

    Use a filled/unfilled icon instead of colour to denote favorites
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751106

 data/Adwaita.css          |    5 -----
 src/photos-icons.h        |    3 +++
 src/photos-main-toolbar.c |   11 ++++-------
 3 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/data/Adwaita.css b/data/Adwaita.css
index b539dd0..7075be1 100644
--- a/data/Adwaita.css
+++ b/data/Adwaita.css
@@ -1,6 +1,5 @@
 @define-color theme_base_color #333333;
 @define-color theme_bg_color #393f3f;
- define-color theme_selected_bg_color #3465a4;
 
 @define-color entry_tag_bg #888a85;
 @define-color entry_tag_fg black;
@@ -104,10 +103,6 @@ GdMainIconView.content-view.cell:active {
     background-image: url("sidebar-radio-selected-prelight.svg");
 }
 
-.photos-favorite.button {
-    color: shade(@theme_selected_bg_color, 1.20);
-}
-
 .photos-collection-icon {
     background-color: @photos_collection_bg;
     border-radius: 8px;
diff --git a/src/photos-icons.h b/src/photos-icons.h
index 2021074..f9b341d 100644
--- a/src/photos-icons.h
+++ b/src/photos-icons.h
@@ -38,6 +38,9 @@ G_BEGIN_DECLS
 
 #define PHOTOS_ICON_IMAGE_X_GENERIC_SYMBOLIC "image-x-generic-symbolic"
 
+#define PHOTOS_ICON_NOT_FAVORITE "non-starred"
+#define PHOTOS_ICON_NOT_FAVORITE_SYMBOLIC PHOTOS_ICON_NOT_FAVORITE "-symbolic"
+
 #define PHOTOS_ICON_OBJECT_SELECT_SYMBOLIC "object-select-symbolic"
 
 #define PHOTOS_ICON_PHOTOS_SYMBOLIC "emblem-photos-symbolic"
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index c46d06c..fd4cdb0 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -455,26 +455,25 @@ static void
 photos_main_toolbar_favorite_button_update (PhotosMainToolbar *self, gboolean favorite)
 {
   PhotosMainToolbarPrivate *priv = self->priv;
-  GtkStyleContext *context;
+  GtkWidget *image;
   gchar *favorite_label;
 
   g_signal_handlers_block_by_func (priv->favorite_button, photos_main_toolbar_favorite_button_clicked, self);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->favorite_button), favorite);
   g_signal_handlers_unblock_by_func (priv->favorite_button, photos_main_toolbar_favorite_button_clicked, 
self);
 
-  context = gtk_widget_get_style_context (priv->favorite_button);
   if (favorite)
     {
       favorite_label = g_strdup (_("Remove from favorites"));
-      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_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->favorite_button);
+  gtk_button_set_image (GTK_BUTTON (priv->favorite_button), image);
   gtk_widget_set_tooltip_text (priv->favorite_button, favorite_label);
   g_free (favorite_label);
 }
@@ -585,9 +584,7 @@ photos_main_toolbar_populate_for_preview (PhotosMainToolbar *self)
 
   g_simple_action_set_enabled (priv->gear_menu, TRUE);
 
-  image = gtk_image_new_from_icon_name (PHOTOS_ICON_FAVORITE_SYMBOLIC, GTK_ICON_SIZE_BUTTON);
   priv->favorite_button = gtk_toggle_button_new ();
-  gtk_button_set_image (GTK_BUTTON (priv->favorite_button), image);
   gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->toolbar), priv->favorite_button);
   g_signal_connect_swapped (priv->favorite_button,
                             "clicked",


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