[patch] remove #if DOCNOTEBOOK



Hi guys,

The attached patch removes the #if DOCNOTEBOOK's and reimplements the calls to file_open_by_name by contacting the DocumentManager plugin.  There is only one place left to do that: open_history (gide.c), but that is going to be moved somewhere else.

See you,

Gustavo

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gIDE/ChangeLog,v
retrieving revision 1.107
diff -u -r1.107 ChangeLog
--- ChangeLog	2001/07/01 21:58:41	1.107
+++ ChangeLog	2001/07/04 22:22:12
@@ -1,3 +1,15 @@
+2001-07-04  Gustavo Giráldez  <gustavo giraldez gmx net>
+
+	* src/gI_window.h: Remove #if DOCNOTEBOOK
+
+	* src/gI_window.c (gI_window_drag_recv): Remove #if DOCNOTEBOOK.
+	Open dragged files by contacting the DocumentManager instead of
+	the obsolete file_open_by_name
+
+	* src/gide.c (main): Remove #if DOCNOTEBOOK.  Open files given in
+	the command line by contacting the DocumentManager instead of
+	file_open_by_name
+	
 2001-07-01  Dave Camp  <dave ximian com>
 
 	* src/tools.c (get_icon_path_for_component_info): Look for the 
Index: src/gI_window.c
===================================================================
RCS file: /cvs/gnome/gIDE/src/gI_window.c,v
retrieving revision 1.33
diff -u -r1.33 gI_window.c
--- src/gI_window.c	2001/06/28 21:33:01	1.33
+++ src/gI_window.c	2001/07/04 22:22:13
@@ -349,6 +349,9 @@
 	GList* fnp;
 	gint count;
 	gchar* fname;
+	CORBA_Environment ev;
+	GNOME_Development_Environment_DocumentManager docman;
+	GNOME_Development_Environment_Document document;
 
 	g_assert(IS_GIDE_WINDOW(widget));
 
@@ -356,20 +359,35 @@
 	files = gnome_uri_list_extract_filenames((gchar*)seldata->data);
 	count = g_list_length(files);
 
+	CORBA_exception_init (&ev);
+	docman = GNOME_Development_Environment_Shell_getObject 
+		(bonobo_object_corba_objref 
+		 (gtk_object_get_data (GTK_OBJECT (widget), "GideShell")),
+		 "DocumentManager", &ev);
+	
 	/* open files */
-	if(count > 0)
+	if(count > 0 && docman != CORBA_OBJECT_NIL)
 	{
+		gchar *curdir = g_get_current_dir ();
+		
 		fnp = g_list_first(files);
 		while(fnp)
 		{
 			fname = (gchar*)fnp->data;
+			
+			/* openFile needs a full path for the file */
+			if (g_path_is_absolute (fname))
+				fname = g_strdup (fname);
+			else
+				fname = g_strdup_printf ("%s/%s", curdir, fname);
 
-#if DOCNOTEBOOK
-			file_open_by_name(GIDE_WINDOW(widget), fname);
-#endif
+			document = GNOME_Development_Environment_DocumentManager_openFile (docman, fname, &ev);
+			bonobo_object_release_unref (document, &ev);
+			g_free (fname);
 
 			fnp = g_list_next(fnp);
 		}
+		g_free (curdir);
 	}
 
 	gnome_uri_list_free_strings(files);
Index: src/gI_window.h
===================================================================
RCS file: /cvs/gnome/gIDE/src/gI_window.h,v
retrieving revision 1.15
diff -u -r1.15 gI_window.h
--- src/gI_window.h	2001/06/21 03:01:33	1.15
+++ src/gI_window.h	2001/07/04 22:22:13
@@ -27,7 +27,6 @@
 #define GIDE_WINDOW_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), gI_window_get_type(), GideWindowClass))
 #define IS_GIDE_WINDOW(o)       (GTK_CHECK_TYPE ((o), gI_window_get_type()))
 
