file-roller r2430 - in trunk: . src



Author: paobac
Date: Sat Aug 16 14:44:56 2008
New Revision: 2430
URL: http://svn.gnome.org/viewvc/file-roller?rev=2430&view=rev

Log:
2008-08-16  Paolo Bacchilega  <paobac svn gnome org>

	* src/dlg-add-files.c: removed a useless callback that checked folder 
	permission on every filechooser selection change.

	* src/dlg-add-folder.c: removed the same callback as above and 
	simplified the response callback as well.
	
2008-08-16  Paolo Bacchilega  <paobac svn gnome org>
	
	* src/dlg-batch-add.c (add_clicked_cb): 
	
	Fixed bug #548020 â "create archive" directory selection not working 
	correctly.  Patch by Marcel Stimberg.


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/dlg-add-files.c
   trunk/src/dlg-add-folder.c
   trunk/src/dlg-batch-add.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Sat Aug 16 14:44:56 2008
@@ -1,11 +1,7 @@
 == Pending ==
 
-[ ] #547733 â 7-zip tells about invalid command line
-
 [ ] #547727 â file-roller crashed with SIGSEGV in strlen()
 
-[ ] #546698 â file-roller-2.23.1/2.23.5 removes r/x bit for anyone but root from /
-
 == ToDo ==
 
 [ ] #525274 â File roller seems to be unable to create zipfiles without .zip extension

Modified: trunk/src/dlg-add-files.c
==============================================================================
--- trunk/src/dlg-add-files.c	(original)
+++ trunk/src/dlg-add-files.c	Sat Aug 16 14:44:56 2008
@@ -129,39 +129,6 @@
 }
 
 
-static void
-selection_changed_cb (GtkWidget  *file_sel,
- 		      DialogData *data)
-{
-	FrWindow *window = data->window;
-	char     *current_folder;
-
-	current_folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (file_sel));
-
-	/* check folder permissions. */
-
-	if (uri_is_dir (current_folder)
-	    && ! check_permissions (current_folder, R_OK | X_OK)) {
-		GtkWidget *d;
-		char      *utf8_path;
-
-		utf8_path = g_filename_display_name (current_folder);
-
-		d = _gtk_error_dialog_new (GTK_WINDOW (window),
-					   GTK_DIALOG_MODAL,
-					   NULL,
-					   _("Could not add the files to the archive"),
-					   _("You don't have the right permissions to read files from folder \"%s\""), 
-					   utf8_path);
-		gtk_dialog_run (GTK_DIALOG (d));
-		gtk_widget_destroy (GTK_WIDGET (d));
-
-		g_free (utf8_path);
-		g_free (current_folder);
-	}
-}
-
-
 /* create the "add" dialog. */
 void
 add_files_cb (GtkWidget *widget,
@@ -220,11 +187,6 @@
 			  G_CALLBACK (file_sel_response_cb),
 			  data);
 
-	g_signal_connect (G_OBJECT (file_sel),
-			  "selection-changed",
-			  G_CALLBACK (selection_changed_cb),
-			  data);
-
 	gtk_window_set_modal (GTK_WINDOW (file_sel), TRUE);
 	gtk_widget_show (file_sel);
 }

Modified: trunk/src/dlg-add-folder.c
==============================================================================
--- trunk/src/dlg-add-folder.c	(original)
+++ trunk/src/dlg-add-folder.c	Sat Aug 16 14:44:56 2008
@@ -95,10 +95,13 @@
 {
 	GtkFileChooser *file_sel = GTK_FILE_CHOOSER (widget);
 	FrWindow       *window = data->window;
-	char           *current_folder;
+	char           *selected_folder;
 	gboolean        update, recursive, follow_links;
-	GSList         *selections, *iter;
-	GList          *item_list = NULL;
+	const char     *include_files;
+	const char     *exclude_files;
+	const char     *exclude_folders;
+	char           *dest_dir;
+
 
 	dlg_add_folder_save_last_options (data);
 
@@ -112,17 +115,15 @@
 		return TRUE;
 	}
 
-	current_folder = gtk_file_chooser_get_current_folder_uri (file_sel);
+	selected_folder = gtk_file_chooser_get_uri (file_sel);
 
 	/* check folder permissions. */
 
-	if (uri_is_dir (current_folder)
-	    && ! check_permissions (current_folder, R_OK | X_OK))
-	{
+	if (! check_permissions (selected_folder, R_OK | X_OK)) {
 		GtkWidget *d;
 		char      *utf8_path;
 
-		utf8_path = g_filename_display_name (current_folder);
+		utf8_path = g_filename_display_name (selected_folder);
 
 		d = _gtk_error_dialog_new (GTK_WINDOW (window),
 					   GTK_DIALOG_MODAL,
@@ -134,7 +135,7 @@
 		gtk_widget_destroy (GTK_WIDGET (d));
 
 		g_free (utf8_path);
-		g_free (current_folder);
+		g_free (selected_folder);
 
 		return FALSE;
 	}
@@ -143,90 +144,40 @@
 	recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->include_subfold_checkbutton));
 	follow_links = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->exclude_symlinks));
 
