2 * Copyright (C) 2005-2007 Imendio AB
3 * Copyright (C) 2007-2010 Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <glib/gi18n.h>
25 #include <libempathy/empathy-utils.h>
26 #include <libempathy-gtk/empathy-ui-utils.h>
28 #include "empathy-debug-window.h"
30 #define EMPATHY_DEBUGGER_DBUS_NAME "org.gnome.Empathy.Debugger"
32 static GtkWidget *window = NULL;
33 static gchar *service = NULL;
36 activate_cb (GApplication *app)
40 window = empathy_debug_window_new (NULL);
41 g_signal_connect (window, "destroy", gtk_main_quit, NULL);
43 /* don't let this application exit automatically */
44 g_application_hold (G_APPLICATION (app));
48 gtk_window_present (GTK_WINDOW (window));
52 empathy_debug_window_show (EMPATHY_DEBUG_WINDOW (window),
57 command_line_cb (GApplication *application,
58 GApplicationCommandLine *command_line,
66 GOptionContext *optcontext;
67 GOptionEntry options[] = {
68 { "show-service", 's',
69 0, G_OPTION_ARG_STRING, &service,
70 N_("Show a particular service"),
75 optcontext = g_option_context_new (N_("- Empathy Debugger"));
76 g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
77 g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);
79 argv = g_application_command_line_get_arguments (command_line, &argc);
81 if (!g_option_context_parse (optcontext, &argc, &argv, &error))
83 g_print ("%s\nRun '%s --help' to see a full list of available command "
85 error->message, argv[0]);
90 g_option_context_free (optcontext);
93 g_application_activate (application);
105 g_thread_init (NULL);
106 gtk_init (&argc, &argv);
109 app = gtk_application_new (EMPATHY_DEBUGGER_DBUS_NAME,
110 G_APPLICATION_HANDLES_COMMAND_LINE);
111 g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
112 g_signal_connect (app, "command-line", G_CALLBACK (command_line_cb), NULL);
114 g_set_application_name (_("Empathy Debugger"));
116 /* Make empathy and empathy-debugger appear as the same app in gnome-shell */
117 gdk_set_program_class ("Empathy");
118 gtk_window_set_default_icon_name ("empathy");
119 textdomain (GETTEXT_PACKAGE);
121 retval = g_application_run (G_APPLICATION (app), argc, argv);
123 g_object_unref (app);