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

« back to all changes in this revision

Viewing changes to src/avahi.c

  • Committer: Balint Reczey
  • Date: 2020-06-11 18:46:02 UTC
  • Revision ID: balint.reczey@canonical.com-20200611184602-2rv1zan3xu723x2u
Moved to git at https://git.launchpad.net/update-notifier

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifdef HAVE_CONFIG_H
2
 
#include "config.h"
3
 
#endif
4
 
 
5
 
#include <glib.h>
6
 
#include <libnotify/notify.h>
7
 
 
8
 
#include "update-notifier.h"
9
 
 
10
 
static gint
11
 
show_notification ()
12
 
{
13
 
        NotifyNotification *n;
14
 
 
15
 
        /* Create and show the notification */
16
 
        n = notify_notification_new (_("Network service discovery disabled"),
17
 
                                     _("Your current network has a .local "
18
 
                                       "domain, which is not recommended "
19
 
                                       "and incompatible with the Avahi "
20
 
                                       "network service discovery. The service "
21
 
                                       "has been disabled."
22
 
                                       ),
23
 
                                     GTK_STOCK_DIALOG_INFO);
24
 
        notify_notification_set_timeout (n, 60000);
25
 
        notify_notification_show (n, NULL);
26
 
        g_object_unref (n);
27
 
 
28
 
        return FALSE;
29
 
}
30
 
 
31
 
int
32
 
main ()
33
 
{
34
 
 
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
 
    }
47
 
}