Commit 12bda829 authored by Milan Crha's avatar Milan Crha

Bug 746763 - Independent layout settings for sub-shell windows

parent ece0ec63
......@@ -30,11 +30,21 @@
<_summary>Contact preview pane position (horizontal)</_summary>
<_description>Position of the contact preview pane when oriented horizontally.</_description>
</key>
<key name="hpane-position-sub" type="i">
<default>200</default>
<_summary>Contact preview pane position (horizontal)</_summary>
<_description>Position of the contact preview pane when oriented horizontally.</_description>
</key>
<key name="vpane-position" type="i">
<default>400</default>
<_summary>Contact preview pane position (vertical)</_summary>
<_description>Position of the contact preview pane when oriented vertically.</_description>
</key>
<key name="vpane-position-sub" type="i">
<default>400</default>
<_summary>Contact preview pane position (vertical)</_summary>
<_description>Position of the contact preview pane when oriented vertically.</_description>
</key>
<key name="preview-show-maps" type="b">
<default>false</default>
<_summary>Show maps</_summary>
......
......@@ -54,6 +54,11 @@
<_summary>Month view vertical pane position</_summary>
<_description>Position of the vertical pane, between the calendar lists and the date navigator calendar</_description>
</key>
<key name="date-navigator-pane-position-sub" type="i">
<default>150</default>
<_summary>Month view vertical pane position</_summary>
<_description>Position of the vertical pane, between the calendar lists and the date navigator calendar</_description>
</key>
<key name="day-end-hour" type="i">
<default>17</default>
<_summary>Workday end hour</_summary>
......
......@@ -299,6 +299,11 @@
<_summary>Height of the message-list pane</_summary>
<_description>Height of the message-list pane.</_description>
</key>
<key name="paned-size-sub" type="i">
<default>144</default>
<_summary>Height of the message-list pane</_summary>
<_description>Height of the message-list pane.</_description>
</key>
<key name="headers-collapsed" type="b">
<default>false</default>
<_summary>Whether message headers are collapsed in the user interface</_summary>
......@@ -308,6 +313,11 @@
<_summary>Width of the message-list pane</_summary>
<_description>Width of the message-list pane.</_description>
</key>
<key name="hpaned-size-sub" type="i">
<default>450</default>
<_summary>Width of the message-list pane</_summary>
<_description>Width of the message-list pane.</_description>
</key>
<key name="layout" type="i">
<default>0</default>
<_summary>Layout style</_summary>
......
......@@ -35,6 +35,11 @@
<_summary>Window buttons are visible</_summary>
<_description>Whether the window buttons should be visible.</_description>
</key>
<key name="buttons-visible-sub" type="b">
<default>true</default>
<_summary>Window buttons are visible</_summary>
<_description>Whether the window buttons should be visible.</_description>
</key>
<key name="buttons-style" type="s">
<default>'toolbar'</default>
<_summary>Window button style</_summary>
......@@ -45,16 +50,31 @@
<_summary>Toolbar is visible</_summary>
<_description>Whether the toolbar should be visible.</_description>
</key>
<key name="toolbar-visible-sub" type="b">
<default>true</default>
<_summary>Toolbar is visible</_summary>
<_description>Whether the toolbar should be visible.</_description>
</key>
<key name="sidebar-visible" type="b">
<default>true</default>
<_summary>Sidebar is visible</_summary>
<_description>Whether the sidebar should be visible.</_description>
</key>
<key name="sidebar-visible-sub" type="b">
<default>true</default>
<_summary>Sidebar is visible</_summary>
<_description>Whether the sidebar should be visible.</_description>
</key>
<key name="statusbar-visible" type="b">
<default>true</default>
<_summary>Statusbar is visible</_summary>
<_description>Whether the status bar should be visible.</_description>
</key>
<key name="statusbar-visible-sub" type="b">
<default>true</default>
<_summary>Statusbar is visible</_summary>
<_description>Whether the status bar should be visible.</_description>
</key>
<key name="default-component-id" type="s">
<default>'mail'</default>
<_summary>ID or alias of the component to be shown by default at start-up.</_summary>
......@@ -65,6 +85,11 @@
<_summary>Default sidebar width</_summary>
<_description>The default width for the sidebar, in pixels.</_description>
</key>
<key name="folder-bar-width-sub" type="i">
<default>200</default>
<_summary>Default sidebar width</_summary>
<_description>The default width for the sidebar, in pixels.</_description>
</key>
<child name="window" schema="org.gnome.evolution.window"/>
</schema>
</schemalist>
......@@ -224,19 +224,31 @@ mail_paned_view_restore_state_cb (EShellWindow *shell_window,
priv = E_MAIL_PANED_VIEW (view)->priv;
/* Bind GObject properties to GSettings keys. */
settings = e_util_ref_settings ("org.gnome.evolution.mail");
g_settings_bind (
settings, "hpaned-size",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT);
if (e_shell_window_is_main_instance (shell_window)) {
g_settings_bind (
settings, "hpaned-size",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "paned-size",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "paned-size",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "hpaned-size-sub",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "paned-size-sub",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
}
g_object_unref (settings);
}
......
......@@ -94,15 +94,29 @@ book_shell_content_restore_state_cb (EShellWindow *shell_window,
settings = e_util_ref_settings ("org.gnome.evolution.addressbook");
g_settings_bind (
settings, "hpane-position",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "vpane-position",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
if (e_shell_window_is_main_instance (shell_window)) {
g_settings_bind (
settings, "hpane-position",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "vpane-position",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "hpane-position-sub",
priv->paned, "hposition",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "vpane-position-sub",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
}
g_object_unref (settings);
}
......
......@@ -148,10 +148,18 @@ cal_base_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
(GDestroyNotify) g_object_unref);
if (priv->date_navigator) {
g_settings_bind (
settings, "date-navigator-pane-position",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
if (e_shell_window_is_main_instance (shell_window)) {
g_settings_bind (
settings, "date-navigator-pane-position",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "date-navigator-pane-position-sub",
priv->paned, "vposition",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
}
}
g_object_unref (settings);
......
......@@ -246,6 +246,26 @@ e_shell_window_private_init (EShellWindow *shell_window)
G_CALLBACK (shell_window_connect_proxy_cb), shell_window);
}
static gboolean
shell_window_check_is_main_instance (GtkApplication *application,
GtkWindow *window)
{
GList *windows, *link;
g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
windows = gtk_application_get_windows (application);
for (link = windows; link; link = g_list_next (link)) {
GtkWindow *wnd = link->data;
if (E_IS_SHELL_WINDOW (wnd) && wnd != window)
return FALSE;
}
return TRUE;
}
void
e_shell_window_private_constructed (EShellWindow *shell_window)
{
......@@ -269,6 +289,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
window = GTK_WINDOW (shell_window);
shell = e_shell_window_get_shell (shell_window);
shell_window->priv->is_main_instance = shell_window_check_is_main_instance (GTK_APPLICATION (shell), window);
ui_manager = e_shell_window_get_ui_manager (shell_window);
......@@ -416,30 +437,62 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "folder-bar-width",
priv->content_pane, "position",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "sidebar-visible",
shell_window, "sidebar-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "statusbar-visible",
shell_window, "taskbar-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "buttons-visible",
shell_window, "switcher-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "toolbar-visible",
shell_window, "toolbar-visible",
G_SETTINGS_BIND_DEFAULT);
if (e_shell_window_is_main_instance (shell_window)) {
g_settings_bind (
settings, "folder-bar-width",
priv->content_pane, "position",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "sidebar-visible",
shell_window, "sidebar-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "statusbar-visible",
shell_window, "taskbar-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "buttons-visible",
shell_window, "switcher-visible",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (
settings, "toolbar-visible",
shell_window, "toolbar-visible",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "folder-bar-width-sub",
priv->content_pane, "position",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "sidebar-visible-sub",
shell_window, "sidebar-visible",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "statusbar-visible-sub",
shell_window, "taskbar-visible",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "buttons-visible-sub",
shell_window, "switcher-visible",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (
settings, "toolbar-visible-sub",
shell_window, "toolbar-visible",
G_SETTINGS_BIND_DEFAULT |
G_SETTINGS_BIND_GET_NO_CHANGES);
}
/* Configure the initial size and position of the window by way
* of either a user-supplied geometry string or the last recorded
......
......@@ -94,6 +94,7 @@ struct _EShellWindowPrivate {
guint switcher_visible : 1;
guint taskbar_visible : 1;
guint toolbar_visible : 1;
guint is_main_instance : 1;
};
void e_shell_window_private_init (EShellWindow *shell_window);
......
......@@ -1106,6 +1106,23 @@ e_shell_window_get_shell (EShellWindow *shell_window)
return E_SHELL (shell_window->priv->shell);
}
/**
* e_shell_window_is_main_instance:
* @shell_window: an #EShellWindow
*
* Returns, whether the @shell_window is the main instance, which is
* the window which was created as the first @shell_window.
*
* Returns: whether the @shell_window is the main instance
**/
gboolean
e_shell_window_is_main_instance (EShellWindow *shell_window)
{
g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), FALSE);
return shell_window->priv->is_main_instance;
}
/**
* e_shell_window_get_shell_view:
* @shell_window: an #EShellWindow
......
......@@ -86,6 +86,7 @@ GtkWidget * e_shell_window_new (EShell *shell,
gboolean safe_mode,
const gchar *geometry);
EShell * e_shell_window_get_shell (EShellWindow *shell_window);
gboolean e_shell_window_is_main_instance (EShellWindow *shell_window);
struct _EShellView *
e_shell_window_get_shell_view (EShellWindow *shell_window,
const gchar *view_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment