[tracker] Bug 620094 - tracker-status-icon shows "search" menu item even though t-s-t is not installed.



commit 9369e5961112c59e73f6410d81a0c777b8ddf761
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 15 13:28:34 2010 +0200

    Bug 620094 - tracker-status-icon shows "search" menu item even though t-s-t is not installed.
    
    Locate application in path before showing the menu items.

 src/tracker-status-icon/tracker-status-icon.c |   40 +++++++++++++-----------
 1 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/src/tracker-status-icon/tracker-status-icon.c b/src/tracker-status-icon/tracker-status-icon.c
index a0d52f5..edb450b 100644
--- a/src/tracker-status-icon/tracker-status-icon.c
+++ b/src/tracker-status-icon/tracker-status-icon.c
@@ -816,16 +816,18 @@ status_icon_initialize_miners_menu (TrackerStatusIcon *icon)
 	priv = TRACKER_STATUS_ICON_GET_PRIVATE (icon);
 
 #if HAVE_TRACKER_SEARCH_TOOL
-	item = gtk_image_menu_item_new_with_mnemonic (_("_Search"));
-	image = gtk_image_new_from_icon_name (GTK_STOCK_FIND,
-	                                      GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-	gtk_menu_shell_append (GTK_MENU_SHELL (priv->miner_menu), item);
-	g_signal_connect (G_OBJECT (item), "activate",
-	                  G_CALLBACK (context_menu_search_cb), icon);
-
-	item = gtk_separator_menu_item_new ();
-	gtk_menu_shell_append (GTK_MENU_SHELL (priv->miner_menu), item);
+	if (g_find_program_in_path ("tracker-search-tool")) {
+		item = gtk_image_menu_item_new_with_mnemonic (_("_Search"));
+		image = gtk_image_new_from_icon_name (GTK_STOCK_FIND,
+						      GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+		gtk_menu_shell_append (GTK_MENU_SHELL (priv->miner_menu), item);
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (context_menu_search_cb), icon);
+
+		item = gtk_separator_menu_item_new ();
+		gtk_menu_shell_append (GTK_MENU_SHELL (priv->miner_menu), item);
+	}
 #endif
 
 	/* miner entries */
@@ -857,14 +859,16 @@ status_icon_create_context_menu (TrackerStatusIcon *icon)
 	menu = gtk_menu_new ();
 
 #if HAVE_TRACKER_PREFERENCES
-	item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
-	image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES,
-	                                      GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	g_signal_connect (G_OBJECT (item), "activate",
-	                  G_CALLBACK (context_menu_preferences_cb),
-	                  icon);
+	if (g_find_program_in_path ("tracker-preferences")) {
+		item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
+		image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES,
+						      GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (context_menu_preferences_cb),
+				  icon);
+	}
 #endif
 
 	/*



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