~elementary-os/elementaryos/os-patch-notify-osd-precise

« back to all changes in this revision

Viewing changes to examples/summary-body.c

  • Committer: Sergey "Shnatsel" Davidoff
  • Date: 2012-06-18 21:08:31 UTC
  • Revision ID: shnatsel@gmail.com-20120618210831-g6k5y7vecjdylgic
Initial import, version 0.9.34-0ubuntu2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
 
3
**      10        20        30        40        50        60        70        80
 
4
**
 
5
** Info: 
 
6
**    Example of how to use libnotify correctly and at the same time comply to
 
7
**    the new jaunty notification spec (read: visual guidelines)
 
8
**
 
9
** Compile:
 
10
**    gcc -O0 -ggdb -Wall -Werror `pkg-config --cflags --libs libnotify \
 
11
**    glib-2.0` summary-body.c example-util.c -o summary-body
 
12
**
 
13
** Copyright 2009 Canonical Ltd.
 
14
**
 
15
** Author:
 
16
**    Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
 
17
**
 
18
** This program is free software: you can redistribute it and/or modify it
 
19
** under the terms of the GNU General Public License version 3, as published
 
20
** by the Free Software Foundation.
 
21
**
 
22
** This program is distributed in the hope that it will be useful, but
 
23
** WITHOUT ANY WARRANTY; without even the implied warranties of
 
24
** MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
25
** PURPOSE.  See the GNU General Public License for more details.
 
26
**
 
27
** You should have received a copy of the GNU General Public License along
 
28
** with this program.  If not, see <http://www.gnu.org/licenses/>.
 
29
**
 
30
*******************************************************************************/
 
31
 
 
32
#include "example-util.h"
 
33
 
 
34
int 
 
35
main (int    argc,
 
36
      char** argv)
 
37
{
 
38
        NotifyNotification* notification;
 
39
        gboolean            success;
 
40
        GError*             error = NULL;
 
41
 
 
42
        if (!notify_init ("summary-body"))
 
43
                return 1;
 
44
 
 
45
        /* call this so we can savely use has_cap(CAP_SOMETHING) later */
 
46
        init_caps ();
 
47
 
 
48
        /* show what's supported */
 
49
        print_caps ();
 
50
 
 
51
        /* try the summary-body case */
 
52
        notification = notify_notification_new (
 
53
                                "Totem",
 
54
                                "This is a superfluous notification",
 
55
                                NULL);
 
56
        error = NULL;
 
57
        success = notify_notification_show (notification, &error);
 
58
        if (!success)
 
59
        {
 
60
                g_print ("That did not work ... \"%s\".\n", error->message);
 
61
                g_error_free (error);
 
62
        }
 
63
 
 
64
        g_signal_connect (G_OBJECT (notification),
 
65
                          "closed",
 
66
                          G_CALLBACK (closed_handler),
 
67
                          NULL);
 
68
 
 
69
        notify_uninit ();
 
70
 
 
71
        return 0;
 
72
}
 
73