From: Christian Dywan Date: Wed, 11 Jul 2012 19:28:10 +0000 (+0200) Subject: Rememember whether inspector was attached X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68a4ed6c99965956f7124cdfe190482ffcc8204b;p=midori Rememember whether inspector was attached --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 3c32a18a..7597e875 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1274,6 +1274,8 @@ midori_view_attach_inspector_cb (GtkWidget* view, gtk_widget_show_all (browser->inspector); browser->inspector_view = inspector_view; gtk_widget_destroy (toplevel); + if (!katze_object_get_boolean (browser->settings, "last-inspector-attached")) + g_object_set (browser->settings, "last-inspector-attached", TRUE, NULL); } static void @@ -1287,6 +1289,8 @@ midori_view_detach_inspector_cb (GtkWidget* view, gtk_container_remove (GTK_CONTAINER (scrolled), GTK_WIDGET (inspector_view)); gtk_container_add (GTK_CONTAINER (scrolled), browser->inspector_view); gtk_widget_hide (paned); + if (katze_object_get_boolean (browser->settings, "last-inspector-attached")) + g_object_set (browser->settings, "last-inspector-attached", FALSE, NULL); } static void diff --git a/midori/midori-view.c b/midori/midori-view.c index 9d1779c7..05e646ee 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3705,7 +3705,7 @@ midori_view_web_inspector_construct_window (gpointer inspector, gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE); #endif gtk_container_add (GTK_CONTAINER (window), inspector_view); - gtk_widget_show_all (window); + gtk_widget_show_all (inspector_view); g_signal_connect (window, "key-press-event", G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL); @@ -3737,7 +3737,13 @@ midori_view_web_inspector_show_window_cb (WebKitWebInspector* inspector, GtkWidget* window = gtk_widget_get_toplevel (GTK_WIDGET (inspector_view)); if (!window) return FALSE; - gtk_window_present (GTK_WINDOW (window)); + if (katze_object_get_boolean (view->settings, "last-inspector-attached")) + g_signal_emit_by_name (inspector, "attach-window"); + else + { + gtk_widget_show (window); + gtk_window_present (GTK_WINDOW (window)); + } return TRUE; } diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index 846a17ce..4862434a 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2010 Christian Dywan + Copyright (C) 2008-2012 Christian Dywan Copyright (C) 2011 Peter Hatina This library is free software; you can redistribute it and/or @@ -70,6 +70,7 @@ struct _MidoriWebSettings gint last_panel_position; gint last_panel_page; gint last_web_search; + gboolean last_inspector_attached; gint maximum_cookie_age; gint maximum_history_age; gint search_width; @@ -120,6 +121,7 @@ enum PROP_LAST_PANEL_POSITION, PROP_LAST_PANEL_PAGE, PROP_LAST_WEB_SEARCH, + PROP_LAST_INSPECTOR_ATTACHED, PROP_SHOW_MENUBAR, PROP_SHOW_NAVIGATIONBAR, @@ -466,6 +468,21 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("The last saved Web search"), 0, G_MAXINT, 0, flags)); + /** + * MidoriWebSettings:last-inspector-attached: + * + * Whether the inspector was attached. + * + * Since: 0.4.7 + */ + g_object_class_install_property (gobject_class, + PROP_LAST_INSPECTOR_ATTACHED, + g_param_spec_boolean ( + "last-inspector-attached", + "Inspector attached", + "Whether the inspector was attached", + FALSE, + flags | MIDORI_PARAM_DELAY_SAVING)); g_object_class_install_property (gobject_class, @@ -1505,6 +1522,9 @@ midori_web_settings_set_property (GObject* object, case PROP_LAST_WEB_SEARCH: web_settings->last_web_search = g_value_get_int (value); break; + case PROP_LAST_INSPECTOR_ATTACHED: + web_settings->last_inspector_attached = g_value_get_boolean (value); + break; case PROP_SHOW_MENUBAR: web_settings->show_menubar = g_value_get_boolean (value); @@ -1815,6 +1835,9 @@ midori_web_settings_get_property (GObject* object, case PROP_LAST_WEB_SEARCH: g_value_set_int (value, web_settings->last_web_search); break; + case PROP_LAST_INSPECTOR_ATTACHED: + g_value_set_boolean (value, web_settings->last_inspector_attached); + break; case PROP_SHOW_MENUBAR: g_value_set_boolean (value, web_settings->show_menubar);