diff options
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-conf.h | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-presence-chooser.c | 26 |
2 files changed, 27 insertions, 1 deletions
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" diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 7c5850af8..ba36e091c 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -35,6 +35,7 @@ #include <telepathy-glib/util.h> +#include <libempathy/empathy-connectivity.h> #include <libempathy/empathy-idle.h> #include <libempathy/empathy-utils.h> #include <libempathy/empathy-status-presets.h> @@ -98,6 +99,9 @@ typedef enum { typedef struct { EmpathyIdle *idle; + EmpathyConnectivity *connectivity; + + gulong state_change_signal_id; gboolean editing_status; int block_set_editing; @@ -710,6 +714,14 @@ presence_chooser_entry_focus_out_cb (EmpathyPresenceChooser *chooser, } static void +presence_chooser_connectivity_state_change (EmpathyConnectivity *connectivity, + gboolean new_online, + EmpathyPresenceChooser *chooser) +{ + gtk_widget_set_sensitive (GTK_WIDGET (chooser), new_online); +} + +static void empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) { EmpathyPresenceChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser, @@ -780,6 +792,14 @@ 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 (); + 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, + empathy_connectivity_is_online (priv->connectivity), chooser); } static void @@ -802,6 +822,12 @@ presence_chooser_finalize (GObject *object) object); g_object_unref (priv->idle); + g_signal_handler_disconnect (priv->connectivity, + priv->state_change_signal_id); + priv->state_change_signal_id = 0; + + g_object_unref (priv->connectivity); + G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object); } |