diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-12-19 23:15:47 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-12-19 23:15:47 +0800 |
commit | d67465faa4318f7d774ef2d41d78c04f4caae264 (patch) | |
tree | 13005f579582f3131fddbe362e59e0dcb42d3c96 /src/bookmarks | |
parent | 528fd1a0f78826908618b98644012c33c9a1674e (diff) | |
download | gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar.gz gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar.bz2 gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar.lz gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar.xz gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.tar.zst gsoc2013-epiphany-d67465faa4318f7d774ef2d41d78c04f4caae264.zip |
Add "View Properties" to duplicated bookmarks dialogue. Fixes bug #117643
2004-12-19 Christian Persch <chpe@cvs.gnome.org>
* src/bookmarks/ephy-new-bookmark.c: (duplicate_dialog_construct),
(duplicate_bookmark_response_cb), (duplicated_node_destroy_cb),
(ephy_new_bookmark_is_unique):
Add "View Properties" to duplicated bookmarks dialogue. Fixes bug #117643
and bug #138300.
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/ephy-new-bookmark.c | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c index 825a4562b..1ea4aae0f 100644 --- a/src/bookmarks/ephy-new-bookmark.c +++ b/src/bookmarks/ephy-new-bookmark.c @@ -21,6 +21,7 @@ #include "config.h" #include "ephy-new-bookmark.h" +#include "ephy-bookmarks.h" #include "ephy-state.h" #include "ephy-topics-selector.h" #include "ephy-debug.h" @@ -53,6 +54,8 @@ static void ephy_new_bookmark_get_property (GObject *object, GValue *value, GParamSpec *pspec); +#define DATA_KEY "EphyNode" + #define EPHY_NEW_BOOKMARK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NEW_BOOKMARK, EphyNewBookmarkPrivate)) enum @@ -304,21 +307,25 @@ duplicate_dialog_construct (GtkWindow *parent, const char *title) { GtkWidget *dialog; - char *str, *tmp_str, *tmp_title; + char *str, *tmp_str; - tmp_title = g_markup_printf_escaped ("<b>%s</b>", title); - tmp_str = g_strdup_printf (_("A bookmark titled %s already exists for this page."), - tmp_title); - str = g_strconcat ("<big>", tmp_str, "</big>", NULL); + tmp_str = g_markup_printf_escaped (_("You already have a bookmark titled \"%s\" for this page."), + title); + str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", tmp_str, "</span>", NULL); dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, GTK_BUTTONS_OK, NULL); + GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, NULL); gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), str); - g_free (tmp_title); g_free (tmp_str); g_free (str); + gtk_dialog_add_button (GTK_DIALOG (dialog), + _("_View Properties"), GTK_RESPONSE_ACCEPT); + gtk_dialog_add_button (GTK_DIALOG (dialog), + GTK_STOCK_OK, GTK_RESPONSE_OK); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + gtk_window_set_title (GTK_WINDOW (dialog), _("Duplicated Bookmark")); gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser"); @@ -326,16 +333,28 @@ duplicate_dialog_construct (GtkWindow *parent, } static void -duplicate_bookmark_response_cb (EphyNewBookmark *new_bookmark, - int response_id, - gpointer user_data) +duplicate_bookmark_response_cb (GtkWidget *dialog, + int response, + EphyBookmarks *bookmarks) { - switch (response_id) + if (response == GTK_RESPONSE_ACCEPT) { - case GTK_RESPONSE_OK: - gtk_widget_destroy (GTK_WIDGET (new_bookmark)); - break; + EphyNode *node; + GtkWidget *parent; + + node = g_object_get_data (G_OBJECT (dialog), DATA_KEY); + parent = GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (dialog))); + ephy_bookmarks_show_bookmark_properties (bookmarks, node, parent); } + + gtk_widget_destroy (dialog); +} + +static void +duplicated_node_destroy_cb (EphyNode *node, + GtkWidget *dialog) +{ + gtk_widget_destroy (dialog); } gboolean @@ -354,10 +373,14 @@ ephy_new_bookmark_is_unique (EphyBookmarks *bookmarks, 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); + g_object_set_data (G_OBJECT (dialog), DATA_KEY, node); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (duplicate_bookmark_response_cb), - dialog); + bookmarks); + ephy_node_signal_connect_object (node, EPHY_NODE_DESTROY, + (EphyNodeCallback) duplicated_node_destroy_cb, + G_OBJECT (dialog)); gtk_widget_show (GTK_WIDGET (dialog)); return FALSE; } |