aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-session.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2005-02-18 08:00:48 +0800
committerXan Lopez <xan@src.gnome.org>2005-02-18 08:00:48 +0800
commit71b930e61ea4b57c7b2305ca47c71b876ce8ae5e (patch)
tree21bdc8096a5a83bfc5b57314469b13481d648cd7 /src/ephy-session.c
parenta1ed3acf5f1951fc21e5550a15211967f56274f1 (diff)
downloadgsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar.gz
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar.bz2
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar.lz
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar.xz
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.tar.zst
gsoc2013-epiphany-71b930e61ea4b57c7b2305ca47c71b876ce8ae5e.zip
Fix #130990 "Mixing up workspaces of windows when restoring session".
* src/ephy-session.c: (impl_attach_window), (write_ephy_window), (restore_geometry), (ephy_session_load): Fix #130990 "Mixing up workspaces of windows when restoring session". Commited patch referenced in bug with slight modifications to make it work properly.
Diffstat (limited to 'src/ephy-session.c')
-rw-r--r--src/ephy-session.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 49ca547d9..3d1781bc3 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -227,6 +227,22 @@ impl_attach_window (EphyExtension *extension,
G_CALLBACK (tab_removed_cb), session);
g_signal_connect (notebook, "tabs_reordered",
G_CALLBACK (tabs_reordered_cb), session);
+
+ /* Set unique identifier as role, so that on restore, the WM can
+ * place the window on the right workspace
+ */
+
+ if (gtk_window_get_role (GTK_WINDOW (window)) == NULL)
+ {
+ /* I guess rand() is unique enough, otherwise we could use
+ * time + pid or something
+ */
+ char *role;
+
+ role = g_strdup_printf ("epiphany-window-%x", rand());
+ gtk_window_set_role (GTK_WINDOW (window), role);
+ g_free (role);
+ }
}
static void
@@ -556,6 +572,7 @@ write_ephy_window (xmlTextWriterPtr writer,
EphyWindow *window)
{
GList *tabs, *l;
+ const char *role;
int ret;
tabs = ephy_window_get_tabs (window);
@@ -571,6 +588,13 @@ write_ephy_window (xmlTextWriterPtr writer,
ret = write_window_geometry (writer, GTK_WINDOW (window));
if (ret < 0) return ret;
+ role = gtk_window_get_role (GTK_WINDOW (window));
+ if (role != NULL)
+ {
+ ret = xmlTextWriterWriteAttribute (writer, "role", role);
+ if (ret < 0) return ret;
+ }
+
for (l = tabs; l != NULL; l = l->next)
{
EphyTab *tab = EPHY_TAB(l->data);
@@ -741,8 +765,16 @@ restore_geometry (GtkWindow *window,
if (success)
{
+ tmp = xmlGetProp (node, (xmlChar *)"role");
+ if (tmp != NULL)
+ {
+ gtk_window_set_role (GTK_WINDOW (window), (const char *)tmp);
+ xmlFree (tmp);
+ }
+
gtk_window_move (window, x, y);
gtk_window_set_default_size (window, width, height);
+
}
}
/*
@@ -792,7 +824,7 @@ ephy_session_load (EphySession *session,
ephy_gui_window_update_user_time (widget, user_time);
- gtk_window_present (GTK_WINDOW (widget));
+ gtk_widget_show (widget);
}
else if (xmlStrEqual (child->name, (const xmlChar *) "toolwindow"))
{
@@ -819,7 +851,7 @@ ephy_session_load (EphySession *session,
ephy_gui_window_update_user_time (widget, user_time);
- gtk_window_present (GTK_WINDOW (widget));
+ gtk_widget_show (widget);
}
child = child->next;