diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-04-29 17:52:07 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-04-29 17:52:07 +0800 |
commit | 813a4f37f81c3486e7952f0a82c791689a68a520 (patch) | |
tree | 9b711465235704f747a598cc61cf3641c38b54d1 /src | |
parent | 71cb9d26791edfca8952b4fcc7170355ed3b2d44 (diff) | |
download | gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar.gz gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar.bz2 gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar.lz gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar.xz gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.tar.zst gsoc2013-empathy-813a4f37f81c3486e7952f0a82c791689a68a520.zip |
call-window: update window's title when contact's name is changed
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 47f87f678..46210640c 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -66,6 +66,7 @@ struct _EmpathyCallWindowPriv { gboolean dispose_has_run; EmpathyCallHandler *handler; + EmpathyContact *contact; gboolean connected; @@ -580,26 +581,41 @@ empathy_call_window_init (EmpathyCallWindow *self) } static void +set_window_title (EmpathyCallWindow *self) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (self); + gchar *tmp; + + tmp = g_strdup_printf (_("Call with %s"), + empathy_contact_get_name (priv->contact)); + gtk_window_set_title (GTK_WINDOW (self), tmp); + g_free (tmp); +} + +static void +contact_name_changed_cb (EmpathyContact *contact, + GParamSpec *pspec, + EmpathyCallWindow *self) +{ + set_window_title (self); +} + +static void empathy_call_window_constructed (GObject *object) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); EmpathyCallWindowPriv *priv = GET_PRIV (self); - EmpathyContact *contact; g_assert (priv->handler != NULL); - g_object_get (priv->handler, "contact", &contact, NULL); + g_object_get (priv->handler, "contact", &(priv->contact), NULL); - if (contact != NULL) + if (priv->contact != NULL) { - gchar *tmp; + set_window_title (self); - tmp = g_strdup_printf (_("Call with %s"), - empathy_contact_get_name (contact)); - gtk_window_set_title (GTK_WINDOW (self), tmp); - - g_free (tmp); - g_object_unref (contact); + g_signal_connect (priv->contact, "notify::name", + G_CALLBACK (contact_name_changed_cb), self); } } @@ -708,6 +724,14 @@ empathy_call_window_dispose (GObject *object) g_object_unref (priv->ui_manager); priv->ui_manager = NULL; + if (priv->contact != NULL) + { + g_object_unref (priv->contact); + g_signal_handlers_disconnect_by_func (priv->contact, + contact_name_changed_cb, self); + priv->contact = NULL; + } + /* release any references held by the object here */ if (G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose) G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object); |