[Goodies-commits] r5535 - in thunar-actions-plugin/trunk: . thunar-actions-plugin

Kees Scherpenhuijzen noik at xfce.org
Wed Oct 8 12:37:02 CEST 2008


Author: noik
Date: 2008-10-08 10:37:02 +0000 (Wed, 08 Oct 2008)
New Revision: 5535

Modified:
   thunar-actions-plugin/trunk/ChangeLog
   thunar-actions-plugin/trunk/INSTALL
   thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.c
   thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.h
   thunar-actions-plugin/trunk/thunar-actions-plugin/ta-provider.c
Log:
Added feature for init .desktopfiles

Modified: thunar-actions-plugin/trunk/ChangeLog
===================================================================
--- thunar-actions-plugin/trunk/ChangeLog	2008-10-08 06:32:36 UTC (rev 5534)
+++ thunar-actions-plugin/trunk/ChangeLog	2008-10-08 10:37:02 UTC (rev 5535)
@@ -1,3 +1,6 @@
+2008-10-08	Kees Scherpenhuijzen <noik00 at gmail.com>
+	* Added feature which inits .desktop-files
+
 2008-07-26  	Kees Scherpenhuijzen <noik00 at gmail.com>
 	* fixed the bug that `make install`/`make uninstall` wouldn't work
 

Modified: thunar-actions-plugin/trunk/INSTALL
===================================================================
--- thunar-actions-plugin/trunk/INSTALL	2008-10-08 06:32:36 UTC (rev 5534)
+++ thunar-actions-plugin/trunk/INSTALL	2008-10-08 10:37:02 UTC (rev 5535)
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
@@ -10,7 +10,10 @@
 Basic Installation
 ==================
 
-These are generic installation instructions.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -23,9 +26,9 @@
 
    It can also use an optional file (typically called `config.cache'
 and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  (Caching is
+the results of its tests to speed up reconfiguring.  Caching is
 disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
 
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
@@ -35,20 +38,17 @@
 may remove or edit it.
 
    The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
 
 The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+     `./configure' to configure the package for your system.
 
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
 
   2. Type `make' to compile the package.
 
@@ -78,7 +78,7 @@
 by setting variables in the command line or in the environment.  Here
 is an example:
 
-     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
 
    *Note Defining Variables::, for more details.
 
@@ -87,17 +87,15 @@
 
 You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory.  After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
 
 Installation Names
 ==================
@@ -190,12 +188,12 @@
      ./configure CC=/usr/local2/bin/gcc
 
 causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).  Here is a another example:
+overridden in the site shell script).
 
-     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
 
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
 
 `configure' Invocation
 ======================

Modified: thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.c
===================================================================
--- thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.c	2008-10-08 06:32:36 UTC (rev 5534)
+++ thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.c	2008-10-08 10:37:02 UTC (rev 5535)
@@ -29,21 +29,12 @@
 static void 		menu_model_finalize    		(GObject                *object);
 static void 		menu_model_init         	(Menu_Model      *model);
 static void 		menu_model_load         	(Menu_Model *menu_model);
-static void 		menu_model_event			(ThunarVfsMonitor       *monitor,
-												ThunarVfsMonitorHandle *handle,
-												ThunarVfsMonitorEvent   event,
-												ThunarVfsPath          *handle_path,
-												ThunarVfsPath          *event_path,
-												gpointer                user_data);
 												
 struct _Menu_Item
 {
 	gchar		*name;
-	/* And the thing what it's about */
-	GtkAction	*action;
 	
-	Menu_Item	*menu;
-	gpointer 	*next;
+	GList		*item;
 };
 
 struct _Menu_ModelClass
@@ -55,9 +46,7 @@
 {
   	GObject	  		 __parent__;
   	  
-  	ThunarVfsMonitor 	*monitor;
-  	GList     		*handles;
-  	GList			*handlers;
+  	GList			*entry;
 };
 
 static GObjectClass *menu_model_parent_class;
@@ -105,20 +94,6 @@
 	Menu_Model *menu_model = MENU_MODEL (object);
 	GList             *lp;
 
-	/* release the handlers */
-	g_list_foreach (menu_model->handlers, (GFunc) g_object_unref, NULL);
-	g_list_free (menu_model->handlers);
-
-	/* disconnect from the monitor (if connected) */
-	if (G_LIKELY (menu_model->monitor != NULL))
-	{
-		/* disconnect all handles and release monitor reference */
-		for (lp = menu_model->handles; lp != NULL; lp = lp->next)
-			thunar_vfs_monitor_remove (menu_model->monitor, lp->data);
-		g_object_unref (G_OBJECT (menu_model->monitor));
-		g_list_free (menu_model->handles);
-	}
-
 	(*G_OBJECT_CLASS (menu_model_parent_class)->finalize) (object);
 }
 
