[Nautilus-list] Patch to reenable the search feature



I ported medusa to gnome2 recently (not committed yet, patch at
http://www.unfactored.org/~jsh/patches/medusa-patch), and I just
rearranged some ifdefs in nautilus to reenable the search ui

The search list view still needs some work to make it comparable to
nautilus 1. E.g. there's no "Where" column currently, and for some
reason details only fill in after their file has been selected. I also
had to patch gtk to make either of the list views work, see bug #70152

I've tested this with and without medusa being installed, and it seems
to work fine in both cases (modulo the above observations)

	John

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4968
diff -u -p -r1.4968 ChangeLog
--- ChangeLog	2002/01/30 22:33:30	1.4968
+++ ChangeLog	2002/01/31 09:01:15
@@ -1,3 +1,24 @@
+2002-01-31  John Harper  <jsh unfactored org>
+
+	Make the search feature work again:
+
+	* configure.in: fixed how HAVE_MEDUSA is defined. Add
+	MEDUSA_CFLAGS to CORE_CFLAGS
+
+	* src/file-manager/fm-search-list-view.c: moved some of the
+	GNOME2_CONVERSION_COMPLETE ifdefs around so that we get a
+	functional object, just without some of the features of the
+	original
+
+	* src/nautilus-shell-ui.xml: copied search parts from nautilus
+	1 version
+
+	* src/nautilus-application.c (create_object): reenable
+	search-list-view creation
+
+	* src/file-manager/nautilus-indexing-info.c: random changes to
+	make it compile (untested as yet)
+
 2002-01-30  Darin Adler  <darin bentspoon com>
 
 	* configure.in: Bump eel version required.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/nautilus/configure.in,v
retrieving revision 1.404
diff -u -p -r1.404 configure.in
--- configure.in	2002/01/30 22:33:32	1.404
+++ configure.in	2002/01/31 09:01:15
@@ -158,8 +158,9 @@ dnl medusa checking (this is the Gnome 1
 AC_MSG_CHECKING(for Medusa)
 
 PKG_CHECK_MODULES(MEDUSA, medusa-2.0 >= $MEDUSA_REQUIRED, have_medusa=yes, have_medusa=no)
-AM_CONDITIONAL(HAVE_MEDUSA, test x$have_medusa = xyes)
-AC_SUBST(HAVE_MEDUSA)
+if test "x$have_medusa" = "xyes"; then
+  AC_DEFINE(HAVE_MEDUSA,1)
+fi
 
 dnl ==========================================================================
 
@@ -272,7 +273,7 @@ AC_SUBST(LIBNAUTILUS_IDL_INCLUDES)
 
 dnl core nautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires")
 CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0 esound"
-CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES`"
+CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $MEDUSA_CFLAGS"
 AC_SUBST(CORE_CFLAGS)
 CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $CDDA_LIBS $FAM_LIBS $LIBJPEG $MEDUSA_LIBS"
 AC_SUBST(CORE_LIBS)
Index: src/nautilus-application.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-application.c,v
retrieving revision 1.175
diff -u -p -r1.175 nautilus-application.c
--- src/nautilus-application.c	2002/01/23 17:59:49	1.175
+++ src/nautilus-application.c	2002/01/31 09:01:17
@@ -113,11 +113,9 @@ create_object (PortableServer_Servant se
 	} else if (strcmp (iid, NAUTILUS_LIST_VIEW_IID) == 0) {
 		directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_list_view_get_type (), NULL));
 		object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
-#if GNOME2_CONVERSION_COMPLETE
 	} else if (strcmp (iid, SEARCH_LIST_VIEW_IID) == 0) {
 		directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_search_list_view_get_type (), NULL));
 		object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
-#endif
 	} else if (strcmp (iid, SHELL_IID) == 0) {
 		application = NAUTILUS_APPLICATION (bonobo_object_from_servant (servant));
 		object = BONOBO_OBJECT (nautilus_shell_new (application));
Index: src/nautilus-shell-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-shell-ui.xml,v
retrieving revision 1.73
diff -u -p -r1.73 nautilus-shell-ui.xml
--- src/nautilus-shell-ui.xml	2002/01/28 23:31:39	1.73
+++ src/nautilus-shell-ui.xml	2002/01/31 09:01:17
@@ -12,6 +12,11 @@
 	 _tip="Go to the previous visited location"/>
 	<cmd name="Forward" accel="*Control*bracketright"
 	 _tip="Go to the next visited location"/>
+	<cmd name="Find" accel="*Control*f"
+	 _tip="Search this computer for files"/>
+	<cmd name="Toggle Find Mode" 
+	 _label="Find"
+	 _tip="Search this computer for files"/>
 	<cmd name="New Window"
 	 _label="New Window"
 	 _tip="Open another Nautilus window for the displayed location"/>
@@ -63,6 +68,13 @@
 		<placeholder name="General Status Placeholder" delimit="top"/>
 		<placeholder name="File Items Placeholder" delimit="top"/>
 		<placeholder name="Dangerous File Items Placeholder" delimit="top"/>
+
+		<separator/>
+
+		<menuitem name="Find"
+			  _label="_Find"
+			  verb="Find"/>
+
 		<placeholder name="Global File Items Placeholder" delimit="top"/>
 	</submenu>
 
@@ -299,6 +311,11 @@
 	          min_width="48"
 	          pixtype="stock" pixname="gtk-home"
 		  verb="Home"/>
+	<toolitem name="Toggle Find Mode"
+	          min_width="48"
+	          type="toggle"
+	          pixtype="stock" pixname="Search"
+		  verb="Toggle Find Mode"/>
 
 	<separator/>
 
Index: src/file-manager/fm-search-list-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-search-list-view.c,v
retrieving revision 1.92
diff -u -p -r1.92 fm-search-list-view.c
--- src/file-manager/fm-search-list-view.c	2002/01/17 20:57:50	1.92
+++ src/file-manager/fm-search-list-view.c	2002/01/31 09:01:17
@@ -50,8 +50,6 @@
 #include <eel/eel-stock-dialogs.h>
 #include <eel/eel-string.h>
 
-#if GNOME2_CONVERSION_COMPLETE
-
 /* FIXME bugzilla.gnome.org 42815: This code uses part of the
  * NautilusSearchBarCriterion class, which is really for complex
  * search bar user interface. We only need to do some non-UI
@@ -77,12 +75,13 @@ static void 	fm_search_list_view_class_i
 static void     real_destroy                             (GtkObject        *object);
 static void 	real_add_file				 (FMDirectoryView  *view,
 							  NautilusFile 	   *file);
+static gboolean real_file_still_belongs 		 (FMDirectoryView  *view, 
+							  NautilusFile 	   *file);
+#if GNOME2_CONVERSION_COMPLETE
 static void	real_adding_file 			 (FMListView 	   *view, 
 							  NautilusFile 	   *file);
 static void	real_removing_file 			 (FMListView 	   *view, 
 							  NautilusFile 	   *file);
-static gboolean real_file_still_belongs 		 (FMDirectoryView  *view, 
-							  NautilusFile 	   *file);
 static int  	real_get_number_of_columns           	 (FMListView       *list_view);
 static int  	real_get_emblems_column                	 (FMListView       *list_view);
 static int  	real_get_link_column                 	 (FMListView       *list_view);
@@ -90,6 +89,7 @@ static char *   real_get_default_sort_at
 static void 	real_get_column_specification        	 (FMListView       *list_view,
 						      	  int               column_number,
 						      	  FMListViewColumn *specification);
+#endif
 static EelStringList * real_get_emblem_names_to_exclude         (FMDirectoryView  *view);
 static void	real_file_limit_reached 		 (FMDirectoryView  *view);
 static void	real_merge_menus 		     	 (FMDirectoryView  *view);
@@ -360,6 +360,7 @@ fm_search_list_view_class_init (gpointer
   	fm_directory_view_class->update_menus =	real_update_menus;
   	fm_directory_view_class->load_error = real_load_error;
 
+#if GNOME2_CONVERSION_COMPLETE
 	fm_list_view_class->adding_file = real_adding_file;
 	fm_list_view_class->removing_file = real_removing_file;
 	fm_list_view_class->get_number_of_columns = real_get_number_of_columns;
@@ -367,6 +368,7 @@ fm_search_list_view_class_init (gpointer
 	fm_list_view_class->get_link_column = real_get_link_column;
 	fm_list_view_class->get_column_specification = real_get_column_specification;
 	fm_list_view_class->get_default_sort_attribute = real_get_default_sort_attribute;
+#endif
 }
 
 static void
@@ -377,7 +379,7 @@ fm_search_list_view_init (gpointer objec
 	NautilusView *nautilus_view;
 	FMDirectoryView *directory_view;
  
- 	g_assert (GTK_BIN (object)->child == NULL);
+	/* g_assert (GTK_BIN (object)->child == NULL); */
 
 	search_view = FM_SEARCH_LIST_VIEW (object);
   	directory_view = FM_DIRECTORY_VIEW (object);
@@ -408,6 +410,17 @@ real_destroy (GtkObject *object)
 	EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
 }
 
+static EelStringList *
+real_get_emblem_names_to_exclude (FMDirectoryView *view)
+{
+	g_assert (FM_IS_DIRECTORY_VIEW (view));
+
+	/* Overridden to show even the trash emblem here */
+	return NULL;
+}
+
+#if GNOME2_CONVERSION_COMPLETE
+
 static int
 real_get_number_of_columns (FMListView *view)
 {
@@ -456,15 +469,6 @@ real_get_default_sort_attribute (FMListV
 	return sort_attribute;
 }
 
-static EelStringList *
-real_get_emblem_names_to_exclude (FMDirectoryView *view)
-{
-	g_assert (FM_IS_DIRECTORY_VIEW (view));
-
-	/* Overridden to show even the trash emblem here */
-	return NULL;
-}
-
 static int
 real_get_link_column (FMListView *view)
 {
@@ -530,6 +534,8 @@ real_get_column_specification (FMListVie
 	}
 }
 
+#endif
+
 static void
 indexing_info_callback (BonoboUIComponent *component, gpointer data, const char *verb)
 {
@@ -611,6 +617,8 @@ real_add_file (FMDirectoryView *view, Na
 	nautilus_file_unref (real_file);
 }
 
+#if GNOME2_CONVERSION_COMPLETE
+
 static void
 real_adding_file (FMListView *view, NautilusFile *file)
 {
@@ -661,6 +669,8 @@ real_removing_file (FMListView *view, Na
 	EEL_CALL_PARENT (FM_LIST_VIEW_CLASS, removing_file, (view, file));
 }
 
+#endif
+
 static gboolean
 real_file_still_belongs (FMDirectoryView *view, NautilusFile *file)
 {
@@ -807,5 +817,3 @@ reveal_selected_items_callback (BonoboUI
 
 	nautilus_file_list_free (selection);
 }
-
-#endif
Index: src/file-manager/nautilus-indexing-info.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/nautilus-indexing-info.c,v
retrieving revision 1.35
diff -u -p -r1.35 nautilus-indexing-info.c
--- src/file-manager/nautilus-indexing-info.c	2002/01/19 00:06:09	1.35
+++ src/file-manager/nautilus-indexing-info.c	2002/01/31 09:01:18
@@ -32,6 +32,7 @@
 #include <gtk/gtkvbox.h>
 #include <libgnome/gnome-i18n.h>
 #include <libgnomeui/gnome-uidefs.h>
+#include <eel/eel-debug.h>
 #include <eel/eel-gdk-extensions.h>
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gtk-extensions.h>
@@ -75,8 +76,10 @@ get_index_percentage_complete (void)
 static void
 set_close_hides_for_dialog (GtkDialog *dialog)
 {
+#ifdef XXX_GTK1_STILL_EXISTS
         gtk_dialog_set_close (dialog, TRUE /*click_closes*/);
         gtk_dialog_close_hides (dialog, TRUE /*just_hide*/);
+#endif
 
 }
 
@@ -111,7 +114,9 @@ dialog_close_cover (gpointer dialog_data
 {
         g_assert (GTK_IS_DIALOG (dialog_data));
 
+#ifdef XXX_GTK1_STILL_EXISTS
         gtk_dialog_close (dialog_data);
+#endif
 }
 
 static void
@@ -119,14 +124,16 @@ show_index_progress_dialog (void)
 {
         int callback_id;
         
+#ifdef XXX_GTK1_STILL_EXISTS
         gtk_dialog_close (dialogs->last_index_time_dialog);
+#endif
         gtk_widget_show_all (GTK_WIDGET (dialogs->index_in_progress_dialog));
         callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
                                                                      dialogs->index_in_progress_dialog);
-        gtk_signal_connect_object (GTK_OBJECT (dialogs->index_in_progress_dialog),
-                                   "destroy",
-                                   medusa_remove_state_changed_function,
-                                   GINT_TO_POINTER (callback_id));
+        g_signal_connect_object (G_OBJECT (dialogs->index_in_progress_dialog),
+				 "destroy",
+				 (GCallback) medusa_remove_state_changed_function,
+				 GINT_TO_POINTER (callback_id), 0);
 }
 
 
@@ -135,14 +142,16 @@ show_last_index_time_dialog (void)
 {
         int callback_id;
 
+#ifdef XXX_GTK1_STILL_EXISTS
         gtk_dialog_close (dialogs->index_in_progress_dialog);
+#endif
         gtk_widget_show_all (GTK_WIDGET (dialogs->last_index_time_dialog));
         callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
                                                                      dialogs->last_index_time_dialog);
-        gtk_signal_connect_object (GTK_OBJECT (dialogs->last_index_time_dialog),
-                                   "destroy",
-                                   medusa_remove_state_changed_function,
-                                   GINT_TO_POINTER (callback_id));
+        g_signal_connect_object (G_OBJECT (dialogs->last_index_time_dialog),
+				 "destroy",
+				 (GCallback) medusa_remove_state_changed_function,
+				 GINT_TO_POINTER (callback_id), 0);
 }
 
 static GtkDialog *
@@ -228,7 +237,7 @@ index_progress_dialog_new (void)
                                            g_free);
         g_signal_connect (progress_bar_hbox,
                             "destroy",
-                            timeout_remove_callback,
+			    (GCallback) timeout_remove_callback,
                             GUINT_TO_POINTER (timeout_id));
         
         return dialog;
@@ -263,15 +272,15 @@ show_indexing_info_dialog (void)
                 
                 callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
                                                                              dialog_shown);
-                gtk_signal_connect_object (GTK_OBJECT (dialog_shown),
-                                           "destroy",
-                                           medusa_remove_state_changed_function,
-                                           GINT_TO_POINTER (callback_id));
+                g_signal_connect_object (G_OBJECT (dialog_shown),
+					 "destroy",
+					 (GCallback) medusa_remove_state_changed_function,
+					 GINT_TO_POINTER (callback_id), 0);
                 return;
         }
 	if (dialogs == NULL) {
                 dialogs = g_new0 (IndexingInfoDialogs, 1);
-                eel_debug_call_at_shutdown (destroy_indexing_info_dialogs_on_exit, NULL);
+                eel_debug_call_at_shutdown (destroy_indexing_info_dialogs_on_exit);
                 
                 dialogs->last_index_time_dialog = last_index_time_dialog_new ();
                 dialogs->index_in_progress_dialog = index_progress_dialog_new ();


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