rpms/gnome-power-manager/F-12 0001-Do-not-show-About-and-Help-menu-items-on-the-panel-i.patch, NONE, 1.1 0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch, NONE, 1.1 gnome-power-manager.spec, 1.177, 1.178

Richard Hughes rhughes at fedoraproject.org
Thu Oct 22 08:27:17 UTC 2009


Author: rhughes

Update of /cvs/pkgs/rpms/gnome-power-manager/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13455

Modified Files:
	gnome-power-manager.spec 
Added Files:
	0001-Do-not-show-About-and-Help-menu-items-on-the-panel-i.patch 
	0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch 
Log Message:
* Thu Oct 22 2009 Richard Hughes  <rhughes at redhat.com> - 2.28.1-2
- Backport two patches from git master to polish the UI for F12.


0001-Do-not-show-About-and-Help-menu-items-on-the-panel-i.patch:
 gpm-tray-icon.c |   92 --------------------------------------------------------
 1 file changed, 92 deletions(-)

--- NEW FILE 0001-Do-not-show-About-and-Help-menu-items-on-the-panel-i.patch ---
>From fd51095da94ce4043126893d28663dd729af83fc Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard at hughsie.com>
Date: Thu, 22 Oct 2009 09:12:16 +0100
Subject: [PATCH 1/2] Do not show 'About' and 'Help' menu items on the panel icon

---
 src/gpm-tray-icon.c |   91 ---------------------------------------------------
 1 files changed, 0 insertions(+), 91 deletions(-)

diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index b90ecbe..65e8e0b 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -283,77 +283,6 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data)
 }
 
 /**
- * gpm_tray_icon_show_help_cb:
- * @action: A valid GtkAction
- **/
-static void
-gpm_tray_icon_show_help_cb (GtkMenuItem *item, gpointer data)
-{
-	gpm_help_display (NULL);
-}
-
-/**
- * gpm_tray_icon_show_about_cb:
- * @action: A valid GtkAction
- **/
-static void
-gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data)
-{
-	const char *authors[] = {
-		"Richard Hughes <richard at hughsie.com>",
-		"William Jon McCann <mccann at jhu.edu>",
-		"Jaap A. Haitsma <jaap at haitsma.org>",
-		NULL};
-	const char *documenters[] = {
-		"Richard Hughes <richard at hughsie.com>",
-		NULL};
-	const char *artists[] = {
-		"Diana Fong <dfong at redhat.com>",
-		"Jakub Steiner <jimmac at ximian.com>",
-		NULL};
-	const char *license[] = {
-		N_("Licensed under the GNU General Public License Version 2"),
-		N_("Power Manager is free software; you can redistribute it and/or\n"
-		   "modify it under the terms of the GNU General Public License\n"
-		   "as published by the Free Software Foundation; either version 2\n"
-		   "of the License, or (at your option) any later version."),
-		N_("Power Manager is distributed in the hope that it will be useful,\n"
-		   "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-		   "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-		   "GNU General Public License for more details."),
-		N_("You should have received a copy of the GNU General Public License\n"
-		   "along with this program; if not, write to the Free Software\n"
-		   "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n"
-		   "02110-1301, USA.")
-	};
-  	const char  *translators = _("translator-credits");
-	char	    *license_trans;
-
-	/* Translators comment: put your own name here to appear in the about dialog. */
-  	if (!strcmp (translators, "translator-credits"))
-		translators = NULL;
-
-	license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n",
-				     _(license[2]), "\n\n", _(license[3]), "\n",  NULL);
-
-	gtk_window_set_default_icon_name (GPM_STOCK_APP_ICON);
-	gtk_show_about_dialog (NULL,
-			       "version", VERSION,
-			       "copyright", "Copyright \xc2\xa9 2005-2007 Richard Hughes",
-			       "license", license_trans,
-			       "website-label", _("GNOME Power Manager Website"),
-			       "website", GPM_HOMEPAGE_URL,
-			       "comments", GPM_DESCRIPTION,
-			       "authors", authors,
-			       "documenters", documenters,
-			       "artists", artists,
-			       "translator-credits", translators,
-			       "logo-icon-name", GPM_STOCK_APP_ICON,
-			       NULL);
-	g_free (license_trans);
-}
-
-/**
  * gpm_tray_icon_popup_cleared_cd:
  * @widget: The popup Gtkwidget
  *
@@ -439,26 +368,6 @@ gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 t
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 	}
 
-	/* separator for HIG */
-	item = gtk_separator_menu_item_new ();
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
-	/* help */
-	item = gtk_image_menu_item_new_with_mnemonic (_("_Help"));
-	image = gtk_image_new_from_icon_name (GTK_STOCK_HELP, GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-	g_signal_connect (G_OBJECT (item), "activate",
-			  G_CALLBACK (gpm_tray_icon_show_help_cb), icon);
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
-	/* about */
-	item = gtk_image_menu_item_new_with_mnemonic (_("_About"));
-	image = gtk_image_new_from_icon_name (GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-	g_signal_connect (G_OBJECT (item), "activate",
-			  G_CALLBACK (gpm_tray_icon_show_about_cb), icon);
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
 	/* show the menu */
 	gtk_widget_show_all (GTK_WIDGET (menu));
 	gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
-- 
1.6.5.rc2


0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch:
 gpm-tray-icon.c |  103 +++++++++++++++++++++++---------------------------------
 1 file changed, 44 insertions(+), 59 deletions(-)

--- NEW FILE 0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch ---
>From ab519b6aad73e9b0d738d4ddb0ee2cd3774b5884 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard at hughsie.com>
Date: Thu, 22 Oct 2009 09:20:42 +0100
Subject: [PATCH 2/2] Make the left and right buttons on the status icon bring up the same menu, UI copied from git master

---
 src/gpm-tray-icon.c |  102 ++++++++++++++++++++++-----------------------------
 1 files changed, 44 insertions(+), 58 deletions(-)

diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index 65e8e0b..96bf8cc 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -326,6 +326,9 @@ gpm_tray_icon_class_init (GpmTrayIconClass *klass)
 			      0);
 }
 
