[Xfce4-commits] <garcon:master> Default menu prefix to "xfce-".

Nick Schermer noreply at xfce.org
Wed Apr 6 18:32:01 CEST 2011


Updating branch refs/heads/master
         to 78fd5b4a096565d002179f029cc86a679603514b (commit)
       from 47e3e7d7d8db87c3c78655fc33fc2d0bf3a48569 (commit)

commit 78fd5b4a096565d002179f029cc86a679603514b
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Apr 6 18:26:07 2011 +0200

    Default menu prefix to "xfce-".
    
    Lot of people have problems with this, if they start
    xfce without startxfce4 (where we set the XDG_MENU_PREFIX.
    It could lead to small problems, for example alacarte will
    read another menu when garcon, but that's a smaller problem
    when having no Xfce menu.

 garcon/garcon-menu-merger.c |    2 +-
 garcon/garcon-menu.c        |   14 +++++++-------
 garcon/garcon-private.h     |    4 ++++
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/garcon/garcon-menu-merger.c b/garcon/garcon-menu-merger.c
index e498ed4..70f5a43 100644
--- a/garcon/garcon-menu-merger.c
+++ b/garcon/garcon-menu-merger.c
@@ -528,7 +528,7 @@ garcon_menu_merger_resolve_default_dirs (GNode                   *node,
 
       /* check if we have an application menu file */
       prefix = g_getenv ("XDG_MENU_PREFIX");
-      applications_filename = g_strconcat (prefix != NULL ? prefix : "", 
+      applications_filename = g_strconcat (prefix != NULL ? prefix : GARCON_DEFAULT_MENU_PREFIX, 
                                            "applications.menu", NULL);
       if (g_strcmp0 (filename, applications_filename) == 0)
         is_application_menu = TRUE;
diff --git a/garcon/garcon-menu.c b/garcon/garcon-menu.c
index 2cd1a13..ba58e67 100644
--- a/garcon/garcon-menu.c
+++ b/garcon/garcon-menu.c
@@ -680,9 +680,9 @@ garcon_menu_load (GarconMenu   *menu,
 
       /* Build the ${XDG_MENU_PREFIX}applications.menu filename */
       prefix = g_getenv ("XDG_MENU_PREFIX");
-      relative_filename = g_strconcat ("menus", G_DIR_SEPARATOR_S, 
-                                       prefix != NULL ? prefix : "", "applications.menu",
-                                       NULL);
+      relative_filename = g_strconcat ("menus", G_DIR_SEPARATOR_S,
+                                       prefix != NULL ? prefix : GARCON_DEFAULT_MENU_PREFIX,
+                                       "applications.menu", NULL);
 
       /* Search for the menu file in user and system config dirs */
       filename = garcon_config_lookup (relative_filename);
@@ -1849,8 +1849,8 @@ garcon_menu_monitor_menu_files (GarconMenu *menu)
       /* Build ${XDG_MENU_PREFIX}applications.menu filename */
       prefix = g_getenv ("XDG_MENU_PREFIX");
       relative_filename = g_strconcat ("menus", G_DIR_SEPARATOR_S, 
-                                       prefix != NULL ? prefix : "", "applications.menu",
-                                       NULL);
+                                       prefix != NULL ? prefix : GARCON_DEFAULT_MENU_PREFIX,
+                                       "applications.menu", NULL);
 
       /* Monitor all application menu candidates */
       paths = garcon_config_build_paths (relative_filename);
@@ -2058,8 +2058,8 @@ garcon_menu_file_changed (GarconMenu       *menu,
   /* Build the ${XDG_MENU_PREFIX}applications.menu filename */
   prefix = g_getenv ("XDG_MENU_PREFIX");
   relative_filename = g_strconcat ("menus", G_DIR_SEPARATOR_S,
-                                   prefix != NULL ? prefix : "", "applications.menu",
-                                   NULL);
+                                   prefix != NULL ? prefix : GARCON_DEFAULT_MENU_PREFIX,
+                                   "applications.menu", NULL);
 
   /* Get XDG config paths for the root spec (e.g. menus/xfce-applications.menu) */
   paths = garcon_config_build_paths (relative_filename);
diff --git a/garcon/garcon-private.h b/garcon/garcon-private.h
index eb2ed8e..1d46fb3 100644
--- a/garcon/garcon-private.h
+++ b/garcon/garcon-private.h
@@ -28,6 +28,10 @@
 
 G_BEGIN_DECLS
 
+/* if XDG_MENU_PREFIX is not set, default to "xfce-" so garcon doesn't
+ * break when xfce is not started with startxfce4 */
+#define GARCON_DEFAULT_MENU_PREFIX "xfce-"
+
 GFile    *_garcon_file_new_for_unknown_input    (const gchar *path,
                                                  GFile       *parent);
 



More information about the Xfce4-commits mailing list