Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 30 Jun 2012 18:05:46 Commit: ff3cae47b5d16a5b930fec64cc9a76a7becfdc28 https://github.com/geany/geany-plugins/commit/ff3cae47b5d16a5b930fec64cc9a76...
Log Message: ----------- WebHelper: Remember inspector docking state
Modified Paths: -------------- webhelper/src/gwh-browser.c webhelper/src/gwh-plugin.c
Modified: webhelper/src/gwh-browser.c 52 files changed, 45 insertions(+), 7 deletions(-) =================================================================== @@ -97,6 +97,9 @@ enum { G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
+static void inspector_set_detached (GwhBrowser *self, + gboolean detached); +
static void set_location_icon (GwhBrowser *self, @@ -186,6 +189,17 @@ enum { }
static void +on_settings_inspector_detached_notify (GObject *object, + GParamSpec *pspec, + GwhBrowser *self) +{ + gboolean detached; + + g_object_get (object, pspec->name, &detached, NULL); + inspector_set_detached (self, detached); +} + +static void on_settings_wm_windows_skip_taskbar_notify (GObject *object, GParamSpec *pspec, GwhBrowser *self) @@ -261,6 +275,25 @@ enum { } }
+static void +inspector_set_detached (GwhBrowser *self, + gboolean detached) +{ + if (detached != INSPECTOR_DETACHED (self)) { + if (detached) { + gtk_widget_reparent (self->priv->inspector_view, + self->priv->inspector_window); + if (INSPECTOR_VISIBLE (self)) { + inspector_show_window (self); + } + } else { + gtk_widget_reparent (self->priv->inspector_view, self->priv->paned); + inspector_hide_window (self); + } + g_object_set (self->priv->settings, "inspector-detached", detached, NULL); + } +} + static WebKitWebView * on_inspector_inspect_web_view (WebKitWebInspector *inspector, WebKitWebView *view, @@ -309,9 +342,7 @@ enum { on_inspector_detach_window (WebKitWebInspector *inspector, GwhBrowser *self) { - gtk_widget_reparent (self->priv->inspector_view, - self->priv->inspector_window); - inspector_show_window (self); + inspector_set_detached (self, TRUE);
return TRUE; } @@ -320,8 +351,7 @@ enum { on_inspector_attach_window (WebKitWebInspector *inspector, GwhBrowser *self) { - gtk_widget_reparent (self->priv->inspector_view, self->priv->paned); - inspector_hide_window (self); + inspector_set_detached (self, FALSE);
return TRUE; } @@ -848,8 +878,6 @@ enum { G_CALLBACK (on_settings_wm_windows_skip_taskbar_notify), self); g_signal_connect (self->priv->settings, "notify::wm-secondary-windows-type", G_CALLBACK (on_settings_wm_windows_type_notify), self); - gtk_container_add (GTK_CONTAINER (self->priv->inspector_window), - self->priv->inspector_view);
return self->priv->inspector_window; } @@ -859,6 +887,7 @@ enum { { GtkWidget *scrolled; WebKitWebSettings *wkws; + gboolean inspector_detached;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GWH_TYPE_BROWSER, GwhBrowserPrivate); @@ -870,6 +899,9 @@ enum { g_object_set (wkws, "enable-developer-extras", TRUE, NULL);
self->priv->settings = gwh_settings_get_default (); + g_object_get (self->priv->settings, + "inspector-detached", &inspector_detached, + NULL);
self->priv->toolbar = create_toolbar (self); self->priv->paned = gtk_vpaned_new (); @@ -890,6 +922,10 @@ enum { self->priv->inspector_web_view = NULL;
self->priv->inspector_window = create_inspector_window (self); + gtk_container_add (GTK_CONTAINER (inspector_detached + ? self->priv->inspector_window + : self->priv->paned), + self->priv->inspector_view);
g_signal_connect (self, "notify::orientation", G_CALLBACK (on_orientation_notify), self); @@ -932,6 +968,8 @@ enum { G_CALLBACK (on_settings_browser_last_uri_notify), self); g_signal_connect (self->priv->settings, "notify::browser-orientation", G_CALLBACK (on_settings_browser_orientation_notify), self); + g_signal_connect (self->priv->settings, "notify::inspector-detached", + G_CALLBACK (on_settings_inspector_detached_notify), self); g_signal_connect (self->priv->settings, "notify::inspector-window-geometry", G_CALLBACK (on_settings_inspector_window_geometry_notify), self); }
Modified: webhelper/src/gwh-plugin.c 6 files changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -339,6 +339,12 @@ enum { "400x300", G_PARAM_READWRITE)); gwh_settings_install_property (G_settings, g_param_spec_boolean ( + "inspector-detached", + _("Inspector detached"), + _("Whether the inspector is in a separate window or docked in the browser"), + FALSE, + G_PARAM_READWRITE)); + gwh_settings_install_property (G_settings, g_param_spec_boolean ( "wm-secondary-windows-skip-taskbar", _("Secondary windows skip task bar"), _("Whether to tell the window manager not to show the secondary windows in the task bar"),
@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).