diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-07-12 01:27:52 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-07-12 16:48:15 +0800 |
commit | ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880 (patch) | |
tree | fcc2f56caf1549cfc2bdc9850e6bb5aeb56f32b0 /src/empathy-call-window.c | |
parent | 3535c55225076c649883aa4a497893b1f165a110 (diff) | |
download | gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar.gz gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar.bz2 gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar.lz gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar.xz gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.tar.zst gsoc2013-empathy-ee432f2c641a383ad8b32cb1ef7d2d2c2ee9c880.zip |
CallWindow: save the window geometry without the sidebar
Since we don't show the sidebar when creating new call windows,
we should not take the sidebar into account when saving the
window geometry.
https://bugzilla.gnome.org/show_bug.cgi?id=634809
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r-- | src/empathy-call-window.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 091a6e3c7..8fd10dea0 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -207,6 +207,9 @@ struct _EmpathyCallWindowPriv gint original_width_before_fs; gint original_height_before_fs; + gint x, y, w, h, sidebar_width; + gboolean maximized; + /* TRUE if the call should be started when the pipeline is playing */ gboolean start_call_when_playing; /* TRUE if we requested to set the pipeline in the playing state */ @@ -952,6 +955,41 @@ create_pipeline (EmpathyCallWindow *self) g_object_unref (bus); } +static gboolean +empathy_call_window_configure_event_cb (GtkWidget *widget, + GdkEvent *event, + EmpathyCallWindow *self) +{ + GdkWindow *gdk_window; + GdkWindowState window_state; + + gtk_window_get_position (GTK_WINDOW (self), &self->priv->x, &self->priv->y); + gtk_window_get_size (GTK_WINDOW (self), &self->priv->w, &self->priv->h); + + gtk_widget_get_preferred_width (self->priv->sidebar, + &self->priv->sidebar_width, NULL); + + gdk_window = gtk_widget_get_window (widget); + window_state = gdk_window_get_state (gdk_window); + self->priv->maximized = (window_state & GDK_WINDOW_STATE_MAXIMIZED); + + return FALSE; +} + +static void +empathy_call_window_destroyed_cb (GtkWidget *object, + EmpathyCallWindow *self) +{ + if (gtk_widget_get_visible (self->priv->sidebar)) + { + /* Save the geometry as if the sidebar was hidden. */ + empathy_geometry_save_values (GTK_WINDOW (self), + self->priv->x, self->priv->y, + self->priv->w - self->priv->sidebar_width, self->priv->h, + self->priv->maximized); + } +} + static void empathy_call_window_init (EmpathyCallWindow *self) { @@ -1152,6 +1190,15 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->sound_mgr = empathy_sound_manager_dup_singleton (); empathy_geometry_bind (GTK_WINDOW (self), "call-window"); + /* These signals are used to track the window position and save it + * when the window is destroyed. We need to do this as we don't want + * the window geometry to be saved with the sidebar taken into account. */ + g_signal_connect (self, "destroy", + G_CALLBACK (empathy_call_window_destroyed_cb), self); + g_signal_connect (self, "configure-event", + G_CALLBACK (empathy_call_window_configure_event_cb), self); + g_signal_connect (self, "window-state-event", + G_CALLBACK (empathy_call_window_configure_event_cb), self); } /* Instead of specifying a width and a height, we specify only one size. That's |