@@ -138,30 +113,31 @@
 
 static void menu_model_load(Menu_Model	*menu_model)
 {
-	ThunarVfsMimeApplication 	 *handler;
-  	const gchar              	 *id;
+  	//const gchar          *id;
 	gchar				**specs;
 	gchar 				 *path;
 	guint	  			  n;
-	gchar				 *file;
+	//gchar				 *file;
+	//GList				*entry;
+	XfceRc				*desktopentry;
 
 	specs = xfce_resource_match (XFCE_RESOURCE_CONFIG, "Thunar/thunar-ta/*.desktop", TRUE);
 	for (n = 0; specs[n] != NULL; ++n)
 	{
     		/* lookup the absolute path to the .desktop file */
       		path = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, specs[n]);
+      		g_message(path);
       		if (G_LIKELY (path != NULL))
         	{
-        		/* we use the filename as desktop-id */
-          		id = specs[n] + (sizeof (g_strconcat("Thunar/thunar-ta/")) - 1);
+				/* Open a .desktop entry */
+				desktopentry = xfce_rc_simple_open( path, FALSE );
 				
-          		/* try to load the .desktop file */
-          		handler = thunar_vfs_mime_application_new_from_file (path, id);
-          		if (G_LIKELY (handler != NULL))
-            	{
-              		/* add to our handler list, sorted by their desktop-ids (reverse order) */
-              		menu_model->handlers = g_list_insert_sorted (menu_model->handlers, handler, tvma_compare);
-            	}
+				/* Set the group used */
+				xfce_rc_set_group(desktopentry, "Desktop Entry");
+				
+				/* Now add the .desktop files to the GList */
+				menu_model->entry = g_list_prepend( menu_model->entry , desktopentry);
+				g_message("desktopitem added"); 								
             }
 			/* cleanup */
     		g_free (specs[n]);
@@ -175,34 +151,17 @@
                          GList          *files, 
                          GList 			*model)
 {
-	GList		*menu = NULL;
+	Menu_Item* item;
 	
-	model = menu;	
+	item->name = "blaat";
+	//(((XfceRc*)(menu_model->entry))->data)
+	
+	model = g_list_append(model, item);
+	
+	//model = menu;	
+	model = NULL;
 }
 
-static void
-menu_model_event (ThunarVfsMonitor       *monitor,
-                  ThunarVfsMonitorHandle *handle,
-                  ThunarVfsMonitorEvent   event,
-                  ThunarVfsPath          *handle_path,
-                  ThunarVfsPath          *event_path,
-                  gpointer                user_data)
-{
-	Menu_Model *menu_model = MENU_MODEL (user_data);
-
-  	/* release the previously loaded handlers */
-  	if (G_LIKELY (menu_model->handlers != NULL))
-    {
-      	g_list_foreach (menu_model->handlers, (GFunc) g_object_unref, NULL);
-      	g_list_free (menu_model->handlers);
-    	menu_model->handlers = NULL;
-    }
-
-  	/* reload the handlers for the model */
-  	menu_model_load (menu_model);
-}
-
-
 Menu_Model* menu_model_new ()
 {
 	Menu_Model* model;

Modified: thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.h
===================================================================
--- thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.h	2008-10-08 06:32:36 UTC (rev 5534)
+++ thunar-actions-plugin/trunk/thunar-actions-plugin/ta-menu-model.h	2008-10-08 10:37:02 UTC (rev 5535)
@@ -36,11 +36,9 @@
 #define MENU_MODEL_GET_CLASS(obj)  	(G_TYPE_INSTANCE_GET_CLASS ((obj), MENU_TYPE_MODEL, Menu_ModelClass))
 
 GType		 menu_model_get_type 		(void) G_GNUC_CONST;
-void		 menu_model_get_matching	(Menu_Model *menu_model, GList *files, GList *model) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+void		 menu_model_get_matching	(Menu_Model *menu_model, GList *files, GList *model);
 Menu_Model 	*menu_model_new      		() G_GNUC_MALLOC;                                	 
 
-void test();
-
 G_END_DECLS;
 
 #endif /* !__MENU_MODEL_H__ */

Modified: thunar-actions-plugin/trunk/thunar-actions-plugin/ta-provider.c
===================================================================
--- thunar-actions-plugin/trunk/thunar-actions-plugin/ta-provider.c	2008-10-08 06:32:36 UTC (rev 5534)
+++ thunar-actions-plugin/trunk/thunar-actions-plugin/ta-provider.c	2008-10-08 10:37:02 UTC (rev 5535)
@@ -136,15 +136,16 @@
 	/* check if we have a valid path here */
 	if (G_LIKELY (path != NULL))
 	{	
+		g_message("test");
 		/* A new model is parsed */
-		menu_model_get_matching(ta_provider->model, files, &model);
+		//menu_model_get_matching(ta_provider->model, files, &model);
 		if ( model != NULL)
 		{
 			/* The made model is parsed in a menu */
 			for ( ; model != NULL; model = model->next)			
 			{
 				/* Make a new menu item, and send a Glist with a layout */
-				actions = menu_action_new("naam", "label", model);		
+				//actions = menu_action_new("naam", "label", model);		
 				actions = g_list_prepend( actions, action);
 			}
 			g_message("test");
@@ -152,7 +153,7 @@
 		else
 		{
 			GClosure  *closure;
-			action = gtk_action_new ("thunar-actions-plugin::config actions", "onfigure actions", "configure actions", NULL);
+			action = gtk_action_new ("thunar-actions-plugin::config actions", "Configure actions", "configure actions", NULL);
 			closure = g_cclosure_new_object_swap (G_CALLBACK (manage_actions), G_OBJECT (window));
   			g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);
 			actions = g_list_prepend( actions, action);




More information about the Goodies-commits mailing list