Add 'Add to Speed Dial' button to 'Add bookmark'

This commit is contained in:
Christian Dywan 2010-05-18 23:16:14 +02:00
parent 9ef1b0bf87
commit a69ba674b1

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2009 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2007-2010 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2008 Dale Whittaker <dayul@users.sf.net>
Copyright (C) 2009 Jérôme Geulfucci <jeromeg@xfce.org>
@ -218,6 +218,9 @@ _action_menus_activate_item_alt (GtkAction* action,
guint button,
MidoriBrowser* browser);
static void
midori_browser_add_speed_dial (MidoriBrowser* browser);
#define _action_by_name(brwsr, nme) \
gtk_action_group_get_action (brwsr->action_group, nme)
#define _action_set_sensitive(brwsr, nme, snstv) \
@ -687,6 +690,15 @@ midori_browser_edit_bookmark_uri_changed_cb (GtkEntry* entry,
|| g_str_has_prefix (uri, "javascript:")));
}
static void
midori_browser_edit_bookmark_add_speed_dial_cb (GtkWidget* button,
KatzeItem* bookmark)
{
MidoriBrowser* browser = midori_browser_get_for_widget (button);
gtk_widget_set_sensitive (button, FALSE);
midori_browser_add_speed_dial (browser);
}
/* Private function, used by MidoriBookmarks and MidoriHistory */
/* static */ void
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
@ -842,6 +854,21 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
gtk_widget_show_all (hbox);
}
if (new_bookmark && !is_folder)
{
hbox = gtk_hbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 1);
label = gtk_label_new (NULL);
gtk_size_group_add_widget (sizegroup, label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
label = gtk_button_new_with_mnemonic (_("Add to _Speed Dial"));
g_signal_connect (label, "clicked",
G_CALLBACK (midori_browser_edit_bookmark_add_speed_dial_cb), bookmark);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (content_area), hbox);
gtk_widget_show_all (hbox);
}
hbox = gtk_hbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 1);
label = gtk_label_new (NULL);