[nautilus-actions: 15/19] Remove obsoleted files



commit 07270d55b49fc02ce9b4e1f4b0cf4a68e238fa78
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Jun 9 22:16:01 2009 +0200

    Remove obsoleted files
---
 ChangeLog                           |    7 +
 src/plugin/Makefile.am              |    4 -
 src/plugin/nautilus-actions-test.c  |  275 -----------------------------------
 src/plugin/nautilus-actions-test.h  |   42 ------
 src/plugin/nautilus-actions-utils.c |  186 -----------------------
 src/plugin/nautilus-actions-utils.h |   42 ------
 src/plugin/nautilus-actions.c       |    1 -
 7 files changed, 7 insertions(+), 550 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 31a1d01..45cd2e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,13 @@
 	Fix #580378 (context menu doesn't update) reported by James Campos.
 	Cleanup the code.
 
+	* src/plugin/nautilus-actions-test.c:
+	* src/plugin/nautilus-actions-test.h:
+	* src/plugin/nautilus-actions-utils.c:
+	* src/plugin/nautilus-actions-utils.h:
+	Removed files as functions are now integrated in NactActionProfile
+	class.
+
 2009-06-08 Pierre Wieser <pwieser trychlos org>
 
 	* src/common/nact-action-profile.c:
diff --git a/src/plugin/Makefile.am b/src/plugin/Makefile.am
index 1e40bea..c31da7d 100644
--- a/src/plugin/Makefile.am
+++ b/src/plugin/Makefile.am
@@ -40,10 +40,6 @@ libnautilus_actions_la_SOURCES = \
 	nautilus-module.c									\
 	nautilus-actions.c									\
 	nautilus-actions.h									\
-	nautilus-actions-test.c								\
-	nautilus-actions-test.h								\
-	nautilus-actions-utils.c							\
-	nautilus-actions-utils.h							\
 	$(NULL)
 
 libnautilus_actions_la_LDFLAGS = -module -avoid-version
