From: Xavier Claessens Date: Sat, 12 Jan 2008 11:02:46 +0000 (+0000) Subject: Add option in preference to automatically connect at startup. Fixes bug #499885 ... X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=1f97396a517a53b2699e6def6ef399d6266e0aa8 Add option in preference to automatically connect at startup. Fixes bug #499885 (Carl-Anton Ingmarsson). svn path=/trunk/; revision=539 --- diff --git a/data/empathy.desktop.in.in b/data/empathy.desktop.in.in index e5d56a27..d7feab25 100644 --- a/data/empathy.desktop.in.in +++ b/data/empathy.desktop.in.in @@ -2,7 +2,7 @@ Version=1.0 _Name=Empathy Instant Messenger _Comment=Send and receive instant messages -Exec=empathy --no-connect +Exec=empathy Icon=empathy StartupNotify=false Terminal=false diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in index 73246486..6a9ab9ee 100644 --- a/data/empathy.schemas.in +++ b/data/empathy.schemas.in @@ -290,10 +290,20 @@ + + + /schemas/apps/empathy/autoconnect + /apps/empathy/autoconnect + empathy + bool + true + + Checks if Empathy should autoconnect on startup + + Whether or not Empathy should automatically login to your accounts on startup. + + + - - - - diff --git a/libempathy-gtk/empathy-preferences.c b/libempathy-gtk/empathy-preferences.c index a8b52954..d6e21a73 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_autoconnect; GtkWidget *radiobutton_contact_list_sort_by_name; GtkWidget *radiobutton_contact_list_sort_by_state; @@ -200,6 +201,10 @@ preferences_setup_widgets (EmpathyPreferences *preferences) preferences_hookup_radio_button (preferences, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, preferences->radiobutton_contact_list_sort_by_name); + + preferences_hookup_toggle_button (preferences, + EMPATHY_PREFS_AUTOCONNECT, + preferences->checkbutton_autoconnect); } static void @@ -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_autoconnect", &preferences->checkbutton_autoconnect, "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 4db860f1..f53d88a8 100644 --- a/libempathy-gtk/empathy-preferences.glade +++ b/libempathy-gtk/empathy-preferences.glade @@ -1,1045 +1,645 @@ - - - + + + - - - - 5 - Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - True - False - gtk-preferences - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 2 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -6 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - True - True - True - GTK_POS_TOP - False - False - - - - 12 - True - False - 18 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 6 - - - - True - Avatars are user chosen images shown in the contact list - True - Show _avatars - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 0 - False - False - - - - - - True - True - Show co_mpact contact list - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Show _smileys as images - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 0 - False - False - - - - - - - - - - True - <b>Appearance</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 0 - - - - True - True - _Open new chats in separate windows - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - - - - - True - <b>Behaviour</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 0 - - - - True - True - Sort by _name - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Sort by s_tate - True - GTK_RELIEF_NORMAL - True - False - False - True - radiobutton_contact_list_sort_by_name - - - 0 - False - False - - - - - - - - - - True - <b>Contact List</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - - - - False - True - - - - - - True - General - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 18 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 6 - - - - True - True - _Play sound when messages arrive - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Enable sounds when _busy - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Enable sounds when _away - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - - - - - True - <b>Audio</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - True - Display notifications when contacts come _online - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - - - - True - <b>Visual</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - False - True - - - - - - True - Notifications - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - False - 18 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 6 - - - - True - False - 0 - - - - True - False - 6 - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - gtk-dialog-info - 4 - 0.5 - 0 - 0 - 0 - - - 0 - False - True - - - - - - True - <small>The list of languages reflects only the languages for which you have a dictionary installed.</small> - False - True - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - True - - - - - 0 - False - True - - - - - - - - - - True - <b>Enable spell checking for languages:</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - - - - - - - - False - True - - - - - - True - Spell Checking - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 18 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - False - 6 - - - - True - False - 12 - - - - True - Chat Th_eme: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - combobox_chat_theme - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - - - - - - True - <b>Appearance</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 6 - 0 - 12 - 0 - - - - True - True - _Use for chat rooms - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - - - - True - <b>Options</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - False - - - - - False - True - - - - - - True - Themes - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - 0 - True - True - - - - - - + + 5 + Preferences + GTK_WIN_POS_CENTER_ON_PARENT + gtk-preferences + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + 2 + + + True + True + 5 + + + True + 12 + 18 + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + 6 + + + True + True + Avatars are user chosen images shown in the contact list + Show _avatars + True + 0 + True + True + + + False + False + + + + + True + True + Show co_mpact contact list + True + 0 + True + + + False + False + 1 + + + + + True + True + Show _smileys as images + True + 0 + True + True + + + False + False + 2 + + + + + + + + + True + <b>Appearance</b> + True + + + label_item + + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + + + True + True + _Open new chats in separate windows + True + 0 + True + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Auto_connect on startup + True + 0 + True + True + + + 1 + + + + + + + + + True + <b>Behaviour</b> + True + + + label_item + + + + + False + False + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + + + True + True + Sort by _name + True + 0 + True + + + False + False + + + + + True + True + Sort by s_tate + True + 0 + True + radiobutton_contact_list_sort_by_name + + + False + False + 1 + + + + + + + + + True + <b>Contact List</b> + True + + + label_item + + + + + 2 + + + + + + + True + General + + + tab + False + + + + + True + 12 + 18 + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + 6 + + + True + True + _Play sound when messages arrive + True + 0 + True + + + False + False + + + + + True + True + Enable sounds when _busy + True + 0 + True + + + False + False + 1 + + + + + True + True + Enable sounds when _away + True + 0 + True + + + False + False + 2 + + + + + + + + + True + <b>Audio</b> + True + + + label_item + + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + True + Display notifications when contacts come _online + True + 0 + True + + + + + + + True + <b>Visual</b> + True + + + label_item + + + + + False + False + 1 + + + + + 1 + + + + + True + Notifications + + + tab + 1 + False + + + + + 12 + 18 + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + 6 + + + True + + + True + 6 + + + True + False + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + + + + + + + True + 6 + + + True + 0 + gtk-dialog-info + + + False + + + + + True + 0 + <small>The list of languages reflects only the languages for which you have a dictionary installed.</small> + True + True + + + 1 + + + + + False + 1 + + + + + + + + + True + <b>Enable spell checking for languages:</b> + True + + + label_item + + + + + + + + + + 2 + + + + + True + Spell Checking + + + tab + 2 + False + + + + + True + 12 + 18 + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + 6 + + + True + 12 + + + True + Chat Th_eme: + True + combobox_chat_theme + + + False + False + + + + + True + + + + False + False + 1 + + + + + + + + + + + True + <b>Appearance</b> + True + + + label_item + + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 6 + 12 + + + True + True + _Use for chat rooms + True + 0 + True + + + + + + + True + <b>Options</b> + True + + + label_item + + + + + False + False + 1 + + + + + 3 + + + + + True + Themes + + + tab + 3 + False + + + + + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + -6 + + + + + False + GTK_PACK_END + + + + + diff --git a/libempathy-gtk/empathy-preferences.h b/libempathy-gtk/empathy-preferences.h index e4cf122b..750666b0 100644 --- a/libempathy-gtk/empathy-preferences.h +++ b/libempathy-gtk/empathy-preferences.h @@ -51,6 +51,7 @@ G_BEGIN_DECLS #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_AUTOCONNECT EMPATHY_PREFS_PATH "/autoconnect" GtkWidget * empathy_preferences_show (GtkWindow *parent); diff --git a/src/empathy.c b/src/empathy.c index cbb81931..185b958d 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -203,15 +203,8 @@ main (int argc, char *argv[]) MissionControl *mc; McAccountMonitor *monitor; EmpathyIdle *idle; - gboolean no_connect = FALSE; + gboolean autoconnect = TRUE; GError *error = NULL; - GOptionEntry options[] = { - { "no-connect", 'n', - 0, G_OPTION_ARG_NONE, &no_connect, - N_("Don't connect on startup"), - NULL }, - { NULL } - }; empathy_debug_set_log_file_from_env (); @@ -221,7 +214,7 @@ main (int argc, char *argv[]) if (!gtk_init_with_args (&argc, &argv, _("- Empathy Instant Messenger"), - options, GETTEXT_PACKAGE, &error)) { + NULL, GETTEXT_PACKAGE, &error)) { empathy_debug (DEBUG_DOMAIN, error->message); return EXIT_FAILURE; } @@ -247,7 +240,11 @@ main (int argc, char *argv[]) G_CALLBACK (operation_error_cb), NULL); - if (!no_connect) { + empathy_conf_get_bool (empathy_conf_get(), + EMPATHY_PREFS_AUTOCONNECT, + &autoconnect); + + if (autoconnect) { start_mission_control (idle); }