[Xfce4-commits] r23896 - in xarchiver/branches/xarchiver-psybsd: . libxarchiver po src

Stephan Arts stephan at xfce.org
Fri Nov 17 21:08:56 CET 2006


Author: stephan
Date: 2006-11-17 20:08:53 +0000 (Fri, 17 Nov 2006)
New Revision: 23896

Modified:
   xarchiver/branches/xarchiver-psybsd/Makefile.am
   xarchiver/branches/xarchiver-psybsd/TODO
   xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
   xarchiver/branches/xarchiver-psybsd/po/nl.po
   xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
   xarchiver/branches/xarchiver-psybsd/src/archive_store.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.c
   xarchiver/branches/xarchiver-psybsd/src/notebook.c
   xarchiver/branches/xarchiver-psybsd/xarchiver.desktop.in
Log:
Made treeview support multi-select again.
Added Dialog for file-activate signal. (So far extract is implemented)



Modified: xarchiver/branches/xarchiver-psybsd/Makefile.am
===================================================================
--- xarchiver/branches/xarchiver-psybsd/Makefile.am	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/Makefile.am	2006-11-17 20:08:53 UTC (rev 23896)
@@ -1,5 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
+AUTOMAKE_OPTIONS =							\
+	1.8								\
+	dist-bzip2
+
 SUBDIRS = libxarchiver src po
 
 pixmapsdir       = $(datadir)/pixmaps/xarchiver

Modified: xarchiver/branches/xarchiver-psybsd/TODO
===================================================================
--- xarchiver/branches/xarchiver-psybsd/TODO	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/TODO	2006-11-17 20:08:53 UTC (rev 23896)
@@ -46,4 +46,7 @@
 
 	In treeview, when going to up dir, select the dir you came from
 
+	When retrieving selected items from the treeview, forget the updir item
+	Add trailing '/' to folder filenames when getting it from treeview
+
   ... Complete TODO-file

Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c	2006-11-17 20:08:53 UTC (rev 23896)
@@ -181,7 +181,8 @@
 			NULL,
 			g_cclosure_marshal_VOID__POINTER,
 			G_TYPE_NONE,
-			0,
+			1,
+			G_TYPE_STRING,
 			NULL);
 }
 

Modified: xarchiver/branches/xarchiver-psybsd/po/nl.po
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/nl.po	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/po/nl.po	2006-11-17 20:08:53 UTC (rev 23896)
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: xarchiver 0.3.9psybsd\n"
 "Report-Msgid-Bugs-To: psybsd at gmail.com\n"
-"POT-Creation-Date: 2006-11-13 10:55+0100\n"
+"POT-Creation-Date: 2006-11-17 20:52+0100\n"
 "PO-Revision-Date: 2006-07-20 16:36+0200\n"
 "Last-Translator: Stephan Arts <psybsd at gmail.com>\n"
 "Language-Team: Dutch <vertaling at vrijschrift.org>\n"
@@ -16,11 +16,11 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: ../libxarchiver/archive.c:398
+#: ../libxarchiver/archive.c:424
 msgid "Filename"
 msgstr "Bestandsnaam"
 
-#: ../libxarchiver/archive.c:401
+#: ../libxarchiver/archive.c:427
 msgid "Mime type"
 msgstr "Mime type"
 
@@ -141,61 +141,70 @@
 "opties.\n"
 
 #. File menu
-#: ../src/main_window.c:185
+#: ../src/main_window.c:188
 msgid "_File"
 msgstr "_Bestand"
 
 #. Action menu
-#: ../src/main_window.c:216
+#: ../src/main_window.c:219
 msgid "_Action"
 msgstr "_Actie"
 
-#: ../src/main_window.c:221
+#: ../src/main_window.c:224
 msgid "_Add"
 msgstr "_Toevoegen"
 
-#: ../src/main_window.c:226
+#: ../src/main_window.c:230
 msgid "_Extract"
 msgstr "_Uitpakken"
 
 #. View menu
