aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-new-bookmark.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-05-13 03:22:27 +0800
committerXan Lopez <xan@src.gnome.org>2003-05-13 03:22:27 +0800
commitbacb58f2fda5bef60b55500aa79e17be7aa8a384 (patch)
treec317366a2a1f6e84cdcc386257a5c68a932b0b35 /src/bookmarks/ephy-new-bookmark.c
parent1044f92a19ab225a74e7829561cfe1733aee6913 (diff)
downloadgsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.gz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.bz2
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.lz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.xz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.zst
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.zip
Don't allow to have more than one bookmark with the same URL^H^H^Haddress,
Don't allow to have more than one bookmark with the same URL^H^H^Haddress, warn the user with a nice dialog. Fixes #110854.
Diffstat (limited to 'src/bookmarks/ephy-new-bookmark.c')
-rw-r--r--src/bookmarks/ephy-new-bookmark.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c
index 3e12ec602..db69e4ee7 100644
--- a/src/bookmarks/ephy-new-bookmark.c
+++ b/src/bookmarks/ephy-new-bookmark.c
@@ -288,6 +288,77 @@ ephy_new_bookmark_construct (EphyNewBookmark *editor)
gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_OK);
}
+static GtkWidget*
+duplicate_dialog_construct (GtkWindow *parent,
+ const char *title)
+{
+ GtkWidget *dialog;
+ GtkWidget *hbox, *vbox, *label, *image;
+ char *str;
+
+ dialog = gtk_dialog_new_with_buttons (_("Duplicated bookmark"),
+ GTK_WINDOW (parent),
+ GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
+ TRUE, TRUE, 0);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+ gtk_widget_show (image);
+ gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+ label = gtk_label_new (NULL);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ str = g_strconcat ("<big>",_("A bookmark titled "), "<b>", title, "</b>",
+ _(" already exists for this address."), "</big>",NULL);
+ gtk_label_set_markup (GTK_LABEL (label), str);
+ g_free (str);
+ gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
+ gtk_widget_show (label);
+
+ return dialog;
+}
+
+gboolean
+ephy_new_bookmark_is_unique (EphyBookmarks *bookmarks,
+ GtkWindow *parent,
+ const char *address)
+{
+ EphyNode *node;
+
+ node = ephy_bookmarks_find_bookmark (bookmarks, address);
+ if (node)
+ {
+ GtkWidget *dialog;
+ const char *title;
+
+ title = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_TITLE);
+ dialog = duplicate_dialog_construct (parent, title);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
GtkWidget *
ephy_new_bookmark_new (EphyBookmarks *bookmarks,
GtkWindow *parent,
@@ -302,7 +373,6 @@ ephy_new_bookmark_new (EphyBookmarks *bookmarks,
"bookmarks", bookmarks,
"location", location,
NULL));
-
if (parent)
{
gtk_window_set_transient_for (GTK_WINDOW (editor), parent);