-#define DOCNOTEBOOK 0
 typedef struct _GideWindowClass         GideWindowClass;
 
 struct _GideWindowClass {
@@ -84,29 +83,6 @@
 void gI_window_set_cfg_values (GideWindow *window);
 void gI_window_set_build (GideWindow *window, const gchar *file);
 void gI_window_set_debug (GideWindow *window, const gchar *file);
-
-#if DOCNOTEBOOK
-/* Functions to do with documents */
-void gI_window_add_doc ( GideWindow *window, GideDocument *document );
-
-gint gI_window_num_docs( GideWindow *window );
-glong gI_window_num_changed_docs( GideWindow *window );
-gboolean gI_window_is_open_doc( GideWindow *window, const gchar *filename );
-
-void gI_window_goto_doc_by_index( GideWindow *window, gint index );
-void gI_window_goto_doc_by_file( GideWindow *window, const gchar *filename );
-
-GideDocument *gI_window_get_nth_doc( GideWindow *window, guint index );
-GideDocument *gI_window_get_current_doc( GideWindow *window );
-gchar *gI_window_get_doc_label( GideWindow *window, GideDocument *document );
-void gI_window_set_doc_label( GideWindow *window,
-			      GideDocument *document,
-			      gchar *str );
-void gI_window_set_doc_label_style( GideWindow *window,
-				    GideDocument *document,
-				    GtkStyle *style );
-
-#endif
 
 /* Title functions */
 void gI_window_update_title( GideWindow *window );
Index: src/gide.c
===================================================================
RCS file: /cvs/gnome/gIDE/src/gide.c,v
retrieving revision 1.31
diff -u -r1.31 gide.c
--- src/gide.c	2001/07/01 21:58:48	1.31
+++ src/gide.c	2001/07/04 22:22:14
@@ -61,7 +61,8 @@
 			ptr = strchr( buf, '\n' );
 			if( ptr )
 				*ptr = '\0';
-			file_open_by_name( main_window, buf );
+			/* FIXME: open the file through DocumentManager */
+			/* file_open_by_name( main_window, buf ); */
 		}
 		fclose( history );
 		}
@@ -75,7 +76,11 @@
 	poptContext ctx;
 	gint nofargs = 0;
 	GtkWidget *splash;
-	
+	CORBA_Environment ev;
+	GNOME_Development_Environment_DocumentManager docman;
+	GNOME_Development_Environment_Document document;
+	const char **startup_files;
+
 	/* Internationalization */
 	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
 	textdomain (PACKAGE);
@@ -110,29 +115,47 @@
 	/* Create main window */
 	main_window = gide_window_new (E_SPLASH (splash));
 	
-#if 0
-	/* FIXME: This is a good thing to be doing, but I don't want to
-	 * implement it just yet. */
+	/* Open files from the command line */
+	CORBA_exception_init (&ev);
+	docman = GNOME_Development_Environment_Shell_getObject 
+		(bonobo_object_corba_objref 
+		 (gtk_object_get_data (GTK_OBJECT (main_window), "GideShell")),
+		 "DocumentManager", &ev);
 	
 	/* open the files */
 	startup_files = poptGetArgs (ctx);
 	nofargs = 0;
-	if (startup_files) {
-		while (startup_files[nofargs]) {
-#if DOCNOTEBOOK
-			file_open_by_name (main_window,
-					   g_strdup(startup_files[nofargs]));
+	if (startup_files && docman != CORBA_OBJECT_NIL) {
+		gchar *curdir = g_get_current_dir ();
+		
+		while (startup_files [nofargs]) {
+			gchar *filename = (gchar *) startup_files [nofargs];
+			
+			/* openFile needs a full path for the file */
+			if (g_path_is_absolute (filename))
+				filename = g_strdup (filename);
+			else
+				filename = g_strdup_printf ("%s/%s", 
+							    curdir, filename);
+
+			document = GNOME_Development_Environment_DocumentManager_openFile (docman, filename, &ev);
+			bonobo_object_release_unref (document, &ev);
 			nofargs++;
-#endif
+			g_free (filename);
 		}
-	}
-	poptFreeContext (ctx);
+		g_free (curdir);
+	};
+
+	bonobo_object_release_unref (docman, &ev);
 
+#if 0
 	if (nofargs == 0) {
 		/* no files given on the commandline, open files from last session */
 		open_history (HISTORY);
 	}
 #endif
+
+	poptFreeContext (ctx);
 
 	gtk_widget_unref (splash);
 	gtk_widget_destroy (splash);


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