~jbicha/hud/build-depend-on-valac-not-gir

« back to all changes in this revision

Viewing changes to tests/test-app-indicator.c

  • Committer: Tarmac
  • Author(s): Ted Gould, Pete Woods, Antti Kaijanmäki, Ted Gould, Albert Astals, Ryan Lortie, Łukasz 'sil2100' Zemczak, Albert Astals Cid, Mathieu Trudel-Lapierre, Kaleo, Tarmac, Ricardo Salveti de Araujo, Michael Terry, Automatic PS uploader
  • Date: 2013-04-10 16:04:51 UTC
  • mfrom: (227.3.148 phablet)
  • Revision ID: tarmac-20130410160451-o3owpv3zaxulm5of
HUD 2.0 Merge.

Approved by PS Jenkins bot, Mathieu Trudel-Lapierre.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Test code for appindicator
3
 
 
4
 
Copyright 2012 Canonical Ltd.
5
 
 
6
 
Authors:
7
 
    Ted Gould <ted@canonical.com>
8
 
 
9
 
This program is free software: you can redistribute it and/or modify it 
10
 
under the terms of the GNU General Public License version 3, as published 
11
 
by the Free Software Foundation.
12
 
 
13
 
This program is distributed in the hope that it will be useful, but 
14
 
WITHOUT ANY WARRANTY; without even the implied warranties of 
15
 
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
16
 
PURPOSE.  See the GNU General Public License for more details.
17
 
 
18
 
You should have received a copy of the GNU General Public License along 
19
 
with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
*/
21
 
 
22
 
#include <libappindicator/app-indicator.h>
23
 
 
24
 
GMainLoop * mainloop = NULL;
25
 
 
26
 
gboolean
27
 
timeout (gpointer user_data)
28
 
{
29
 
        g_print("Timeout\n");
30
 
        g_main_loop_quit(mainloop);
31
 
        return FALSE;
32
 
}
33
 
 
34
 
int
35
 
main (int argc, char ** argv)
36
 
{
37
 
        GtkWidget *menu = NULL;
38
 
        AppIndicator *ci = NULL;
39
 
 
40
 
        gtk_init (&argc, &argv);
41
 
 
42
 
        ci = app_indicator_new ("example-simple-client",
43
 
                                "indicator-messages",
44
 
                                APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
45
 
 
46
 
        app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE);
47
 
 
48
 
        g_assert (IS_APP_INDICATOR (ci));
49
 
        g_assert (G_IS_OBJECT (ci));
50
 
 
51
 
        menu = gtk_menu_new (); 
52
 
        GtkWidget *item = gtk_check_menu_item_new_with_label("Test");
53
 
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
54
 
        gtk_widget_show (item);
55
 
 
56
 
        app_indicator_set_menu (ci, GTK_MENU (menu));
57
 
 
58
 
        g_timeout_add_seconds(2, timeout, NULL);
59
 
 
60
 
        mainloop = g_main_loop_new(NULL, FALSE);
61
 
        g_main_loop_run(mainloop);
62
 
 
63
 
        return 0;
64
 
}
65