2006-03-24 Christopher Aillon <caillon@redhat.com>

* gnome/applet/applet-notifications.c:
	When displaying a notification, make sure to get rid of the
	previous notification so as to not have competing bubbles,
	and stop leaking the old one.

	* gnome/applet/applet.c:
	* gnome/applet/applet.h:
	Add a new 'notification' member to the applet, and zero it out
	and free it appropriately.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1635 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Christopher Aillon
2006-03-24 14:55:40 +00:00
committed by Chris Aillon
parent deb66e629a
commit ff296fdf61
4 changed files with 43 additions and 5 deletions

View File

@@ -1,3 +1,15 @@
2006-03-24 Christopher Aillon <caillon@redhat.com>
* gnome/applet/applet-notifications.c:
When displaying a notification, make sure to get rid of the
previous notification so as to not have competing bubbles,
and stop leaking the old one.
* gnome/applet/applet.c:
* gnome/applet/applet.h:
Add a new 'notification' member to the applet, and zero it out
and free it appropriately.
2006-03-23 Robert Love <rml@novell.com>
Patch by j <j@bootlab.org>:

View File

@@ -30,7 +30,7 @@ nma_send_event_notification (NMApplet *applet,
const char *message,
const char *icon)
{
NotifyNotification *notification;
const char *notify_icon;
g_return_if_fail (applet != NULL);
g_return_if_fail (summary != NULL);
@@ -39,9 +39,16 @@ nma_send_event_notification (NMApplet *applet,
if (!notify_is_initted ())
notify_init ("NetworkManager");
notification = notify_notification_new (summary, message,
icon ? icon : GTK_STOCK_NETWORK, GTK_WIDGET (applet));
notify_notification_set_urgency (notification, urgency);
notify_notification_show (notification, NULL);
if (applet->notification != NULL) {
notify_notification_close (applet->notification, NULL);
g_object_unref (applet->notification);
}
notify_icon = icon ? icon : GTK_STOCK_NETWORK;
applet->notification = notify_notification_new (summary, message, notify_icon, GTK_WIDGET (applet));
notify_notification_set_urgency (applet->notification, urgency);
notify_notification_show (applet->notification, NULL);
}

View File

@@ -2538,6 +2538,10 @@ static void G_GNUC_NORETURN nma_destroy (NMApplet *applet)
nma_icons_free (applet);
nmi_passphrase_dialog_destroy (applet);
#ifdef ENABLE_NOTIFY
notify_notification_close (applet->notification, NULL);
g_object_unref (applet->notification);
#endif
if (applet->redraw_timeout_id > 0)
{
@@ -2579,6 +2583,10 @@ static GtkWidget * nma_get_instance (NMApplet *applet)
applet->nm_state = NM_STATE_DISCONNECTED;
applet->tooltips = NULL;
applet->passphrase_dialog = NULL;
#ifdef ENABLE_NOTIFY
applet->notification = NULL;
#endif
applet->glade_file = g_build_filename (GLADEDIR, "applet.glade", NULL);
if (!applet->glade_file || !g_file_test (applet->glade_file, G_FILE_TEST_IS_REGULAR))
{

View File

@@ -21,6 +21,11 @@
#ifndef APPLET_H
#define APPLET_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
@@ -33,6 +38,9 @@
#include "wireless-network.h"
#include "dbus-method-dispatcher.h"
#ifdef ENABLE_NOTIFY
#include <libnotify/notify.h>
#endif
/*
* Preference locations
@@ -119,6 +127,9 @@ typedef struct
GtkWidget * passphrase_dialog;
GladeXML * info_dialog_xml;
#ifdef ENABLE_NOTIFY
NotifyNotification* notification;
#endif
} NMApplet;
typedef struct