[PATCH] Duplicated screensaver entry in control center
- From: Rodrigo Moya <rodrigo novell com>
- To: Control Center List <gnomecc-list gnome org>
- Subject: [PATCH] Duplicated screensaver entry in control center
- Date: Fri, 14 Oct 2005 12:58:47 +0200
Hi
Attached patch was submitted to bugzilla a month ago. It makes the
control center not show the xscreensaver capplet icon if
gnome-screensaver is installed (all other gnome modules run g-s if
installed, if not, xscreensaver).
I think this should also get into the 2.12 branch. Ok?
--
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center/ChangeLog,v
retrieving revision 1.154
diff -u -p -r1.154 ChangeLog
--- ChangeLog 6 Jun 2005 21:49:33 -0000 1.154
+++ ChangeLog 14 Oct 2005 10:59:08 -0000
@@ -1,3 +1,11 @@
+2005-10-14 Rodrigo Moya <rodrigo novell com>
+
+ Fixes #315505
+
+ * control-center-categories.c (control_center_entry_new): don't show
+ xscreensaver capplet icon if gnome-screensaver is installed.
+ (populate_category): don't add NULL entries to the list.
+
2005-06-06 Carlos Garnacho Parro <carlosg gnome org>
* gnomecc-canvas.c: added a11y support
Index: control-center-categories.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center/control-center-categories.c,v
retrieving revision 1.9
diff -u -p -r1.9 control-center-categories.c
--- control-center-categories.c 2 May 2005 08:05:27 -0000 1.9
+++ control-center-categories.c 14 Oct 2005 10:59:08 -0000
@@ -32,6 +32,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <libgnome/gnome-desktop-item.h>
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
#include <gmenu-tree.h>
@@ -90,7 +91,33 @@ control_center_entry_new (ControlCenterC
GMenuTreeEntry *menu_entry)
{
ControlCenterEntry *retval;
+ char *desktop_entry;
+ /* only add entries that exist */
+ desktop_entry = gmenu_tree_entry_get_desktop_file_path (menu_entry);
+ if (desktop_entry) {
+ GnomeDesktopItem *item;
+ const char *exec;
+ char *path;
+
+ item = gnome_desktop_item_new_from_file (desktop_entry,
+ GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
+ NULL);
+ if (!item)
+ return NULL;
+
+ /* FIXME: discard xscreensaver if gnome-screensaver is installed */
+ exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC);
+ if ((exec && !strcmp (exec, "xscreensaver-demo")) && (path = g_find_program_in_path ("gnome-screensaver"))) {
+ gnome_desktop_item_unref (item);
+ g_free (path);
+ return NULL;
+ }
+
+ gnome_desktop_item_unref (item);
+ }
+
+ /* create the new entry */
retval = g_new0 (ControlCenterEntry, 1);
retval->category = category;
@@ -137,10 +164,13 @@ populate_category (ControlCenterCategory
for (l = items; l; l = l->next) {
GMenuTreeItem *item = l->data;
- if (gmenu_tree_item_get_type (item) == GMENU_TREE_ITEM_ENTRY)
- entries = g_slist_append (entries,
- control_center_entry_new (category,
- GMENU_TREE_ENTRY (item)));
+ if (gmenu_tree_item_get_type (item) == GMENU_TREE_ITEM_ENTRY) {
+ ControlCenterEntry *entry;
+
+ entry = control_center_entry_new (category, GMENU_TREE_ENTRY (item));
+ if (entry)
+ entries = g_slist_append (entries, entry);
+ }
gmenu_tree_item_unref (item);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]