[tracker] Fixes GB#618707: tracker preferences shows notification area options even when status icon isn't bui



commit fbb60a93ea148c437eca29d52e25d5db081f4c5b
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Mon May 17 17:27:40 2010 +0200

    Fixes GB#618707: tracker preferences shows notification area options even when status icon isn't built

 configure.ac                                     |   17 +++++++++++++++--
 src/tracker-preferences/Makefile.am              |    1 +
 src/tracker-preferences/config.vapi              |    1 +
 src/tracker-preferences/tracker-preferences.vala |   11 +++++++++++
 src/tracker-status-icon/tracker-status-icon.c    |    8 ++++----
 5 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e3a043a..2b196dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1014,6 +1014,9 @@ if test "x$enable_tracker_status_icon" = "xyes"; then
    if test "x$have_tracker_status_icon" != "xyes"; then
       AC_MSG_ERROR([Couldn't find tracker-status-icon dependencies ($APP_REQUIREMENTS).])
    fi
+   AC_DEFINE(HAVE_TRACKER_STATUS_ICON, [1], [Define to 1 if status icon is compiled])
+else
+   AC_DEFINE(HAVE_TRACKER_STATUS_ICON, [0], [Define to 0 if status icon is not compiled])
 fi
 
 AM_CONDITIONAL(HAVE_TRACKER_STATUS_ICON, test "$have_tracker_status_icon" = "yes")
@@ -1042,6 +1045,9 @@ if test "x$enable_tracker_explorer" = "xyes"; then
    if test "x$have_tracker_explorer" != "xyes"; then
       AC_MSG_ERROR([Couldn't find tracker-explorer dependencies ($APP_REQUIREMENTS $VALA_REQUIREMENTS).])
    fi
+   AC_DEFINE(HAVE_TRACKER_EXPLORER, [1], [Define to 1 if tracker explorer is compiled])
+else
+   AC_DEFINE(HAVE_TRACKER_EXPLORER, [0], [Define to 0 if tracker explorer is not compiled])
 fi
 
 AM_CONDITIONAL(HAVE_TRACKER_EXPLORER, test "$have_tracker_explorer" = "yes")
@@ -1070,6 +1076,9 @@ if test "x$enable_tracker_search_bar" = "xyes"; then
    if test "x$have_tracker_search_bar" != "xyes"; then
       AC_MSG_ERROR([Couldn't find tracker-search-bar dependencies ($APP_REQUIREMENTS $APPLET_REQUIREMENTS).])
    fi
+   AC_DEFINE(HAVE_TRACKER_SEARCH_BAR, [1], [Define to 1 if t-s-b is compiled])
+else
+   AC_DEFINE(HAVE_TRACKER_SEARCH_BAR, [0], [Define to 0 if t-s-b is not compiled])
 fi
 
 AM_CONDITIONAL(HAVE_TRACKER_SEARCH_BAR, test "$have_tracker_search_bar" = "yes")
@@ -1089,7 +1098,6 @@ if test "x$enable_tracker_search_tool" != "xno"; then
       have_tracker_search_tool="no"
    else
       have_tracker_search_tool="yes"
-      AC_DEFINE(HAVE_TRACKER_SEARCH_TOOL, [], [Define if t-s-t is compiled])
    fi
 else
    have_tracker_search_tool="no  (disabled)"
@@ -1099,6 +1107,9 @@ if test "x$enable_tracker_search_tool" = "xyes"; then
    if test "x$have_tracker_search_tool" != "xyes"; then
       AC_MSG_ERROR([Couldn't find tracker-search-tool dependencies ($APP_REQUIREMENTS $VALA_REQUIREMENTS).])
    fi
+   AC_DEFINE(HAVE_TRACKER_SEARCH_TOOL, [1], [Define to 1 if t-s-t is compiled])
+else
+   AC_DEFINE(HAVE_TRACKER_SEARCH_TOOL, [0], [Define to 0 if t-s-t is not compiled])
 fi
 
 AM_CONDITIONAL(HAVE_TRACKER_SEARCH_TOOL, test "$have_tracker_search_tool" = "yes")
@@ -1117,7 +1128,6 @@ if test "x$enable_tracker_preferences" != "xno" ; then
       have_tracker_preferences="no"
    else
       have_tracker_preferences="yes"
-      AC_DEFINE(HAVE_TRACKER_PREFERENCES, [], [Define if tracker-preferences is compiled])
    fi
 else
    have_tracker_preferences="no  (disabled)"
@@ -1127,6 +1137,9 @@ if test "x$enable_tracker_preferences" = "xyes"; then
    if test "x$have_tracker_preferences" != "xyes"; then
       AC_MSG_ERROR([Couldn't find tracker-preferences dependencies ($APP_REQUIREMENTS).])
    fi
+   AC_DEFINE(HAVE_TRACKER_PREFERENCES, [1], [Define to 1 if tracker preferences is compiled])
+else
+   AC_DEFINE(HAVE_TRACKER_PREFERENCES, [0], [Define to 0 if tracker preferences is not compiled])
 fi
 
 AM_CONDITIONAL(HAVE_TRACKER_PREFERENCES, test "$have_tracker_preferences" = "yes")
diff --git a/src/tracker-preferences/Makefile.am b/src/tracker-preferences/Makefile.am
index 71d7468..585b4a8 100644
--- a/src/tracker-preferences/Makefile.am
+++ b/src/tracker-preferences/Makefile.am
@@ -17,6 +17,7 @@ INCLUDES = 								\
 	-DTRACKER_COMPILATION 						\
 	-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"			\
 	-I$(top_srcdir)/src						\
+	-I$(top_builddir)						\
 	$(TRACKER_APPS_CFLAGS)						\
 	$(WARN_CFLAGS)							\
 	$(GCOV_CFLAGS)
diff --git a/src/tracker-preferences/config.vapi b/src/tracker-preferences/config.vapi
index f46e084..e0ebb0d 100644
--- a/src/tracker-preferences/config.vapi
+++ b/src/tracker-preferences/config.vapi
@@ -1,2 +1,3 @@
 [CCode (cheader_filename = "config.h")]
 public const string TRACKER_DATADIR;
+public const bool HAVE_TRACKER_STATUS_ICON;
diff --git a/src/tracker-preferences/tracker-preferences.vala b/src/tracker-preferences/tracker-preferences.vala
index bbc9ba2..3921f27 100644
--- a/src/tracker-preferences/tracker-preferences.vala
+++ b/src/tracker-preferences/tracker-preferences.vala
@@ -50,6 +50,7 @@ public static TreeView treeview_ignored_directories;
 public static TreeView treeview_ignored_directories_with_content;
 public static TreeView treeview_ignored_files;
 public static ToggleButton togglebutton_home;
+public static Notebook notebook;
 public static RadioButton radiobutton_display_never;
 public static RadioButton radiobutton_display_active;
 public static RadioButton radiobutton_display_always;
@@ -368,11 +369,21 @@ static int main (string[] args) {
 		hscale_throttle.set_value ((double) config.throttle);
 		togglebutton_home = builder.get_object ("togglebutton_home") as ToggleButton;
 
+		notebook = builder.get_object ("notebook") as Notebook;
+
 		radiobutton_display_never = builder.get_object ("radiobutton_display_never") as RadioButton;
 		radiobutton_display_active = builder.get_object ("radiobutton_display_active") as RadioButton;
 		radiobutton_display_always = builder.get_object ("radiobutton_display_always") as RadioButton;
 		initialize_visibility_radiobutton ();
 
+		/* Note: if the General tab ever has more config parameters than those
+		 *  of the status icon, then don't remove the page, just the status-icon
+		 *  related parameters */
+		if (!HAVE_TRACKER_STATUS_ICON) {
+			/* Page #0 is the Contents page */
+			notebook.remove_page (0);
+		}
+
 		treeview_index_recursively = builder.get_object ("treeview_index_recursively") as TreeView;
 		treeview_index_single = builder.get_object ("treeview_index_single") as TreeView;
 		treeview_ignored_directories = builder.get_object ("treeview_ignored_directories") as TreeView;
diff --git a/src/tracker-status-icon/tracker-status-icon.c b/src/tracker-status-icon/tracker-status-icon.c
index 0191aa7..69694af 100644
--- a/src/tracker-status-icon/tracker-status-icon.c
+++ b/src/tracker-status-icon/tracker-status-icon.c
@@ -709,7 +709,7 @@ context_menu_pause_cb (GtkMenuItem *item,
 	update_icon_status (icon);
 }
 
-#ifdef HAVE_TRACKER_SEARCH_TOOL
+#if HAVE_TRACKER_SEARCH_TOOL
 static void
 context_menu_search_cb (GtkMenuItem *item,
                         gpointer     user_data)
@@ -719,7 +719,7 @@ context_menu_search_cb (GtkMenuItem *item,
 }
 #endif
 
-#ifdef HAVE_TRACKER_PREFERENCES
+#if HAVE_TRACKER_PREFERENCES
 static void
 context_menu_preferences_cb (GtkMenuItem *item,
                              gpointer     user_data)
@@ -839,7 +839,7 @@ status_icon_create_context_menu (TrackerStatusIcon *icon)
 	item = gtk_separator_menu_item_new ();
 	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 
-#ifdef HAVE_TRACKER_SEARCH_TOOL
+#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);
@@ -849,7 +849,7 @@ status_icon_create_context_menu (TrackerStatusIcon *icon)
 	                  G_CALLBACK (context_menu_search_cb), icon);
 #endif
 
-#ifdef HAVE_TRACKER_PREFERENCES
+#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);



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