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
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)
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
#include <libnautilus-extension/nautilus-menu-provider.h>
#include <glib/gi18n-lib.h>
-#include <gtk/gtkicontheme.h>
-#include <gtk/gtkwidget.h>
-#include <gconf/gconf-client.h>
-#include <libgnome/gnome-desktop-item.h>
+//#include <gtk/gtkicontheme.h>
+//#include <gtk/gtkwidget.h>
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,
{
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
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);
g_strfreev (array_version);
array_version = g_strsplit (version, ".", -1);
+ g_free (version);
break;
}
}
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,
g_free (quoted_directory);
g_free (working_directory);
- g_free (argv[0]);
g_free (argv[1]);
}
NautilusFileInfo *file_info)
{
NautilusMenuItem *item;
+ if (!gnome_search_tool)
+ return NULL;
item = search_tool_menu_item_new ();
g_signal_connect (item, "activate",
{
NautilusMenuItem *item;
+ if (!gnome_search_tool)
+ return NULL;
+
if (g_list_length (files) != 1)
return NULL;
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;
}