-#: ../src/main_window.c:234
+#: ../src/main_window.c:244
 msgid "_View"
 msgstr "B_eeld"
 
-#: ../src/main_window.c:238
+#: ../src/main_window.c:248
 msgid "_Location Selector"
 msgstr "_Locatie Selecteerder"
 
-#: ../src/main_window.c:243
+#: ../src/main_window.c:253
 msgid "Internal style"
 msgstr "Interne stijl"
 
-#: ../src/main_window.c:247
+#: ../src/main_window.c:257
 msgid "Toolbar style"
 msgstr "Toolbar stijl"
 
-#: ../src/main_window.c:251
+#: ../src/main_window.c:261
 msgid "Pathbar style"
 msgstr "Padbar stijl"
 
-#: ../src/main_window.c:277
+#: ../src/main_window.c:287
 msgid "Add"
 msgstr "Toevoegen"
 
-#: ../src/main_window.c:281 ../src/extract_dialog.c:102
+#: ../src/main_window.c:291 ../src/main_window.c:672
+#: ../src/extract_dialog.c:102
 msgid "Extract"
 msgstr "Uitpakken"
 
-#: ../src/main_window.c:476
+#: ../src/main_window.c:489
 msgid "Open archive"
 msgstr "Archief openen"
 
-#: ../src/main_window.c:646
+#: ../src/main_window.c:671
+msgid "Which action do you want to perform on the selected file(s)?"
+msgstr "Welke actie wil je uitvoeren op de geselecteerde bestand(en)?"
+
+#: ../src/main_window.c:672
+msgid "View"
+msgstr "Weergeven"
+
+#: ../src/main_window.c:735
 msgid "Failed to open file"
 msgstr "Het openen van een bestand is mislukt"
 
-#: ../src/main_window.c:647
+#: ../src/main_window.c:736
 #, c-format
 msgid ""
 "'%s'\n"

Modified: xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot	2006-11-17 20:08:53 UTC (rev 23896)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: psybsd at gmail.com\n"
-"POT-Creation-Date: 2006-11-13 10:55+0100\n"
+"POT-Creation-Date: 2006-11-17 20:52+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,11 +16,11 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ../libxarchiver/archive.c:398
+#: ../libxarchiver/archive.c:424
 msgid "Filename"
 msgstr ""
 
-#: ../libxarchiver/archive.c:401
+#: ../libxarchiver/archive.c:427
 msgid "Mime type"
 msgstr ""
 
@@ -138,61 +138,70 @@
 msgstr ""
 
 #. File menu
-#: ../src/main_window.c:185
+#: ../src/main_window.c:188
 msgid "_File"
 msgstr ""
 
 #. Action menu
-#: ../src/main_window.c:216
+#: ../src/main_window.c:219
 msgid "_Action"
 msgstr ""
 
-#: ../src/main_window.c:221
+#: ../src/main_window.c:224
 msgid "_Add"
 msgstr ""
 
-#: ../src/main_window.c:226
+#: ../src/main_window.c:230
 msgid "_Extract"
 msgstr ""
 
 #. View menu
-#: ../src/main_window.c:234
+#: ../src/main_window.c:244
 msgid "_View"
 msgstr ""
 
-#: ../src/main_window.c:238
+#: ../src/main_window.c:248
 msgid "_Location Selector"
 msgstr ""
 
-#: ../src/main_window.c:243
+#: ../src/main_window.c:253
 msgid "Internal style"
 msgstr ""
 
-#: ../src/main_window.c:247
+#: ../src/main_window.c:257
 msgid "Toolbar style"
 msgstr ""
 
-#: ../src/main_window.c:251
+#: ../src/main_window.c:261
 msgid "Pathbar style"
 msgstr ""
 
-#: ../src/main_window.c:277
+#: ../src/main_window.c:287
 msgid "Add"
 msgstr ""
 
