From 8daae9d4540406968b405c850586b26ca2a1699c Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Tue, 18 Aug 2009 16:57:49 +0100 Subject: empathy-conf: rename use_nm to use_conn Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h index 2383a7edf..d8e34f6b9 100644 --- a/libempathy-gtk/empathy-conf.h +++ b/libempathy-gtk/empathy-conf.h @@ -78,7 +78,7 @@ struct _EmpathyConfClass { #define EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM EMPATHY_PREFS_PATH "/contacts/sort_criterium" #define EMPATHY_PREFS_HINTS_CLOSE_MAIN_WINDOW EMPATHY_PREFS_PATH "/hints/close_main_window" #define EMPATHY_PREFS_SALUT_ACCOUNT_CREATED EMPATHY_PREFS_PATH "/accounts/salut_created" -#define EMPATHY_PREFS_USE_NM EMPATHY_PREFS_PATH "/use_nm" +#define EMPATHY_PREFS_USE_CONN EMPATHY_PREFS_PATH "/use_conn" #define EMPATHY_PREFS_AUTOCONNECT EMPATHY_PREFS_PATH "/autoconnect" #define EMPATHY_PREFS_IMPORT_ASKED EMPATHY_PREFS_PATH "/import_asked" #define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder" -- cgit v1.2.3 From 4080b07d140362f0d2888d0baf6a4ecf60e8ea2a Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Wed, 19 Aug 2009 11:51:47 +0100 Subject: empathy-presence-chooser: make chooser insensitive when there's no connection Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-presence-chooser.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 7c5850af8..b0668196b 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -35,6 +35,7 @@ #include +#include #include #include #include @@ -98,6 +99,7 @@ typedef enum { typedef struct { EmpathyIdle *idle; + EmpathyConnectivity *connectivity; gboolean editing_status; int block_set_editing; @@ -709,6 +711,15 @@ presence_chooser_entry_focus_out_cb (EmpathyPresenceChooser *chooser, return FALSE; } +static void +presence_chooser_connectivity_state_change (EmpathyConnectivity *connectivity, + gboolean old_online, + gboolean new_online, + EmpathyPresenceChooser *chooser) +{ + gtk_widget_set_sensitive (GTK_WIDGET (chooser), new_online); +} + static void empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) { @@ -780,6 +791,13 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) /* FIXME: this string sucks */ gtk_widget_set_tooltip_text (GTK_WIDGET (chooser), _("Set your presence and current status")); + + priv->connectivity = empathy_connectivity_dup_singleton (); + g_signal_connect (priv->connectivity, "state-change", + G_CALLBACK (presence_chooser_connectivity_state_change), + chooser); + presence_chooser_connectivity_state_change (priv->connectivity, FALSE, + empathy_connectivity_is_online (priv->connectivity), chooser); } static void @@ -802,6 +820,12 @@ presence_chooser_finalize (GObject *object) object); g_object_unref (priv->idle); + g_signal_handlers_disconnect_by_func (priv->connectivity, + presence_chooser_connectivity_state_change, + object); + + g_object_unref (priv->connectivity); + G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object); } -- cgit v1.2.3 From c98e85dcf635914dc66755d6a8560e2d370cfffe Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Wed, 19 Aug 2009 16:50:14 +0100 Subject: empathy-connectivity: only send the new state in the state-change signal It can be assumed that the old state was always the opposite to the new state, because the signal is only ever fired if the new state differs from the old state. Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-presence-chooser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index b0668196b..490ad898a 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -713,7 +713,6 @@ presence_chooser_entry_focus_out_cb (EmpathyPresenceChooser *chooser, static void presence_chooser_connectivity_state_change (EmpathyConnectivity *connectivity, - gboolean old_online, gboolean new_online, EmpathyPresenceChooser *chooser) { @@ -796,7 +795,7 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) g_signal_connect (priv->connectivity, "state-change", G_CALLBACK (presence_chooser_connectivity_state_change), chooser); - presence_chooser_connectivity_state_change (priv->connectivity, FALSE, + presence_chooser_connectivity_state_change (priv->connectivity, empathy_connectivity_is_online (priv->connectivity), chooser); } -- cgit v1.2.3 From 8e549e268287120c56eb2dbc25b9d70dadb895f2 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Wed, 19 Aug 2009 17:07:48 +0100 Subject: all: save the signal id and use that to disconnect from the signal Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-presence-chooser.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 490ad898a..ba36e091c 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -101,6 +101,8 @@ typedef struct { EmpathyIdle *idle; EmpathyConnectivity *connectivity; + gulong state_change_signal_id; + gboolean editing_status; int block_set_editing; int block_changed; @@ -792,7 +794,8 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) _("Set your presence and current status")); priv->connectivity = empathy_connectivity_dup_singleton (); - g_signal_connect (priv->connectivity, "state-change", + priv->state_change_signal_id = g_signal_connect (priv->connectivity, + "state-change", G_CALLBACK (presence_chooser_connectivity_state_change), chooser); presence_chooser_connectivity_state_change (priv->connectivity, @@ -819,9 +822,9 @@ presence_chooser_finalize (GObject *object) object); g_object_unref (priv->idle); - g_signal_handlers_disconnect_by_func (priv->connectivity, - presence_chooser_connectivity_state_change, - object); + g_signal_handler_disconnect (priv->connectivity, + priv->state_change_signal_id); + priv->state_change_signal_id = 0; g_object_unref (priv->connectivity); -- cgit v1.2.3