~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/avahi.c

  • Committer: Jeremy Bicha
  • Date: 2019-02-09 14:25:07 UTC
  • Revision ID: jbicha@ubuntu.com-20190209142507-45fc0sqnn4uqdl7j
Try adding gnome-shell as alternate dependency of notification-daemon

as part of an effort to drop notification-daemon to universe

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include "config.h"
3
3
#endif
4
4
 
 
5
#include <glib.h>
5
6
#include <libnotify/notify.h>
6
7
 
7
8
#include "update-notifier.h"
8
9
 
9
10
static gint
10
 
show_notification (void* data)
 
11
show_notification ()
11
12
{
12
13
        NotifyNotification *n;
13
14
 
19
20
                                       "network service discovery. The service "
20
21
                                       "has been disabled."
21
22
                                       ),
22
 
                                     GTK_STOCK_DIALOG_INFO,
23
 
                                     NULL);
 
23
                                     GTK_STOCK_DIALOG_INFO);
24
24
        notify_notification_set_timeout (n, 60000);
25
25
        notify_notification_show (n, NULL);
 
26
        g_object_unref (n);
26
27
 
27
28
        return FALSE;
28
29
}
29
30
 
30
 
gboolean
31
 
avahi_disabled_check()
 
31
int
 
32
main ()
32
33
{
33
 
        if (g_file_test (UNICAST_LOCAL_AVAHI_FILE, G_FILE_TEST_EXISTS)) {
34
 
                /* Show the notification, after a delay so it doesn't look ugly
35
 
                 * if we've just logged in */
36
 
                g_timeout_add(5000, (GSourceFunc)(show_notification), NULL);
37
 
        }
38
34
 
39
 
        return TRUE;
 
35
    notify_init("update-notifier");
 
36
    setlocale (LC_ALL, "");
 
37
    bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
 
38
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
 
39
    textdomain(GETTEXT_PACKAGE);
 
40
    if (g_file_test ("/run/avahi-daemon/disabled-for-unicast-local", G_FILE_TEST_EXISTS)) {
 
41
        show_notification();
 
42
        return 0;
 
43
    } else
 
44
    {
 
45
        return 1;
 
46
    }
40
47
}