[epiphany] bookmarks: Stop hardcoding "Favorites" everywhere



commit 913dbc3042ec18c8699d0f48db21a015b1d12bb4
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Feb 19 16:38:18 2017 -0600

    bookmarks: Stop hardcoding "Favorites" everywhere

 po/POTFILES.in                                |    1 +
 src/bookmarks/ephy-bookmark-properties-grid.c |    4 ++--
 src/bookmarks/ephy-bookmark.c                 |    4 ++--
 src/bookmarks/ephy-bookmarks-manager.c        |    4 ++--
 src/bookmarks/ephy-bookmarks-manager.h        |    3 +++
 src/bookmarks/ephy-bookmarks-popover.c        |    4 ++--
 6 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 31a1fed..af6f0ef 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -27,6 +27,7 @@ lib/widgets/ephy-location-entry.c
 lib/widgets/ephy-security-popover.c
 src/bookmarks/ephy-bookmark-properties-grid.c
 src/bookmarks/ephy-bookmarks-import.c
+src/bookmarks/ephy-bookmarks-manager.h
 src/bookmarks/ephy-bookmarks-popover.c
 src/clear-data-dialog.c
 src/cookies-dialog.c
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties-grid.c
index af2a2d5..a7b5c7a 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.c
+++ b/src/bookmarks/ephy-bookmark-properties-grid.c
@@ -157,7 +157,7 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
   gboolean default_tag;
   const char *label_text;
 
-  default_tag = (g_strcmp0 (tag, "Favorites") == 0);
+  default_tag = (g_strcmp0 (tag, EPHY_BOOKMARKS_FAVORITES_TAG) == 0);
 
   widget = gtk_flow_box_child_new ();
   gtk_widget_set_can_focus (widget, FALSE);
@@ -174,7 +174,7 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
     gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
   }
 
-  label_text = default_tag ? _("Favorites") : tag;
+  label_text = default_tag ? _(EPHY_BOOKMARKS_FAVORITES_TAG) : tag;
   label = gtk_label_new (label_text);
   gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
 
diff --git a/src/bookmarks/ephy-bookmark.c b/src/bookmarks/ephy-bookmark.c
index f42f732..80431a8 100644
--- a/src/bookmarks/ephy-bookmark.c
+++ b/src/bookmarks/ephy-bookmark.c
@@ -518,9 +518,9 @@ ephy_bookmark_tags_compare (const char *tag1, const char *tag2)
   if (result == 0)
     return 0;
 
-  if (g_strcmp0 (tag1, "Favorites") == 0)
+  if (g_strcmp0 (tag1, EPHY_BOOKMARKS_FAVORITES_TAG) == 0)
     return -1;
-  if (g_strcmp0 (tag2, "Favorites") == 0)
+  if (g_strcmp0 (tag2, EPHY_BOOKMARKS_FAVORITES_TAG) == 0)
     return 1;
 
   return result;
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index f94b27b..c10006b 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -174,7 +174,7 @@ ephy_bookmarks_manager_init (EphyBookmarksManager *self)
   self->tags = g_sequence_new (g_free);
 
   g_sequence_insert_sorted (self->tags,
-                            g_strdup ("Favorites"),
+                            g_strdup (EPHY_BOOKMARKS_FAVORITES_TAG),
                             (GCompareDataFunc)ephy_bookmark_tags_compare,
                             NULL);
 
@@ -408,7 +408,7 @@ ephy_bookmarks_manager_delete_tag (EphyBookmarksManager *self, const char *tag)
   g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
   g_return_if_fail (tag != NULL);
 
-  if (strcmp (tag, "Favorites"))
+  if (strcmp (tag, EPHY_BOOKMARKS_FAVORITES_TAG) == 0)
     return;
 
   iter = g_sequence_lookup (self->tags,
diff --git a/src/bookmarks/ephy-bookmarks-manager.h b/src/bookmarks/ephy-bookmarks-manager.h
index f9e100c..6d3b042 100644
--- a/src/bookmarks/ephy-bookmarks-manager.h
+++ b/src/bookmarks/ephy-bookmarks-manager.h
@@ -22,6 +22,7 @@
 
 #include "ephy-bookmark.h"
 
+#include <glib/gi18n.h>
 #include <gio/gio.h>
 
 G_BEGIN_DECLS
@@ -30,6 +31,8 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (EphyBookmarksManager, ephy_bookmarks_manager, EPHY, BOOKMARKS_MANAGER, GObject)
 
+#define EPHY_BOOKMARKS_FAVORITES_TAG N_("Favorites")
+
 EphyBookmarksManager *ephy_bookmarks_manager_new                  (void);
 
 void         ephy_bookmarks_manager_add_bookmark                  (EphyBookmarksManager *self,
diff --git a/src/bookmarks/ephy-bookmarks-popover.c b/src/bookmarks/ephy-bookmarks-popover.c
index 1882e1c..eb696db 100644
--- a/src/bookmarks/ephy-bookmarks-popover.c
+++ b/src/bookmarks/ephy-bookmarks-popover.c
@@ -209,9 +209,9 @@ create_tag_row (const char *tag)
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_widget_set_halign (box, GTK_ALIGN_START);
 
-  if (g_strcmp0 (tag, "Favorites") == 0) {
+  if (g_strcmp0 (tag, EPHY_BOOKMARKS_FAVORITES_TAG) == 0) {
     image = gtk_image_new_from_icon_name ("emblem-favorite-symbolic", GTK_ICON_SIZE_MENU);
-    label = gtk_label_new (_("Favorites"));
+    label = gtk_label_new (_(EPHY_BOOKMARKS_FAVORITES_TAG));
   } else {
     image = gtk_image_new_from_icon_name ("ephy-bookmark-tag-symbolic", GTK_ICON_SIZE_MENU);
     label = gtk_label_new (tag);


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