[gnome-photos] Use macros to represent the names of icons



commit 5259a077d19a0360e4bab11261c74203736d701f
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 31 09:31:47 2014 +0100

    Use macros to represent the names of icons

 src/Makefile.am                    |    1 +
 src/photos-base-item.c             |    3 +-
 src/photos-dlna-renderers-dialog.c |    3 +-
 src/photos-empty-results-box.c     |    3 +-
 src/photos-icons.h                 |   48 ++++++++++++++++++++++++++++++++++++
 src/photos-indexing-notification.c |    5 ++-
 src/photos-main-toolbar.c          |    9 +++---
 src/photos-preview-nav-buttons.c   |    8 +++--
 src/photos-selection-toolbar.c     |    4 ++-
 9 files changed, 71 insertions(+), 13 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 75d6353..438e0f9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,7 @@ gnome_photos_SOURCES = \
        photos-flickr-item.h \
        photos-header-bar.c \
        photos-header-bar.h \
+       photos-icons.h \
        photos-indexing-notification.c \
        photos-indexing-notification.h \
        photos-item-manager.c \
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7629834..81d598d 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -35,6 +35,7 @@
 #include "photos-base-item.h"
 #include "photos-collection-icon-watcher.h"
 #include "photos-delete-item-job.h"
+#include "photos-icons.h"
 #include "photos-print-operation.h"
 #include "photos-query.h"
 #include "photos-selection-controller.h"
@@ -135,7 +136,7 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
 
   if (priv->favorite)
     {
-      pix = photos_base_item_create_symbolic_emblem ("emblem-favorite");
+      pix = photos_base_item_create_symbolic_emblem (PHOTOS_ICON_FAVORITE);
       emblem_icons = g_list_prepend (emblem_icons, pix);
     }
 
diff --git a/src/photos-dlna-renderers-dialog.c b/src/photos-dlna-renderers-dialog.c
index 52413d6..a60c62b 100644
--- a/src/photos-dlna-renderers-dialog.c
+++ b/src/photos-dlna-renderers-dialog.c
@@ -31,6 +31,7 @@
 #include "photos-dleyna-renderer-push-host.h"
 #include "photos-dlna-renderer.h"
 #include "photos-dlna-renderers-manager.h"
+#include "photos-icons.h"
 #include "photos-item-manager.h"
 #include "photos-local-item.h"
 #include "photos-mode-controller.h"