-	/**/
-
-	selections = gtk_file_chooser_get_uris (file_sel);
-	for (iter = selections; iter != NULL; iter = iter->next) {
-		char *path = iter->data;
-		item_list = g_list_prepend (item_list, path);
-	}
-
-	if (item_list != NULL) {
-		const char *folder = (char*) item_list->data;
-		const char *include_files;
-		const char *exclude_files;
-		const char *exclude_folders;
-		char       *dest_dir;
-
-		include_files = gtk_entry_get_text (GTK_ENTRY (data->include_files_entry));
-		exclude_files = gtk_entry_get_text (GTK_ENTRY (data->exclude_files_entry));
-		exclude_folders = gtk_entry_get_text (GTK_ENTRY (data->exclude_folders_entry));
-
-		if (utf8_only_spaces (include_files))
-			include_files = "*";
-		if (utf8_only_spaces (exclude_files))
-			exclude_files = NULL;
-		if (utf8_only_spaces (exclude_folders))
-			exclude_folders = NULL;
-
-		dest_dir = build_uri (fr_window_get_current_location (window),
-				      file_name_from_path (folder),
-				      NULL);
-
-		fr_window_archive_add_with_wildcard (window,
-						     include_files,
-						     exclude_files,
-						     exclude_folders,
-						     folder,
-						     dest_dir,
-						     update,
-						     follow_links);
-
-		g_free (dest_dir);
-	}
-
-	g_list_free (item_list);
-	g_slist_foreach (selections, (GFunc) g_free, NULL);
-	g_slist_free (selections);
-	g_free (current_folder);
-
+	include_files = gtk_entry_get_text (GTK_ENTRY (data->include_files_entry));
+	if (utf8_only_spaces (include_files))
+		include_files = "*";
+
+	exclude_files = gtk_entry_get_text (GTK_ENTRY (data->exclude_files_entry));
+	if (utf8_only_spaces (exclude_files))
+		exclude_files = NULL;
+
+	exclude_folders = gtk_entry_get_text (GTK_ENTRY (data->exclude_folders_entry));
+	if (utf8_only_spaces (exclude_folders))
+		exclude_folders = NULL;
+
+	dest_dir = build_uri (fr_window_get_current_location (window),
+			      file_name_from_path (selected_folder),
+			      NULL);
+
+	fr_window_archive_add_with_wildcard (window,
+					     include_files,
+					     exclude_files,
+					     exclude_folders,
+					     selected_folder,
+					     dest_dir,
+					     update,
+					     follow_links);
+
+	g_free (dest_dir);
+	g_free (selected_folder);
+	
 	gtk_widget_destroy (data->dialog);
 
 	return TRUE;
 }
 
 
-static void
-selection_changed_cb (GtkWidget  *file_sel,
-		      DialogData *data)
-{
-	FrWindow *window = data->window;
-	char     *current_folder;
-
-	/* check folder permissions. */
-
-	current_folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (file_sel));
-	if (uri_is_dir (current_folder) && ! check_permissions (current_folder, R_OK | X_OK)) {
-		GtkWidget *d;
-		char      *display_name;
-
-		display_name = g_filename_display_name (current_folder);
-
-		d = _gtk_error_dialog_new (GTK_WINDOW (window),
-					   GTK_DIALOG_MODAL,
-					   NULL,
-					   _("Could not add the files to the archive"),
-					   _("You don't have the right permissions to read files from folder \"%s\""),
-					   display_name);
-		gtk_dialog_run (GTK_DIALOG (d));
-		gtk_widget_destroy (GTK_WIDGET (d));
-
-		g_free (display_name);
-	}
-	g_free (current_folder);
-}
-
-
 static int
 include_subfold_toggled_cb (GtkWidget *widget,
 			    gpointer   callback_data)
@@ -394,10 +345,6 @@
 			  "response",
 			  G_CALLBACK (file_sel_response_cb),
 			  data);
-	g_signal_connect (G_OBJECT (file_sel),
-			  "selection-changed",
-			  G_CALLBACK (selection_changed_cb),
-			  data);
 	g_signal_connect (G_OBJECT (data->include_subfold_checkbutton),
 			  "toggled",
 			  G_CALLBACK (include_subfold_toggled_cb),

Modified: trunk/src/dlg-batch-add.c
==============================================================================
--- trunk/src/dlg-batch-add.c	(original)
+++ trunk/src/dlg-batch-add.c	Sat Aug 16 14:44:56 2008
@@ -208,7 +208,7 @@
 
 	/* Check directory existence. */
 
-	archive_dir = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (data->a_location_filechooserbutton));
+	archive_dir = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->a_location_filechooserbutton));
 	if (archive_dir == NULL) {
 		g_free (archive_dir);
 		g_free (archive_name);



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