[Xfce4-commits] r29421 - in xfce4-appfinder/trunk: . src

Jannis Pohlmann jannis at xfce.org
Sun Feb 1 13:57:56 CET 2009


Author: jannis
Date: 2009-02-01 12:57:56 +0000 (Sun, 01 Feb 2009)
New Revision: 29421

Modified:
   xfce4-appfinder/trunk/ChangeLog
   xfce4-appfinder/trunk/src/xfce-appfinder-window.c
Log:
	* src/xfce-appfinder-window.c: Try to load items from
	  xfce-applications.menu before trying applications.menu in order to
	  provide the same items as the xfdesktop menu does. Reported by
	  Mark Trompell.

Modified: xfce4-appfinder/trunk/ChangeLog
===================================================================
--- xfce4-appfinder/trunk/ChangeLog	2009-02-01 10:49:14 UTC (rev 29420)
+++ xfce4-appfinder/trunk/ChangeLog	2009-02-01 12:57:56 UTC (rev 29421)
@@ -1,3 +1,10 @@
+2009-02-01	Jannis Pohlmann <jannis at xfce.org>
+
+	* src/xfce-appfinder-window.c: Try to load items from 
+	  xfce-applications.menu before trying applications.menu in order to
+	  provide the same items as the xfdesktop menu does. Reported by
+	  Mark Trompell.
+
 2009-01-25	Jannis Pohlmann <jannis at xfce.org>
 
 	* == 4.5.99.1 released! ==

Modified: xfce4-appfinder/trunk/src/xfce-appfinder-window.c
===================================================================
--- xfce4-appfinder/trunk/src/xfce-appfinder-window.c	2009-02-01 10:49:14 UTC (rev 29420)
+++ xfce4-appfinder/trunk/src/xfce-appfinder-window.c	2009-02-01 12:57:56 UTC (rev 29421)
@@ -79,6 +79,7 @@
                                                             const GValue             *value,
                                                             GParamSpec               *pspec);
 static void       _xfce_appfinder_window_closed            (XfceAppfinderWindow      *window);
+static gchar     *_xfce_appfinder_window_get_menu_filename (XfceAppfinderWindow      *window);
 static gpointer   _xfce_appfinder_window_reload_menu       (XfceAppfinderWindow      *window);
 static void       _xfce_appfinder_window_entry_changed     (GtkEditable              *editable,
                                                             XfceAppfinderWindow      *window);
@@ -891,12 +892,38 @@
 
 
 
+static gchar *
+_xfce_appfinder_window_get_menu_filename (XfceAppfinderWindow *window)
+{
+  gchar **paths;
+  gchar  *filename = NULL;
+  gint    i;
+
+  g_return_val_if_fail (XFCE_IS_APPFINDER_WINDOW (window), NULL);
+
+  paths = xfce_resource_lookup_all (XFCE_RESOURCE_CONFIG, "menus/xfce-applications.menu");
+
+  for (i = 0; paths[i] != NULL; ++i)
+    if (g_file_test (paths[i], G_FILE_TEST_IS_REGULAR))
+      {
+        filename = g_strdup (paths[i]);
+        break;
+      }
+
+  g_strfreev (paths);
+
+  return filename;
+}
+
+
+
 static gpointer 
 _xfce_appfinder_window_reload_menu (XfceAppfinderWindow *window)
 {
   GtkWidget *button;
   GError    *error = NULL;
   GSList    *menus;
+  gchar     *filename = NULL;
   gint       counter = 0;
 
   g_return_if_fail (XFCE_IS_APPFINDER_WINDOW (window));
@@ -906,8 +933,17 @@
   if (G_UNLIKELY (window->menu_filename != NULL))
     window->menu = xfce_menu_new (window->menu_filename, &error);
   else
-    window->menu = xfce_menu_get_root (&error);
+    {
+      filename = _xfce_appfinder_window_get_menu_filename (window);
 
+      if (G_LIKELY (filename != NULL))
+        window->menu = xfce_menu_new (filename, &error);
+      else
+        window->menu = xfce_menu_get_root (&error);
+
+      g_free (filename);
+    }
+
   if (G_UNLIKELY (window->menu == NULL))
     {
       if (G_LIKELY (error != NULL))




More information about the Xfce4-commits mailing list