Patch for bonobo-file-selector-util



Hi,
  here you can find a patch for bonobo-file-selector-util.
This patch fixes bonobo-file-selector-util to work with the new GtkFileSelection API for multiple files.

Ciao

Paolo

-- 
Paolo Maggi                      E-mail: maggi athena polito it
Dip. Automatica e Informatica    Tel.  : + 39 011 564 7085
Politecnico di Torino            Fax   : + 39 011 564 7099

A Bugless Program is an Abstract Theoretical Concept.



? libbonoboui_paolo_file_sel_util_patch_v1.diff
? libbonoboui_paolo_filesel.diff
? libbonoboui_paolo_file_sel_util_20020226_v1.diff
? bonobo/libbonoboui_paolo_file_sel_util_v1.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonoboui/ChangeLog,v
retrieving revision 1.290
diff -u -r1.290 ChangeLog
--- ChangeLog	2002/02/25 22:36:16	1.290
+++ ChangeLog	2002/02/26 11:12:19
@@ -1,3 +1,8 @@
+2002-02-26  Paolo Maggi  <maggi athena polito it>
+
+	* bonobo/bonobo-file-selector-ui.c: fixed to work
+	with the new GtkFileSelection API for multiple files
+
 2002-02-24  Jody Goldberg <jody gnome org>
 
 	* bonobo/bonobo-ui-component.h (BonoboUIVerb) : const the name to
Index: bonobo/bonobo-file-selector-util.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-file-selector-util.c,v
retrieving revision 1.12
diff -u -r1.12 bonobo-file-selector-util.c
--- bonobo/bonobo-file-selector-util.c	2002/02/19 20:21:44	1.12
+++ bonobo/bonobo-file-selector-util.c	2002/02/26 11:12:19
@@ -4,8 +4,9 @@
  *
  * Authors:
  *    Jacob Berkman  <jacob ximian com>
+ *    Paolo Maggi  <maggi athena polito it>
  *
- * Copyright 2001 Ximian, Inc.
+ * Copyright 2001-2002 Ximian, Inc.
  *
  */
 
@@ -38,11 +39,6 @@
 	FILESEL_SAVE
 } FileselMode;
 
-/* Take in sync with gtkfilesel.c */
-enum {
-  FILE_COLUMN
-};
-
 static GQuark user_data_id = 0;
 
 static gint
@@ -204,58 +200,8 @@
 		g_free (dir_name);
 
 	} else if (GET_MODE (fsel) == FILESEL_OPEN_MULTI) {
-
-		GtkTreeSelection *selection;
-		GtkTreeModel *model;
-		GtkTreeIter iter;
-		
-		char *filedirname;
-		char **strv;
-		int rows, i;
-
-		gtk_widget_hide (GTK_WIDGET (fsel));
-
-		model = gtk_tree_view_get_model (GTK_TREE_VIEW (GTK_FILE_SELECTION (fsel)->file_list));	
-		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (GTK_FILE_SELECTION (fsel)->file_list));	
-
-		rows = 	gtk_tree_model_iter_n_children (model, NULL);
-
-		strv = g_new (char *, rows + 2);
-		strv[rows] = g_strdup (file_name);
-
-		if (!gtk_tree_model_get_iter_root (model, &iter))
-			return;
-
-		filedirname = g_path_get_dirname (file_name);
-		
-		i = 0;
+		gchar **strv = gtk_file_selection_get_selections (fsel);
 		
-		do {
-			if (gtk_tree_selection_iter_is_selected (selection, &iter)) {
-		      		gchar *f;
-      
-      				gtk_tree_model_get (model, &iter, FILE_COLUMN, &f, -1);
-				strv[i] = concat_dir_and_file (filedirname, f);
-				
-				g_free (f);
-
-				/* avoid duplicates */
-				if (strv[rows] && (strcmp (strv[i], strv[rows]) == 0)) {
-					g_free (strv[rows]);
-					strv[rows] = NULL;
-				}
-
-				++i;
-			}
-		} while (gtk_tree_model_iter_next (model, &iter));
-
-		strv[i] = strv[rows];
-		strv[i + 1] = NULL;
-
-		strv = g_renew (char *, strv, i + 2);
-
-		g_free (filedirname);
-
 		g_object_set_qdata (G_OBJECT (fsel),
 				    user_data_id, strv);
 		gtk_main_quit ();
@@ -319,15 +265,8 @@
 
 	g_free (path);
 
-	if (mode == FILESEL_OPEN_MULTI) {
-		GtkTreeSelection *selection;
-
-		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (GTK_FILE_SELECTION (filesel)->file_list));	
-		/* FIXME: change GTK_SELECTION_SINGLE to GTK_SELECTION_MULTIPLE as soon as bug #70505
-		 * will be fixed -- Paolo
-		 */	
-		gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-	}
+	if (mode == FILESEL_OPEN_MULTI) 
+		gtk_file_selection_set_select_multiple (GTK_FILE_SELECTION (filesel), TRUE);
 
 	return GTK_WINDOW (filesel);
 }


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