diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-03 22:48:18 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-08-04 17:10:20 +0800 |
commit | 0ea5743214b87e35e92b867485d9c5a0f8b5e272 (patch) | |
tree | 04977d3652aa7506cae5c17e4e11ca9b53e37146 /src/empathy.c | |
parent | 07f472213136ac29908a323a9d7612894c7ee5b4 (diff) | |
download | gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar.gz gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar.bz2 gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar.lz gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar.xz gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.tar.zst gsoc2013-empathy-0ea5743214b87e35e92b867485d9c5a0f8b5e272.zip |
Allow to specify the tab to open in the preferences
https://bugzilla.gnome.org/show_bug.cgi?id=655884
Diffstat (limited to 'src/empathy.c')
-rw-r--r-- | src/empathy.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/empathy.c b/src/empathy.c index 8ac944d07..66b387788 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -107,6 +107,7 @@ struct _EmpathyApp gboolean no_connect; gboolean start_hidden; gboolean show_preferences; + gint preferences_tab; gboolean activated; @@ -295,7 +296,8 @@ empathy_app_command_line (GApplication *app, } if (self->show_preferences) - empathy_main_window_show_preferences (EMPATHY_MAIN_WINDOW (self->window)); + empathy_main_window_show_preferences (EMPATHY_MAIN_WINDOW (self->window), + self->preferences_tab); if (!self->start_hidden) empathy_window_present (GTK_WINDOW (self->window)); @@ -308,6 +310,24 @@ empathy_app_command_line (GApplication *app, } static gboolean +preferences_cb (const char *option_name, + const char *value, + gpointer data, + GError **error) +{ + EmpathyApp *self = data; + + self->show_preferences = TRUE; + + self->preferences_tab = -1; + + if (value != NULL) + self->preferences_tab = atoi (value); + + return TRUE; +} + +static gboolean show_version_cb (const char *option_name, const char *value, gpointer data, @@ -325,9 +345,9 @@ empathy_app_local_command_line (GApplication *app, gboolean retval = FALSE; GError *error = NULL; gboolean no_connect = FALSE, start_hidden = FALSE; - gboolean show_preferences = FALSE; GOptionContext *optcontext; + GOptionGroup *group; GOptionEntry options[] = { { "no-connect", 'n', 0, G_OPTION_ARG_NONE, &no_connect, @@ -338,7 +358,7 @@ empathy_app_local_command_line (GApplication *app, N_("Don't display the contact list or any other dialogs on startup"), NULL }, { "show-preferences", 'p', - 0, G_OPTION_ARG_NONE, &show_preferences, + G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &preferences_cb, NULL, NULL }, { "version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version_cb, @@ -346,9 +366,14 @@ empathy_app_local_command_line (GApplication *app, { NULL } }; + /* We create a group so that GOptionArgFuncs get the user data */ + group = g_option_group_new ("empathy", NULL, NULL, app, NULL); + g_option_group_add_entries (group, options); + optcontext = g_option_context_new (N_("- Empathy IM Client")); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); - g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); + g_option_context_set_main_group (optcontext, group); + g_option_context_set_translation_domain (optcontext, GETTEXT_PACKAGE); argc = g_strv_length (*arguments); @@ -376,7 +401,6 @@ empathy_app_local_command_line (GApplication *app, self->no_connect = no_connect; self->start_hidden = start_hidden; - self->show_preferences = show_preferences; return retval; } |