mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-17 18:30:40 +02:00
2006-02-21 Dan Williams <dcbw@redhat.com>
Patch from Rodney Dawes <dobey@novell.com>
* gnome/applet/Makefile.am
gnome/applet/applet.c
- Add libnotify support if '--enable-notify=yes' is passed
at configure time
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1479 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
69ed439bb9
commit
06f760a049
4 changed files with 99 additions and 0 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2006-02-21 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Rodney Dawes <dobey@novell.com>
|
||||
* configure.in
|
||||
gnome/applet/Makefile.am
|
||||
gnome/applet/applet.c
|
||||
- Add libnotify support if '--enable-notify=yes' is passed
|
||||
at configure time
|
||||
|
||||
2006-02-16 Kang Jeong-Hee <keizie@gmail.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): ko added. (Korean)
|
||||
|
|
|
|||
|
|
@ -159,6 +159,13 @@ PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1)
|
|||
AC_SUBST(GNOME_KEYRING_CFLAGS)
|
||||
AC_SUBST(GNOME_KEYRING_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES([NOTIFY], [libnotify >= 0.3.0], [enable_notify=yes],
|
||||
[enable_notify=no])
|
||||
if test "x$enable_notify" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([ENABLE_NOTIFY], [1],
|
||||
[Enable notifications with libnotify])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(LIBNL, libnl-1)
|
||||
AC_SUBST(LIBNL_CFLAGS)
|
||||
AC_SUBST(LIBNL_LIBS)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ nm_applet_CPPFLAGS = \
|
|||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(PANEL_APPLET_CFLAGS) \
|
||||
$(GNOME_KEYRING_CFLAGS) \
|
||||
$(NOTIFY_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DBINDIR=\""$(bindir)"\" \
|
||||
|
|
@ -97,6 +98,7 @@ nm_applet_LDADD = \
|
|||
$(GCONF_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(GNOME_KEYRING_LIBS) \
|
||||
$(NOTIFY_LIBS) \
|
||||
$(top_builddir)/utils/libnmutils.la \
|
||||
$(top_builddir)/libnm-util/libnm-util.la \
|
||||
$(NULL)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#include <glade/glade.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#ifdef ENABLE_NOTIFY
|
||||
#include <libnotify/notify.h>
|
||||
#endif
|
||||
|
||||
#include "applet.h"
|
||||
#include "applet-compat.h"
|
||||
#include "applet-dbus.h"
|
||||
|
|
@ -1064,6 +1068,81 @@ static gboolean animation_timeout (NMWirelessApplet *applet)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_notify_state
|
||||
*
|
||||
* Notify the user of change in connectivity
|
||||
*
|
||||
*/
|
||||
static void nmwa_notify_state (NMWirelessApplet *applet, NetworkDevice *act_dev, WirelessNetwork *active_network)
|
||||
{
|
||||
#ifdef ENABLE_NOTIFY
|
||||
NotifyNotification * n;
|
||||
NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
|
||||
char * title = NULL;
|
||||
char * msg = NULL;
|
||||
char * icon = NULL;
|
||||
static int state = NM_STATE_ASLEEP;
|
||||
|
||||
if (!notify_is_initted ())
|
||||
notify_init ("NetworkManager");
|
||||
|
||||
switch (applet->nm_state)
|
||||
{
|
||||
case NM_STATE_ASLEEP:
|
||||
case NM_STATE_DISCONNECTED:
|
||||
title = g_strdup (_("Disconnected"));
|
||||
msg = g_strdup (_("The network connection has been disconnected."));
|
||||
icon = g_strdup ("nm-no-connection");
|
||||
urgency = NOTIFY_URGENCY_CRITICAL;
|
||||
break;
|
||||
|
||||
case NM_STATE_CONNECTED:
|
||||
title = g_strdup (_("Connected"));
|
||||
if (network_device_is_wired (act_dev))
|
||||
{
|
||||
msg = g_strdup (_("Connected to a wired network interface."));
|
||||
icon = g_strdup ("nm-device-wired");
|
||||
urgency = NOTIFY_URGENCY_LOW;
|
||||
}
|
||||
else if (network_device_is_wireless (act_dev))
|
||||
{
|
||||
if (applet->is_adhoc)
|
||||
{
|
||||
msg = g_strdup (_("An ad-hoc wireless network connection has been established."));
|
||||
icon = g_strdup ("nm-adhoc");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = g_strdup_printf (_("A wireless network connection to '%s' has been established."),
|
||||
active_network ? wireless_network_get_essid (active_network) : "(unknown)");
|
||||
icon = g_strdup ("nm-device-wireless");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (state != applet->nm_state && title && msg && icon) {
|
||||
n = notify_notification_new (title, msg, icon, (GtkWidget *) applet);
|
||||
notify_notification_set_urgency (n, urgency);
|
||||
|
||||
notify_notification_show (n, NULL);
|
||||
|
||||
g_object_unref (n);
|
||||
}
|
||||
g_free (icon);
|
||||
g_free (msg);
|
||||
g_free (title);
|
||||
|
||||
state = applet->nm_state;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_update_state
|
||||
*
|
||||
|
|
@ -1189,6 +1268,8 @@ done:
|
|||
show_applet = FALSE;
|
||||
}
|
||||
|
||||
nmwa_notify_state (applet, act_dev, active_network);
|
||||
|
||||
/* determine if we should hide the notification icon */
|
||||
if (show_applet)
|
||||
gtk_widget_show (GTK_WIDGET (applet));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue