[Nautilus-list] Build patch for recent GLib/GTK+ changes



Here are a bunch of fixes to get nautilus building with the current
GLib and GTK+. It's mostly GTK_OBJECT_DESTROYED() fixes and
glib-object.h fixes with a few other random things thrown in.

I'm happy to file a bug report for the FIXME in here ... basically
someone needs to sit down and figure out what happens to
NautilusDirectory on ::destroy.

Regards.
                                        Owen

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4849
diff -u -p -r1.4849 ChangeLog
--- ChangeLog	2001/11/15 11:15:57	1.4849
+++ ChangeLog	2001/11/21 02:54:36
@@ -1,3 +1,39 @@
+Tue Nov 20 21:45:43 2001  Owen Taylor  <otaylor redhat com>
+
+	* src/nautilus-main.c components/news/nautilus-news.c: Fix usage of g_log_domain_glib.
+
+	* components/text/nautilus-text-view.c (file_read_callback): 
+	text_view->details->text_display is set to NULL in
+	nautilus_text_view_destroy(), so simply check for non-NULL
+	rather than calling GTK_OBJECT_DESTROYED().
+
+	* src/file-manager/fm-properties-window.c (real_destroy): NULL
+	out name_field here, since it will be destroyed, so we
+	can avoid accessing it in rename_callback.
+
+	* libnautilus-private/Makefile.am (nautilus-marshal-guts.c): Get rid
+	of nautilus-marshal-guts.h, since glib-genmarshal now generates correct
+	standalone headers.
+
+	* libnautilus/nautilus-clipboard.c (select_all_callback)
+	libnautilus-private/nautilus-entry.c (nautilus_entry_select_all_at_idle):
+	Remove the idle on destrunction of the widget, rather than checking
+	GTK_OBJECT_DESTROYED().
+
+	* libnautilus-private/nautilus-directory.c (nautilus_directory_find_file_by_internal_uri): 
+	Remove assertion using GTK_OBJECT_DESTROYED ... it's not worth setting up
+	a ::destroy signal handle to check for something that shouldn't happen.
+
+	* libnautilus-private/nautilus-directory-async.c: Comment out
+	GTK_OBJECT_DESTROYED() call and add a FIXME.
+
+	* components/sample/nautilus-sample-content-view.c: 
+	libnautilus/nautilus-undo-private.h: Include glib-object.h instead of
+	gobject/*.h.
+
+	* configure.in: Add [quoting] around AC_CHECK_HEADERS needed for 
+	some autoconf versions.
+
 2001-11-15  Ramiro Estrugo  <ramiro fateware com>
 
 	* src/nautilus-preferences-dialog.c:
Index: configure.in
===================================================================
RCS file: /cvs/gnome/nautilus/configure.in,v
retrieving revision 1.384
diff -u -p -r1.384 configure.in
--- configure.in	2001/11/12 07:00:31	1.384
+++ configure.in	2001/11/21 02:54:36
@@ -127,10 +127,10 @@ dnl FAM
 FAM_MISSING_WARNING="Nautilus depends on FAM to provide notification when files are altered (either through filesystem polling, or a kernel notification mechanism). If Nautilus is built without FAM support, directories viewed with Nautilus will not remain in synch with the actual filesystem when they are altered by external processes. Particularly if you are a distributor please compile Nautilus with FAM support. FAM is available from http://oss.sgi.com/projects/fam/. A patch to add Linux Kernel 2.4 directory notify support to FAM (highly desirable) is available from http://people.redhat.com/alexl/files/";
 FAM_LIBS=
 AC_CHECK_LIB(fam, FAMOpen,
-  AC_CHECK_HEADERS(fam.h,
+  [AC_CHECK_HEADERS(fam.h,
     [AC_DEFINE(HAVE_LIBFAM)
      FAM_LIBS="-lfam"],
-    AC_MSG_WARN(*** FAM support will not be built (header files not found) $FAM_MISSING_WARNING ***)),
+    AC_MSG_WARN(*** FAM support will not be built (header files not found) $FAM_MISSING_WARNING ***))],
   AC_MSG_WARN(*** FAM support will not be built (FAM library not found) $FAM_MISSING_WARNING ***))
 AC_SUBST(FAM_LIBS)
 
@@ -415,9 +415,9 @@ dnl libpng
 
   if test -z "$LIBPNG"; then
     AC_CHECK_LIB(png, png_read_info,
-      AC_CHECK_HEADER(png.h,
+      [AC_CHECK_HEADER(png.h,
         png_ok=yes,
-        png_ok=no),
+        png_ok=no)],
       AC_MSG_ERROR(*** (PNG library not found) ***), -lz -lm)
     if test "$png_ok" = yes; then
       AC_MSG_CHECKING([for png_structp in png.h])
@@ -444,9 +444,9 @@ dnl libjpeg
 
   if test -z "$LIBJPEG"; then
     AC_CHECK_LIB(jpeg, jpeg_start_decompress,
-      AC_CHECK_HEADER(jpeglib.h,
+      [AC_CHECK_HEADER(jpeglib.h,
         jpeg_ok=yes,
-        jpeg_ok=no),
+        jpeg_ok=no)],
       AC_MSG_WARN(*** (jpeg library not found) ***), -lm)
     if test "$jpeg_ok" = yes; then
       JPEG='jpeg'; LIBJPEG='-ljpeg'
Index: components/news/nautilus-news.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/news/nautilus-news.c,v
retrieving revision 1.47
diff -u -p -r1.47 nautilus-news.c
--- components/news/nautilus-news.c	2001/11/11 00:50:04	1.47
+++ components/news/nautilus-news.c	2001/11/21 02:54:38
@@ -2542,7 +2542,7 @@ main(int argc, char *argv[])
 	 */
 	if (g_getenv("NAUTILUS_DEBUG") != NULL) {
 		eel_make_warnings_and_criticals_stop_in_debugger
-			(G_LOG_DOMAIN, g_log_domain_glib, "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo", NULL);
+			(G_LOG_DOMAIN, "GLib", "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo", NULL);
 	}
 	
         return nautilus_view_standard_main ("nautilus-news",
Index: components/sample/nautilus-sample-content-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/sample/nautilus-sample-content-view.c,v
retrieving revision 1.32
diff -u -p -r1.32 nautilus-sample-content-view.c
--- components/sample/nautilus-sample-content-view.c	2001/11/13 01:22:26	1.32
+++ components/sample/nautilus-sample-content-view.c	2001/11/21 02:54:38
@@ -36,7 +36,6 @@
 #include "nautilus-sample-content-view.h"
 
 #include <bonobo/bonobo-i18n.h>
-#include <gobject/gsignal.h>
 #include <gtk/gtklabel.h>
 #include <libgnome/gnome-macros.h>
 #include <string.h>
Index: components/text/nautilus-text-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/text/nautilus-text-view.c,v
retrieving revision 1.41
diff -u -p -r1.41 nautilus-text-view.c
--- components/text/nautilus-text-view.c	2001/11/15 07:06:07	1.41
+++ components/text/nautilus-text-view.c	2001/11/21 02:54:38
@@ -325,8 +325,9 @@ file_read_callback (GnomeVFSAsyncHandle 
 	/* at EOF, bytes_read is 0 and result is GNOME_VFS_OK */
 	if (result == GNOME_VFS_OK && bytes_read > 0) {
 		/* write the buffer into the text field */
-                display = GTK_TEXT (text_view->details->text_display);
-		if (!GTK_OBJECT_DESTROYED (display)) {
+                if (text_view->details->text_display) {
+                        display = GTK_TEXT (text_view->details->text_display);
+                        
                         gtk_text_freeze (display);
                         gtk_text_set_point (display,
                                             gtk_text_get_length (display));
Index: libnautilus/nautilus-clipboard.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-clipboard.c,v
retrieving revision 1.33
diff -u -p -r1.33 nautilus-clipboard.c
--- libnautilus/nautilus-clipboard.c	2001/11/09 02:05:36	1.33
+++ libnautilus/nautilus-clipboard.c	2001/11/21 02:54:38
@@ -103,12 +103,8 @@ select_all_idle_callback (gpointer callb
 
 	editable = GTK_EDITABLE (callback_data);
 
-	if (!GTK_OBJECT_DESTROYED (GTK_OBJECT (editable))) {
-		select_all (editable);
-	}
+	select_all (editable);
 
-	g_object_unref (G_OBJECT (editable));
-
 	return FALSE;
 }
 
@@ -118,13 +114,19 @@ select_all_callback (BonoboUIComponent *
 		     const char *command_name)
 {
 	GtkEditable *editable;
+	GSource *source;
 
 	g_assert (BONOBO_IS_UI_COMPONENT (ui));
 	g_assert (strcmp (command_name, "Select All") == 0);
 
 	editable = GTK_EDITABLE (callback_data);
-	g_object_ref (G_OBJECT (editable));
-	gtk_idle_add (select_all_idle_callback, editable);
+	
+	source = g_idle_source_new ();
+	g_source_set_callback (source, select_all_idle_callback, editable, NULL);
+	g_signal_connect_swapped (editable, "destroy",
+				  G_CALLBACK (g_source_destroy), source);
+	g_source_attach (source, NULL);
+	g_source_unref (source);
 }
 
 static void
Index: libnautilus/nautilus-undo-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-undo-private.h,v
retrieving revision 1.3
diff -u -p -r1.3 nautilus-undo-private.h
--- libnautilus/nautilus-undo-private.h	2001/11/06 18:40:04	1.3
+++ libnautilus/nautilus-undo-private.h	2001/11/21 02:54:38
@@ -26,7 +26,7 @@
 #define NAUTILUS_UNDO_PRIVATE_H
 
 #include <libnautilus/nautilus-distributed-undo.h>
-#include <gobject/gobject.h>
+#include <glib-object.h>
 
 Nautilus_Undo_Manager nautilus_undo_get_undo_manager    (GObject               *attached_object);
 void                  nautilus_undo_attach_undo_manager (GObject               *object,
Index: libnautilus-private/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/Makefile.am,v
retrieving revision 1.204
diff -u -p -r1.204 Makefile.am
--- libnautilus-private/Makefile.am	2001/11/09 01:10:00	1.204
+++ libnautilus-private/Makefile.am	2001/11/21 02:54:38
@@ -27,7 +27,7 @@ nautilus_metafile_server_idl_sources = \
 	$(NULL)
 
 marshal_sources = \
-	nautilus-marshal-guts.h \
+	nautilus-marshal.h \
 	nautilus-marshal-guts.c \
 	$(NULL)
 
@@ -112,7 +112,6 @@ libnautilus_private_la_SOURCES = \
 	nautilus-link-historical.h \
 	nautilus-link.c \
 	nautilus-link.h \
-	nautilus-marshal-guts.h \
 	nautilus-marshal.c \
 	nautilus-marshal.h \
 	nautilus-medusa-support.c \
@@ -176,7 +175,7 @@ nautilus_metafile_server_idl_stamp: naut
 	$(ORBIT_IDL) -I$(top_srcdir) $(CORE_IDL_INCLUDES) $<
 	touch $@
 
-nautilus-marshal-guts.h: nautilus-marshal.list $(GLIB_GENMARSHAL)
+nautilus-marshal.h: nautilus-marshal.list $(GLIB_GENMARSHAL)
 	$(GLIB_GENMARSHAL) $< --header --prefix=nautilus_marshal > $@
 nautilus-marshal-guts.c: nautilus-marshal.list $(GLIB_GENMARSHAL)
 	$(GLIB_GENMARSHAL) $< --body --prefix=nautilus_marshal > $@
Index: libnautilus-private/nautilus-directory-async.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-async.c,v
retrieving revision 1.169
diff -u -p -r1.169 nautilus-directory-async.c
--- libnautilus-private/nautilus-directory-async.c	2001/10/28 20:21:43	1.169
+++ libnautilus-private/nautilus-directory-async.c	2001/11/21 02:54:38
@@ -3044,9 +3044,16 @@ nautilus_directory_async_state_changed (
 	 * is not longer needed once the callbacks are satisfied.
 	 */
 
-	if (GTK_OBJECT_DESTROYED (directory)) {
-		return;
-	}
+	/* FIXME: GTK_OBJECT_DESTROYED no longer works, so we either
+	 *        need to make sure this works after destruction,
+	 *        or detect destruction some other way, perhaps
+	 *        by NULLing out directory->details.
+	 *
+	 * if (GTK_OBJECT_DESTROYED (directory)) {
+	 *          return;
+	 * }
+	 */
+	
 	if (directory->details->in_async_service_loop) {
 		directory->details->state_changed = TRUE;
 		return;
Index: libnautilus-private/nautilus-directory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory.c,v
retrieving revision 1.222
diff -u -p -r1.222 nautilus-directory.c
--- libnautilus-private/nautilus-directory.c	2001/11/09 02:05:37	1.222
+++ libnautilus-private/nautilus-directory.c	2001/11/21 02:54:39
@@ -669,7 +669,6 @@ nautilus_directory_find_file_by_internal
 		result = nautilus_directory_get_existing_corresponding_file (directory);
 		if (result != NULL) {
 			nautilus_file_unref (result);
-			g_return_val_if_fail (!GTK_OBJECT_DESTROYED (result), NULL);
 		}
 	} else {
 		result = nautilus_directory_find_file_by_relative_uri (directory, relative_uri);
Index: libnautilus-private/nautilus-entry.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-entry.c,v
retrieving revision 1.40
diff -u -p -r1.40 nautilus-entry.c
--- libnautilus-private/nautilus-entry.c	2001/11/09 02:05:37	1.40
+++ libnautilus-private/nautilus-entry.c	2001/11/21 02:54:39
@@ -267,10 +267,7 @@ select_all_at_idle (gpointer callback_da
 	NautilusEntry *entry;
 
 	entry = NAUTILUS_ENTRY (callback_data);
-	if (!GTK_OBJECT_DESTROYED (entry)) {
-		nautilus_entry_select_all (entry);
-	}
-	g_object_unref (G_OBJECT (entry));
+	nautilus_entry_select_all (entry);
 	return FALSE;
 }
 
@@ -287,14 +284,20 @@ select_all_at_idle (gpointer callback_da
 void
 nautilus_entry_select_all_at_idle (NautilusEntry *entry)
 {
+	GSource *source;
+	
 	g_return_if_fail (NAUTILUS_IS_ENTRY (entry));
 
 	/* If the text cursor position changes in this routine
 	 * then gtk_entry_key_press will unselect (and we want
 	 * to move the text cursor position to the end).
 	 */
-	g_object_ref (G_OBJECT (entry));
-	gtk_idle_add (select_all_at_idle, entry);
+	source = g_idle_source_new ();
+	g_source_set_callback (source, select_all_at_idle, entry, NULL);
+	g_signal_connect_swapped (entry, "destroy",
+				  G_CALLBACK (g_source_destroy), source);
+	g_source_attach (source, NULL);
+	g_source_unref (source);
 }
 
 /**
Index: libnautilus-private/nautilus-marshal.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-marshal.h,v
retrieving revision 1.1
diff -u -p -r1.1 nautilus-marshal.h
--- libnautilus-private/nautilus-marshal.h	2001/10/31 00:30:59	1.1
+++ libnautilus-private/nautilus-marshal.h	2001/11/21 02:54:39
@@ -1,3 +1 @@
-#include <gobject/gclosure.h>
-#include <gobject/gvaluetypes.h>
 #include "nautilus-marshal-guts.h"
Index: src/nautilus-main.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-main.c,v
retrieving revision 1.111
diff -u -p -r1.111 nautilus-main.c
--- src/nautilus-main.c	2001/11/14 23:22:41	1.111
+++ src/nautilus-main.c	2001/11/21 02:54:39
@@ -167,7 +167,8 @@ main (int argc, char *argv[])
 	 */
 	if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
 		eel_make_warnings_and_criticals_stop_in_debugger
-			(G_LOG_DOMAIN, g_log_domain_glib,
+			(G_LOG_DOMAIN,
+			 "GLib",
 			 "Bonobo",
 			 "Gdk",
 			 "GnomeUI",
Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.134
diff -u -p -r1.134 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	2001/11/09 02:05:52	1.134
+++ src/file-manager/fm-properties-window.c	2001/11/21 02:54:39
@@ -473,7 +473,7 @@ rename_callback (NautilusFile *file, Gno
 					       result,
 					       GTK_WINDOW (window));
 		/* This can trigger after window destroy, before finalize. */
-		if (!GTK_OBJECT_DESTROYED (window)) {
+		if (window->details->name_field) {
 			name_field_restore_original_name (window->details->name_field);
 		}
 	}
@@ -2474,6 +2474,8 @@ real_destroy (GtkObject *object)
 	if (window->details->update_directory_contents_timeout_id != 0) {
 		gtk_timeout_remove (window->details->update_directory_contents_timeout_id);
 	}
+
+	window->details->name_field = NULL;
 
 	/* Note that file_changed_handler_id is disconnected in dispose,
 	 * and details are freed in finalize 


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