network-manager-applet r440 - in trunk: . po src src/vpn-properties



Author: dcbw
Date: Fri Jan 11 23:19:52 2008
New Revision: 440
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=440&view=rev

Log:
2008-01-11  Dan Williams  <dcbw redhat com>

	Require GTK+ 2.10 or higher and libnotify 0.4.3 or higher.

	* src/vpn-properties/Makefile.am
	  src/Makefile.am
		- Remove pre-GTK+ 2.10 bits

	* configure.ac
		- Require GTK+ 2.10 or higher
		- Require libnotify 0.4.3 or higher

	* src/applet.h
	  src/applet.c
		- Unconditionalize libnotify support
		- Delete pre-GTK+ 2.10 code
		- Remove some unused variables like 'is_adhoc' and 'top_menu_item'
		- Rename nma_send_event_notification() -> applet_do_notify()

	* src/eggtrayicon.c
	  src/eggtrayicon.h
	  COPYING.LIB
	  po/POTFILES.in
		- Remove eggtrayicon; no longer used



Removed:
   trunk/COPYING.LIB
   trunk/src/eggtrayicon.c
   trunk/src/eggtrayicon.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/po/POTFILES.in
   trunk/src/Makefile.am
   trunk/src/applet.c
   trunk/src/applet.h
   trunk/src/vpn-properties/Makefile.am

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Jan 11 23:19:52 2008
@@ -63,11 +63,12 @@
 		 NetworkManager >= 0.7.0
 		 libnm_glib
 		 libnm-util
-		 gtk+-2.0 >= 2.6
+		 gtk+-2.0 >= 2.10
 		 libglade-2.0
 		 gmodule-export-2.0
 		 gconf-2.0
-		 gnome-keyring-1])
+		 gnome-keyring-1
+		 libnotify >= 0.4.3])
 
 ##### Find out the version of DBUS we're using
 dbus_version=`pkg-config --modversion dbus-1`
@@ -102,34 +103,6 @@
 fi
 AC_SUBST(DBUS_CFLAGS)
 
