[Xfce4-commits] <midori:master> Rememember whether inspector was attached

Christian Dywan noreply at xfce.org
Wed Jul 11 21:30:01 CEST 2012


Updating branch refs/heads/master
         to 68a4ed6c99965956f7124cdfe190482ffcc8204b (commit)
       from d260e71a23e61d1d3f009f7adbc3ea5219709ed0 (commit)

commit 68a4ed6c99965956f7124cdfe190482ffcc8204b
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jul 11 21:28:10 2012 +0200

    Rememember whether inspector was attached

 midori/midori-browser.c     |    4 ++++
 midori/midori-view.c        |   10 ++++++++--
 midori/midori-websettings.c |   25 ++++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 3c32a18..7597e87 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 9d1779c..05e646e 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 846a17c..4862434 100644
--- a/midori/midori-websettings.c
+++ b/midori/midori-websettings.c
@@ -1,5 +1,5 @@
 /*
- Copyright (C) 2008-2010 Christian Dywan <christian at twotoasts.de>
+ Copyright (C) 2008-2012 Christian Dywan <christian at twotoasts.de>
  Copyright (C) 2011 Peter Hatina <phatina at 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);


More information about the Xfce4-commits mailing list