[patch] remove #if DOCNOTEBOOK



Hi!

The first patch attached removes the few remaining #if DOCNOTEBOOK in gIDE.  Most of these #if's disabled the file_open_by_name function call, which is now part of the DocumentManager plugin.  

So, the other patch in this message addresses the functionality which was provided by file_open_by_name by contacting the docman, to open the files given in the command line.  I don't know if this implementation is correct or if this is the best approach (I am new to bonobo).  If it is ok, the other places where it should be done is in open_history (how is this supossed to work?) and gI_window_drag_recv, and of course I volunteer to do it.

Regards,

Gustavo

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/02 04:12:12
@@ -363,10 +363,9 @@
 		while(fnp)
 		{
 			fname = (gchar*)fnp->data;
-
-#if DOCNOTEBOOK
-			file_open_by_name(GIDE_WINDOW(widget), fname);
-#endif
+			
+			/* FIXME: open the file through DocumentManager */
+			/* file_open_by_name(GIDE_WINDOW(widget), fname); */
 
 			fnp = g_list_next(fnp);
 		}
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/02 04:12:12
@@ -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.30
diff -u -r1.30 gide.c
--- src/gide.c	2001/06/29 03:23:55	1.30
+++ src/gide.c	2001/07/02 04:12:13
@@ -60,7 +60,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 );
 		}
@@ -116,11 +117,10 @@
 	nofargs = 0;
 	if (startup_files) {
 		while (startup_files[nofargs]) {
-#if DOCNOTEBOOK
-			file_open_by_name (main_window,
-					   g_strdup(startup_files[nofargs]));
-			nofargs++;
-#endif
+			/* FIXME: open the file through the DocumentManager */
+			/* file_open_by_name (main_window,
+			   g_strdup(startup_files[nofargs]));
+			   nofargs++; */
 		}
 	}
 	poptFreeContext (ctx);
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/02 06:26:54
@@ -363,10 +363,9 @@
 		while(fnp)
 		{
 			fname = (gchar*)fnp->data;
-
-#if DOCNOTEBOOK
-			file_open_by_name(GIDE_WINDOW(widget), fname);
-#endif
+			
+			/* FIXME: open the file through DocumentManager */
+			/* file_open_by_name(GIDE_WINDOW(widget), fname); */
 
 			fnp = g_list_next(fnp);
 		}
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/02 06:26:55
@@ -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.30
diff -u -r1.30 gide.c
--- src/gide.c	2001/06/29 03:23:55	1.30
+++ src/gide.c	2001/07/02 06:26:56
@@ -60,7 +60,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 );
 		}
@@ -74,7 +75,10 @@
 	poptContext ctx;
 	gint nofargs = 0;
 	GtkWidget *splash;
-	
+	CORBA_Environment ev;
+	GNOME_Development_Environment_DocumentManager docman;
+	const char **startup_files;
+
 	/* Internationalization */
 	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
 	textdomain (PACKAGE);
@@ -107,29 +111,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 complete path for the file */
+			if (g_path_is_absolute (filename))
+				filename = g_strdup (filename);
+			else
+				filename = g_strdup_printf ("%s/%s", 
+							    curdir, filename);
+
+			GNOME_Development_Environment_DocumentManager_openFile 
+				(docman, filename, &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]