-AC_ARG_WITH(notify, AC_HELP_STRING([--with-notify], [Use libnotify]), enable_notify=$withval, enable_notify=auto)
-
-LIBNOTIFY_REQUIRED=0.3.0
-
-# Building with GTK+ >= 2.10 will use the GtkStatusIcon applet
-# implementation.  Earlier versions of GTK+ will use the EggTrayIcon
-# applet implementation.
-
-PKG_CHECK_EXISTS([gtk+-2.0 >= 2.10],[have_gtk_2_10=yes LIBNOTIFY_REQUIRED=0.4.3],[have_gtk_2_10=no])
-if test x"$have_gtk_2_10" != xno; then
-	AC_DEFINE_UNQUOTED([HAVE_STATUS_ICON], [1],
-		[Use GtkStatusIcon for the applet's icon rather than an EggTrayIcon])
-else
-	PKG_CHECK_MODULES([LIBGNOMEUI], [libgnomeui-2.0])
-fi
-
-if test x"$enable_notify" != xno; then
-	PKG_CHECK_MODULES([NOTIFY], [libnotify >= $LIBNOTIFY_REQUIRED], [enable_notify=yes],
-				[enable_notify=no])
-	if test "x$enable_notify" != "xno"; then
-		AC_DEFINE_UNQUOTED([ENABLE_NOTIFY], [1],
-		[Enable notifications with libnotify])
-	fi
-fi
-
-AM_CONDITIONAL(WITH_NOTIFY, test x"$enable_notify" != xno) # can't do it from inside 'if'
-AM_CONDITIONAL([HAVE_GTK_2_10],[test "$have_gtk_2_10" = "yes"])
-
 AC_MSG_CHECKING([for wireless-tools >= 28pre9])
 AC_TRY_COMPILE([#include <iwlib.h>],
                [#ifndef IWEVGENIE

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Fri Jan 11 23:19:52 2008
@@ -8,8 +8,6 @@
 src/applet.h
 src/connection-editor/nm-connection-editor.c
 src/connection-editor/nm-connection-editor.glade
-src/eggtrayicon.c
-src/eggtrayicon.h
 src/keyring.png
 src/main.c
 src/menu-items.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri Jan 11 23:19:52 2008
@@ -4,8 +4,9 @@
 
 bin_PROGRAMS = nm-applet
 
-nm_applet_CPPFLAGS =									\
-	$(NMA_CFLAGS)										\
+nm_applet_CPPFLAGS = \
+	$(NMA_CFLAGS) \
+	$(NOTIFY_CFLAGS) \
 	-DICONDIR=\""$(datadir)/icons"\"						\
 	-DGLADEDIR=\""$(gladedir)"\"							\
 	-DBINDIR=\""$(bindir)"\"								\
@@ -21,10 +22,6 @@
 	-I${top_srcdir}/src/wireless-security  \
 	$(NULL)
 
-if WITH_NOTIFY
-nm_applet_CPPFLAGS += $(NOTIFY_CFLAGS)
-endif
-
 nm_applet_SOURCES =			\
 	main.c				\
 	applet.c				\
@@ -44,22 +41,13 @@
 	wireless-dialog.c \
 	$(NULL)
 
-if !HAVE_GTK_2_10
-nm_applet_SOURCES += \
-	eggtrayicon.c	\
-	eggtrayicon.h
-endif
-
 nm_applet_LDADD = \
 	$(NMA_LIBS) \
+	$(NOTIFY_LIBS) \
 	${top_builddir}/src/utils/libutils.la \
 	${top_builddir}/src/gconf-helpers/libgconf-helpers.la \
 	${top_builddir}/src/wireless-security/libwireless-security.la
 
-if WITH_NOTIFY
-nm_applet_LDADD += $(NOTIFY_LIBS)
-endif
-
 applet-marshal.h: Makefile.am applet-marshal.list
 	$(GLIB_GENMARSHAL) --prefix=applet_marshal $(srcdir)/applet-marshal.list --header > \
 		xgen-gmh \

Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c	(original)
+++ trunk/src/applet.c	Fri Jan 11 23:19:52 2008
@@ -59,10 +59,7 @@
 #include <glade/glade.h>
 #include <gconf/gconf-client.h>
 #include <gnome-keyring.h>
-
-#ifdef ENABLE_NOTIFY
 #include <libnotify/notify.h>
-#endif
 
 #include "applet.h"
 #include "menu-items.h"
@@ -79,11 +76,6 @@
 #include "vpn-connection-info.h"
 #include "connection-editor/nm-connection-list.h"
 
-/* Compat for GTK 2.6 */
-#if (GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION == 6)
-	#define GTK_STOCK_INFO			GTK_STOCK_DIALOG_INFO
-#endif
-
 static GObject * nma_constructor (GType type, guint n_props, GObjectConstructParam *construct_props);
 static void      nma_icons_init (NMApplet *applet);
 static void      nma_icons_free (NMApplet *applet);
@@ -98,7 +90,7 @@
 static void      foo_manager_running_cb (NMClient *client, gboolean running, gpointer user_data);
 static void      foo_client_state_change (NMClient *client, NMState state, gpointer user_data, gboolean synthetic);
 static gboolean  add_seen_bssid (AppletDbusConnectionSettings *connection, NMAccessPoint *ap);
-static GtkWidget *nma_menu_create (GtkMenuItem *parent, NMApplet *applet);
+static GtkWidget *nma_menu_create (NMApplet *applet);
 static void      wireless_dialog_response_cb (GtkDialog *dialog, gint response, gpointer user_data);
 
 
@@ -127,14 +119,9 @@
 {
 	applet->animation_id = 0;
 	applet->animation_step = 0;
-	applet->passphrase_dialog = NULL;
 	applet->icon_theme = NULL;
-#ifdef ENABLE_NOTIFY
 	applet->notification = NULL;
-#endif
-#ifdef HAVE_STATUS_ICON
 	applet->size = -1;
-#endif
 
 	nma_icons_zero (applet);
 
@@ -390,8 +377,7 @@
 static void 
 nma_about_cb (GtkMenuItem *mi, NMApplet *applet)
 {
-	static const gchar *authors[] =
-	{
+	static const gchar *authors[] = {
 		"The Red Hat Desktop Team, including:\n",
 		"Christopher Aillon <caillon redhat com>",
 		"Jonathan Blandford <jrb redhat com>",
@@ -410,8 +396,7 @@
 		NULL
 	};
 
-	static const gchar *artists[] =
-	{
+	static const gchar *artists[] = {
 		"Diana Fong <dfong redhat com>",
 		NULL
 	};
@@ -972,13 +957,12 @@
 //	nmi_dbus_signal_user_interface_activated (info->applet->connection);
 }
 
-#if ENABLE_NOTIFY
 static void
-nma_send_event_notification (NMApplet *applet, 
-                              NotifyUrgency urgency,
-                              const char *summary,
-                              const char *message,
-                              const char *icon)
+applet_do_notify (NMApplet *applet, 
+                  NotifyUrgency urgency,
+                  const char *summary,
+                  const char *message,
+                  const char *icon)
 {
 	const char *notify_icon;
 
@@ -986,12 +970,10 @@
 	g_return_if_fail (summary != NULL);
 	g_return_if_fail (message != NULL);
 
-#ifdef HAVE_STATUS_ICON
-#if (GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 11)
+#if GTK_CHECK_VERSION(2, 11, 0)
 	if (!gtk_status_icon_is_embedded (applet->status_icon))
 		return;
 #endif
-#endif
 
 	if (!notify_is_initted ())
 		notify_init ("NetworkManager");
@@ -1003,38 +985,11 @@
 
 	notify_icon = icon ? icon : GTK_STOCK_NETWORK;
 
-#ifdef HAVE_STATUS_ICON
 	applet->notification = notify_notification_new_with_status_icon (summary, message, notify_icon, applet->status_icon);
-#else
-	applet->notification = notify_notification_new (summary, message, notify_icon, GTK_WIDGET (applet->tray_icon));
-#endif /* HAVE_STATUS_ICON */
 
 	notify_notification_set_urgency (applet->notification, urgency);
 	notify_notification_show (applet->notification, NULL);
 }
-#else
-static void
-nma_show_notification_dialog (const char *title,
-                              const char *msg)
-{
-	GtkWidget	*dialog;
-
-	g_return_if_fail (title != NULL);
-	g_return_if_fail (msg != NULL);
-
-	dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR,
-				GTK_BUTTONS_OK, msg, NULL);
-	gtk_window_set_title (GTK_WINDOW (dialog), title);
-	g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-	g_signal_connect (dialog, "close", G_CALLBACK (gtk_widget_destroy), NULL);
-
-	/* Bash focus-stealing prevention in the face */
-	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
-	gtk_widget_realize (dialog);
-	gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ());
-	gtk_widget_show_all (dialog);
-}
-#endif
 
 static void
 show_vpn_state (NMApplet *applet,
@@ -1050,15 +1005,8 @@
 		banner = nm_vpn_connection_get_banner (connection);
 		if (banner && strlen (banner)) {
 			title = _("VPN Login Message");
-#ifdef ENABLE_NOTIFY
 			msg = g_strdup_printf ("\n%s", banner);
-			nma_send_event_notification (applet, NOTIFY_URGENCY_LOW,
-								    title, msg, "gnome-lockscreen");
-#else
-			msg = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
-							   title, banner);
-			nma_show_notification_dialog (title, msg);
-#endif
+			applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg, "gnome-lockscreen");
 			g_free (msg);
 		}
 		break;
@@ -1970,17 +1918,7 @@
 
 	if (applet->menu)
 		gtk_widget_destroy (applet->menu);
-
-#if GTK_CHECK_VERSION(2, 12, 0)
-	gtk_menu_item_set_submenu (GTK_MENU_ITEM (applet->top_menu_item), NULL);
-#else
-	gtk_menu_item_remove_submenu (GTK_MENU_ITEM (applet->top_menu_item));
-#endif /* gtk 2.12.0 */
-
-	applet->menu = nma_menu_create (GTK_MENU_ITEM (applet->top_menu_item), applet);
-#ifndef HAVE_STATUS_ICON
-	g_signal_connect (applet->menu, "deactivate", G_CALLBACK (nma_menu_deactivate_cb), applet);
-#endif /* !HAVE_STATUS_ICON */
+	applet->menu = nma_menu_create (applet);
 }
 
 
@@ -1994,13 +1932,8 @@
 {
 	g_return_if_fail (menu != NULL);
 	g_return_if_fail (applet != NULL);
-	g_return_if_fail (applet->menu != NULL);
 
-#ifdef HAVE_STATUS_ICON
 	gtk_status_icon_set_tooltip (applet->status_icon, NULL);
-#else
-	gtk_tooltips_set_tip (applet->tooltips, applet->event_box, NULL, NULL);
-#endif /* HAVE_STATUS_ICON */
 
 	if (!nm_client_manager_is_running (applet->nm_client)) {
 		nma_menu_add_text_item (menu, _("NetworkManager is not running..."));
@@ -2015,7 +1948,7 @@
 	nma_menu_add_devices (menu, applet);
 	nma_menu_add_vpn_submenu (menu, applet);
 
-	gtk_widget_show_all (applet->menu);
+	gtk_widget_show_all (menu);
 
 //	nmi_dbus_signal_user_interface_activated (applet->connection);
 }
@@ -2027,18 +1960,15 @@
  *
  */
 static GtkWidget *
-nma_menu_create (GtkMenuItem *parent, NMApplet *applet)
+nma_menu_create (NMApplet *applet)
 {
 	GtkWidget	*menu;
 
-	g_return_val_if_fail (parent != NULL, NULL);
 	g_return_val_if_fail (applet != NULL, NULL);
 
 	menu = gtk_menu_new ();
 	gtk_container_set_border_width (GTK_CONTAINER (menu), 0);
-	gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), menu);
 	g_signal_connect (menu, "show", G_CALLBACK (nma_menu_show_cb), applet);
-
 	return menu;
 }
 
@@ -2164,8 +2094,6 @@
 }
 
 
-#ifdef HAVE_STATUS_ICON
-
 /*
  * nma_status_icon_screen_changed_cb:
  *
@@ -2255,108 +2183,6 @@
  *
  */
 
-#else /* !HAVE_STATUS_ICON */
-
-/*
- * nma_menu_position_func
- *
- * Position main dropdown menu, adapted from netapplet
- *
- */
-static void nma_menu_position_func (GtkMenu *menu G_GNUC_UNUSED, int *x, int *y, gboolean *push_in, gpointer user_data)
-{
-	int screen_w, screen_h, button_x, button_y, panel_w, panel_h;
-	GtkRequisition requisition;
-	GdkScreen *screen;
-	NMApplet *applet = (NMApplet *)user_data;
-
-	screen = gtk_widget_get_screen (applet->event_box);
-	screen_w = gdk_screen_get_width (screen);
-	screen_h = gdk_screen_get_height (screen);
-
-	gdk_window_get_origin (applet->event_box->window, &button_x, &button_y);
-	gtk_window_get_size (GTK_WINDOW (gtk_widget_get_toplevel (applet->event_box)), &panel_w, &panel_h);
-
-	*x = button_x;
-
-	/* Check to see if we would be placing the menu off of the end of the screen. */
-	gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-	if (button_y + panel_h + requisition.height >= screen_h)
-		*y = button_y - requisition.height;
-	else
-		*y = button_y + panel_h;
-
-	*push_in = TRUE;
-}
-
-/*
- * nma_toplevel_menu_button_press_cb
- *
- * Handle left/right-clicks for the dropdown and context popup menus
- *
- */
-static gboolean nma_toplevel_menu_button_press_cb (GtkWidget *widget, GdkEventButton *event, NMApplet *applet)
-{
-	g_return_val_if_fail (applet != NULL, FALSE);
-
-	switch (event->button)
-	{
-		case 1:
-			nma_menu_clear (applet);
-			gtk_widget_set_state (applet->event_box, GTK_STATE_SELECTED);
-			gtk_menu_popup (GTK_MENU (applet->menu), NULL, NULL, nma_menu_position_func, applet, event->button, event->time);
-			return TRUE;
-		case 3:
-			nma_context_menu_update (applet);
-			gtk_menu_popup (GTK_MENU (applet->context_menu), NULL, NULL, nma_menu_position_func, applet, event->button, event->time);
-			return TRUE;
-		default:
-			g_signal_stop_emission_by_name (widget, "button_press_event");
-			return FALSE;
-	}
-
-	return FALSE;
-}
-
-
-/*
- * nma_toplevel_menu_button_press_cb
- *
- * Handle left-unclick on the dropdown menu.
- *
- */
-static void nma_menu_deactivate_cb (GtkWidget *menu, NMApplet *applet)
-{
-
-	g_return_if_fail (applet != NULL);
-
-	gtk_widget_set_state (applet->event_box, GTK_STATE_NORMAL);
-}
-
-/*
- * nma_theme_change_cb
- *
- * Destroy the popdown menu when the theme changes
- *
- */
-static void nma_theme_change_cb (NMApplet *applet)
-{
-	g_return_if_fail (applet != NULL);
-
-	nma_menu_clear (applet);
-	if (applet->top_menu_item) {
-#if GTK_CHECK_VERSION(2, 12, 0)
-		gtk_menu_item_set_submenu (GTK_MENU_ITEM (applet->top_menu_item), NULL);
-#else
-		gtk_menu_item_remove_submenu (GTK_MENU_ITEM (applet->top_menu_item));
-#endif /* gtk 2.12.0 */
-
-		applet->menu = nma_menu_create (GTK_MENU_ITEM (applet->top_menu_item), applet);
-		g_signal_connect (applet->menu, "deactivate", G_CALLBACK (nma_menu_deactivate_cb), applet);
-	}
-}
-#endif /* HAVE_STATUS_ICON */
-
 /*
  * nma_setup_widgets
  *
@@ -2369,7 +2195,6 @@
 {
 	g_return_val_if_fail (NM_IS_APPLET (applet), FALSE);
 
-#ifdef HAVE_STATUS_ICON
 	applet->status_icon = gtk_status_icon_new ();
 	if (!applet->status_icon)
 		return FALSE;
@@ -2383,41 +2208,9 @@
 	g_signal_connect (applet->status_icon, "popup-menu",
 			  G_CALLBACK (nma_status_icon_popup_menu_cb), applet);
 
-#else
-	applet->tray_icon = egg_tray_icon_new ("NetworkManager");
-	if (!applet->tray_icon)
-		return FALSE;
-
-	g_object_ref (applet->tray_icon);
-	gtk_object_sink (GTK_OBJECT (applet->tray_icon));
-
-	/* Event box is the main applet widget */
-	applet->event_box = gtk_event_box_new ();
-	if (!applet->event_box)
-		return FALSE;
-	gtk_container_set_border_width (GTK_CONTAINER (applet->event_box), 0);
-	g_signal_connect (applet->event_box, "button_press_event", G_CALLBACK (nma_toplevel_menu_button_press_cb), applet);
-
-	applet->pixmap = gtk_image_new ();
-	if (!applet->pixmap)
-		return FALSE;
-	gtk_container_add (GTK_CONTAINER (applet->event_box), applet->pixmap);
-	gtk_container_add (GTK_CONTAINER (applet->tray_icon), applet->event_box);
- 	gtk_widget_show_all (GTK_WIDGET (applet->tray_icon));
-#endif /* HAVE_STATUS_ICON */
-
-	applet->top_menu_item = gtk_menu_item_new ();
-	if (!applet->top_menu_item)
-		return FALSE;
-	gtk_widget_set_name (applet->top_menu_item, "ToplevelMenu");
-	gtk_container_set_border_width (GTK_CONTAINER (applet->top_menu_item), 0);
-
-	applet->menu = nma_menu_create (GTK_MENU_ITEM (applet->top_menu_item), applet);
+	applet->menu = nma_menu_create (applet);
 	if (!applet->menu)
 		return FALSE;
-#ifndef HAVE_STATUS_ICON
-	g_signal_connect (applet->menu, "deactivate", G_CALLBACK (nma_menu_deactivate_cb), applet);
-#endif /* !HAVE_STATUS_ICON */
 
 	applet->context_menu = nma_context_menu_create (applet);
 	if (!applet->context_menu)
@@ -2680,14 +2473,12 @@
 				applet_dbus_connection_settings_save (NM_CONNECTION_SETTINGS (connection_settings));
 		}
 
-#ifdef ENABLE_NOTIFY
 		if (!synthetic) {
 			tip = g_strdup_printf (_("You are now connected to the wireless network '%s'."), esc_ssid);
-			nma_send_event_notification (applet, NOTIFY_URGENCY_LOW, _("Connection Established"),
-							    tip, "nm-device-wireless");
+			applet_do_notify (applet, NOTIFY_URGENCY_LOW, _("Connection Established"),
+							  tip, "nm-device-wireless");
 			g_free (tip);
 		}
-#endif
 
 		tip = g_strdup_printf (_("Wireless network connection to '%s'"), esc_ssid);
 		handled = TRUE;
@@ -2738,13 +2529,12 @@
 		foo_set_icon (applet, applet->wired_icon, ICON_LAYER_LINK);
 		tip = g_strdup (_("Wired network connection"));
 
-#ifdef ENABLE_NOTIFY		
-		if (!synthetic)
-			nma_send_event_notification (applet, NOTIFY_URGENCY_LOW,
-							    _("Connection Established"),
-							    _("You are now connected to the wired network."),
-							    "nm-device-wired");
-#endif
+		if (!synthetic) {
+			applet_do_notify (applet, NOTIFY_URGENCY_LOW,
+							  _("Connection Established"),
+							  _("You are now connected to the wired network."),
+							  "nm-device-wired");
+		}
 
 		handled = TRUE;
 		break;
@@ -2783,14 +2573,12 @@
 	case NM_DEVICE_STATE_ACTIVATED:
 		foo_set_icon (applet, applet->gsm_icon, ICON_LAYER_LINK);
 		tip = g_strdup (_("GSM connection"));
-
-#ifdef ENABLE_NOTIFY		
-		if (!synthetic)
-			nma_send_event_notification (applet, NOTIFY_URGENCY_LOW,
-							    _("Connection Established"),
-							    _("You are now connected to the GSM network."),
-							    "nm-adhock");
-#endif
+		if (!synthetic) {
+			applet_do_notify (applet, NOTIFY_URGENCY_LOW,
+						      _("Connection Established"),
+							  _("You are now connected to the GSM network."),
+							  "nm-adhoc");
+		}
 
 		handled = TRUE;
 		break;
@@ -3122,14 +2910,11 @@
 	case NM_STATE_DISCONNECTED:
 		pixbuf = applet->no_connection_icon;
 		tip = g_strdup (_("No network connection"));
-
-#ifdef ENABLE_NOTIFY
-		if (!synthetic)
-			nma_send_event_notification (applet, NOTIFY_URGENCY_NORMAL, _("Disconnected"),
-							    _("The network connection has been disconnected."),
-							    "nm-no-connection");
-#endif
-
+		if (!synthetic) {
+			applet_do_notify (applet, NOTIFY_URGENCY_NORMAL, _("Disconnected"),
+							  _("The network connection has been disconnected."),
+							  "nm-no-connection");
+		}
 		break;
 	default:
 		break;
@@ -3168,9 +2953,9 @@
 
 static void
 foo_manager_running (NMClient *client,
-				 gboolean running,
-				 gpointer user_data,
-                                 gboolean synthetic)
+                     gboolean running,
+                     gpointer user_data,
+                     gboolean synthetic)
 {
 	NMApplet *applet = NM_APPLET (user_data);
 
@@ -3511,42 +3296,21 @@
 	NMApplet *applet = NM_APPLET (object);
 
 	nma_menu_clear (applet);
-	if (applet->top_menu_item)
-#if GTK_CHECK_VERSION(2, 12, 0)
-		gtk_menu_item_set_submenu (GTK_MENU_ITEM (applet->top_menu_item), NULL);
-#else
-		gtk_menu_item_remove_submenu (GTK_MENU_ITEM (applet->top_menu_item));
-#endif /* gtk 2.12.0 */
-
 	nma_icons_free (applet);
 
-//	nmi_passphrase_dialog_destroy (applet);
-#ifdef ENABLE_NOTIFY
 	if (applet->notification) {
 		notify_notification_close (applet->notification, NULL);
 		g_object_unref (applet->notification);
 	}
-#endif
 
 	g_free (applet->glade_file);
 	if (applet->info_dialog_xml)
 		g_object_unref (applet->info_dialog_xml);
-#ifndef HAVE_STATUS_ICON
-	if (applet->tooltips)
-		g_object_unref (applet->tooltips);
-#endif
 
 	g_object_unref (applet->gconf_client);
 
-#ifdef HAVE_STATUS_ICON
 	if (applet->status_icon)
 		g_object_unref (applet->status_icon);
-#else
-	if (applet->tray_icon) {
-		gtk_widget_destroy (GTK_WIDGET (applet->tray_icon));
-		g_object_unref (applet->tray_icon);
-	}
-#endif /* HAVE_STATUS_ICON */
 
 	g_hash_table_destroy (applet->vpn_connections);
 	g_object_unref (applet->vpn_manager);
@@ -3580,11 +3344,6 @@
 
 	applet = NM_APPLET (G_OBJECT_CLASS (nma_parent_class)->constructor (type, n_props, construct_props));
 
-#ifndef HAVE_STATUS_ICON
-	applet->tooltips = gtk_tooltips_new ();
-	if (!applet->tooltips)
-		goto error;
-#endif
 	g_set_application_name (_("NetworkManager Applet"));
 	gtk_window_set_default_icon_name (GTK_STOCK_NETWORK);
 
@@ -3635,12 +3394,6 @@
 										    (GDestroyNotify) g_free,
 										    (GDestroyNotify) g_object_unref);
 