-#: ../src/main_window.c:281 ../src/extract_dialog.c:102
+#: ../src/main_window.c:291 ../src/main_window.c:672
+#: ../src/extract_dialog.c:102
 msgid "Extract"
 msgstr ""
 
-#: ../src/main_window.c:476
+#: ../src/main_window.c:489
 msgid "Open archive"
 msgstr ""
 
-#: ../src/main_window.c:646
+#: ../src/main_window.c:671
+msgid "Which action do you want to perform on the selected file(s)?"
+msgstr ""
+
+#: ../src/main_window.c:672
+msgid "View"
+msgstr ""
+
+#: ../src/main_window.c:735
 msgid "Failed to open file"
 msgstr ""
 
-#: ../src/main_window.c:647
+#: ../src/main_window.c:736
 #, c-format
 msgid ""
 "'%s'\n"

Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-11-17 20:08:53 UTC (rev 23896)
@@ -55,6 +55,7 @@
 enum {
 	XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED = 0,
 	XA_ARCHIVE_STORE_SIGNAL_NEW_ARCHIVE,
+	XA_ARCHIVE_STORE_SIGNAL_FILE_ACTIVATED,
 	XA_ARCHIVE_STORE_SIGNAL_NUMBER
 };
 static gint xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_NUMBER];
@@ -265,7 +266,7 @@
 		 NULL,
 		 g_cclosure_marshal_VOID__VOID,
 		 G_TYPE_NONE,
-		 0,
+		 0, 
 		 NULL);
 
 	xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_NEW_ARCHIVE] = g_signal_new("xa-new-archive",
@@ -278,6 +279,18 @@
 		 G_TYPE_NONE,
 		 0,
 		 NULL);
+
+	xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_FILE_ACTIVATED] = g_signal_new("xa-file-activated",
+	   G_TYPE_FROM_CLASS(as_class),
+		 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		 0,
+		 NULL,
+		 NULL,
+		 g_cclosure_marshal_VOID__POINTER,
+		 G_TYPE_NONE,
+		 1,
+		 G_TYPE_STRING,
+		 NULL);
 /*
 	xa_archive_store_up_entry.filename = "..";
 	xa_archive_store_up_entry.props = NULL;
@@ -1034,6 +1047,7 @@
 
 	gint *indices = gtk_tree_path_get_indices(path);
 	gint depth = gtk_tree_path_get_depth(path) - 1;
+	GValue *value = g_new0(GValue, 1);
 
 	/* only support list: depth is always 0 */
 	g_return_if_fail(depth == 0);
@@ -1066,6 +1080,9 @@
 #ifdef DEBUG
 			g_debug("file clicked");
 #endif
+			lxa_archive_iter_get_prop_value(archive, entry, LXA_ARCHIVE_PROP_FILENAME, value);
+			g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_FILE_ACTIVATED], 0, g_value_get_string(value), NULL); 
+			g_value_unset(value);
 			return;
 		}
 
@@ -1077,6 +1094,7 @@
 
 	xa_archive_store_refresh(store);
 	g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
+	g_free(value);
 }
 
 void

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-11-17 20:08:53 UTC (rev 23896)
@@ -70,9 +70,11 @@
 static void cb_xa_main_close_window(GtkWidget *widget, gpointer userdata);
 
 static void
-cb_xa_main_window_notebook_page_switched(XANotebook *notebook, GtkNotebookPage *page, guint page_nr, gpointer data);
+cb_xa_main_window_notebook_page_switched(XANotebook *, GtkNotebookPage *, guint, gpointer);
 static void
-cb_xa_main_window_notebook_page_removed(XANotebook *notebook, gpointer data);
+cb_xa_main_window_notebook_page_removed(XANotebook *, gpointer);
+static void
+cb_xa_main_window_notebook_file_activated(XANotebook *, gchar *, gpointer);
 
 
 GType
