Make bookmark panel properly detachable

This commit is contained in:
Christian Dywan 2009-04-23 04:13:19 +02:00
parent 5a43b646b5
commit 9e97fabd30

View file

@ -116,10 +116,9 @@ midori_bookmarks_get_stock_id (MidoriViewable* viewable)
static void static void
midori_bookmarks_add_clicked_cb (GtkWidget* toolitem) midori_bookmarks_add_clicked_cb (GtkWidget* toolitem)
{ {
GtkWidget* browser = gtk_widget_get_toplevel (toolitem); MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
/* FIXME: Take selected folder into account */ /* FIXME: Take selected folder into account */
midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
NULL, TRUE, FALSE);
} }
static void static void
@ -140,9 +139,8 @@ midori_bookmarks_edit_clicked_cb (GtkWidget* toolitem,
is_separator = !KATZE_IS_ARRAY (item) && !katze_item_get_uri (item); is_separator = !KATZE_IS_ARRAY (item) && !katze_item_get_uri (item);
if (!is_separator) if (!is_separator)
{ {
GtkWidget* browser = gtk_widget_get_toplevel (toolitem); MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, FALSE);
item, FALSE, FALSE);
} }
g_object_unref (item); g_object_unref (item);
@ -687,14 +685,14 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
{ {
if ((uri = katze_item_get_uri (child)) && *uri) if ((uri = katze_item_get_uri (child)) && *uri)
{ {
GtkWidget* browser; MidoriBrowser* browser;
MidoriWebSettings* settings; MidoriWebSettings* settings;
browser = gtk_widget_get_toplevel (GTK_WIDGET (bookmarks)); browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
n = midori_browser_add_item (MIDORI_BROWSER (browser), child); n = midori_browser_add_item (browser, child);
settings = katze_object_get_object (browser, "settings"); settings = katze_object_get_object (browser, "settings");
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (MIDORI_BROWSER (browser), n); midori_browser_set_current_page (browser, n);
g_object_unref (settings); g_object_unref (settings);
} }
i++; i++;
@ -704,14 +702,14 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
{ {
if ((uri = katze_item_get_uri (item)) && *uri) if ((uri = katze_item_get_uri (item)) && *uri)
{ {
GtkWidget* browser; MidoriBrowser* browser;
MidoriWebSettings* settings; MidoriWebSettings* settings;
browser = gtk_widget_get_toplevel (GTK_WIDGET (bookmarks)); browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
n = midori_browser_add_item (MIDORI_BROWSER (browser), item); n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings"); settings = katze_object_get_object (browser, "settings");
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (MIDORI_BROWSER (browser), n); midori_browser_set_current_page (browser, n);
g_object_unref (settings); g_object_unref (settings);
} }
} }
@ -825,12 +823,12 @@ midori_bookmarks_button_release_event_cb (GtkWidget* widget,
if (uri && *uri) if (uri && *uri)
{ {
GtkWidget* browser; MidoriBrowser* browser;
gint n; gint n;
browser = gtk_widget_get_toplevel (widget); browser = midori_browser_get_for_widget (widget);
n = midori_browser_add_uri (MIDORI_BROWSER (browser), uri); n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page (MIDORI_BROWSER (browser), n); midori_browser_set_current_page (browser, n);
} }
} }
else else