[Xfce4-commits] r26914 - in xfdesktop/trunk: common menueditor modules/menu src

Brian Tarricone kelnos at xfce.org
Thu May 1 09:04:05 CEST 2008


Author: kelnos
Date: 2008-05-01 07:04:05 +0000 (Thu, 01 May 2008)
New Revision: 26914

Added:
   xfdesktop/trunk/common/desktop-menu-utils.c
   xfdesktop/trunk/common/desktop-menu-utils.h
Modified:
   xfdesktop/trunk/common/Makefile.am
   xfdesktop/trunk/common/xfdesktop-common.c
   xfdesktop/trunk/common/xfdesktop-common.h
   xfdesktop/trunk/menueditor/Makefile.am
   xfdesktop/trunk/menueditor/menueditor-main-window.c
   xfdesktop/trunk/modules/menu/Makefile.am
   xfdesktop/trunk/modules/menu/desktop-menu.c
   xfdesktop/trunk/src/xfce-desktop-settings.c
Log:
rearrange stuff a little; menu module doesn't need most of libxfdesktop.a


Modified: xfdesktop/trunk/common/Makefile.am
===================================================================
--- xfdesktop/trunk/common/Makefile.am	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/common/Makefile.am	2008-05-01 07:04:05 UTC (rev 26914)
@@ -10,12 +10,27 @@
 	$(GTK_CFLAGS)
 
 if BUILD_DESKTOP_MENU
-  noinst_LTLIBRARIES += libxfdesktop-menu.la
-  libxfdesktop_menu_la_SOURCES = desktop-menu-stub.c desktop-menu-stub.h
-  libxfdesktop_menu_la_CFLAGS = \
+
+noinst_LTLIBRARIES += \
+	libxfdesktop-menu.la \
+	libxfdesktop-menu-utils.la
+
+libxfdesktop_menu_la_SOURCES = \
+	desktop-menu-stub.c \
+	desktop-menu-stub.h
+
+libxfdesktop_menu_la_CFLAGS = \
 	$(GMODULE_CFLAGS) \
 	$(GTK_CFLAGS) \
 	-DXFCEMODDIR=\"$(libdir)/xfce4/modules\"
+
+libxfdesktop_menu_utils_la_SOURCES = \
+	desktop-menu-utils.c \
+	desktop-menu-utils.h
+
+libxfdesktop_menu_utils_la_CFLAGS = \
+	$(LIBXFCE4UTIL_CFLAGS)
+
 endif
 
 if HAVE_CYGWIN

Added: xfdesktop/trunk/common/desktop-menu-utils.c
===================================================================
--- xfdesktop/trunk/common/desktop-menu-utils.c	                        (rev 0)
+++ xfdesktop/trunk/common/desktop-menu-utils.c	2008-05-01 07:04:05 UTC (rev 26914)
@@ -0,0 +1,75 @@
+/*
+ *  Copyright (c) 2004-2007 Brian Tarricone <bjt23 at cornell.edu>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "desktop-menu-utils.h"
+
+gchar *
+xfce_desktop_get_menufile()
+{
+    XfceKiosk *kiosk;
+    gboolean user_menu;
+    gchar *menu_file = NULL;
+    gchar **all_dirs;
+    const gchar *userhome = xfce_get_homedir();
+    gint i;
+
+    kiosk = xfce_kiosk_new("xfdesktop");
+    user_menu = xfce_kiosk_query(kiosk, "UserMenu");
+    xfce_kiosk_free(kiosk);
+    
+    if(user_menu) {
+        gchar *file = xfce_resource_save_location(XFCE_RESOURCE_CONFIG,
+                                                  "menus/xfce-applications.menu",
+                                                  FALSE);
+        if(file) {
+            DBG("checking %s", file);
+            if(g_file_test(file, G_FILE_TEST_IS_REGULAR))
+                return file;
+            else
+                g_free(file);
+        }
+    }
+    
+    all_dirs = xfce_resource_lookup_all(XFCE_RESOURCE_CONFIG,
+                                        "menus/xfce-applications.menu");
+    for(i = 0; all_dirs[i]; i++) {
+        DBG("checking %s", all_dirs[i]);
+        if(user_menu || strstr(all_dirs[i], userhome) != all_dirs[i]) {
+            if(g_file_test(all_dirs[i], G_FILE_TEST_IS_REGULAR)) {
+                menu_file = g_strdup(all_dirs[i]);
+                break;
+            }
+        }
+    }
+    g_strfreev(all_dirs);
+
+    if(!menu_file)
+        g_warning("%s: Could not locate a menu definition file", PACKAGE);
+
+    return menu_file;
+}

Added: xfdesktop/trunk/common/desktop-menu-utils.h
===================================================================
--- xfdesktop/trunk/common/desktop-menu-utils.h	                        (rev 0)
+++ xfdesktop/trunk/common/desktop-menu-utils.h	2008-05-01 07:04:05 UTC (rev 26914)
@@ -0,0 +1,30 @@
+/*
+ *  Copyright (c) 2004-2007 Brian Tarricone <bjt23 at cornell.edu>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __DESKTOP_MENU_UTILS_H__
+#define __DESKTOP_MENU_UTILS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gchar *xfce_desktop_get_menufile();
+
+G_END_DECLS
+
+#endif  /* __DESKTOP_MENU_UTILS_H__ */