+/* prototype to avoid moving a huge function and bloating the patch */
+static guint gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *array, DkpDeviceType type);
+
 /**
  * gpm_tray_icon_popup_menu_cb:
  *
@@ -339,11 +342,47 @@ gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 t
 	GtkWidget *image;
 	gchar *path;
 	gboolean ret;
+	guint dev_cnt = 0;
+	GPtrArray *array;
 
-	egg_debug ("icon right clicked");
+	/* add all device types to the drop down menu */
+	array = gpm_engine_get_devices (icon->priv->engine);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_BATTERY);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_UPS);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_MOUSE);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_KEYBOARD);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_PDA);
+	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_PHONE);
+	g_ptr_array_unref (array);
+
+	/* only do the seporator if we have at least one device and can do an action */
+	if (dev_cnt != 0 && (icon->priv->show_suspend || icon->priv->show_hibernate || icon->priv->show_context_menu)) {
+		item = gtk_separator_menu_item_new ();
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	}
+
+	/* Suspend if available */
+	if (icon->priv->show_suspend) {
+		item = gtk_image_menu_item_new_with_mnemonic (_("_Suspend"));
+		image = gtk_image_new_from_icon_name (GPM_STOCK_SUSPEND, GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (gpm_tray_icon_suspend_cb), icon);
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	}
+
+	/* Hibernate if available */
+	if (icon->priv->show_hibernate) {
+		item = gtk_image_menu_item_new_with_mnemonic (_("Hi_bernate"));
+		image = gtk_image_new_from_icon_name (GPM_STOCK_HIBERNATE, GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (gpm_tray_icon_hibernate_cb), icon);
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	}
 
 	if (!icon->priv->show_context_menu)
-		return;
+		goto show;
 
 	/* preferences */
 	item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
@@ -367,7 +406,7 @@ gpm_tray_icon_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint32 t
 				  G_CALLBACK (gpm_tray_icon_show_statistics_cb), icon);
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 	}
-
+show:
 	/* show the menu */
 	gtk_widget_show_all (GTK_WIDGET (menu));
 	gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
