diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 35 |
2 files changed, 32 insertions, 10 deletions
@@ -1,3 +1,10 @@ +2004-11-11 Xan Lopez <xan@gnome.org> + + * src/bookmarks/ephy-bookmarks-editor.c: + (delete_topic_dialog_construct), (cmd_delete): + + Do not warn if topic is empty, better title and primary text. + 2004-11-10 Xan Lopez <xan@gnome.org> * src/bookmarks/ephy-bookmarks-editor.c: diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 5c6f58953..a5647eebb 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -452,13 +452,19 @@ delete_topic_dialog_construct (GtkWindow *parent, const char *topic) { GtkWidget *dialog; GtkWindowGroup *group; + char *str; + str = g_strdup_printf (_("Delete topic %s?"), topic); + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CANCEL, - _("Delete topic?")); + str); + + g_free (str); + gtk_window_set_title (GTK_WINDOW (dialog), _("Delete this topic?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("Deleting this topic will cause all its bookmarks to become " "uncategorized, unless they also belong to other topics. " @@ -505,20 +511,29 @@ cmd_delete (GtkAction *action, GtkWidget *dialog; const char *title; int response; - - title = ephy_node_get_property_string (node, EPHY_NODE_KEYWORD_PROP_NAME); - dialog = delete_topic_dialog_construct (GTK_WINDOW (editor), title); - + GPtrArray *children; - response = gtk_dialog_run (GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); - - if (response == GTK_RESPONSE_ACCEPT) + children = ephy_node_get_children(node); + + /* Do not warn if the topic is empty */ + if (children->len == 0) { ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->key_view)); } + else + { + title = ephy_node_get_property_string (node, EPHY_NODE_KEYWORD_PROP_NAME); + dialog = delete_topic_dialog_construct (GTK_WINDOW (editor), title); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + if (response == GTK_RESPONSE_ACCEPT) + { + ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->key_view)); + } + } } g_list_free (selected); } |