-#ifndef HAVE_STATUS_ICON
-	g_signal_connect (applet->tray_icon, "style-set", G_CALLBACK (nma_theme_change_cb), NULL);
-
-	nma_icons_load_from_disk (applet);
-#endif /* !HAVE_STATUS_ICON */
-
 	return G_OBJECT (applet);
 
 error:
@@ -3753,13 +3506,9 @@
 
 	g_return_val_if_fail (!applet->icons_loaded, FALSE);
 
-#ifdef HAVE_STATUS_ICON
 	size = applet->size;
 	if (size < 0)
 		return FALSE;
-#else
-	size = 22; /* hard-coded */
-#endif /* HAVE_STATUS_ICON */
 
 	for (i = 0; i <= ICON_LAYER_MAX; i++)
 		applet->icon_layers[i] = NULL;
@@ -3820,38 +3569,20 @@
 
 static void nma_icons_init (NMApplet *applet)
 {
-	const char style[] =
-		"style \"MenuBar\"\n"
-		"{\n"
-			"GtkMenuBar::shadow_type = GTK_SHADOW_NONE\n"
-			"GtkMenuBar::internal-padding = 0\n"
-		"}\n"
-		"style \"MenuItem\"\n"
-		"{\n"
-			"xthickness=0\n"
-			"ythickness=0\n"
-		"}\n"
-		"class \"GtkMenuBar\" style \"MenuBar\"\n"
-		"widget \"*ToplevelMenu*\" style \"MenuItem\"\n";
 	GdkScreen *screen;
 	gboolean path_appended;
 
-	if (applet->icon_theme)
-	{
+	if (applet->icon_theme) {
 		g_signal_handlers_disconnect_by_func (applet->icon_theme,
 						      G_CALLBACK (nma_icon_theme_changed),
 						      applet);
 	}
 
-#ifdef HAVE_STATUS_ICON
 #if GTK_CHECK_VERSION(2, 11, 0)
 	screen = gtk_status_icon_get_screen (applet->status_icon);
 #else
 	screen = gdk_screen_get_default ();
 #endif /* gtk 2.11.0 */
-#else /* !HAVE_STATUS_ICON */
-	screen = gtk_widget_get_screen (GTK_WIDGET (applet->tray_icon));
-#endif /* HAVE_STATUS_ICON */
 	
 	applet->icon_theme = gtk_icon_theme_get_for_screen (screen);
 
@@ -3867,9 +3598,6 @@
 	}
 
 	g_signal_connect (applet->icon_theme, "changed", G_CALLBACK (nma_icon_theme_changed), applet);
-
-	/* FIXME: Do we need to worry about other screens? */
-	gtk_rc_parse_string (style);
 }
 
 NMApplet *

