From 94e69c61684fb3da6671153ca31433d0ecc557d4 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 26 Apr 2009 07:17:48 +0000 Subject: [PATCH] Added autogen.sh Applied patches from OpenSuse git-svn-id: http://saetta.homelinux.org/svn/nautilus-search-tool/trunk@2 20f00ee0-92f8-4baf-bd23-f7db83d90979 --- ChangeLog | 7 +++++- autogen.sh | 2 +- configure.ac | 8 +++++-- src/nautilus-search-tool.c | 44 ++++++++++++++++++++++++++------------ src/nautilus-search-tool.h | 3 ++- src/search-tool.c | 2 ++ 6 files changed, 47 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9397eec..d38a2ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2009-04-26 Andrea Zagli + + * added autogen.sh (thanks to nautilus-open-terminal authors) + * applied patches from opensuse + 2009-04-12 Andrea Zagli * added turkish translation (thanks to Yavuz Selim) * fixes to work with nautilus >= 2.22 (thanks to nautilus-open-terminal authors) - * fixes to work with gnome-utils => 2.22 + * fixes to work with gnome-utils >= 2.22 * version 0.3.0 2007-07-01 Andrea Zagli diff --git a/autogen.sh b/autogen.sh index 2de1cb9..81a3731 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,7 +7,7 @@ test -z "$srcdir" && srcdir=. PKGNAME=nautilus-search-tool REQUIRED_AUTOMAKE_VERSION=1.7 -(test -f $srcdir/configure.in) || { +(test -f $srcdir/configure.ac) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level $PKG_NAME directory" exit 1 diff --git a/configure.ac b/configure.ac index f721cc1..4ac602b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,12 @@ AC_PREREQ(2.59) -AC_INIT([nautilus-search-tool], [0.3.0], [azagli@libero.it]) +AC_INIT([nautilus-search-tool], [0.3.1], [azagli@libero.it]) AC_CONFIG_SRCDIR([src/search-tool.c]) -AM_CONFIG_HEADER(config.h) +AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE +AM_MAINTAINER_MODE + NAUTILUS_REQUIRED=2.10.0 EEL_REQUIRED=2.10.0 GNOME_DESKTOP_REQUIRED=2.10.0 @@ -16,6 +18,7 @@ AC_PROG_CXX AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_INTLTOOL([0.22]) +AC_PROG_RANLIB # Check for pkg-config AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) @@ -64,6 +67,7 @@ AC_SUBST(GNOME_SEARCH_TOOL_VERSION) AC_DEFINE_UNQUOTED(GNOME_SEARCH_TOOL_VERSION, "$GNOME_SEARCH_TOOL_VERSION", [gnome-search-tool version]) # Checks for header files. +AC_CHECK_HEADERS([libintl.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/src/nautilus-search-tool.c b/src/nautilus-search-tool.c index 476a1f0..a1cb5b4 100644 --- a/src/nautilus-search-tool.c +++ b/src/nautilus-search-tool.c @@ -30,15 +30,14 @@ #include #include -#include -#include -#include -#include +//#include +//#include static void nautilus_search_tool_instance_init (NautilusSearchTool *cvs); static void nautilus_search_tool_class_init (NautilusSearchToolClass *class); static GType search_tool_type = 0; +static gchar *gnome_search_tool = NULL; static void search_tool_callback (NautilusMenuItem *item, @@ -57,11 +56,18 @@ search_tool_callback (NautilusMenuItem *item, { if (strcmp (nautilus_file_info_get_uri_scheme (file_info), "x-nautilus-desktop") == 0) { - working_directory = g_strdup_printf ("%s/Desktop", g_get_home_dir ()); + working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)); } else { working_directory = g_filename_from_uri (uri, NULL, NULL); + if (!nautilus_file_info_is_directory (file_info)) { + gchar *tmp; + + tmp = g_path_get_dirname (working_directory); + g_free (working_directory); + working_directory = tmp; + } } } else @@ -69,17 +75,14 @@ search_tool_callback (NautilusMenuItem *item, working_directory = g_strdup (g_get_home_dir ()); } - if (!nautilus_file_info_is_directory (file_info)) - working_directory = g_path_get_dirname (working_directory); - g_free (uri); - argv[0] = g_strdup ("gnome-search-tool"); + argv[0] = gnome_search_tool; quoted_directory = g_shell_quote (working_directory); #ifdef GNOME_SEARCH_TOOL_VERSION guint i; - gchar *version; + gchar *version = NULL; gchar **array_version = g_strsplit (GNOME_SEARCH_TOOL_VERSION, " ", -1); guint array_lenght = g_strv_length (array_version); @@ -92,6 +95,7 @@ search_tool_callback (NautilusMenuItem *item, g_strfreev (array_version); array_version = g_strsplit (version, ".", -1); + g_free (version); break; } } @@ -106,16 +110,15 @@ search_tool_callback (NautilusMenuItem *item, argv[2] = NULL; } - g_free (version); g_strfreev (array_version); #else argv[1] = NULL; -#endif /* GNOME_SEARCH_TOOL */ +#endif /* GNOME_SEARCH_TOOL_VERSION */ g_spawn_async (working_directory, argv, NULL, - G_SPAWN_SEARCH_PATH, + 0, NULL, NULL, NULL, @@ -123,7 +126,6 @@ search_tool_callback (NautilusMenuItem *item, g_free (quoted_directory); g_free (working_directory); - g_free (argv[0]); g_free (argv[1]); } @@ -142,6 +144,8 @@ nautilus_search_tool_get_background_items (NautilusMenuProvider *provider, NautilusFileInfo *file_info) { NautilusMenuItem *item; + if (!gnome_search_tool) + return NULL; item = search_tool_menu_item_new (); g_signal_connect (item, "activate", @@ -158,6 +162,9 @@ nautilus_search_tool_get_file_items (NautilusMenuProvider *provider, { NautilusMenuItem *item; + if (!gnome_search_tool) + return NULL; + if (g_list_length (files) != 1) return NULL; @@ -222,4 +229,13 @@ nautilus_search_tool_register_type (GTypeModule *module) search_tool_type, NAUTILUS_TYPE_MENU_PROVIDER, &menu_provider_iface_info); + + gnome_search_tool = g_find_program_in_path ("gnome-search-tool"); +} + +void +nautilus_search_tool_free (void) +{ + g_free (gnome_search_tool); + gnome_search_tool = NULL; } diff --git a/src/nautilus-search-tool.h b/src/nautilus-search-tool.h index 889c9fd..89ca3bf 100644 --- a/src/nautilus-search-tool.h +++ b/src/nautilus-search-tool.h @@ -47,7 +47,8 @@ struct _NautilusSearchToolClass { }; GType nautilus_search_tool_get_type (void); -void nautilus_search_tool_register_type (GTypeModule *module); +void nautilus_search_tool_register_type (GTypeModule *module); +void nautilus_search_tool_free (void); G_END_DECLS diff --git a/src/search-tool.c b/src/search-tool.c index 2c5b0be..9d56db5 100644 --- a/src/search-tool.c +++ b/src/search-tool.c @@ -47,6 +47,8 @@ void nautilus_module_shutdown (void) { g_print ("Shutting down nautilus-search-tool extension\n"); + + nautilus_search_tool_free (); } void -- 2.49.0