summaryrefslogtreecommitdiff
path: root/gtk/gtkbookmarksmanager.c
diff options
context:
space:
mode:
authorTimothy Arceri <t_arceri@yahoo.com.au>2013-05-28 18:12:27 +1000
committerFederico Mena Quintero <federico@gnome.org>2013-05-30 10:37:58 -0500
commit44cd166447807712775b2bd4f57a6b0aebedd262 (patch)
tree885e2ba6d8b199f58dca07cab675893286a724a3 /gtk/gtkbookmarksmanager.c
parent54e2091740bb87eaa9b8e03446900374f054cf40 (diff)
downloadgtk+-44cd166447807712775b2bd4f57a6b0aebedd262.tar.gz
GtkBookmarksManager: Refactor duplicate set error code and localise error strings
https://bugzilla.gnome.org/show_bug.cgi?id=593079
Diffstat (limited to 'gtk/gtkbookmarksmanager.c')
-rw-r--r--gtk/gtkbookmarksmanager.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/gtk/gtkbookmarksmanager.c b/gtk/gtkbookmarksmanager.c
index f0cc53eace..eb31ed9b97 100644
--- a/gtk/gtkbookmarksmanager.c
+++ b/gtk/gtkbookmarksmanager.c
@@ -39,6 +39,20 @@ _gtk_bookmark_free (GtkBookmark *bookmark)
g_slice_free (GtkBookmark, bookmark);
}
+static void
+set_error_bookmark_doesnt_exist (GFile *file, GError **error)
+{
+ gchar *uri = g_file_get_uri (file);
+
+ g_set_error (error,
+ GTK_FILE_CHOOSER_ERROR,
+ GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
+ _("%s does not exist in the bookmarks list"),
+ uri);
+
+ g_free (uri);
+}
+
static GFile *
get_legacy_bookmarks_file (void)
{
@@ -350,7 +364,7 @@ _gtk_bookmarks_manager_insert_bookmark (GtkBookmarksManager *manager,
g_set_error (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS,
- "%s already exists in the bookmarks list",
+ _("%s already exists in the bookmarks list"),
uri);
g_free (uri);
@@ -397,16 +411,7 @@ _gtk_bookmarks_manager_remove_bookmark (GtkBookmarksManager *manager,
}
else
{
- gchar *uri = g_file_get_uri (file);
-
- g_set_error (error,
- GTK_FILE_CHOOSER_ERROR,
- GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
- "%s does not exist in the bookmarks list",
- uri);
-
- g_free (uri);
-
+ set_error_bookmark_doesnt_exist (file, error);
return FALSE;
}
@@ -454,16 +459,7 @@ _gtk_bookmarks_manager_reorder_bookmark (GtkBookmarksManager *manager,
}
else
{
- gchar *uri = g_file_get_uri (file);
-
- g_set_error (error,
- GTK_FILE_CHOOSER_ERROR,
- GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
- "%s does not exist in the bookmarks list",
- uri);
-
- g_free (uri);
-
+ set_error_bookmark_doesnt_exist (file, error);
return FALSE;
}
@@ -527,16 +523,7 @@ _gtk_bookmarks_manager_set_bookmark_label (GtkBookmarksManager *manager,
}
else
{
- gchar *uri = g_file_get_uri (file);
-
- g_set_error (error,
- GTK_FILE_CHOOSER_ERROR,
- GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
- "%s does not exist in the bookmarks list",
- uri);
-
- g_free (uri);
-
+ set_error_bookmark_doesnt_exist (file, error);
return FALSE;
}