~vibhavp/ubuntu/raring/libnotify/add-autopkgtest

« back to all changes in this revision

Viewing changes to tests/test-removal.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Laurent Bigonville, Martin Pitt
  • Date: 2011-09-02 11:37:34 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: package-import@ubuntu.com-20110902113734-wys0vzvb1v4donai
Tags: 0.7.4-1
[ Laurent Bigonville ]
* Follow multi-arch specification
* debian/control.in:
  - Bump cdbs and debhelper build-dependencies
  - Add Multi-Arch and Pre-Depends fields
* debian/rules:
  - Pass multi-arch compatible path to libdir
* debian/*.install:
  - Adjust for multi-arch paths
  - Drop "debian/tmp" from paths
* debian/libnotify-dev.install:
  - Drop .la file, no other package is referencing it anymore

[ Martin Pitt ]
* New upstream bug fix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
2
 *
 
3
 * This library is free software; you can redistribute it and/or
 
4
 * modify it under the terms of the GNU Lesser General Public
 
5
 * License as published by the Free Software Foundation; either
 
6
 * version 2.1 of the License, or(at your option) any later version.
 
7
 *
 
8
 * This library is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public
 
14
 * License along with this library; if not, write to the
 
15
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
16
 * Boston, MA  02111-1307, USA.
 
17
 */
 
18
 
 
19
#include <stdlib.h>
 
20
#include <libnotify/notify.h>
 
21
#include <gtk/gtk.h>
 
22
 
 
23
static void
 
24
next_callback (NotifyNotification *n,
 
25
               const char         *action)
 
26
{
 
27
        g_assert (action != NULL);
 
28
 
 
29
        printf ("You clicked Next\n");
 
30
 
 
31
        notify_notification_close (n, NULL);
 
32
 
 
33
        gtk_main_quit ();
 
34
}
 
35
 
 
36
int
 
37
main (int argc, char *argv[])
 
38
{
 
39
        NotifyNotification *n;
 
40
 
 
41
        gtk_init (&argc, &argv);
 
42
 
 
43
        notify_init ("Urgency");
 
44
 
 
45
        n = notify_notification_new ("Low Urgency",
 
46
                                     "Joe signed online.",
 
47
                                     NULL);
 
48
        notify_notification_set_urgency (n, NOTIFY_URGENCY_LOW);
 
49
        if (!notify_notification_show (n, NULL)) {
 
50
                fprintf (stderr, "failed to send notification\n");
 
51
                exit (1);
 
52
        }
 
53
 
 
54
        sleep (3);
 
55
 
 
56
        if (!notify_notification_close (n, NULL)) {
 
57
                fprintf (stderr, "failed to remove notification\n");
 
58
                exit (1);
 
59
        }
 
60
 
 
61
        g_object_unref (G_OBJECT (n));
 
62
 
 
63
 
 
64
        n = notify_notification_new ("Normal Urgency",
 
65
                                     "You have a meeting in 10 minutes.",
 
66
                                     NULL);
 
67
        notify_notification_set_urgency (n, NOTIFY_URGENCY_NORMAL);
 
68
        if (!notify_notification_show (n, NULL)) {
 
69
                fprintf (stderr, "failed to send notification\n");
 
70
                exit (1);
 
71
        }
 
72
 
 
73
        sleep (3);
 
74
 
 
75
        if (!notify_notification_close (n, NULL)) {
 
76
                fprintf (stderr, "failed to remove notification\n");
 
77
                exit (1);
 
78
        }
 
79
 
 
80
        g_object_unref (G_OBJECT (n));
 
81
 
 
82
 
 
83
        n = notify_notification_new ("Critical Urgency",
 
84
                                     "This message will self-destruct in 10 seconds.",
 
85
                                     NULL);
 
86
        notify_notification_set_urgency (n, NOTIFY_URGENCY_CRITICAL);
 
87
        notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER);
 
88
        notify_notification_add_action (n,
 
89
                                        "media-skip-forward",
 
90
                                        "Next",
 
91
                                        (NotifyActionCallback) next_callback,
 
92
                                        NULL,
 
93
                                        NULL);
 
94
 
 
95
        if (!notify_notification_show (n, NULL)) {
 
96
                fprintf (stderr, "failed to send notification\n");
 
97
                exit (1);
 
98
        }
 
99
 
 
100
        sleep (3);
 
101
 
 
102
        if (!notify_notification_close (n, NULL)) {
 
103
                fprintf (stderr, "failed to remove notification\n");
 
104
                exit (1);
 
105
        }
 
106
 
 
107
        gtk_main ();
 
108
 
 
109
        g_object_unref (G_OBJECT (n));
 
110
 
 
111
        return 0;
 
112
}