diff --git a/src/plugin/nautilus-actions-test.c b/src/plugin/nautilus-actions-test.c
deleted file mode 100644
index 27a6f39..0000000
--- a/src/plugin/nautilus-actions-test.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Nautilus Actions
- * A Nautilus extension which offers configurable context menu actions.
- *
- * Copyright (C) 2005 The GNOME Foundation
- * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
- * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
- *
- * 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 Library; see the file COPYING.  If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307, USA.
- *
- * Authors:
- *   Frederic Ruaudel <grumz grumz net>
- *   Rodrigo Moya <rodrigo gnome-db org>
- *   Pierre Wieser <pwieser trychlos org>
- *   ... and many others (see AUTHORS)
- */
-
-#include <libnautilus-extension/nautilus-file-info.h>
-#include <string.h>
-
-#include "nautilus-actions-test.h"
-
-static int nautilus_actions_test_check_scheme (GSList* schemes2test, NautilusFileInfo* file)
-{
-	int retv = 0;
-	GSList* iter;
-	gboolean found = FALSE;
-
-	iter = schemes2test;
-	while (iter && !found)
-	{
-		gchar* scheme = nautilus_file_info_get_uri_scheme (file);
-
-		if (g_ascii_strncasecmp (scheme, (gchar*)iter->data, strlen ((gchar*)iter->data)) == 0)
-		{
-			found = TRUE;
-			retv = 1;
-		}
-
-		g_free (scheme);
-		iter = iter->next;
-	}
-
-	return retv;
-}
-
-gboolean nautilus_actions_test_validate (NautilusActionsConfigActionProfile *action_profile, GList* files)
-{
-	gboolean retv = FALSE;
-	gboolean test_multiple_file = FALSE;
-	gboolean test_file_type = FALSE;
-	gboolean test_scheme = FALSE;
-	gboolean test_basename = FALSE;
-	gboolean test_mimetype = FALSE;
-	GList* glob_patterns = NULL;
-	GList* glob_mime_patterns = NULL;
-	GSList* iter;
-	GList* iter1;
-	GList* iter2;
-	guint dir_count = 0;
-	guint file_count = 0;
-	guint total_count = 0;
-	guint scheme_ok_count = 0;
-	guint glob_ok_count = 0;
-	guint mime_glob_ok_count = 0;
-	gboolean basename_match_ok = FALSE;
-	gboolean mimetype_match_ok = FALSE;
-
-	if (action_profile->basenames && action_profile->basenames->next != NULL &&
-			g_ascii_strcasecmp ((gchar*)(action_profile->basenames->data), "*") == 0)
-	{
-		/* if the only pattern is '*' then all files will match, so it
-		 * is not necessary to make the test for each of them
-		 */
-		test_basename = TRUE;
-	}
-	else
-	{
-		for (iter = action_profile->basenames; iter; iter = iter->next)
-		{
-			gchar* tmp_pattern = (gchar*)iter->data;
-			if (!action_profile->match_case)
-			{
-				/* --> if case-insensitive asked, lower all the string
-				 * since the pattern matching function don't manage it
-				 * itself.
-				 */
-				tmp_pattern = g_ascii_strdown ((gchar*)iter->data, strlen ((gchar*)iter->data));
-			}
-
-			glob_patterns = g_list_append (glob_patterns, g_pattern_spec_new (tmp_pattern));
-
-			if (!action_profile->match_case)
-			{
-				g_free (tmp_pattern);
-			}
-		}
-	}
-
-	if (action_profile->mimetypes && action_profile->mimetypes->next != NULL &&
-			(g_ascii_strcasecmp ((gchar*)(action_profile->mimetypes->data), "*") == 0 ||
-			 g_ascii_strcasecmp ((gchar*)(action_profile->mimetypes->data), "*/*") == 0))
-	{
-		/* if the only pattern is '*' or * / * then all mimetypes will
-		 * match, so it is not necessary to make the test for each of them
-		 */
-		test_mimetype = TRUE;
-	}
-	else
-	{
-		for (iter = action_profile->mimetypes; iter; iter = iter->next)
-		{
-			glob_mime_patterns = g_list_append (glob_mime_patterns, g_pattern_spec_new ((gchar*)iter->data));
-		}
-	}
-
-	for (iter1 = files; iter1; iter1 = iter1->next)
-	{
-		gchar* tmp_filename = nautilus_file_info_get_name ((NautilusFileInfo *)iter1->data);
-
-		if (tmp_filename)
-		{
-			gchar* tmp_mimetype = nautilus_file_info_get_mime_type ((NautilusFileInfo *)iter1->data);
-
-			if (!action_profile->match_case)
-			{
-				/* --> if case-insensitive asked, lower all the string
-				 * since the pattern matching function don't manage it
-				 * itself.
-				 */
-				gchar* tmp_filename2 = g_ascii_strdown (tmp_filename, strlen (tmp_filename));
-				g_free (tmp_filename);
-				tmp_filename = tmp_filename2;
-			}
-
-			/* --> for the moment we deal with all mimetypes case-insensitively */
-			gchar* tmp_mimetype2 = g_ascii_strdown (tmp_mimetype, strlen (tmp_mimetype));
-			g_free (tmp_mimetype);
-			tmp_mimetype = tmp_mimetype2;
-
-			if (nautilus_file_info_is_directory ((NautilusFileInfo *)iter1->data))
-			{
-				dir_count++;
-			}
-			else
-			{
-				file_count++;
-			}
-
-			scheme_ok_count += nautilus_actions_test_check_scheme (action_profile->schemes, (NautilusFileInfo*)iter1->data);
-
-			if (!test_basename) /* if it is already ok, skip the test to improve performance */
-			{
-				basename_match_ok = FALSE;
-				iter2 = glob_patterns;
-				while (iter2 && !basename_match_ok)
-				{
-					if (g_pattern_match_string ((GPatternSpec*)iter2->data, tmp_filename))
-					{
-						basename_match_ok = TRUE;
-					}
-					iter2 = iter2->next;
-				}
-
-				if (basename_match_ok)
-				{
-					glob_ok_count++;
-				}
-			}
-
-			if (!test_mimetype) /* if it is already ok, skip the test to improve performance */
-			{
-				mimetype_match_ok = FALSE;
-				iter2 = glob_mime_patterns;
-				while (iter2 && !mimetype_match_ok)
-				{
-					if (g_pattern_match_string ((GPatternSpec*)iter2->data, tmp_mimetype))
-					{
-						mimetype_match_ok = TRUE;
-					}
-					iter2 = iter2->next;
-				}
-
-				if (mimetype_match_ok)
-				{
-					mime_glob_ok_count++;
-				}
-			}
-
-			g_free (tmp_mimetype);
-			g_free (tmp_filename);
-
-		}
-
-		total_count++;
-	}
-
-	if ((files != NULL) && (files->next == NULL) && (!action_profile->accept_multiple_files))
-	{
-		test_multiple_file = TRUE;
-	}
-	else if (action_profile->accept_multiple_files)
-	{
-		test_multiple_file = TRUE;
-	}
-
-	if (action_profile->is_dir && action_profile->is_file)
-	{
-		if (dir_count > 0 || file_count > 0)
-		{
-			test_file_type = TRUE;
-		}
-	}
-	else if (action_profile->is_dir && !action_profile->is_file)
-	{
-		if (file_count == 0)
-		{
-			test_file_type = TRUE;
-		}
-	}
-	else if (!action_profile->is_dir && action_profile->is_file)
-	{
-		if (dir_count == 0)
-		{
-			test_file_type = TRUE;
-		}
-	}
-
-	if (scheme_ok_count == total_count)
-	{
-		test_scheme = TRUE;
-	}
-
-
-	if (!test_basename) /* if not already tested */
-	{
-		if (glob_ok_count == total_count)
-		{
-			test_basename = TRUE;
-		}
-	}
-
-	if (!test_mimetype) /* if not already tested */
-	{
-		if (mime_glob_ok_count == total_count)
-		{
-			test_mimetype = TRUE;
-		}
-	}
-
-	if (test_basename && test_mimetype && test_file_type && test_scheme && test_multiple_file)
-	{
-		retv = TRUE;
-	}
-
-	g_list_foreach (glob_patterns, (GFunc) g_pattern_spec_free, NULL);
-	g_list_free (glob_patterns);
-	g_list_foreach (glob_mime_patterns, (GFunc) g_pattern_spec_free, NULL);
-	g_list_free (glob_mime_patterns);
-
-	return retv;
-}
diff --git a/src/plugin/nautilus-actions-test.h b/src/plugin/nautilus-actions-test.h
deleted file mode 100644
index 9bca772..0000000
--- a/src/plugin/nautilus-actions-test.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Nautilus Actions
- * A Nautilus extension which offers configurable context menu actions.
- *
- * Copyright (C) 2005 The GNOME Foundation
- * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
- * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
- *
- * 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 Library; see the file COPYING.  If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307, USA.
- *
- * Authors:
- *   Frederic Ruaudel <grumz grumz net>
- *   Rodrigo Moya <rodrigo gnome-db org>
- *   Pierre Wieser <pwieser trychlos org>
- *   ... and many others (see AUTHORS)
- */
-
-#ifndef __NAUTILUS_ACTIONS_TEST_H__
-#define __NAUTILUS_ACTIONS_TEST_H__
-
-#include <common/nautilus-actions-config.h>
-
-G_BEGIN_DECLS
-
-gboolean nautilus_actions_test_validate (NautilusActionsConfigActionProfile *action_profile, GList* files);
-
-G_END_DECLS
-
-#endif /* __NAUTILUS_ACTIONS_TEST_H__ */
diff --git a/src/plugin/nautilus-actions-utils.c b/src/plugin/nautilus-actions-utils.c
deleted file mode 100644
index 349b137..0000000
--- a/src/plugin/nautilus-actions-utils.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Nautilus Actions
- * A Nautilus extension which offers configurable context menu actions.
- *
- * Copyright (C) 2005 The GNOME Foundation
- * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
- * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
- *
- * 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 Library; see the file COPYING.  If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307, USA.
- *
- * Authors:
- *   Frederic Ruaudel <grumz grumz net>
- *   Rodrigo Moya <rodrigo gnome-db org>
- *   Pierre Wieser <pwieser trychlos org>
- *   ... and many others (see AUTHORS)
- */
-
-#include <glib.h>
-#include <string.h>
-/*#include <libgnomevfs/gnome-vfs-file-info.h>*/
-#include <libnautilus-extension/nautilus-file-info.h>
-#include <libgnomevfs/gnome-vfs.h>
-
-#include "nautilus-actions-utils.h"
-
-gchar* nautilus_actions_utils_parse_parameter (const gchar* param_template, GList* files)
-{
-	/*
-	 * Valid parameters :
-	 *
-	 * %u : gnome-vfs URI
-	 * %d : base dir of the selected file(s)/folder(s)
-	 * %f : the name of the selected file/folder or the 1st one if many are selected
-	 * %m : list of the basename of the selected files/directories separated by space.
-	 * %M : list of the selected files/directories with their complete path separated by space.
-	 * %s : scheme of the gnome-vfs URI
-	 * %h : hostname of the gnome-vfs URI
-	 * %U : username of the gnome-vfs URI
-	 * %% : a percent sign
-	 *
-	 */
-	gchar* retv = NULL;
-
-	if (files != NULL)
-	{
-		GString* tmp_string = g_string_new ("");
-		gchar* iter = g_strdup (param_template);
-		gchar* old_iter = iter;
-		/*int current_len = strlen (iter);*/
-		gchar* uri = nautilus_file_info_get_uri ((NautilusFileInfo*)files->data);
-		GnomeVFSURI* gvfs_uri = gnome_vfs_uri_new (uri);
-		gchar* filename;
-		gchar* dirname;
-		gchar* scheme = nautilus_file_info_get_uri_scheme ((NautilusFileInfo*)files->data);
-		gchar* hostname = g_strdup (gnome_vfs_uri_get_host_name (gvfs_uri));
-		gchar* username = g_strdup (gnome_vfs_uri_get_user_name (gvfs_uri));
-		gchar* file_list;
-		gchar* path_file_list;
-		GList* file_iter = NULL;
-		GString* tmp_file_list;
-		GString* tmp_path_file_list;
-		gchar* tmp;
-		gchar* tmp2;
-
-		tmp = gnome_vfs_uri_extract_dirname (gvfs_uri);
-		dirname = (gchar*)gnome_vfs_unescape_string ((const gchar*)tmp, "");
-		g_free (tmp);
-
-		tmp = nautilus_file_info_get_name ((NautilusFileInfo*)files->data);
-		if (!tmp)
-		{
-			tmp = g_strdup ("");
-		}
-
-		filename = g_shell_quote (tmp);
-		tmp2 = g_build_path ("/", dirname, tmp, NULL);
-		g_free (tmp);
-		tmp_file_list = g_string_new (filename);
-		tmp = g_shell_quote (tmp2);
-		tmp_path_file_list = g_string_new (tmp);
-		g_free (tmp2);
-		g_free (tmp);
-
-		/* We already have the first item, so we start with the next one if any */
-		for (file_iter = files->next; file_iter; file_iter = file_iter->next)
-		{
-			gchar* tmp_filename = nautilus_file_info_get_name ((NautilusFileInfo*)file_iter->data);
-			gchar* tmp_uri = nautilus_file_info_get_uri ((NautilusFileInfo*)file_iter->data);
-			GnomeVFSURI* tmp_gvfs_uri = gnome_vfs_uri_new (tmp_uri);
-			tmp = gnome_vfs_uri_extract_dirname (tmp_gvfs_uri);
-			gchar* tmp_dirname = (gchar*)gnome_vfs_unescape_string ((const gchar*)tmp, "");
-			g_free (tmp);
-
-			if (!tmp_filename)
-			{
-				tmp_filename = g_strdup ("");
-			}
-
-			gchar* quoted_tmp_filename = g_shell_quote (tmp_filename);
-			g_string_append_printf (tmp_file_list, " %s", quoted_tmp_filename);
-
-			tmp = g_build_path ("/", tmp_dirname, tmp_filename, NULL);
-			tmp2 = g_shell_quote (tmp);
-			g_string_append_printf (tmp_path_file_list, " %s", tmp2);
-
-			g_free (tmp2);
-			g_free (tmp);
-			g_free (tmp_filename);
-			g_free (quoted_tmp_filename);
-			g_free (tmp_dirname);
-			g_free (tmp_uri);
-			gnome_vfs_uri_unref (tmp_gvfs_uri);
-		}
-		file_list = g_string_free (tmp_file_list, FALSE);
-		path_file_list = g_string_free (tmp_path_file_list, FALSE);
-
-
-		while ((iter = g_strstr_len (iter, strlen (iter), "%")))
-		{
-			tmp_string = g_string_append_len (tmp_string, old_iter, strlen (old_iter) - strlen (iter));
-			switch (iter[1])
-			{
-				case 'u': /* gnome-vfs URI */
-					tmp_string = g_string_append (tmp_string, uri);
-					break;
-				case 'd': /* base dir of the selected file(s)/folder(s) */
-					tmp = g_shell_quote (dirname);
-					tmp_string = g_string_append (tmp_string, tmp);
-					g_free (tmp);
-					break;
-				case 'f': /* the basename of the selected file/folder or the 1st one if many are selected */
-					tmp_string = g_string_append (tmp_string, filename);
-					break;
-				case 'm': /* list of the basename of the selected files/directories separated by space */
-					tmp_string = g_string_append (tmp_string, file_list);
-					break;
-	 			case 'M': /* list of the selected files/directories with their complete path separated by space. */
-					tmp_string = g_string_append (tmp_string, path_file_list);
-					break;
-				case 's': /* scheme of the gnome-vfs URI */
-					tmp_string = g_string_append (tmp_string, scheme);
-					break;
-				case 'h': /* hostname of the gnome-vfs URI */
-					tmp_string = g_string_append (tmp_string, hostname);
-					break;
-				case 'U': /* username of the gnome-vfs URI */
-					tmp_string = g_string_append (tmp_string, username);
-					break;
-				case '%': /* a percent sign */
-					tmp_string = g_string_append_c (tmp_string, '%');
-					break;
-			}
-			iter+=2; /* skip the % sign and the character after. */
-			old_iter = iter; /* store the new start of the string */
-		}
-		tmp_string = g_string_append_len (tmp_string, old_iter, strlen (old_iter));
-
-		g_free (uri);
-		g_free (dirname);
-		g_free (filename);
-		g_free (file_list);
-		g_free (path_file_list);
-		g_free (scheme);
-		g_free (hostname);
-		g_free (username);
-		g_free (iter);
-		gnome_vfs_uri_unref (gvfs_uri);
-
-		retv = g_string_free (tmp_string, FALSE); /* return the content of the GString */
-	}
-
-	return retv;
-}
diff --git a/src/plugin/nautilus-actions-utils.h b/src/plugin/nautilus-actions-utils.h
deleted file mode 100644
index feb1ccb..0000000
--- a/src/plugin/nautilus-actions-utils.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Nautilus Actions
- * A Nautilus extension which offers configurable context menu actions.
- *
- * Copyright (C) 2005 The GNOME Foundation
- * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
- * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
- *
- * 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 Library; see the file COPYING.  If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307, USA.
- *
- * Authors:
- *   Frederic Ruaudel <grumz grumz net>
- *   Rodrigo Moya <rodrigo gnome-db org>
- *   Pierre Wieser <pwieser trychlos org>
- *   ... and many others (see AUTHORS)
- */
-
-#ifndef __NAUTILUS_ACTIONS_UTILS_H__
-#define __NAUTILUS_ACTIONS_UTILS_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-gchar* nautilus_actions_utils_parse_parameter (const gchar* param_template, GList* files);
-
-G_END_DECLS
-
-#endif /* __NAUTILUS_ACTIONS_UTILS_H__ */
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 04286ff..d003887 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -238,7 +238,6 @@ instance_dispose( GObject *object )
 		self->private->dispose_has_run = TRUE;
 
 		g_object_unref( self->private->pivot );
-		g_object_unref( self->private->configs );
 
 		/* chain up to the parent class */
 		G_OBJECT_CLASS( st_parent_class )->dispose( object );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]