@@ -446,61 +485,8 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr
 static void
 gpm_tray_icon_activate_cb (GtkStatusIcon *status_icon, GpmTrayIcon *icon)
 {
-	GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
-	GtkWidget *item;
-	GtkWidget *image;
-	guint dev_cnt = 0;
-	GPtrArray *array;
-	egg_debug ("icon left clicked");
-
-	/* add all device types to the drop down menu */
-	array = gpm_engine_get_devices (icon->priv->engine);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_BATTERY);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_UPS);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_MOUSE);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_KEYBOARD);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_PDA);
-	dev_cnt += gpm_tray_icon_add_device (icon, menu, array, DKP_DEVICE_TYPE_PHONE);
-	g_ptr_array_unref (array);
-
-	/* nothing to display! */
-	if (dev_cnt == 0 && !icon->priv->show_suspend && !icon->priv->show_hibernate)
-		return;
-
-	/* only do the seporator if we have at least one device and can do an action */
-	if (dev_cnt != 0 && (icon->priv->show_suspend || icon->priv->show_hibernate)) {
-		item = gtk_separator_menu_item_new ();
-		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	}
-
-	/* Suspend if available */
-	if (icon->priv->show_suspend) {
-		item = gtk_image_menu_item_new_with_mnemonic (_("_Suspend"));
-		image = gtk_image_new_from_icon_name (GPM_STOCK_SUSPEND, GTK_ICON_SIZE_MENU);
-		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-		g_signal_connect (G_OBJECT (item), "activate",
-				  G_CALLBACK (gpm_tray_icon_suspend_cb), icon);
-		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	}
-
-	/* Hibernate if available */
-	if (icon->priv->show_hibernate) {
-		item = gtk_image_menu_item_new_with_mnemonic (_("Hi_bernate"));
-		image = gtk_image_new_from_icon_name (GPM_STOCK_HIBERNATE, GTK_ICON_SIZE_MENU);
-		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-		g_signal_connect (G_OBJECT (item), "activate",
-				  G_CALLBACK (gpm_tray_icon_hibernate_cb), icon);
-		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	}
-
-	/* show the menu */
-	gtk_widget_show_all (GTK_WIDGET (menu));
-	gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
-			gtk_status_icon_position_menu, status_icon,
-			1, gtk_get_current_event_time());
-
-	g_signal_connect (GTK_WIDGET (menu), "hide",
-			  G_CALLBACK (gpm_tray_icon_popup_cleared_cd), icon);
+	/* fake this (coming from a left click, now) */
+	gpm_tray_icon_popup_menu_cb (status_icon, 1, gtk_get_current_event_time(), icon);
 }
 
 /**
-- 
1.6.5.rc2



Index: gnome-power-manager.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-power-manager/F-12/gnome-power-manager.spec,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -p -r1.177 -r1.178
--- gnome-power-manager.spec	19 Oct 2009 10:32:07 -0000	1.177
+++ gnome-power-manager.spec	22 Oct 2009 08:27:17 -0000	1.178
@@ -5,7 +5,7 @@
 Summary: GNOME power management service
 Name: gnome-power-manager
 Version: 2.28.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 #Release: 0.5.%{?alphatag}git%{?dist}
 License: GPLv2+ and GFDL
 Group: Applications/System
@@ -15,6 +15,12 @@ Source: http://download.gnome.org/source
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 URL: http://projects.gnome.org/gnome-power-manager/
 
+# Fedora-specific backport, already same UI in git master
+Patch1: 0001-Do-not-show-About-and-Help-menu-items-on-the-panel-i.patch
+
+# Fedora-specific backport, already same UI in git master
+Patch2: 0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch
+
 BuildRequires: libwnck-devel
 BuildRequires: hal-devel >= %{hal_version}
 BuildRequires: dbus-devel >= %{dbus_version}
@@ -62,6 +68,8 @@ Extra GNOME power management application
 %prep
 %setup -q
 #%setup -q -n %{?name}-%{?version}-%{?alphatag}
+%patch1 -p1 -b .remove-help
+%patch2 -p1 -b .uni-menu
 
 %build
 %configure \
@@ -180,6 +188,9 @@ fi
 %{_datadir}/icons/hicolor/*/apps/gnome-inhibit-applet.*
 
 %changelog
+* Thu Oct 22 2009 Richard Hughes  <rhughes at redhat.com> - 2.28.1-2
+- Backport two patches from git master to polish the UI for F12.
+
 * Mon Oct 19 2009 Richard Hughes  <rhughes at redhat.com> - 2.28.1-1
 - Update to 2.28.1
 - Translation updates




More information about the fedora-extras-commits mailing list