Rememember whether inspector was attached

This commit is contained in:
Christian Dywan 2012-07-11 21:28:10 +02:00
parent d260e71a23
commit 68a4ed6c99
3 changed files with 36 additions and 3 deletions

View file

@ -1274,6 +1274,8 @@ midori_view_attach_inspector_cb (GtkWidget* view,
gtk_widget_show_all (browser->inspector); gtk_widget_show_all (browser->inspector);
browser->inspector_view = inspector_view; browser->inspector_view = inspector_view;
gtk_widget_destroy (toplevel); 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 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_remove (GTK_CONTAINER (scrolled), GTK_WIDGET (inspector_view));
gtk_container_add (GTK_CONTAINER (scrolled), browser->inspector_view); gtk_container_add (GTK_CONTAINER (scrolled), browser->inspector_view);
gtk_widget_hide (paned); 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 static void

View file

@ -3705,7 +3705,7 @@ midori_view_web_inspector_construct_window (gpointer inspector,
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE); gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE);
#endif #endif
gtk_container_add (GTK_CONTAINER (window), inspector_view); 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_signal_connect (window, "key-press-event",
G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL); 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)); GtkWidget* window = gtk_widget_get_toplevel (GTK_WIDGET (inspector_view));
if (!window) if (!window)
return FALSE; 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; return TRUE;
} }

View 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> Copyright (C) 2011 Peter Hatina <phatina@redhat.com>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -70,6 +70,7 @@ struct _MidoriWebSettings
gint last_panel_position; gint last_panel_position;
gint last_panel_page; gint last_panel_page;
gint last_web_search; gint last_web_search;
gboolean last_inspector_attached;
gint maximum_cookie_age; gint maximum_cookie_age;
gint maximum_history_age; gint maximum_history_age;
gint search_width; gint search_width;
@ -120,6 +121,7 @@ enum
PROP_LAST_PANEL_POSITION, PROP_LAST_PANEL_POSITION,
PROP_LAST_PANEL_PAGE, PROP_LAST_PANEL_PAGE,
PROP_LAST_WEB_SEARCH, PROP_LAST_WEB_SEARCH,
PROP_LAST_INSPECTOR_ATTACHED,
PROP_SHOW_MENUBAR, PROP_SHOW_MENUBAR,
PROP_SHOW_NAVIGATIONBAR, PROP_SHOW_NAVIGATIONBAR,
@ -466,6 +468,21 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("The last saved Web search"), _("The last saved Web search"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
flags)); 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, g_object_class_install_property (gobject_class,
@ -1505,6 +1522,9 @@ midori_web_settings_set_property (GObject* object,
case PROP_LAST_WEB_SEARCH: case PROP_LAST_WEB_SEARCH:
web_settings->last_web_search = g_value_get_int (value); web_settings->last_web_search = g_value_get_int (value);
break; break;
case PROP_LAST_INSPECTOR_ATTACHED:
web_settings->last_inspector_attached = g_value_get_boolean (value);
break;
case PROP_SHOW_MENUBAR: case PROP_SHOW_MENUBAR:
web_settings->show_menubar = g_value_get_boolean (value); 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: case PROP_LAST_WEB_SEARCH:
g_value_set_int (value, web_settings->last_web_search); g_value_set_int (value, web_settings->last_web_search);
break; break;
case PROP_LAST_INSPECTOR_ATTACHED:
g_value_set_boolean (value, web_settings->last_inspector_attached);
break;
case PROP_SHOW_MENUBAR: case PROP_SHOW_MENUBAR:
g_value_set_boolean (value, web_settings->show_menubar); g_value_set_boolean (value, web_settings->show_menubar);