Author: stephan
Date: 2006-11-14 19:34:57 +0000 (Tue, 14 Nov 2006)
New Revision: 23874
Modified:
xarchiver/branches/xarchiver-psybsd/src/main_window.c
xarchiver/branches/xarchiver-psybsd/src/notebook.c
xarchiver/branches/xarchiver-psybsd/src/notebook.h
Log:
Fixed extract-selected-items
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-11-14
16:57:29 UTC (rev 23873)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-11-14
19:34:57 UTC (rev 23874)
@@ -517,38 +517,20 @@
LXAArchive *lp_archive = NULL;
LXAArchiveSupport *lp_support = NULL;
- GSList *filenames = NULL;
- GValue *value = g_new0(GValue, 1);
+ GSList *filenames =
xa_notebook_get_selected_items(XA_NOTEBOOK(window->notebook));
- GtkTreeView *treeview =
GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(xa_notebook_get_active_child(XA_NOTEBOOK(window->notebook)))));
- GtkTreeModel *treemodel = gtk_tree_view_get_model(treeview);
- GtkTreeIter iter;
- GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
-
xa_notebook_get_active_archive(XA_NOTEBOOK(window->notebook),
&lp_archive, &lp_support);
- dialog = xa_extract_archive_dialog_new(lp_support, lp_archive,
gtk_tree_selection_count_selected_rows (selection));
+ dialog = xa_extract_archive_dialog_new(lp_support, lp_archive,
g_slist_length(filenames));
result = gtk_dialog_run (GTK_DIALOG (dialog) );
if(result == GTK_RESPONSE_OK)
{
gtk_widget_hide(dialog);
extract_archive_path =
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(XA_EXTRACT_ARCHIVE_DIALOG(dialog)->sel_files_radio)))
+
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(XA_EXTRACT_ARCHIVE_DIALOG(dialog)->all_files_radio)))
{
- GList *rows =
gtk_tree_selection_get_selected_rows(selection, &treemodel);
- GList *_rows = rows;
- while(_rows)
- {
-
gtk_tree_model_get_iter(GTK_TREE_MODEL(treemodel), &iter, _rows->data);
-
if(xa_archive_store_get_show_icons(XA_ARCHIVE_STORE(treemodel)))
-
gtk_tree_model_get_value(GTK_TREE_MODEL(treemodel), &iter, 1, value);
- else
-
gtk_tree_model_get_value(GTK_TREE_MODEL(treemodel), &iter, 0, value);
-
- g_value_unset(value);
- _rows = _rows->next;
- }
- g_list_free(rows);
+ g_slist_free(filenames);
+ filenames = NULL;
}
lxa_archive_support_extract(lp_support, lp_archive,
extract_archive_path, filenames);
g_free(extract_archive_path);
@@ -583,16 +565,24 @@
cb_xa_main_remove_from_archive(GtkWidget *widget, gpointer userdata)
{
XAMainWindow *window = XA_MAIN_WINDOW(userdata);
+ LXAArchive *lp_archive = NULL;
+ LXAArchiveSupport *lp_support = NULL;
GtkWidget *dialog = NULL;
gint result = 0;
+ GSList *filenames =
xa_notebook_get_selected_items(XA_NOTEBOOK(window->notebook));
- dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, "Are you sure you want to remove the selected files?");
- result = gtk_dialog_run(GTK_DIALOG(dialog));
- if(result == GTK_RESPONSE_OK)
+ if(filenames)
{
- gtk_widget_hide(dialog);
+ dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, "Are you sure you want to remove the selected files?");
+ result = gtk_dialog_run(GTK_DIALOG(dialog));
+ if(result == GTK_RESPONSE_OK)
+ {
+ gtk_widget_hide(dialog);
+
xa_notebook_get_active_archive(XA_NOTEBOOK(window->notebook), &lp_archive,
&lp_support);
+ lxa_archive_support_remove(lp_support, lp_archive,
filenames);
+ }
+ gtk_widget_destroy (dialog);
}
- gtk_widget_destroy (dialog);
}
static void
Modified: xarchiver/branches/xarchiver-psybsd/src/notebook.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/notebook.c 2006-11-14 16:57:29 UTC
(rev 23873)
+++ xarchiver/branches/xarchiver-psybsd/src/notebook.c 2006-11-14 19:34:57 UTC
(rev 23874)
@@ -435,6 +435,40 @@
xa_notebook_add_archive(XA_NOTEBOOK(notebook), archive,
support);
}
+GSList *
+xa_notebook_get_selected_items(XANotebook *notebook)
+{
+ GtkWidget *scrolledwindow = xa_notebook_get_active_child(notebook);
+ GtkTreeIter iter;
+ GValue *value = g_new0(GValue, 1);
+ GSList *filenames = NULL;
+
+ GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(scrolledwindow));
+ GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+ gchar *pwd = xa_archive_store_get_pwd(XA_ARCHIVE_STORE(store));
+ GtkTreeSelection *selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW(treeview));
+ GList *rows = gtk_tree_selection_get_selected_rows(selection, &store);
+ GList *_rows = rows;
+ while(_rows)
+ {
+ gtk_tree_model_get_iter(store, &iter, _rows->data);
+ if(xa_archive_store_get_show_icons(XA_ARCHIVE_STORE(store)))
+ gtk_tree_model_get_value(store, &iter, 1, value);
+ else
+ gtk_tree_model_get_value(store, &iter, 0, value);
+
+ filenames = g_slist_prepend(filenames, g_strconcat(pwd,
g_value_get_string(value), NULL));
+
+ g_value_unset(value);
+ _rows = _rows->next;
+ }
+ g_list_free(rows);
+ g_free(pwd);
+
+ return filenames;
+}
+
+
LXAArchive*
xa_notebook_page_get_archive(XANotebook *notebook, gint n)
{
Modified: xarchiver/branches/xarchiver-psybsd/src/notebook.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/notebook.h 2006-11-14 16:57:29 UTC
(rev 23873)
+++ xarchiver/branches/xarchiver-psybsd/src/notebook.h 2006-11-14 19:34:57 UTC
(rev 23874)
@@ -70,12 +70,14 @@
void xa_notebook_set_navigation_bar(XANotebook *, XANavigationBar *);
void xa_notebook_add_archive(XANotebook *, LXAArchive *,
LXAArchiveSupport *);
void xa_notebook_page_set_archive(XANotebook *, LXAArchive *,
LXAArchiveSupport *, gint n);
-LXAArchive* xa_notebook_page_get_archive(XANotebook *, gint n);
+LXAArchive *xa_notebook_page_get_archive(XANotebook *, gint n);
void xa_notebook_set_icon_theme(XANotebook *, GtkIconTheme *);
void xa_notebook_get_active_archive(XANotebook *, LXAArchive **,
LXAArchiveSupport **);
-GtkWidget * xa_notebook_get_active_child(XANotebook *notebook);
+GtkWidget *xa_notebook_get_active_child(XANotebook *notebook);
gboolean xa_notebook_get_multi_tab(XANotebook *notebook);
void xa_notebook_close_active_archive(XANotebook *);
+GSList *xa_notebook_get_selected_items(XANotebook *notebook);
+
G_END_DECLS
#endif /* __XARCHIVER_NOTEBOOK_H__ */
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits