From 59b6fe4212cbb1b8e8712995bf59e26a0039964e Mon Sep 17 00:00:00 2001 From: xclaesse Date: Thu, 6 Dec 2007 14:31:58 +0000 Subject: 2007-12-06 Xavier Claessens * data/empathy.schemas.in: * libempathy-gtk/empathy-preferences.c: * libempathy-gtk/empathy-preferences.glade: * libempathy-gtk/empathy-preferences.h: * libempathy-gtk/empathy-status-icon.c: * libempathy/empathy-idle.c: * libempathy/empathy-idle.h: Add a preference option to disable/enable NM support. git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@468 4ee84921-47dd-4033-b63a-18d7a039a3e4 --- libempathy-gtk/empathy-preferences.c | 6 ++++ libempathy-gtk/empathy-preferences.glade | 50 ++++++++++++++++++++++++++------ libempathy-gtk/empathy-preferences.h | 1 + libempathy-gtk/empathy-status-icon.c | 30 +++++++++++++++++-- 4 files changed, 75 insertions(+), 12 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-preferences.c b/libempathy-gtk/empathy-preferences.c index a8b52954d..14ee8f763 100644 --- a/libempathy-gtk/empathy-preferences.c +++ b/libempathy-gtk/empathy-preferences.c @@ -50,6 +50,7 @@ typedef struct { GtkWidget *combobox_chat_theme; GtkWidget *checkbutton_theme_chat_room; GtkWidget *checkbutton_separate_chat_windows; + GtkWidget *checkbutton_use_nm; GtkWidget *radiobutton_contact_list_sort_by_name; GtkWidget *radiobutton_contact_list_sort_by_state; @@ -177,6 +178,10 @@ preferences_setup_widgets (EmpathyPreferences *preferences) EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, preferences->checkbutton_separate_chat_windows); + preferences_hookup_toggle_button (preferences, + EMPATHY_PREFS_USE_NM, + preferences->checkbutton_use_nm); + preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_UI_SHOW_AVATARS, preferences->checkbutton_show_avatars); @@ -939,6 +944,7 @@ empathy_preferences_show (GtkWindow *parent) "combobox_chat_theme", &preferences->combobox_chat_theme, "checkbutton_theme_chat_room", &preferences->checkbutton_theme_chat_room, "checkbutton_separate_chat_windows", &preferences->checkbutton_separate_chat_windows, + "checkbutton_use_nm", &preferences->checkbutton_use_nm, "radiobutton_contact_list_sort_by_name", &preferences->radiobutton_contact_list_sort_by_name, "radiobutton_contact_list_sort_by_state", &preferences->radiobutton_contact_list_sort_by_state, "checkbutton_sounds_for_messages", &preferences->checkbutton_sounds_for_messages, diff --git a/libempathy-gtk/empathy-preferences.glade b/libempathy-gtk/empathy-preferences.glade index 73cb66d5f..5c3321197 100644 --- a/libempathy-gtk/empathy-preferences.glade +++ b/libempathy-gtk/empathy-preferences.glade @@ -209,16 +209,48 @@ 0 - + True - True - _Open new chats in separate windows - True - GTK_RELIEF_NORMAL - True - False - False - True + False + 0 + + + + True + True + _Open new chats in separate windows + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + _Use network manager + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + diff --git a/libempathy-gtk/empathy-preferences.h b/libempathy-gtk/empathy-preferences.h index 39c2994c1..e4cf122bc 100644 --- a/libempathy-gtk/empathy-preferences.h +++ b/libempathy-gtk/empathy-preferences.h @@ -50,6 +50,7 @@ G_BEGIN_DECLS #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" GtkWidget * empathy_preferences_show (GtkWindow *parent); diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c index 4421ddc85..cca41d5dd 100644 --- a/libempathy-gtk/empathy-status-icon.c +++ b/libempathy-gtk/empathy-status-icon.c @@ -139,6 +139,19 @@ static void status_icon_event_free (StatusIconEvent *event G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT); +static void +status_icon_notify_use_nm_cb (EmpathyConf *conf, + const gchar *key, + gpointer user_data) +{ + EmpathyStatusIconPriv *priv = GET_PRIV (user_data); + gboolean use_nm; + + if (empathy_conf_get_bool (conf, key, &use_nm)) { + empathy_idle_set_use_nm (priv->idle, use_nm); + } +} + static void empathy_status_icon_class_init (EmpathyStatusIconClass *klass) { @@ -154,13 +167,11 @@ empathy_status_icon_init (EmpathyStatusIcon *icon) { EmpathyStatusIconPriv *priv; GList *pendings, *l; + gboolean use_nm; priv = GET_PRIV (icon); priv->icon = gtk_status_icon_new (); - priv->idle = empathy_idle_new (); - empathy_idle_set_auto_away (priv->idle, TRUE); - empathy_idle_set_auto_disconnect (priv->idle, TRUE); priv->manager = empathy_contact_manager_new (); priv->mc = empathy_mission_control_new (); priv->text_filter = empathy_filter_new ("org.gnome.Empathy.ChatFilter", @@ -169,6 +180,19 @@ empathy_status_icon_init (EmpathyStatusIcon *icon) MC_FILTER_PRIORITY_DIALOG, MC_FILTER_FLAG_INCOMING); + /* Setup EmpathyIdle */ + priv->idle = empathy_idle_new (); + empathy_conf_get_bool (empathy_conf_get (), + EMPATHY_PREFS_USE_NM, + &use_nm); + empathy_conf_notify_add (empathy_conf_get (), + EMPATHY_PREFS_USE_NM, + status_icon_notify_use_nm_cb, + icon); + empathy_idle_set_auto_away (priv->idle, TRUE); + empathy_idle_set_use_nm (priv->idle, use_nm); + + status_icon_create_menu (icon); status_icon_idle_notify_cb (icon); -- cgit v1.2.3