]> spindle.queued.net Git - midori/commitdiff
Rememember whether inspector was attached
authorChristian Dywan <christian@twotoasts.de>
Wed, 11 Jul 2012 19:28:10 +0000 (21:28 +0200)
committerChristian Dywan <christian@twotoasts.de>
Wed, 11 Jul 2012 19:28:10 +0000 (21:28 +0200)
midori/midori-browser.c
midori/midori-view.c
midori/midori-websettings.c

index 3c32a18a1e0073b9fe4499d293ef282dce1acf60..7597e875cbb9f267b8d860d184e352c3317a0263 100644 (file)
@@ -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
index 9d1779c7cbf6eaf3f1f7357fe74c8187807d638f..05e646ee6a78987aaf38a123cd212c28f224f4ea 100644 (file)
@@ -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;
 }
 
index 846a17cef5ea7df961ab4f18c001f9137e2a3b98..4862434afaccf324dc9e6d62b301eb20eef8b97e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2008-2012 Christian Dywan <christian@twotoasts.de>
  Copyright (C) 2011 Peter Hatina <phatina@redhat.com>
 
  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);