@@ -194,7 +195,7 @@ photos_dlna_renderers_dialog_add_renderer (PhotosDlnaRenderersDialog *self, Phot
 
   name = photos_dlna_renderer_get_friendly_name (renderer);
 
-  icon = g_themed_icon_new_with_default_fallbacks ("video-display-symbolic");
+  icon = g_themed_icon_new_with_default_fallbacks (PHOTOS_ICON_VIDEO_DISPLAY_SYMBOLIC);
   image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
 
   g_object_ref (image); /* keep a ref for the following async call and release it in the callback */
diff --git a/src/photos-empty-results-box.c b/src/photos-empty-results-box.c
index bf4b50f..7eda8a8 100644
--- a/src/photos-empty-results-box.c
+++ b/src/photos-empty-results-box.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n.h>
 
 #include "photos-empty-results-box.h"
+#include "photos-icons.h"
 #include "photos-source-manager.h"
 
 
@@ -148,7 +149,7 @@ photos_empty_results_box_constructed (GObject *object)
   context = gtk_widget_get_style_context (GTK_WIDGET (self));
   gtk_style_context_add_class (context, "dim-label");
 
-  image = gtk_image_new_from_icon_name ("emblem-photos-symbolic", GTK_ICON_SIZE_INVALID);
+  image = gtk_image_new_from_icon_name (PHOTOS_ICON_PHOTOS_SYMBOLIC, GTK_ICON_SIZE_INVALID);
   gtk_image_set_pixel_size (GTK_IMAGE (image), 64);
   gtk_container_add (GTK_CONTAINER (self), image);
 
diff --git a/src/photos-icons.h b/src/photos-icons.h
new file mode 100644
index 0000000..2dfe771
--- /dev/null
+++ b/src/photos-icons.h
@@ -0,0 +1,48 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef PHOTOS_ICONS_H
+#define PHOTOS_ICONS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_ICON_EDIT_FIND_SYMBOLIC "edit-find-symbolic"
+
+#define PHOTOS_ICON_FAVORITE "emblem-favorite"
+#define PHOTOS_ICON_FAVORITE_SYMBOLIC PHOTOS_ICON_FAVORITE "-symbolic"
+
+#define PHOTOS_ICON_GO_NEXT_SYMBOLIC "go-next-symbolic"
+#define PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC "go-previous-symbolic"
+
+#define PHOTOS_ICON_OBJECT_SELECT_SYMBOLIC "object-select-symbolic"
+
+#define PHOTOS_ICON_PHOTOS_SYMBOLIC "emblem-photos-symbolic"
+
+#define PHOTOS_ICON_SYSTEM_SYMBOLIC "emblem-system-symbolic"
+
+#define PHOTOS_ICON_VIDEO_DISPLAY_SYMBOLIC "video-display-symbolic"
+
+#define PHOTOS_ICON_WINDOW_CLOSE_SYMBOLIC "window-close-symbolic"
+
+G_END_DECLS
+
+#endif /* PHOTOS_ICONS_H */
diff --git a/src/photos-indexing-notification.c b/src/photos-indexing-notification.c
index 5a03b84..a7bdd2e 100644
--- a/src/photos-indexing-notification.c
+++ b/src/photos-indexing-notification.c
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -29,6 +29,7 @@
 #include <glib/gi18n.h>
 #include <libtracker-miner/tracker-miner.h>
 
+#include "photos-icons.h"
 #include "photos-indexing-notification.h"
 #include "photos-notification-manager.h"
 
@@ -175,7 +176,7 @@ photos_indexing_notification_init (PhotosIndexingNotification *self)
   gtk_style_context_add_class (context, "dim-label");
   gtk_container_add (GTK_CONTAINER (labels), secondary);
 
-  image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_INVALID);
+  image = gtk_image_new_from_icon_name (PHOTOS_ICON_WINDOW_CLOSE_SYMBOLIC, GTK_ICON_SIZE_INVALID);
   gtk_widget_set_margin_bottom (image, 2);
   gtk_widget_set_margin_top (image, 2);
   gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index 4e36611..8252661 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -35,6 +35,7 @@
 #include "photos-dlna-renderers-manager.h"
 #include "photos-dropdown.h"
 #include "photos-header-bar.h"
+#include "photos-icons.h"
 #include "photos-item-manager.h"
 #include "photos-main-toolbar.h"
 #include "photos-mode-controller.h"
@@ -152,7 +153,7 @@ photos_main_toolbar_add_back_button (PhotosMainToolbar *self)
   const gchar *icon_name;
 
   direction = gtk_widget_get_direction (GTK_WIDGET (priv->toolbar));
-  icon_name = (direction == GTK_TEXT_DIR_RTL) ? "go-next-symbolic" : "go-previous-symbolic";
+  icon_name = (direction == GTK_TEXT_DIR_RTL) ? PHOTOS_ICON_GO_NEXT_SYMBOLIC : 
PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC;
 
   back_button = gd_header_simple_button_new ();
   gd_header_button_set_label (GD_HEADER_BUTTON (back_button), _("Back"));
@@ -280,7 +281,7 @@ photos_main_toolbar_add_search_button (PhotosMainToolbar *self)
 
   search_button = gd_header_toggle_button_new ();
   gd_header_button_set_label (GD_HEADER_BUTTON (search_button), _("Search"));
