Back to index

libappindicator  12.10.0
test-simple-app.c
Go to the documentation of this file.
00001 /*
00002 Test that creates a small test app which links with libappindicator.
00003 
00004 Copyright 2009 Canonical Ltd.
00005 
00006 Authors:
00007     Ted Gould <ted@canonical.com>
00008 
00009 This program is free software: you can redistribute it and/or modify it 
00010 under the terms of the GNU General Public License version 3, as published 
00011 by the Free Software Foundation.
00012 
00013 This program is distributed in the hope that it will be useful, but 
00014 WITHOUT ANY WARRANTY; without even the implied warranties of 
00015 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
00016 PURPOSE.  See the GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License along 
00019 with this program.  If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 
00023 #include <dbus/dbus-glib.h>
00024 #include <dbus/dbus-glib-lowlevel.h>
00025 #include <glib.h>
00026 #include <libdbusmenu-glib/server.h>
00027 #include <app-indicator.h>
00028 
00029 static GMainLoop * mainloop = NULL;
00030 
00031 int
00032 main (int argc, char ** argv)
00033 {
00034        g_type_init();
00035 
00036        DbusmenuServer * dms = dbusmenu_server_new("/menu");
00037        DbusmenuMenuitem * dmi = dbusmenu_menuitem_new();
00038        dbusmenu_menuitem_property_set(dmi, "label", "Bob");
00039 
00040        AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, 
00041                                                       "id", "test-application",
00042                                                       "status-enum", APP_INDICATOR_STATUS_ACTIVE,
00043                                                       "icon-name", "system-shutdown",
00044                                                       "menu-object", dms,
00045                                                       NULL));
00046 
00047        mainloop = g_main_loop_new(NULL, FALSE);
00048        g_main_loop_run(mainloop);
00049 
00050        g_object_unref(G_OBJECT(ci));
00051        g_debug("Quiting");
00052 
00053        return 0;
00054 }