Modified: xfdesktop/trunk/common/xfdesktop-common.c
===================================================================
--- xfdesktop/trunk/common/xfdesktop-common.c	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/common/xfdesktop-common.c	2008-05-01 07:04:05 UTC (rev 26914)
@@ -1,6 +1,7 @@
 /*
  *  Copyright (C) 2002 Jasper Huijsmans (huysmans at users.sourceforge.net)
  *  Copyright (C) 2003 Benedikt Meurer (benedikt.meurer at unix-ag.uni-siegen.de)
+ *  Copyright (c) 2004-2007 Brian Tarricone <bjt23 at cornell.edu>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -131,52 +132,6 @@
     return size_read;
 }
 
-gchar *
-xfce_desktop_get_menufile(void)
-{
-    XfceKiosk *kiosk;
-    gboolean user_menu;
-    gchar *menu_file = NULL;
-    gchar **all_dirs;
-    const gchar *userhome = xfce_get_homedir();
-    gint i;
-
-    kiosk = xfce_kiosk_new("xfdesktop");
-    user_menu = xfce_kiosk_query(kiosk, "UserMenu");
-    xfce_kiosk_free(kiosk);
-    
-    if(user_menu) {
-        gchar *file = xfce_resource_save_location(XFCE_RESOURCE_CONFIG,
-                                                  "menus/xfce-applications.menu",
-                                                  FALSE);
-        if(file) {
-            DBG("checking %s", file);
-            if(g_file_test(file, G_FILE_TEST_IS_REGULAR))
-                return file;
-            else
-                g_free(file);
-        }
-    }
-    
-    all_dirs = xfce_resource_lookup_all(XFCE_RESOURCE_CONFIG,
-                                        "menus/xfce-applications.menu");
-    for(i = 0; all_dirs[i]; i++) {
-        DBG("checking %s", all_dirs[i]);
-        if(user_menu || strstr(all_dirs[i], userhome) != all_dirs[i]) {
-            if(g_file_test(all_dirs[i], G_FILE_TEST_IS_REGULAR)) {
-                menu_file = g_strdup(all_dirs[i]);
-                break;
-            }
-        }
-    }
-    g_strfreev(all_dirs);
-
-    if(!menu_file)
-        g_warning("%s: Could not locate a menu definition file", PACKAGE);
-
-    return menu_file;
-}
-
 gboolean
 xfdesktop_check_is_running(Window *xid)
 {

Modified: xfdesktop/trunk/common/xfdesktop-common.h
===================================================================
--- xfdesktop/trunk/common/xfdesktop-common.h	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/common/xfdesktop-common.h	2008-05-01 07:04:05 UTC (rev 26914)
@@ -46,7 +46,6 @@
 gchar **get_list_from_file(const gchar *);
 gboolean is_backdrop_list(const gchar *path);
 gboolean xfdesktop_check_image_file(const gchar *filename);
-gchar *xfce_desktop_get_menufile(void);
 gboolean xfdesktop_check_is_running(Window *xid);
 void xfdesktop_send_client_message(Window xid, const gchar *msg);
 gboolean xfdesktop_popup_grab_available(GdkWindow *win, guint32 timestamp);

Modified: xfdesktop/trunk/menueditor/Makefile.am
===================================================================
--- xfdesktop/trunk/menueditor/Makefile.am	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/menueditor/Makefile.am	2008-05-01 07:04:05 UTC (rev 26914)
@@ -31,7 +31,7 @@
 	
 
 xfce4_menueditor_LDADD =						\
-	$(top_builddir)/common/libxfdesktop.la				\
+	$(top_builddir)/common/libxfdesktop-menu-utils.la		\
 	$(LIBEXO_LIBS)							\
 	$(LIBX11_LDFLAGS)						\
 	$(LIBX11_LIBS)							\

Modified: xfdesktop/trunk/menueditor/menueditor-main-window.c
===================================================================
--- xfdesktop/trunk/menueditor/menueditor-main-window.c	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/menueditor/menueditor-main-window.c	2008-05-01 07:04:05 UTC (rev 26914)
@@ -48,7 +48,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <libxfcegui4/libxfcegui4.h>
 
-#include <xfdesktop-common.h>
+#include <desktop-menu-utils.h>
 
 #include "menueditor-add-dialog.h"
 #include "menueditor-add-external-dialog.h"

Modified: xfdesktop/trunk/modules/menu/Makefile.am
===================================================================
--- xfdesktop/trunk/modules/menu/Makefile.am	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/modules/menu/Makefile.am	2008-05-01 07:04:05 UTC (rev 26914)
@@ -21,7 +21,7 @@
 	-DBINDIR=\"$(bindir)\"
 
 xfce4_desktop_menu_la_DEPENDENCIES = \
-	$(top_builddir)/common/libxfdesktop.la
+	$(top_builddir)/common/libxfdesktop-menu-utils.la
 
 xfce4_desktop_menu_la_LDFLAGS = \
 	-export-dynamic \
@@ -34,7 +34,7 @@
 endif
 
 xfce4_desktop_menu_la_LIBADD = \
-	$(top_builddir)/common/libxfdesktop.la \
+	$(top_builddir)/common/libxfdesktop-menu-utils.la \
 	$(GMODULE_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(LIBXFCE4MENU_LIBS) \

Modified: xfdesktop/trunk/modules/menu/desktop-menu.c
===================================================================
--- xfdesktop/trunk/modules/menu/desktop-menu.c	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/modules/menu/desktop-menu.c	2008-05-01 07:04:05 UTC (rev 26914)
@@ -67,7 +67,7 @@
 #include <thunar-vfs/thunar-vfs.h>
 #endif
 
-#include "xfdesktop-common.h"
+#include "desktop-menu-utils.h"
 
 typedef struct
 {

Modified: xfdesktop/trunk/src/xfce-desktop-settings.c
===================================================================
--- xfdesktop/trunk/src/xfce-desktop-settings.c	2008-05-01 07:03:53 UTC (rev 26913)
+++ xfdesktop/trunk/src/xfce-desktop-settings.c	2008-05-01 07:04:05 UTC (rev 26914)
@@ -192,12 +192,12 @@
                 break;
         } while(1);
         
-        g_print("picked i=%d, %s\n", i, files[i]);
+        DBG("picked i=%d, %s\n", i, files[i]);
         /* validate the image; if it's good, return it */
         if(xfdesktop_check_image_file(files[i]))
             break;
         
-        g_print("file not valid, ditching\n");
+        DBG("file not valid, ditching\n");
         
         /* bad image: remove it from the list and write it out */
         save_list_file_minus_one(listfile, files, i);



More information about the Xfce4-commits mailing list