File nautilus-search-tool-hide-when-unavailable.patch of Package nautilus-search-tool

Index: nautilus-search-tool-0.3.0/src/nautilus-search-tool.c
===================================================================
--- nautilus-search-tool-0.3.0.orig/src/nautilus-search-tool.c
+++ nautilus-search-tool-0.3.0/src/nautilus-search-tool.c
@@ -39,6 +39,7 @@ static void nautilus_search_tool_instanc
 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,
@@ -72,7 +73,7 @@ search_tool_callback (NautilusMenuItem *
 
 	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
@@ -113,7 +114,7 @@ search_tool_callback (NautilusMenuItem *
 	g_spawn_async (working_directory,
 	               argv,
 	               NULL,
-	               G_SPAWN_SEARCH_PATH,
+	               0,
 	               NULL,
 	               NULL,
 	               NULL,
@@ -121,7 +122,6 @@ search_tool_callback (NautilusMenuItem *
 
 	g_free (quoted_directory);
 	g_free (working_directory);
-	g_free (argv[0]);
 	g_free (argv[1]);
 }
 
@@ -141,6 +141,9 @@ nautilus_search_tool_get_background_item
 {
 	NautilusMenuItem *item;
 
+	if (!gnome_search_tool)
+		return NULL;
+
 	item = search_tool_menu_item_new ();
 	g_signal_connect (item, "activate",
 	                  G_CALLBACK (search_tool_callback),
@@ -156,6 +159,9 @@ nautilus_search_tool_get_file_items (Nau
 {
 	NautilusMenuItem *item;
 
+	if (!gnome_search_tool)
+		return NULL;
+
 	if (g_list_length (files) != 1)
 		return NULL;
 
@@ -220,4 +226,13 @@ nautilus_search_tool_register_type (GTyp
 	                             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;
 }
Index: nautilus-search-tool-0.3.0/src/nautilus-search-tool.h
===================================================================
--- nautilus-search-tool-0.3.0.orig/src/nautilus-search-tool.h
+++ nautilus-search-tool-0.3.0/src/nautilus-search-tool.h
@@ -48,6 +48,7 @@ struct _NautilusSearchToolClass {
 
 GType nautilus_search_tool_get_type (void);
 void  nautilus_search_tool_register_type (GTypeModule *module);
+void  nautilus_search_tool_free (void);
 
 G_END_DECLS
 
Index: nautilus-search-tool-0.3.0/src/search-tool.c
===================================================================
--- nautilus-search-tool-0.3.0.orig/src/search-tool.c
+++ nautilus-search-tool-0.3.0/src/search-tool.c
@@ -44,6 +44,7 @@ nautilus_module_initialize (GTypeModule
 void
 nautilus_module_shutdown (void)
 {
+	nautilus_search_tool_free ();
 }
 
 void
openSUSE Build Service is sponsored by