2
A small wrapper utility to load indicators and put them as menu items
3
into the gnome-panel using it's applet interface.
5
Copyright 2009 Canonical Ltd.
8
Ted Gould <ted@canonical.com>
9
Christoph Korn <c_korn@gmx.de>
10
Cody Russell <crussell@canonical.com>
11
Conor Curran <conor.curran@canonical.com>
12
Charles Kerr <charles.kerr@canonical.com>
14
This program is free software: you can redistribute it and/or modify it
15
under the terms of the GNU General Public License version 3, as published
16
by the Free Software Foundation.
18
This program is distributed in the hope that it will be useful, but
19
WITHOUT ANY WARRANTY; without even the implied warranties of
20
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
21
PURPOSE. See the GNU General Public License for more details.
23
You should have received a copy of the GNU General Public License along
24
with this program. If not, see <http://www.gnu.org/licenses/>.
32
#include <glib/gi18n.h>
34
#include <gio/gdesktopappinfo.h>
36
#include <libdbusmenu-glib/server.h>
40
#include <libindicator/indicator-service.h>
42
#include "session-dbus.h"
43
#include "session-menu-mgr.h"
44
#include "shared-names.h"
45
#include "users-service-dbus.h"
47
static SessionDbus * session_dbus = NULL;
48
static GMainLoop * mainloop = NULL;
51
/* When the service interface starts to shutdown,
52
we should follow it. */
54
service_shutdown (IndicatorService * service, gpointer user_data)
58
g_debug ("Service shutdown");
59
g_main_loop_quit (mainloop);
63
static inline gboolean
64
is_greeter_mode (void)
66
return !g_strcmp0 (g_getenv ("INDICATOR_GREETER_MODE"), "1");
69
/* Main, is well, main. It brings everything up and throws
70
us into the mainloop of no return. */
72
main (int argc, char ** argv)
74
/* Setting up i18n and gettext.
75
Apparently we need all of these. */
76
setlocale (LC_ALL, "");
77
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
78
textdomain (GETTEXT_PACKAGE);
80
IndicatorService * service = indicator_service_new_version (INDICATOR_SESSION_DBUS_NAME,
81
INDICATOR_SESSION_DBUS_VERSION);
82
g_signal_connect (G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN,
83
G_CALLBACK(service_shutdown), NULL);
85
session_dbus = session_dbus_new();
87
SessionMenuMgr * menu_mgr = session_menu_mgr_new (session_dbus, is_greeter_mode());
88
DbusmenuServer* server = dbusmenu_server_new (INDICATOR_SESSION_DBUS_OBJECT);
89
dbusmenu_server_set_root (server, session_menu_mgr_get_menu (menu_mgr));
91
mainloop = g_main_loop_new(NULL, FALSE);
92
g_main_loop_run(mainloop);