aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bookmarks/ephy-bookmarks.c85
-rw-r--r--src/prefs-dialog.c18
2 files changed, 81 insertions, 22 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 0d520f2ac..f8e9fe428 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -40,11 +40,14 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkdialog.h>
#define EPHY_BOOKMARKS_XML_ROOT "ephy_bookmarks"
#define EPHY_BOOKMARKS_XML_VERSION "1.03"
#define BOOKMARKS_SAVE_DELAY (3 * 1000)
#define MAX_FAVORITES_NUM 10
+#define UPDATE_URI_DATA_KEY "updated-uri"
#define EPHY_BOOKMARKS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS, EphyBookmarksPrivate))
@@ -476,27 +479,87 @@ history_cleared_cb (EphyHistory *history, EphyBookmarks *bookmarks)
clear_favorites (bookmarks);
}
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkdialog.h>
-
static void
-redirect_cb (EphyHistory *history,
- const char *from_uri,
- const char *to_uri,
- EphyBookmarks *eb)
+update_bookmark_response_cb (GtkWidget *dialog,
+ int response,
+ EphyNode *bookmark)
{
- EphyNode *bookmark;
GValue value = { 0, };
+ char *to_uri;
- bookmark = ephy_bookmarks_find_bookmark (eb, from_uri);
- if (bookmark != NULL)
+ if (response == GTK_RESPONSE_ACCEPT)
{
+ to_uri = (char *) g_object_steal_data (G_OBJECT (dialog),
+ UPDATE_URI_DATA_KEY);
+
g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, to_uri);
+ g_value_take_string (&value, to_uri);
ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_LOCATION,
&value);
g_value_unset (&value);
}
+
+ gtk_widget_destroy (dialog);
+}
+
+static void
+update_bookmark_destroy_cb (EphyNode *zombie,
+ GtkWidget *dialog)
+{
+ gtk_widget_destroy (dialog);
+}
+
+static void
+redirect_cb (EphyHistory *history,
+ const char *from_uri,
+ const char *to_uri,
+ EphyBookmarks *eb)
+{
+ EphyNode *bookmark;
+ GtkWidget *dialog;
+ const char *title;
+
+ bookmark = ephy_bookmarks_find_bookmark (eb, from_uri);
+
+ /* FIXME check if there's another update-bookmark dialog up
+ * for from_uri' -> from_uri and update it accordingly
+ */
+ if (bookmark == NULL) return;
+
+ title = ephy_node_get_property_string (bookmark, EPHY_NODE_BMK_PROP_TITLE);
+
+ dialog = gtk_message_dialog_new
+ (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ /* translators: the %s is the title of the bookmark */
+ _("Update bookmark \"%s\"?"),
+ title);
+ gtk_message_dialog_format_secondary_markup
+ (GTK_MESSAGE_DIALOG (dialog),
+ /* translators: the %s is a URL */
+ _("The bookmarked page has moved to <tt>%s</tt>."),
+ to_uri);
+
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Don't update bookmark"), GTK_RESPONSE_REJECT);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Update bookmark"), GTK_RESPONSE_ACCEPT);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Update bookmark?"));
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser");
+
+ g_object_set_data_full (G_OBJECT (dialog), UPDATE_URI_DATA_KEY,
+ g_strdup (to_uri), (GDestroyNotify) g_free);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (update_bookmark_response_cb), bookmark);
+ ephy_node_signal_connect_object (bookmark,
+ EPHY_NODE_DESTROY,
+ (EphyNodeCallback) update_bookmark_destroy_cb,
+ G_OBJECT (dialog));
+
+ gtk_window_present (GTK_WINDOW (dialog));
}
static void
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index f47c7474c..c40d680e4 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -518,6 +518,9 @@ struct PrefsDialogPrivate
#endif
};
+/* gtk+' gettext domain */
+#define GTK_DOMAIN "gtk20"
+
static GObjectClass *parent_class = NULL;
GType
@@ -1429,24 +1432,17 @@ get_download_button_label ()
if (key == NULL || g_utf8_collate (key, "~") == 0)
{
- /* Note that this does NOT refer to the home page but to a
- * user's home folder. It should be translated by the same
- * term as GTK+'s "Home" string to be consistent with the
- * filechooser */
- label = g_strdup (_("Home"));
+ label = g_strdup (dgettext (GTK_DOMAIN, "Home"));
}
else if ((converted_dp != NULL && g_utf8_collate (key, converted_dp) == 0) ||
g_utf8_collate (key, "Downloads") == 0)
{
label = g_strdup (_("Downloads"));
}
- else if (g_utf8_collate (key, "~/Desktop") == 0)
- {
- label = g_strdup (_("Desktop"));
- }
- else if (g_utf8_collate (key, "Desktop") == 0)
+ else if (g_utf8_collate (key, "~/Desktop") == 0 ||
+ g_utf8_collate (key, "Desktop") == 0)
{
- label = g_strdup (_("Desktop"));
+ label = g_strdup (dgettext (GTK_DOMAIN, "Desktop"));
}
else
{