Modified: trunk/src/applet.h
==============================================================================
--- trunk/src/applet.h	(original)
+++ trunk/src/applet.h	Fri Jan 11 23:19:52 2008
@@ -29,30 +29,21 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
 #include <gconf/gconf-client.h>
 #include <glade/glade.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
 #include <net/ethernet.h>
 
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
-
-#ifndef HAVE_STATUS_ICON
-#include "eggtrayicon.h"
-#endif
+#include <libnotify/notify.h>
 
 #include <nm-client.h>
 #include <nm-access-point.h>
 #include <nm-vpn-manager.h>
-
 #include <nm-device.h>
 
-#ifdef ENABLE_NOTIFY
-#include <libnotify/notify.h>
-#endif
-
 #include "applet-dbus-manager.h"
 #include "applet-dbus-settings.h"
 
@@ -85,7 +76,7 @@
  */
 typedef struct
 {
-	GObject                 parent_instance;
+	GObject parent_instance;
 
 	NMClient *nm_client;
 	NMVPNManager *vpn_manager;
@@ -95,14 +86,13 @@
 	NMSettings * settings;
 	GSList * active_connections;
 
-	GConfClient *		gconf_client;
-	char	*			glade_file;
+	GConfClient *	gconf_client;
+	char	*		glade_file;
 
 	/* Data model elements */
-	gboolean			is_adhoc;
-	gboolean			icons_loaded;
+	gboolean		icons_loaded;
 
-	GtkIconTheme *          icon_theme;
+	GtkIconTheme *	icon_theme;
 	GdkPixbuf *		no_connection_icon;
 	GdkPixbuf *		wired_icon;
 	GdkPixbuf *		adhoc_icon;
@@ -127,31 +117,20 @@
 	guint			animation_id;
 
 	/* Direct UI elements */
-#ifdef HAVE_STATUS_ICON
-	GtkStatusIcon *		status_icon;
-	int			size;
-#else
-	EggTrayIcon *		tray_icon;
-	GtkWidget *		pixmap;
-	GtkWidget *		event_box;
-	GtkTooltips *		tooltips;
-#endif /* HAVE_STATUS_ICON */
+	GtkStatusIcon *	status_icon;
+	int				size;
 
-	GtkWidget *		top_menu_item;
 	GtkWidget *		menu;
-	GtkSizeGroup *		encryption_size_group;
+	GtkSizeGroup *	encryption_size_group;
 
 	GtkWidget *		context_menu;
 	GtkWidget *		enable_networking_item;
 	GtkWidget *		stop_wireless_item;
 	GtkWidget *		info_menu_item;
-	GtkWidget *             connections_menu_item;
+	GtkWidget *		connections_menu_item;
 
-	GtkWidget *		passphrase_dialog;
 	GladeXML *		info_dialog_xml;
-#ifdef ENABLE_NOTIFY
 	NotifyNotification*	notification;
-#endif
 } NMApplet;
 
 GType nma_get_type (void);

Modified: trunk/src/vpn-properties/Makefile.am
==============================================================================
--- trunk/src/vpn-properties/Makefile.am	(original)
+++ trunk/src/vpn-properties/Makefile.am	Fri Jan 11 23:19:52 2008
@@ -30,11 +30,6 @@
 	$(NMA_LIBS) \
 	${top_builddir}/src/gconf-helpers/libgconf-helpers.la
 
-if !HAVE_GTK_2_10
-nm_vpn_properties_LDADD += $(LIBGNOMEUI_LIBS)
-nm_vpn_properties_CFLAGS += $(LIBGNOMEUI_CFLAGS)
-endif
-
 CLEANFILES = $(server_DATA) *.bak *.gladep *~
 
 EXTRA_DIST = $(glade_DATA)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]