@@ -348,6 +350,7 @@
 	window->notebook = xa_notebook_new(window->navigationbar, use_tabs, window->accel_group);
 	g_signal_connect(G_OBJECT(window->notebook), "switch-page", G_CALLBACK(cb_xa_main_window_notebook_page_switched), window);
 	g_signal_connect(G_OBJECT(window->notebook), "archive-removed", G_CALLBACK(cb_xa_main_window_notebook_page_removed), window);
+	g_signal_connect(G_OBJECT(window->notebook), "xa_file_activated", G_CALLBACK(cb_xa_main_window_notebook_file_activated), window);
 /* Statusbar */
 
 	window->statusbar = gtk_statusbar_new();
@@ -658,6 +661,54 @@
 	}
 }
 
+static void
+cb_xa_main_window_notebook_file_activated(XANotebook *notebook, gchar *path, gpointer data)
+{
+	GtkWindow *window = GTK_WINDOW(data);
+	LXAArchive *lp_archive = NULL;
+	LXAArchiveSupport *lp_support = NULL;
+	gchar *extract_archive_path = NULL;
+	GtkWidget *label = gtk_label_new(_("Which action do you want to perform on the selected file(s)?"));
+	GtkWidget *dialog = gtk_dialog_new_with_buttons("",window,GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, _("View"), GTK_RESPONSE_OK, _("Extract"), GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+	GtkWidget *extr_dialog = NULL;
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 20);
+	gtk_widget_show(label);
+	gint result = gtk_dialog_run(GTK_DIALOG(dialog));
+	gtk_widget_hide(dialog);
+
+	GSList *filenames = g_slist_prepend(NULL, path);
+	switch(result)
+	{
+		case GTK_RESPONSE_OK: /* VIEW */
+			/* extract to tmp and view */
+			break;
+		case GTK_RESPONSE_ACCEPT: /* EXTRACT */
+			xa_notebook_get_active_archive(XA_NOTEBOOK(notebook), &lp_archive, &lp_support);
+			extr_dialog = xa_extract_archive_dialog_new(lp_support, lp_archive, 1);
+			result = gtk_dialog_run (GTK_DIALOG (extr_dialog) );
+			if(result == GTK_RESPONSE_OK)
+			{
+				gtk_widget_hide(extr_dialog);
+				extract_archive_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(extr_dialog));
+				if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(XA_EXTRACT_ARCHIVE_DIALOG(extr_dialog)->all_files_radio)))
+				{
+					g_slist_free(filenames);
+					filenames = NULL;
+				}
+				lxa_archive_support_extract(lp_support, lp_archive, extract_archive_path, filenames);
+				g_free(extract_archive_path);
+				extract_archive_path = NULL;
+			}
+			gtk_widget_destroy (extr_dialog);
+			
+			break;
+		case GTK_RESPONSE_CANCEL: /* CANCEL */
+			break;
+	}
+	g_slist_free(filenames);
+	gtk_widget_destroy(dialog);
+}
+
 gint
 xa_main_window_open_archive(XAMainWindow *window, gchar *path, gint replace)
 {

Modified: xarchiver/branches/xarchiver-psybsd/src/notebook.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/notebook.c	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/src/notebook.c	2006-11-17 20:08:53 UTC (rev 23896)
@@ -46,11 +46,14 @@
 static void
 cb_notebook_close_archive(GtkButton *button, GtkWidget *child);
 
-void
+static void
 cb_notebook_archive_status_changed(LXAArchive *archive, XANotebook *notebook);
-void
+static void
 cb_notebook_archive_refreshed(LXAArchive *archive, GtkTreeView *tree_view);
 static void
+cb_notebook_file_activated(XAArchiveStore *, gchar *, XANotebook *);
+
+static void
 cb_xa_notebook_page_switched(XANotebook *notebook, GtkNotebookPage *, guint page_nr, gpointer data);
 static void
 cb_xa_notebook_page_removed(XANotebook *notebook, gpointer data);
@@ -122,6 +125,13 @@
 			g_cclosure_marshal_VOID__VOID,
 			G_TYPE_NONE, 0, NULL);
 
+	xa_notebook_signals[3] = g_signal_new("xa_file_activated",
+			G_TYPE_FROM_CLASS(notebook_class),
+			G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, 0,
+			NULL, NULL,
+			g_cclosure_marshal_VOID__POINTER,
+			G_TYPE_NONE, 1, G_TYPE_STRING, NULL);
+
 	pspec = g_param_spec_boolean("multi_tab",
 		"",
 		"",
@@ -239,6 +249,9 @@
 	GtkWidget *tree_view = gtk_tree_view_new();
 	gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree_view), TRUE);
 
+	GtkTreeSelection *selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (tree_view) );
+	gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+
 	GtkTreeModel *tree_model = xa_archive_store_new(archive, notebook->props._show_icons, notebook->props._up_dir, notebook->icon_theme);
 
 	gtk_box_pack_start(GTK_BOX(lbl_hbox), archive_image, FALSE, FALSE, 3);
@@ -252,6 +265,7 @@
 	g_signal_connect(G_OBJECT(archive), "lxa_refreshed", G_CALLBACK(cb_notebook_archive_refreshed), tree_view);
 
 	g_signal_connect(G_OBJECT(close_button), "clicked", G_CALLBACK(cb_notebook_close_archive), scroll_window);
+	g_signal_connect(G_OBJECT(tree_model), "xa_file_activated", G_CALLBACK(cb_notebook_file_activated), notebook);
 
 
 	xa_archive_store_set_support(XA_ARCHIVE_STORE(tree_model), support);
@@ -281,7 +295,7 @@
 
 	gint n = gtk_notebook_page_num(notebook, child);
 	gtk_notebook_remove_page(notebook, n);
-	g_signal_emit(G_OBJECT(notebook), xa_notebook_signals[0], 0, notebook);
+	g_signal_emit(G_OBJECT(notebook), xa_notebook_signals[0], 0, NULL);
 }
 
 void
@@ -290,7 +304,7 @@
 	GtkNotebook *_notebook = GTK_NOTEBOOK(notebook);
 	gint n = gtk_notebook_get_current_page(_notebook);
 	gtk_notebook_remove_page(_notebook, n);
-	g_signal_emit(G_OBJECT(notebook), xa_notebook_signals[0], 0, notebook);
+	g_signal_emit(G_OBJECT(notebook), xa_notebook_signals[0], 0, NULL);
 }
 
 void
@@ -388,7 +402,15 @@
 		xa_navigation_bar_set_store(notebook->navigation_bar, NULL);
 }
 
+static void
+cb_notebook_file_activated(XAArchiveStore *store, gchar *filename, XANotebook *notebook)
+{
+	gchar *pwd = xa_archive_store_get_pwd(store);
+	gchar *path = g_strconcat(pwd, filename, NULL);
+	g_signal_emit(G_OBJECT(notebook), xa_notebook_signals[3], 0, path, NULL);
+}
 
+
 void
 xa_notebook_get_active_archive(XANotebook *notebook, LXAArchive **lp_archive, LXAArchiveSupport **lp_support)
 {

Modified: xarchiver/branches/xarchiver-psybsd/xarchiver.desktop.in
===================================================================
--- xarchiver/branches/xarchiver-psybsd/xarchiver.desktop.in	2006-11-17 16:11:26 UTC (rev 23895)
+++ xarchiver/branches/xarchiver-psybsd/xarchiver.desktop.in	2006-11-17 20:08:53 UTC (rev 23896)
@@ -2,8 +2,8 @@
 Encoding=UTF-8
 Version=1.0
 Name=Xarchiver
-Comment=A GTK+2 only archive manager
-GenericName=Archive manager
+_Comment=A GTK+2 only archive manager
+_GenericName=Archive manager
 Exec=xarchiver
 Icon=xarchiver.png
 Terminal=false



More information about the Xfce4-commits mailing list