-  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (search_button), "edit-find-symbolic");
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (search_button), PHOTOS_ICON_EDIT_FIND_SYMBOLIC);
   gtk_actionable_set_action_name (GTK_ACTIONABLE (search_button), "app.search");
   gtk_header_bar_pack_end (GTK_HEADER_BAR (self->priv->toolbar), search_button);
 
@@ -296,7 +297,7 @@ photos_main_toolbar_add_selection_button (PhotosMainToolbar *self)
 
   selection_button = gd_header_simple_button_new ();
   gd_header_button_set_label (GD_HEADER_BUTTON (selection_button), _("Select Items"));
-  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (selection_button), "object-select-symbolic");
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (selection_button), 
PHOTOS_ICON_OBJECT_SELECT_SYMBOLIC);
   gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->toolbar), selection_button);
   g_signal_connect (selection_button, "clicked", G_CALLBACK (photos_main_toolbar_select_button_clicked), 
self);
 
@@ -524,7 +525,7 @@ photos_main_toolbar_populate_for_preview (PhotosMainToolbar *self)
   menu_button = gd_header_menu_button_new ();
   gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_button), "app.gear-menu");
   gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), G_MENU_MODEL (preview_menu));
-  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (menu_button), "emblem-system-symbolic");
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (menu_button), PHOTOS_ICON_SYSTEM_SYMBOLIC);
   gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->toolbar), menu_button);
 
   g_simple_action_set_enabled (priv->gear_menu, TRUE);
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 7bc9d15..f0c4e8c 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -29,6 +29,7 @@
 #include <glib/gi18n.h>
 #include <libgd/gd.h>
 
+#include "photos-icons.h"
 #include "photos-item-manager.h"
 #include "photos-preview-model.h"
 #include "photos-preview-nav-buttons.h"
@@ -363,8 +364,8 @@ photos_preview_nav_buttons_constructed (GObject *object)
   G_OBJECT_CLASS (photos_preview_nav_buttons_parent_class)->constructed (object);
 
   is_rtl = (gtk_widget_get_direction (priv->preview_view) == GTK_TEXT_DIR_RTL);
-  prev_icon_name = is_rtl ? "go-next-symbolic" : "go-previous-symbolic";
-  next_icon_name = is_rtl ? "go-previous-symbolic" : "go-next-symbolic";
+  prev_icon_name = is_rtl ? PHOTOS_ICON_GO_NEXT_SYMBOLIC : PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC;
+  next_icon_name = is_rtl ? PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC : PHOTOS_ICON_GO_NEXT_SYMBOLIC;
 
   priv->prev_widget = gtk_revealer_new ();
   gtk_widget_set_halign (priv->prev_widget, GTK_ALIGN_START);
@@ -444,7 +445,8 @@ photos_preview_nav_buttons_constructed (GObject *object)
                             self);
 
   priv->favorite_button = gd_header_toggle_button_new ();
-  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->favorite_button), 
"emblem-favorite-symbolic");
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->favorite_button),
+                                           PHOTOS_ICON_FAVORITE_SYMBOLIC);
   gtk_action_bar_pack_end (GTK_ACTION_BAR (toolbar), priv->favorite_button);
   g_signal_connect_swapped (priv->favorite_button,
                             "clicked",
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 85bb8df..a1e4904 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -31,6 +31,7 @@
 
 #include "photos-application.h"
 #include "photos-base-item.h"
+#include "photos-icons.h"
 #include "photos-item-manager.h"
 #include "photos-organize-collection-dialog.h"
 #include "photos-properties-dialog.h"
@@ -427,7 +428,8 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
   gtk_container_add (GTK_CONTAINER (self), toolbar);
 
   priv->toolbar_favorite = gd_header_toggle_button_new ();
-  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->toolbar_favorite), 
"emblem-favorite-symbolic");
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->toolbar_favorite),
+                                           PHOTOS_ICON_FAVORITE_SYMBOLIC);
   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]