[Xfce4-commits] r23194 - in xarchiver/branches/xarchiver-psybsd: . libxarchiver po src
Stephan Arts
stephan at xfce.org
Thu Sep 21 21:56:19 UTC 2006
Author: stephan
Date: 2006-09-21 21:56:17 +0000 (Thu, 21 Sep 2006)
New Revision: 23194
Modified:
xarchiver/branches/xarchiver-psybsd/TODO
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.h
xarchiver/branches/xarchiver-psybsd/po/POTFILES.in
xarchiver/branches/xarchiver-psybsd/po/nl.po
xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
xarchiver/branches/xarchiver-psybsd/src/main.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
xarchiver/branches/xarchiver-psybsd/src/main_window.h
Log:
Fixed 'stop' button
Modified: xarchiver/branches/xarchiver-psybsd/TODO
===================================================================
--- xarchiver/branches/xarchiver-psybsd/TODO 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/TODO 2006-09-21 21:56:17 UTC (rev 23194)
@@ -9,6 +9,9 @@
---------------------------------------------------------------
+-+-+-+
+ Fix 'Stop' Segfault
+
++-+-+-+
Fix table column stuff work correctly
+-+-+-+
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -195,6 +195,7 @@
LXAArchiveSupportGnuTar *support;
support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, "view-time", TRUE, "view-date", TRUE, "view-owner", TRUE, "view-rights", TRUE, NULL);
+ /* support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, NULL); */
return LXA_ARCHIVE_SUPPORT(support);
}
@@ -473,7 +474,10 @@
gchar *temp_filename = NULL;
gchar *_size = NULL;
+ if(!LXA_IS_ARCHIVE(archive))
+ return FALSE;
+
if(cond & (G_IO_PRI | G_IO_IN))
{
while(TRUE)
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -1,5 +1,4 @@
-/*
- * Copyright (c) 2006 Stephan Arts <psyBSD at gmail.com>
+/* * Copyright (c) 2006 Stephan Arts <psyBSD at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +22,10 @@
#include <glib/gstdio.h>
#include <glib-object.h>
#include <thunar-vfs/thunar-vfs.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
#include "archive.h"
#include "archive-support.h"
@@ -41,7 +44,7 @@
void
lxa_archive_free_entry(LXAEntry *entry, LXAArchive *archive);
-static gint lxa_archive_signals[1];
+static gint lxa_archive_signals[2];
GType
@@ -87,6 +90,17 @@
G_TYPE_NONE,
0,
NULL);
+
+ lxa_archive_signals[1] = g_signal_new("destroy",
+ G_TYPE_FROM_CLASS(archive_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0,
+ NULL);
}
static void
@@ -103,6 +117,18 @@
g_free(archive->path);
/* TODO: free archive->root_entry.children */
lxa_archive_free_entry(&archive->root_entry, archive);
+ g_debug("destroying archive");
+ switch(archive->status)
+ {
+ case(LXA_ARCHIVESTATUS_IDLE):
+ case(LXA_ARCHIVESTATUS_ERROR):
+ case(LXA_ARCHIVESTATUS_USERBREAK):
+ break;
+ default:
+ kill ( archive->child_pid , SIGHUP);
+ break;
+ }
+ g_signal_emit(G_OBJECT(archive), lxa_archive_signals[1], 0, archive);
}
LXAArchive *
@@ -136,11 +162,14 @@
void
lxa_archive_set_status(LXAArchive *archive, LXAArchiveStatus status)
{
- if(archive->status != status)
+ if(LXA_IS_ARCHIVE(archive))
{
- archive->old_status = archive->status;
- archive->status = status;
- g_signal_emit(G_OBJECT(archive), lxa_archive_signals[0], 0, archive);
+ if(archive->status != status)
+ {
+ archive->old_status = archive->status;
+ archive->status = status;
+ g_signal_emit(G_OBJECT(archive), lxa_archive_signals[0], 0, archive);
+ }
}
}
@@ -222,3 +251,10 @@
}
g_free(entry->filename);
}
+
+gint
+lxa_stop_archive_child( LXAArchive *archive )
+{
+ lxa_archive_set_status(archive, LXA_ARCHIVESTATUS_USERBREAK);
+ return 0;
+}
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-09-21 21:56:17 UTC (rev 23194)
@@ -27,7 +27,6 @@
LXA_ARCHIVESTATUS_EXTRACT,
LXA_ARCHIVESTATUS_REMOVE,
LXA_ARCHIVESTATUS_REFRESH,
- LXA_ARCHIVESTATUS_VIEW,
LXA_ARCHIVESTATUS_ERROR,
LXA_ARCHIVESTATUS_USERBREAK
} LXAArchiveStatus;
@@ -45,7 +44,7 @@
#define LXA_IS_ARCHIVE(obj) ( \
G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- xa_archive_get_type()))
+ lxa_archive_get_type()))
#define LXA_ARCHIVE_CLASS(class) ( \
G_TYPE_CHECK_CLASS_CAST ((class), \
@@ -68,6 +67,9 @@
LXAArchiveStatus status;
LXAArchiveStatus old_status;
GPid child_pid;
+ GIOChannel *ioc_in;
+ GIOChannel *ioc_out;
+ GIOChannel *ioc_err;
gpointer support;
gchar *tmp_file;
gchar *files;
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -33,12 +33,17 @@
{
LXAArchive *archive = data;
archive->child_pid = 0;
- if(archive->status != LXA_ARCHIVESTATUS_REFRESH)
- lxa_archive_set_status(archive, LXA_ARCHIVESTATUS_IDLE);
- if(archive->files)
+ if(archive->old_status == LXA_ARCHIVESTATUS_REFRESH && archive->status == LXA_ARCHIVESTATUS_USERBREAK)
+ g_object_unref(archive);
+ else
{
- g_free(archive->files);
- archive->files = NULL;
+ if(archive->status != LXA_ARCHIVESTATUS_REFRESH)
+ lxa_archive_set_status(archive, LXA_ARCHIVESTATUS_IDLE);
+ if(archive->files)
+ {
+ g_free(archive->files);
+ archive->files = NULL;
+ }
}
}
@@ -48,7 +53,6 @@
gchar **argvp;
gint argcp;
gint fd_in, fd_out, fd_err;
- GIOChannel *ioc_in, *ioc_out, *ioc_err;
if (archive->child_pid)
return 1;
@@ -88,30 +92,30 @@
#ifdef DEBUG
g_debug("Adding watch to stdin");
#endif
- ioc_in = g_io_channel_unix_new(fd_in);
- g_io_channel_set_encoding (ioc_in, "ISO8859-1" , NULL);
- g_io_channel_set_flags ( ioc_in, G_IO_FLAG_NONBLOCK , NULL );
- g_io_add_watch (ioc_in, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, f_in, archive);
+ archive->ioc_in = g_io_channel_unix_new(fd_in);
+ g_io_channel_set_encoding (archive->ioc_in, "ISO8859-1" , NULL);
+ g_io_channel_set_flags ( archive->ioc_in, G_IO_FLAG_NONBLOCK , NULL );
+ g_io_add_watch (archive->ioc_in, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, f_in, archive);
}
if(f_out)
{
#ifdef DEBUG
g_debug("Adding watch to stdout");
#endif
- ioc_out = g_io_channel_unix_new(fd_out);
- g_io_channel_set_encoding (ioc_out, NULL, NULL);
- g_io_channel_set_flags ( ioc_out , G_IO_FLAG_NONBLOCK , NULL );
- g_io_add_watch (ioc_out, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, f_out, archive);
+ archive->ioc_out = g_io_channel_unix_new(fd_out);
+ g_io_channel_set_encoding (archive->ioc_out, NULL, NULL);
+ g_io_channel_set_flags (archive->ioc_out , G_IO_FLAG_NONBLOCK , NULL );
+ g_io_add_watch (archive->ioc_out, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, f_out, archive);
}
if(f_err)
{
#ifdef DEBUG
g_debug("Adding watch to stderr");
#endif
- ioc_err = g_io_channel_unix_new(fd_out);
+ archive->ioc_err = g_io_channel_unix_new(fd_out);
// g_io_channel_set_encoding (ioc_err, "ISO8859-1" , NULL);
- g_io_channel_set_flags ( ioc_err , G_IO_FLAG_NONBLOCK , NULL );
- g_io_add_watch (ioc_err, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, f_err, archive);
+ g_io_channel_set_flags (archive->ioc_err , G_IO_FLAG_NONBLOCK , NULL );
+ g_io_add_watch (archive->ioc_err, G_IO_IN|G_IO_PRI|G_IO_NVAL, f_err, archive);
}
return 0;
}
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -97,4 +97,5 @@
void
lxa_close_archive(LXAArchive *archive)
{
+ g_object_unref(archive);
}
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.h 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.h 2006-09-21 21:56:17 UTC (rev 23194)
@@ -74,6 +74,9 @@
void
lxa_close_archive( LXAArchive *archive );
+gint
+lxa_stop_archive_child( LXAArchive *archive );
+
G_END_DECLS
#endif /* __LIBXARCHIVER_H__ */
Modified: xarchiver/branches/xarchiver-psybsd/po/POTFILES.in
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/POTFILES.in 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/po/POTFILES.in 2006-09-21 21:56:17 UTC (rev 23194)
@@ -9,5 +9,3 @@
src/main_window.c
src/new_dialog.c
src/extract_dialog.c
-src/main_window_menu_bar.c
-src/main_window_tool_bar.c
Modified: xarchiver/branches/xarchiver-psybsd/po/nl.po
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-09-21 21:56:17 UTC (rev 23194)
@@ -6,8 +6,8 @@
msgid ""
msgstr ""
"Project-Id-Version: xarchiver 0.3.9psybsd\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-04 01:18+0200\n"
+"Report-Msgid-Bugs-To: psybsd at gmail.com\n"
+"POT-Creation-Date: 2006-09-21 23:56+0200\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,12 +16,12 @@
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: ../libxarchiver/archive-support-gnu-tar.c:127
+#: ../libxarchiver/archive-support-gnu-tar.c:133
#: ../libxarchiver/archive-support-zip.c:104
msgid "Overwrite existing files"
msgstr "Bestaande bestanden overschrijven"
-#: ../libxarchiver/archive-support-gnu-tar.c:128
+#: ../libxarchiver/archive-support-gnu-tar.c:134
#: ../libxarchiver/archive-support-zip.c:105
msgid "Overwrite existing files on extraction"
msgstr "Bestaande bestanden overschrijven tijdens uitpakken"
@@ -47,11 +47,11 @@
msgid "Version information"
msgstr "Versie informatie"
-#: ../src/main.c:108
+#: ../src/main.c:119
msgid "[archive name]"
msgstr "[archief naam]"
-#: ../src/main.c:112
+#: ../src/main.c:123
#, c-format
msgid ""
"%s: %s\n"
@@ -64,7 +64,7 @@
#.
#. * Could not create archive (mime type unsupported)
#.
-#: ../src/main.c:185
+#: ../src/main.c:196
msgid "Could not create archive, MIME-type unsupported"
msgstr "Kan archief niet maken, MIME-type wordt niet ondersteund"
@@ -72,60 +72,89 @@
#. * Could not open archive (mime type not supported or file did not exist)
#. * Should be a more specific error message.
#.
-#: ../src/main.c:202
+#: ../src/main.c:213
msgid "Could not open archive, MIME-type unsupported or file did not exist"
msgstr ""
"Kan archief niet openen, MIME-type wordt niet ondersteund of bestand bestaat "
"niet"
-#: ../src/main_window.c:170
+#: ../src/main_window.c:94
+msgid "_Archive"
+msgstr "_Archief"
+
+#: ../src/main_window.c:95
+msgid "A_ction"
+msgstr "A_ctie"
+
+#: ../src/main_window.c:96
+msgid "_Help"
+msgstr "_Help"
+
+#: ../src/main_window.c:136 ../src/main_window.c:175
+msgid "Add"
+msgstr "Toevoegen"
+
+#: ../src/main_window.c:141 ../src/main_window.c:179
+#: ../src/extract_dialog.c:99
+msgid "Extract"
+msgstr "Uitpakken"
+
+#: ../src/main_window.c:314
msgid "Open archive"
msgstr "Archief openen"
+#: ../src/main_window.c:422
+msgid "Initializing archive..."
+msgstr "Bezig met initialiseren van archief..."
+
+#: ../src/main_window.c:425
+msgid "Reading archive contents..."
+msgstr "Bezig met lezen van archief..."
+
+#: ../src/main_window.c:428
+msgid "Extracting archive..."
+msgstr "Archief uitpakken..."
+
+#: ../src/main_window.c:431
+msgid "Adding file(s) to archive..."
+msgstr "Bestand(en) toevoegen aan archief..."
+
+#: ../src/main_window.c:434
+msgid "Removing file(s) from archive..."
+msgstr "Bestand(en) toevoegen aan archief..."
+
+#: ../src/main_window.c:448
+msgid "Done"
+msgstr "Klaar"
+
+#: ../src/main_window.c:481
+msgid "Error"
+msgstr "Fout"
+
+#: ../src/main_window.c:499
+msgid "Cancelled"
+msgstr "Geannuleerd"
+
#: ../src/new_dialog.c:85
msgid "Create new archive"
msgstr "Maak nieuw archief"
-#: ../src/extract_dialog.c:74
+#: ../src/extract_dialog.c:75
msgid "<b>Extract files:</b>"
msgstr "<b> Bestanden uitpakken:</b>"
-#: ../src/extract_dialog.c:75
+#: ../src/extract_dialog.c:76
msgid "<b>Options:</b>"
msgstr "<b>Opties:</b>"
-#: ../src/extract_dialog.c:85
+#: ../src/extract_dialog.c:86
msgid "All files"
msgstr "Alle bestanden"
-#: ../src/extract_dialog.c:86
+#: ../src/extract_dialog.c:87
msgid "Selected files"
msgstr "Geselecteerde bestanden"
-#: ../src/extract_dialog.c:98 ../src/main_window_menu_bar.c:122
-#: ../src/main_window_tool_bar.c:91
-msgid "Extract"
-msgstr "Uitpakken"
-
-#: ../src/extract_dialog.c:110
+#: ../src/extract_dialog.c:111
msgid "Extract archive"
msgstr "Archief uitpakken"
-
-#: ../src/main_window_menu_bar.c:75
-msgid "_Archive"
-msgstr "_Archief"
-
-#: ../src/main_window_menu_bar.c:76
-msgid "A_ction"
-msgstr "A_ctie"
-
-#: ../src/main_window_menu_bar.c:77
-msgid "_Help"
-msgstr "_Help"
-
-#: ../src/main_window_menu_bar.c:117 ../src/main_window_tool_bar.c:88
-msgid "Add"
-msgstr "Toevoegen"
-
-#~ msgid "Delete"
-#~ msgstr "Verwijderen"
Modified: xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-09-21 21:56:17 UTC (rev 23194)
@@ -7,8 +7,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-04 01:18+0200\n"
+"Report-Msgid-Bugs-To: psybsd at gmail.com\n"
+"POT-Creation-Date: 2006-09-21 23:56+0200\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,12 +16,12 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../libxarchiver/archive-support-gnu-tar.c:127
+#: ../libxarchiver/archive-support-gnu-tar.c:133
#: ../libxarchiver/archive-support-zip.c:104
msgid "Overwrite existing files"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:128
+#: ../libxarchiver/archive-support-gnu-tar.c:134
#: ../libxarchiver/archive-support-zip.c:105
msgid "Overwrite existing files on extraction"
msgstr ""
@@ -47,11 +47,11 @@
msgid "Version information"
msgstr ""
-#: ../src/main.c:108
+#: ../src/main.c:119
msgid "[archive name]"
msgstr ""
-#: ../src/main.c:112
+#: ../src/main.c:123
#, c-format
msgid ""
"%s: %s\n"
@@ -61,7 +61,7 @@
#.
#. * Could not create archive (mime type unsupported)
#.
-#: ../src/main.c:185
+#: ../src/main.c:196
msgid "Could not create archive, MIME-type unsupported"
msgstr ""
@@ -69,55 +69,87 @@
#. * Could not open archive (mime type not supported or file did not exist)
#. * Should be a more specific error message.
#.
-#: ../src/main.c:202
+#: ../src/main.c:213
msgid "Could not open archive, MIME-type unsupported or file did not exist"
msgstr ""
-#: ../src/main_window.c:170
+#: ../src/main_window.c:94
+msgid "_Archive"
+msgstr ""
+
+#: ../src/main_window.c:95
+msgid "A_ction"
+msgstr ""
+
+#: ../src/main_window.c:96
+msgid "_Help"
+msgstr ""
+
+#: ../src/main_window.c:136 ../src/main_window.c:175
+msgid "Add"
+msgstr ""
+
+#: ../src/main_window.c:141 ../src/main_window.c:179
+#: ../src/extract_dialog.c:99
+msgid "Extract"
+msgstr ""
+
+#: ../src/main_window.c:314
msgid "Open archive"
msgstr ""
-#: ../src/new_dialog.c:85
-msgid "Create new archive"
+#: ../src/main_window.c:422
+msgid "Initializing archive..."
msgstr ""
-#: ../src/extract_dialog.c:74
-msgid "<b>Extract files:</b>"
+#: ../src/main_window.c:425
+msgid "Reading archive contents..."
msgstr ""
-#: ../src/extract_dialog.c:75
-msgid "<b>Options:</b>"
+#: ../src/main_window.c:428
+msgid "Extracting archive..."
msgstr ""
-#: ../src/extract_dialog.c:85
-msgid "All files"
+#: ../src/main_window.c:431
+msgid "Adding file(s) to archive..."
msgstr ""
-#: ../src/extract_dialog.c:86
-msgid "Selected files"
+#: ../src/main_window.c:434
+msgid "Removing file(s) from archive..."
msgstr ""
-#: ../src/extract_dialog.c:98 ../src/main_window_menu_bar.c:122
-#: ../src/main_window_tool_bar.c:91
-msgid "Extract"
+#: ../src/main_window.c:448
+msgid "Done"
msgstr ""
-#: ../src/extract_dialog.c:110
-msgid "Extract archive"
+#: ../src/main_window.c:481
+msgid "Error"
msgstr ""
-#: ../src/main_window_menu_bar.c:75
-msgid "_Archive"
+#: ../src/main_window.c:499
+msgid "Cancelled"
msgstr ""
-#: ../src/main_window_menu_bar.c:76
-msgid "A_ction"
+#: ../src/new_dialog.c:85
+msgid "Create new archive"
msgstr ""
-#: ../src/main_window_menu_bar.c:77
-msgid "_Help"
+#: ../src/extract_dialog.c:75
+msgid "<b>Extract files:</b>"
msgstr ""
-#: ../src/main_window_menu_bar.c:117 ../src/main_window_tool_bar.c:88
-msgid "Add"
+#: ../src/extract_dialog.c:76
+msgid "<b>Options:</b>"
msgstr ""
+
+#: ../src/extract_dialog.c:86
+msgid "All files"
+msgstr ""
+
+#: ../src/extract_dialog.c:87
+msgid "Selected files"
+msgstr ""
+
+#: ../src/extract_dialog.c:111
+msgid "Extract archive"
+msgstr ""
Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -90,7 +90,10 @@
cb_main_window_destroy(XAMainWindow *window, gpointer data)
{
if(window->lp_xa_archive)
+ {
+ lxa_close_archive(window->lp_xa_archive);
opened_archives--;
+ }
if(opened_archives <= 0)
{
gtk_main_quit();
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-21 21:56:17 UTC (rev 23194)
@@ -23,6 +23,7 @@
#include <libxarchiver/libxarchiver.h>
#include "main_window.h"
#include "new_dialog.h"
+#include "extract_dialog.h"
#include "main.h"
@@ -73,7 +74,7 @@
xa_main_window_init(XAMainWindow *window)
{
GtkWidget *main_vbox;
- GtkWidget *menubar, *toolbar, *statusbar;
+ GtkWidget *menubar, *toolbar;
GtkWidget *menu_separator;
GtkToolItem *tool_separator;
GtkWidget *tmp_image;
@@ -150,6 +151,9 @@
window->menubar.menu_item_settings = gtk_image_menu_item_new_from_stock("gtk-preferences", accel_group);
gtk_container_add(GTK_CONTAINER(window->menubar.menu_action), window->menubar.menu_item_settings);
+ g_signal_connect(G_OBJECT(window->menubar.menu_item_add), "activate", G_CALLBACK(cb_xa_main_add_to_archive), window);
+ g_signal_connect(G_OBJECT(window->menubar.menu_item_extract), "activate", G_CALLBACK(cb_xa_main_extract_archive), window);
+
/* Help menu */
window->menubar.menu_item_about = gtk_image_menu_item_new_from_stock("gtk-about", accel_group);
gtk_container_add(GTK_CONTAINER(window->menubar.menu_help), window->menubar.menu_item_about);
@@ -185,6 +189,18 @@
gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(window->toolbar.tool_item_remove));
gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(tool_separator));
+ g_signal_connect(G_OBJECT(window->toolbar.tool_item_add), "clicked", G_CALLBACK(cb_xa_main_add_to_archive), window);
+ g_signal_connect(G_OBJECT(window->toolbar.tool_item_extract), "clicked", G_CALLBACK(cb_xa_main_extract_archive), window);
+
+/* control pane */
+
+ window->toolbar.tool_item_stop = gtk_tool_button_new_from_stock("gtk-stop");
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_stop), FALSE);
+
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(window->toolbar.tool_item_stop));
+
+ g_signal_connect(G_OBJECT(window->toolbar.tool_item_stop), "clicked", G_CALLBACK(cb_xa_main_stop_archive), window);
+
/* main view */
window->scrollwindow = gtk_scrolled_window_new(NULL, NULL);
@@ -197,17 +213,17 @@
g_signal_connect(G_OBJECT(window->treeview), "row-activated", G_CALLBACK(cb_xa_main_item_activated), window);
/* Statusbar */
- statusbar = gtk_statusbar_new();
+ window->statusbar = gtk_statusbar_new();
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), toolbar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), window->scrollwindow, TRUE, TRUE, 0);
- gtk_box_pack_end(GTK_BOX(main_vbox), statusbar, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(main_vbox), window->statusbar, FALSE, FALSE, 0);
gtk_widget_show(main_vbox);
gtk_widget_show_all(menubar);
gtk_widget_show_all(toolbar);
- gtk_widget_show_all(statusbar);
+ gtk_widget_show_all(window->statusbar);
gtk_container_add(GTK_CONTAINER(window), main_vbox);
}
@@ -323,11 +339,51 @@
}
void
+cb_xa_main_add_to_archive(GtkWidget *widget, gpointer userdata)
+{
+
+}
+
+void
cb_xa_main_extract_archive(GtkWidget *widget, gpointer userdata)
{
+ GtkWidget *dialog = NULL;
+ gchar *extract_archive_path = NULL;
+ gint result = 0;
+ XAMainWindow *window = XA_MAIN_WINDOW(userdata);
+ LXAArchiveSupport *lp_support = NULL;
+ lp_support = lxa_get_support_for_mime(window->lp_xa_archive->mime);
+
+ dialog = xa_extract_archive_dialog_new(lp_support, window->lp_xa_archive, FALSE);
+ result = gtk_dialog_run (GTK_DIALOG (dialog) );
+ if(result == GTK_RESPONSE_OK)
+ {
+ gtk_widget_hide(GTK_WIDGET(dialog));
+ extract_archive_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ lxa_archive_support_extract(lp_support, window->lp_xa_archive, extract_archive_path, NULL);
+ g_free(extract_archive_path);
+ extract_archive_path = NULL;
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog) );
}
+void
+cb_xa_main_stop_archive(GtkWidget *widget, gpointer userdata)
+{
+ XAMainWindow *window = XA_MAIN_WINDOW(userdata);
+
+ lxa_stop_archive_child(window->lp_xa_archive);
+}
+
+void
+xa_main_window_archive_destroyed(LXAArchive *archive, XAMainWindow *window)
+{
+ g_debug("AAA");
+ if(archive == window->lp_xa_archive)
+ window->lp_xa_archive = NULL;
+}
+
gint
xa_main_window_open_archive(XAMainWindow *window, gchar *archive_path)
{
@@ -335,9 +391,7 @@
if(!lxa_open_archive(archive_path, &window->lp_xa_archive))
{
- gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_add), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_remove), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_extract), TRUE);
+ g_signal_connect(G_OBJECT(window->lp_xa_archive), "destroy", G_CALLBACK(xa_main_window_archive_destroyed), window);
g_signal_connect(G_OBJECT(window->lp_xa_archive), "lxa_status_changed", G_CALLBACK(xa_main_window_archive_status_changed), window);
g_slist_free(window->working_node);
window->working_node = NULL;
@@ -362,38 +416,123 @@
GtkListStore *liststore = NULL;
gint x = 0;
XAMainWindow *main_window = XA_MAIN_WINDOW(userdata);
- if(archive->old_status == LXA_ARCHIVESTATUS_REFRESH)
+ switch(archive->status)
{
- GList *columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(main_window->treeview));
- while(columns)
- {
- gtk_tree_view_remove_column(GTK_TREE_VIEW(main_window->treeview), columns->data);
- columns = columns->next;
- }
- g_list_free(columns);
- liststore = gtk_list_store_newv(archive->column_number, archive->column_types);
+ case(LXA_ARCHIVESTATUS_INIT):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Initializing archive..."));
+ break;
+ case(LXA_ARCHIVESTATUS_REFRESH):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Reading archive contents..."));
+ break;
+ case(LXA_ARCHIVESTATUS_EXTRACT):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Extracting archive..."));
+ break;
+ case(LXA_ARCHIVESTATUS_ADD):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Adding file(s) to archive..."));
+ break;
+ case(LXA_ARCHIVESTATUS_REMOVE):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Removing file(s) from archive..."));
+ break;
+ case(LXA_ARCHIVESTATUS_IDLE):
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_extract), TRUE);
- for(x = 0; x < archive->column_number; x++)
- {
- switch(archive->column_types[x])
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_extract), TRUE);
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Done"));
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), FALSE);
+ if(archive->old_status == LXA_ARCHIVESTATUS_REFRESH)
{
- case(G_TYPE_STRING):
- case(G_TYPE_UINT64):
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(archive->column_names[x], renderer, "text", x, NULL);
- break;
+ GList *columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(main_window->treeview));
+ while(columns)
+ {
+ gtk_tree_view_remove_column(GTK_TREE_VIEW(main_window->treeview), columns->data);
+ columns = columns->next;
+ }
+ g_list_free(columns);
+ liststore = gtk_list_store_newv(archive->column_number, archive->column_types);
+
+ for(x = 0; x < archive->column_number; x++)
+ {
+ switch(archive->column_types[x])
+ {
+ case(G_TYPE_STRING):
+ case(G_TYPE_UINT64):
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(archive->column_names[x], renderer, "text", x, NULL);
+ break;
+ }
+ gtk_tree_view_column_set_resizable(column, TRUE);
+ gtk_tree_view_column_set_sort_column_id(column, x);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(main_window->treeview), column);
+ }
+ gtk_tree_view_set_model(GTK_TREE_VIEW(main_window->treeview), GTK_TREE_MODEL(liststore));
+ main_window->working_node = g_slist_prepend(main_window->working_node, &(archive->root_entry));
+ xa_main_window_set_contents(main_window, archive, archive->root_entry.children);
}
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_column_set_sort_column_id(column, x);
- gtk_tree_view_append_column(GTK_TREE_VIEW(main_window->treeview), column);
- }
- gtk_tree_view_set_model(GTK_TREE_VIEW(main_window->treeview), GTK_TREE_MODEL(liststore));
- main_window->working_node = g_slist_prepend(main_window->working_node, &(archive->root_entry));
- xa_main_window_set_contents(main_window, archive, archive->root_entry.children);
+ break;
+ case(LXA_ARCHIVESTATUS_ERROR):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Error"));
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_open), TRUE);
+ if(archive->old_status != LXA_ARCHIVESTATUS_REFRESH)
+ {
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_extract), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_extract), TRUE);
+ lxa_close_archive(main_window->lp_xa_archive);
+ }
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), FALSE);
+ break;
+ case(LXA_ARCHIVESTATUS_USERBREAK):
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Cancelled"));
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_open), TRUE);
+ if(archive->old_status != LXA_ARCHIVESTATUS_REFRESH)
+ {
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_extract), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_remove), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_extract), TRUE);
+ }
+ else
+ lxa_close_archive(main_window->lp_xa_archive);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), FALSE);
+ break;
}
- if(archive->status == LXA_ARCHIVESTATUS_IDLE)
+ if((archive->status != LXA_ARCHIVESTATUS_IDLE) &&
+ (archive->status != LXA_ARCHIVESTATUS_ERROR) &&
+ (archive->status != LXA_ARCHIVESTATUS_USERBREAK))
+
{
- /* TODO:Fix stuff */
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_new), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_open), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_add), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_extract), FALSE);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_new), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_open), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_add), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_extract), FALSE);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), TRUE);
}
}
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-09-21 16:23:47 UTC (rev 23193)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-09-21 21:56:17 UTC (rev 23194)
@@ -53,6 +53,7 @@
GtkWindow parent;
GtkWidget *treeview;
GtkWidget *scrollwindow;
+ GtkWidget *statusbar;
struct {
GtkWidget *menu_item_archive;
GtkWidget *menu_archive;
@@ -87,6 +88,7 @@
GtkToolItem *tool_item_add;
GtkToolItem *tool_item_extract;
GtkToolItem *tool_item_remove;
+ GtkToolItem *tool_item_stop;
} toolbar;
LXAArchive *lp_xa_archive;
GValue *parent_node;
@@ -107,6 +109,8 @@
void cb_xa_main_new_archive(GtkWidget *widget, gpointer userdata);
void cb_xa_main_open_archive(GtkWidget *widget, gpointer userdata);
void cb_xa_main_extract_archive(GtkWidget *widget, gpointer userdata);
+void cb_xa_main_add_to_archive(GtkWidget *widget, gpointer userdata);
+void cb_xa_main_stop_archive(GtkWidget *widget, gpointer userdata);
void xa_main_window_archive_status_changed(LXAArchive *archive, gpointer userdata);
gint xa_main_window_open_archive(XAMainWindow *window, gchar *archive_path);
More information about the Xfce4-commits
mailing list