midori_browser_window_state_event_cb (MidoriBrowser* browser,
GdkEventWindowState* event)
{
+ MidoriWindowState window_state = MIDORI_WINDOW_NORMAL;
+ if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
+ window_state = MIDORI_WINDOW_MINIMIZED;
+ else if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
+ window_state = MIDORI_WINDOW_MAXIMIZED;
+ else if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
+ window_state = MIDORI_WINDOW_FULLSCREEN;
+ g_object_set (browser->settings, "last-window-state", window_state, NULL);
+
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
{
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
{
gboolean remember_last_window_size;
gint last_window_width, last_window_height;
+ MidoriWindowState last_window_state;
gboolean compact_sidepanel;
gint last_panel_position, last_panel_page;
gboolean show_menubar, show_navigationbar, show_bookmarkbar;
"remember-last-window-size", &remember_last_window_size,
"last-window-width", &last_window_width,
"last-window-height", &last_window_height,
+ "last-window-state", &last_window_state,
"compact-sidepanel", &compact_sidepanel,
"last-panel-position", &last_panel_position,
"last-panel-page", &last_panel_page,
else
gtk_window_set_default_size (GTK_WINDOW (browser),
default_width, default_height);
+ switch (last_window_state)
+ {
+ case MIDORI_WINDOW_MINIMIZED:
+ gtk_window_iconify (GTK_WINDOW (browser));
+ break;
+ case MIDORI_WINDOW_MAXIMIZED:
+ gtk_window_maximize (GTK_WINDOW (browser));
+ break;
+ case MIDORI_WINDOW_FULLSCREEN:
+ gtk_window_fullscreen (GTK_WINDOW (browser));
+ break;
+ default:
+ ;/* Do nothing. */
+ }
}
_midori_browser_set_toolbar_style (browser, toolbar_style);
/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+ Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
gboolean remember_last_window_size;
gint last_window_width;
gint last_window_height;
+ MidoriWindowState last_window_state;
gint last_panel_position;
gint last_panel_page;
gint last_web_search;
PROP_REMEMBER_LAST_WINDOW_SIZE,
PROP_LAST_WINDOW_WIDTH,
PROP_LAST_WINDOW_HEIGHT,
+ PROP_LAST_WINDOW_STATE,
PROP_LAST_PANEL_POSITION,
PROP_LAST_PANEL_PAGE,
PROP_LAST_WEB_SEARCH,
PROP_CACHE_SIZE
};
+GType
+midori_window_state_get_type (void)
+{
+ static GType type = 0;
+ if (!type)
+ {
+ static const GEnumValue values[] = {
+ { MIDORI_WINDOW_NORMAL, "MIDORI_WINDOW_NORMAL", "Normal" },
+ { MIDORI_WINDOW_MINIMIZED, "MIDORI_WINDOW_MINIMIZED", "Minimized" },
+ { MIDORI_WINDOW_MAXIMIZED, "MIDORI_WINDOW_MAXIMIZED", "Maximized" },
+ { MIDORI_WINDOW_FULLSCREEN, "MIDORI_WINDOW_FULLSCREEN", "Fullscreen" },
+ { 0, NULL, NULL }
+ };
+ type = g_enum_register_static ("MidoriWindowState", values);
+ }
+ return type;
+}
+
GType
midori_startup_get_type (void)
{
0, G_MAXINT, 0,
flags));
+ /**
+ * MidoriWebSettings:last-window-state:
+ *
+ * The last saved window state.
+ *
+ * Since: 0.1.3
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_LAST_WINDOW_STATE,
+ g_param_spec_enum (
+ "last-window-state",
+ "Last window state",
+ "The last saved window state",
+ MIDORI_TYPE_WINDOW_STATE,
+ MIDORI_WINDOW_NORMAL,
+ flags));
+
g_object_class_install_property (gobject_class,
PROP_LAST_PANEL_POSITION,
g_param_spec_int (
case PROP_LAST_WINDOW_HEIGHT:
web_settings->last_window_height = g_value_get_int (value);
break;
+ case PROP_LAST_WINDOW_STATE:
+ web_settings->last_window_state = g_value_get_enum (value);
+ break;
case PROP_LAST_PANEL_POSITION:
web_settings->last_panel_position = g_value_get_int (value);
break;
case PROP_LAST_WINDOW_HEIGHT:
g_value_set_int (value, web_settings->last_window_height);
break;
+ case PROP_LAST_WINDOW_STATE:
+ g_value_set_enum (value, web_settings->last_window_state);
+ break;
case PROP_LAST_PANEL_POSITION:
g_value_set_int (value, web_settings->last_panel_position);
break;
typedef struct _MidoriWebSettings MidoriWebSettings;
typedef struct _MidoriWebSettingsClass MidoriWebSettingsClass;
+typedef enum
+{
+ MIDORI_WINDOW_NORMAL,
+ MIDORI_WINDOW_MINIMIZED,
+ MIDORI_WINDOW_MAXIMIZED,
+ MIDORI_WINDOW_FULLSCREEN,
+} MidoriWindowState;
+
+GType
+midori_window_state_get_type (void) G_GNUC_CONST;
+
+#define MIDORI_TYPE_WINDOW_STATE \
+ (midori_startup_get_type ())
+
typedef enum
{
MIDORI_STARTUP_BLANK_PAGE,