]> spindle.queued.net Git - midori/commitdiff
Require bookmarks and folders to have a title
authorChristian Dywan <christian@twotoasts.de>
Mon, 19 Jul 2010 18:47:33 +0000 (20:47 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 19 Jul 2010 18:47:33 +0000 (20:47 +0200)
midori/midori-browser.c

index b304d7c31b80724498a0bb7dd836a96e56f50634..e2063b2b3a6af0fdb2230a0180453359ef9def37 100644 (file)
@@ -678,6 +678,15 @@ midori_browser_edit_bookmark_uri_changed_cb (GtkEntry*      entry,
         || g_str_has_prefix (uri, "javascript:")));
 }
 
+static void
+midori_browser_edit_bookmark_title_changed_cb (GtkEntry*      entry,
+                                               GtkDialog*     dialog)
+{
+    const gchar* title = gtk_entry_get_text (entry);
+    gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT,
+        title != NULL && title[0] != '\0');
+}
+
 static void
 midori_browser_edit_bookmark_add_speed_dial_cb (GtkWidget* button,
                                                 KatzeItem* bookmark)
@@ -757,6 +766,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
     gtk_entry_set_activates_default (GTK_ENTRY (entry_title), TRUE);
     value = katze_item_get_name (bookmark);
     gtk_entry_set_text (GTK_ENTRY (entry_title), value ? value : "");
+    midori_browser_edit_bookmark_title_changed_cb (GTK_ENTRY (entry_title),
+                                                   GTK_DIALOG (dialog));
+    g_signal_connect (entry_title, "changed",
+        G_CALLBACK (midori_browser_edit_bookmark_title_changed_cb), dialog);
     gtk_box_pack_start (GTK_BOX (hbox), entry_title, TRUE, TRUE, 0);
     gtk_container_add (GTK_CONTAINER (content_area), hbox);
     gtk_widget_show_all (hbox);