aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-debugger.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-03 19:45:39 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-08-04 17:10:20 +0800
commit448ee1db1054f99169b09d357a8da4e5f992af26 (patch)
treedc08446ee608a0c660edefb7914d539b53d310af /src/empathy-debugger.c
parente58bcfb19122660374ec83f9e06cbc92f97908f4 (diff)
downloadgsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar.gz
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar.bz2
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar.lz
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar.xz
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.tar.zst
gsoc2013-empathy-448ee1db1054f99169b09d357a8da4e5f992af26.zip
empathy-debugger: add a command line option to show a service
https://bugzilla.gnome.org/show_bug.cgi?id=655884
Diffstat (limited to 'src/empathy-debugger.c')
-rw-r--r--src/empathy-debugger.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/empathy-debugger.c b/src/empathy-debugger.c
index 3d38e7103..664dc211a 100644
--- a/src/empathy-debugger.c
+++ b/src/empathy-debugger.c
@@ -30,6 +30,7 @@
#define EMPATHY_DEBUGGER_DBUS_NAME "org.gnome.Empathy.Debugger"
static GtkWidget *window = NULL;
+static gchar *service = NULL;
static void
activate_cb (GApplication *app)
@@ -46,6 +47,52 @@ activate_cb (GApplication *app)
{
gtk_window_present (GTK_WINDOW (window));
}
+
+ if (service != NULL)
+ empathy_debug_window_show (EMPATHY_DEBUG_WINDOW (window),
+ service);
+}
+
+static gint
+command_line_cb (GApplication *application,
+ GApplicationCommandLine *command_line,
+ gpointer user_data)
+{
+ GError *error = NULL;
+ gchar **argv;
+ gint argc;
+ gint retval = 0;
+
+ GOptionContext *optcontext;
+ GOptionEntry options[] = {
+ { "show-service", 's',
+ 0, G_OPTION_ARG_STRING, &service,
+ N_("Show a particular service"),
+ NULL },
+ { NULL }
+ };
+
+ optcontext = g_option_context_new (N_("- Empathy Debugger"));
+ g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
+ g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);
+
+ argv = g_application_command_line_get_arguments (command_line, &argc);
+
+ if (!g_option_context_parse (optcontext, &argc, &argv, &error))
+ {
+ g_print ("%s\nRun '%s --help' to see a full list of available command "
+ "line options.\n",
+ error->message, argv[0]);
+
+ retval = 1;
+ }
+
+ g_option_context_free (optcontext);
+ g_strfreev (argv);
+
+ g_application_activate (application);
+
+ return retval;
}
int
@@ -60,8 +107,9 @@ main (int argc,
empathy_gtk_init ();
app = gtk_application_new (EMPATHY_DEBUGGER_DBUS_NAME,
- G_APPLICATION_FLAGS_NONE);
+ G_APPLICATION_HANDLES_COMMAND_LINE);
g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
+ g_signal_connect (app, "command-line", G_CALLBACK (command_line_cb), NULL);
g_set_application_name (_("Empathy Debugger"));