[Xfce4-commits] r23204 - in xarchiver/branches/xarchiver-psybsd: libxarchiver po src
Stephan Arts
stephan at xfce.org
Mon Sep 25 13:23:22 UTC 2006
Author: stephan
Date: 2006-09-25 13:23:21 +0000 (Mon, 25 Sep 2006)
New Revision: 23204
Added:
xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c
xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h
Modified:
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
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/Makefile.am
xarchiver/branches/xarchiver-psybsd/src/add_dialog.c
xarchiver/branches/xarchiver-psybsd/src/add_dialog.h
xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c
xarchiver/branches/xarchiver-psybsd/src/main.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
xarchiver/branches/xarchiver-psybsd/src/main_window.h
Log:
Using GtkIconTheme to retrieve the xarchiver icon
fixed some bugs
started work on 'add-dialog' and 'preferences-dialog'
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -44,9 +44,8 @@
void
lxa_archive_free_entry(LXAEntry *entry, LXAArchive *archive);
-static gint lxa_archive_signals[2];
+static gint lxa_archive_signals[1];
-
GType
lxa_archive_get_type ()
{
@@ -90,17 +89,6 @@
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
@@ -115,9 +103,7 @@
LXAArchive *archive = LXA_ARCHIVE(object);
if(archive->path)
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):
@@ -128,7 +114,6 @@
kill ( archive->child_pid , SIGHUP);
break;
}
- g_signal_emit(G_OBJECT(archive), lxa_archive_signals[1], 0, archive);
}
LXAArchive *
@@ -138,6 +123,7 @@
ThunarVfsMimeInfo *mime_info;
archive = g_object_new(lxa_archive_get_type(), NULL);
+
if(path)
archive->path = g_strdup(path);
else
@@ -155,7 +141,6 @@
g_object_unref(archive);
archive = NULL;
}
-
return archive;
}
Modified: xarchiver/branches/xarchiver-psybsd/po/POTFILES.in
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/POTFILES.in 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/po/POTFILES.in 2006-09-25 13:23:21 UTC (rev 23204)
@@ -8,4 +8,5 @@
src/main.c
src/main_window.c
src/new_dialog.c
+src/add_dialog.c
src/extract_dialog.c
Modified: xarchiver/branches/xarchiver-psybsd/po/nl.po
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-09-25 13:23:21 UTC (rev 23204)
@@ -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-09-21 23:56+0200\n"
+"POT-Creation-Date: 2006-09-25 00:02+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"
@@ -78,67 +78,78 @@
"Kan archief niet openen, MIME-type wordt niet ondersteund of bestand bestaat "
"niet"
-#: ../src/main_window.c:94
+#: ../src/main_window.c:101
msgid "_Archive"
msgstr "_Archief"
-#: ../src/main_window.c:95
+#: ../src/main_window.c:102
msgid "A_ction"
msgstr "A_ctie"
-#: ../src/main_window.c:96
+#: ../src/main_window.c:103
msgid "_Help"
msgstr "_Help"
-#: ../src/main_window.c:136 ../src/main_window.c:175
+#: ../src/main_window.c:147 ../src/main_window.c:191
msgid "Add"
msgstr "Toevoegen"
-#: ../src/main_window.c:141 ../src/main_window.c:179
+#: ../src/main_window.c:152 ../src/main_window.c:195
#: ../src/extract_dialog.c:99
msgid "Extract"
msgstr "Uitpakken"
-#: ../src/main_window.c:314
+#: ../src/main_window.c:357
msgid "Open archive"
msgstr "Archief openen"
-#: ../src/main_window.c:422
+#: ../src/main_window.c:507
msgid "Initializing archive..."
msgstr "Bezig met initialiseren van archief..."
-#: ../src/main_window.c:425
+#: ../src/main_window.c:510
msgid "Reading archive contents..."
msgstr "Bezig met lezen van archief..."
-#: ../src/main_window.c:428
+#: ../src/main_window.c:513
msgid "Extracting archive..."
msgstr "Archief uitpakken..."
-#: ../src/main_window.c:431
+#: ../src/main_window.c:516
msgid "Adding file(s) to archive..."
msgstr "Bestand(en) toevoegen aan archief..."
-#: ../src/main_window.c:434
+#: ../src/main_window.c:519
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
+#: ../src/main_window.c:522
msgid "Error"
msgstr "Fout"
-#: ../src/main_window.c:499
+#: ../src/main_window.c:525
msgid "Cancelled"
msgstr "Geannuleerd"
+#: ../src/main_window.c:528
+msgid "Done"
+msgstr "Klaar"
+
#: ../src/new_dialog.c:85
msgid "Create new archive"
msgstr "Maak nieuw archief"
+#. * XA_ADD_DIALOG
+#. * Frame title
+#.
+#: ../src/add_dialog.c:68
+msgid "Files and folders to add"
+msgstr ""
+
+#: ../src/add_dialog.c:82
+msgid "Add file(s) to archive"
+msgstr "Bestand(en) toevoegen aan archief"
+
#: ../src/extract_dialog.c:75
msgid "<b>Extract files:</b>"
msgstr "<b> Bestanden uitpakken:</b>"
Modified: xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-09-25 13:23:21 UTC (rev 23204)
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: psybsd at gmail.com\n"
-"POT-Creation-Date: 2006-09-21 23:56+0200\n"
+"POT-Creation-Date: 2006-09-25 00:02+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"
@@ -73,67 +73,78 @@
msgid "Could not open archive, MIME-type unsupported or file did not exist"
msgstr ""
-#: ../src/main_window.c:94
+#: ../src/main_window.c:101
msgid "_Archive"
msgstr ""
-#: ../src/main_window.c:95
+#: ../src/main_window.c:102
msgid "A_ction"
msgstr ""
-#: ../src/main_window.c:96
+#: ../src/main_window.c:103
msgid "_Help"
msgstr ""
-#: ../src/main_window.c:136 ../src/main_window.c:175
+#: ../src/main_window.c:147 ../src/main_window.c:191
msgid "Add"
msgstr ""
-#: ../src/main_window.c:141 ../src/main_window.c:179
+#: ../src/main_window.c:152 ../src/main_window.c:195
#: ../src/extract_dialog.c:99
msgid "Extract"
msgstr ""
-#: ../src/main_window.c:314
+#: ../src/main_window.c:357
msgid "Open archive"
msgstr ""
-#: ../src/main_window.c:422
+#: ../src/main_window.c:507
msgid "Initializing archive..."
msgstr ""
-#: ../src/main_window.c:425
+#: ../src/main_window.c:510
msgid "Reading archive contents..."
msgstr ""
-#: ../src/main_window.c:428
+#: ../src/main_window.c:513
msgid "Extracting archive..."
msgstr ""
-#: ../src/main_window.c:431
+#: ../src/main_window.c:516
msgid "Adding file(s) to archive..."
msgstr ""
-#: ../src/main_window.c:434
+#: ../src/main_window.c:519
msgid "Removing file(s) from archive..."
msgstr ""
-#: ../src/main_window.c:448
-msgid "Done"
-msgstr ""
-
-#: ../src/main_window.c:481
+#: ../src/main_window.c:522
msgid "Error"
msgstr ""
-#: ../src/main_window.c:499
+#: ../src/main_window.c:525
msgid "Cancelled"
msgstr ""
+#: ../src/main_window.c:528
+msgid "Done"
+msgstr ""
+
#: ../src/new_dialog.c:85
msgid "Create new archive"
msgstr ""
+#. * XA_ADD_DIALOG
+#. * Frame title
+#.
+#: ../src/add_dialog.c:68
+msgid "Files and folders to add"
+msgstr ""
+
+#: ../src/add_dialog.c:82
+msgid "Add file(s) to archive"
+msgstr ""
+
#: ../src/extract_dialog.c:75
msgid "<b>Extract files:</b>"
msgstr ""
Modified: xarchiver/branches/xarchiver-psybsd/src/Makefile.am
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/Makefile.am 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/Makefile.am 2006-09-25 13:23:21 UTC (rev 23204)
@@ -5,6 +5,7 @@
main_window.c main_window.h \
new_dialog.c new_dialog.h \
add_dialog.c add_dialog.h \
+ preferences_dialog.c preferences_dialog.h \
extract_dialog.c extract_dialog.h
xarchiver_CFLAGS = \
Modified: xarchiver/branches/xarchiver-psybsd/src/add_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/add_dialog.c 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/add_dialog.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -62,13 +62,17 @@
static void
xa_add_dialog_init(XAAddDialog *dialog)
{
-/*
- GtkWidget *hbox = gtk_hbox_new(FALSE, 10);
- gtk_box_pack_start (GTK_BOX (hbox),gtk_label_new (_("Archive type:")),FALSE, FALSE, 0);
-
- gtk_widget_show_all(hbox);
- gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, TRUE, 0);
-*/
+ GtkWidget *frame = gtk_frame_new(_("Files and folders to add"));
+ dialog->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (dialog->scrolled_window), GTK_SHADOW_IN);
+ gtk_container_set_border_width(GTK_CONTAINER(dialog->scrolled_window), 5);
+ gtk_container_add(GTK_CONTAINER(frame), dialog->scrolled_window);
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, TRUE, TRUE, 5);
+ gtk_widget_show_all(frame);
+
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_OK,
Modified: xarchiver/branches/xarchiver-psybsd/src/add_dialog.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/add_dialog.h 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/add_dialog.h 2006-09-25 13:23:21 UTC (rev 23204)
@@ -43,6 +43,7 @@
struct _XAAddDialog
{
GtkDialog parent;
+ GtkWidget *scrolled_window;
};
typedef struct _XAAddDialogClass XAAddDialogClass;
Modified: xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -130,12 +130,12 @@
gtk_box_pack_start(GTK_BOX(r_vbox), test, FALSE, FALSE, 0);
break;
case (G_TYPE_STRING): /* TODO: Add text-field */
- hbox = gtk_hbox_new(FALSE, 0);
+ hbox = gtk_hbox_new(FALSE, 4);
test = gtk_label_new(g_param_spec_get_nick(G_PARAM_SPEC(extract_options->data)));
- gtk_box_pack_start(GTK_BOX(hbox), test, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), test, FALSE, FALSE, 3);
test = gtk_entry_new();
- gtk_box_pack_start(GTK_BOX(hbox), test, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), test, TRUE, TRUE, 3);
g_signal_connect(G_OBJECT(test), "child_notify", G_CALLBACK(xa_extract_dialog_option_child_notify), (void *)g_param_spec_get_name(G_PARAM_SPEC(extract_options->data)));
gtk_box_pack_start(GTK_BOX(r_vbox), hbox, FALSE, FALSE, 0);
Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -107,6 +107,7 @@
GtkWidget *main_window = NULL;
LXAArchive *lp_archive;
LXAArchiveSupport *lpSupport;
+ GtkIconTheme *icon_theme = NULL;
GError *cli_error = NULL;
gint i = 0;
@@ -232,19 +233,20 @@
if(!new_archive && !add_archive_path && !extract_archive && !extract_archive_path)
{
+ icon_theme = gtk_icon_theme_get_default();
if(argc > 1)
{
opened_archives++;
for(i = 1; i < argc; i++)
{
/* Show main window */
- main_window = xa_main_window_new();
+ main_window = xa_main_window_new(icon_theme);
g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(cb_main_window_destroy), NULL);
if(!xa_main_window_open_archive(XA_MAIN_WINDOW(main_window), argv[i]))
{
opened_archives++;
- gtk_widget_set_size_request(main_window, 400, 300);
+ gtk_widget_set_size_request(main_window, 500, 350);
gtk_widget_show_all(main_window);
} else
{
@@ -257,9 +259,9 @@
} else
{
/* Show main window */
- main_window = xa_main_window_new();
+ main_window = xa_main_window_new(icon_theme);
g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(cb_main_window_destroy), NULL);
- gtk_widget_set_size_request(main_window, 400, 300);
+ gtk_widget_set_size_request(main_window, 500, 350);
gtk_widget_show_all(main_window);
}
} else
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+ /*
+ FIXME: File is full of hacks.
+ */
+
#include <config.h>
#include <string.h>
#include <glib.h>
@@ -24,21 +28,39 @@
#include "main_window.h"
#include "new_dialog.h"
#include "extract_dialog.h"
+#include "add_dialog.h"
+#include "preferences_dialog.h"
#include "main.h"
+enum {
+ XA_MAIN_WINDOW_SHOW_ICONS = 1
+};
+
static void
+xa_main_window_init(XAMainWindow *);
+static void
xa_main_window_class_init(XAMainWindowClass *);
-
static void
-xa_main_window_init(XAMainWindow *);
+xa_main_window_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void
+xa_main_window_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
void
cb_xa_main_item_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column, gpointer userdata);
+void
+xa_main_window_archive_destroyed(LXAArchive *archive, XAMainWindow *window);
+
void
xa_main_window_set_contents(XAMainWindow *, LXAArchive *, GSList *);
+void
+cb_xa_main_close_archive(GtkWidget *widget, gpointer userdata);
+
+void
+cb_xa_main_settings_archive(GtkWidget *widget, gpointer userdata);
+
GType
xa_main_window_get_type ()
{
@@ -68,6 +90,18 @@
static void
xa_main_window_class_init(XAMainWindowClass *window_class)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (window_class);
+ GParamSpec *pspec = NULL;
+
+ object_class->set_property = xa_main_window_set_property;
+ object_class->get_property = xa_main_window_get_property;
+
+ pspec = g_param_spec_boolean("show_icons",
+ _("Show icons"),
+ _("Show icons"),
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, XA_MAIN_WINDOW_SHOW_ICONS, pspec);
}
static void
@@ -85,7 +119,6 @@
window->parent_node = g_value_init(window->parent_node, G_TYPE_STRING);
g_value_set_string(window->parent_node, "..");
- gtk_window_set_default_icon_from_file(DATADIR "/pixmaps/xarchiver.png", NULL);
main_vbox = gtk_vbox_new(FALSE, 0);
menubar = gtk_menu_bar_new();
@@ -120,6 +153,9 @@
window->menubar.menu_item_properties = gtk_image_menu_item_new_from_stock("gtk-properties", accel_group);
gtk_container_add(GTK_CONTAINER(window->menubar.menu_archive), window->menubar.menu_item_properties);
+ window->menubar.menu_item_close = gtk_image_menu_item_new_from_stock("gtk-close", accel_group);
+ gtk_container_add(GTK_CONTAINER(window->menubar.menu_archive), window->menubar.menu_item_close);
+
menu_separator = gtk_separator_menu_item_new();
gtk_container_add(GTK_CONTAINER(window->menubar.menu_archive), menu_separator);
@@ -128,6 +164,7 @@
g_signal_connect(G_OBJECT(window->menubar.menu_item_new), "activate", G_CALLBACK(cb_xa_main_new_archive), window);
g_signal_connect(G_OBJECT(window->menubar.menu_item_open), "activate", G_CALLBACK(cb_xa_main_open_archive), window);
+ g_signal_connect(G_OBJECT(window->menubar.menu_item_close), "activate", G_CALLBACK(cb_xa_main_close_archive), window);
/* g_signal_connect(G_OBJECT(window->menubar.menu_item_properties), "activate", NULL, NULL);*/
g_signal_connect(G_OBJECT(window->menubar.menu_item_quit), "activate", G_CALLBACK(gtk_main_quit), window);
@@ -153,7 +190,13 @@
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);
+ g_signal_connect(G_OBJECT(window->menubar.menu_item_settings), "activate", G_CALLBACK(cb_xa_main_settings_archive), window);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_add), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_extract), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_close), FALSE);
+
/* 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);
@@ -229,17 +272,43 @@
}
GtkWidget *
-xa_main_window_new()
+xa_main_window_new(GtkIconTheme *icon_theme)
{
GtkWidget *window;
+ GdkPixbuf *icon = gtk_icon_theme_load_icon(icon_theme, "xarchiver", 24, 0, NULL);
window = g_object_new(xa_main_window_get_type(),
"title", "Xarchiver " PACKAGE_VERSION,
NULL);
+
+ gtk_window_set_icon(GTK_WINDOW(window), icon);
+
return window;
}
+static void
+xa_main_window_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ switch(prop_id)
+ {
+ case XA_MAIN_WINDOW_SHOW_ICONS:
+ g_value_set_boolean(value, XA_MAIN_WINDOW(object)->props._show_icons);
+ break;
+ }
+}
+
+static void
+xa_main_window_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ switch(prop_id)
+ {
+ case XA_MAIN_WINDOW_SHOW_ICONS:
+ XA_MAIN_WINDOW(object)->props._show_icons = g_value_get_boolean(value);
+ break;
+ }
+}
+
GtkWidget *
xa_main_window_find_image(gchar *filename, GtkIconSize size)
{
@@ -277,7 +346,8 @@
{
GtkWidget *dialog = NULL;
gchar *new_archive_path = NULL;
- XAMainWindow *parent_window = XA_MAIN_WINDOW(userdata);
+ XAMainWindow *window = XA_MAIN_WINDOW(userdata);
+ LXAArchiveSupport *lp_support = NULL;
gint result = 0;
dialog = xa_new_archive_dialog_new();
@@ -290,29 +360,63 @@
if(result == GTK_RESPONSE_OK)
{
new_archive_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- if(parent_window->lp_xa_archive)
+ if(window->lp_xa_archive)
{
- g_object_unref(parent_window->lp_xa_archive);
- parent_window->lp_xa_archive = NULL;
+ g_object_unref(window->lp_xa_archive);
+ window->lp_xa_archive = NULL;
}
- if(!lxa_new_archive(new_archive_path, TRUE, NULL, &(parent_window->lp_xa_archive)))
+ if(!lxa_new_archive(new_archive_path, TRUE, NULL, &(window->lp_xa_archive)))
{
g_debug("Archive opened");
+ 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;
+ lp_support = lxa_get_support_for_mime(window->lp_xa_archive->mime);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_close), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_extract), FALSE);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_add), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_extract), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_stop), FALSE);
}
+ else
+ g_debug("Archive-creation failed");
gtk_widget_destroy (GTK_WIDGET (dialog) );
}
}
void
+cb_xa_main_close_archive(GtkWidget *widget, gpointer userdata)
+{
+ g_object_unref(XA_MAIN_WINDOW(userdata)->lp_xa_archive);
+}
+
+void
+cb_xa_main_settings_archive(GtkWidget *widget, gpointer userdata)
+{
+ GtkWidget *dialog = xa_preferences_dialog_new();
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+}
+
+void
cb_xa_main_open_archive(GtkWidget *widget, gpointer userdata)
{
GtkWidget *dialog = NULL;
gchar *open_archive_path = NULL;
gint result = 0;
- XAMainWindow *parent_window = XA_MAIN_WINDOW(userdata);
+ XAMainWindow *window = XA_MAIN_WINDOW(userdata);
dialog = gtk_file_chooser_dialog_new(_("Open archive"),
- GTK_WINDOW(parent_window),
+ GTK_WINDOW(window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
@@ -325,14 +429,16 @@
if(result == GTK_RESPONSE_OK)
{
open_archive_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- if(parent_window->lp_xa_archive)
+ if(window->lp_xa_archive)
{
- g_object_unref(parent_window->lp_xa_archive);
- parent_window->lp_xa_archive = NULL;
+ g_object_unref(window->lp_xa_archive);
+ window->lp_xa_archive = NULL;
}
- xa_main_window_open_archive(parent_window, open_archive_path);
+ xa_main_window_open_archive(window, open_archive_path);
+
+
gtk_widget_destroy (GTK_WIDGET (dialog) );
}
@@ -341,7 +447,21 @@
void
cb_xa_main_add_to_archive(GtkWidget *widget, gpointer userdata)
{
+ GtkWidget *dialog = 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_add_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));
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog) );
+
}
void
@@ -379,9 +499,35 @@
void
xa_main_window_archive_destroyed(LXAArchive *archive, XAMainWindow *window)
{
- g_debug("AAA");
+ GtkTreeModel *liststore = gtk_tree_view_get_model(GTK_TREE_VIEW(window->treeview));
+ GList *columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(window->treeview));
+
+ gtk_list_store_clear(GTK_LIST_STORE(liststore));
+
+ while(columns)
+ {
+ gtk_tree_view_remove_column(GTK_TREE_VIEW(window->treeview), columns->data);
+ columns = columns->next;
+ }
+ g_list_free(columns);
+
if(archive == window->lp_xa_archive)
window->lp_xa_archive = NULL;
+
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_close), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_add), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->menubar.menu_item_extract), FALSE);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_new), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_open), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_add), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_remove), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_extract), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(window->toolbar.tool_item_stop), FALSE);
+ g_debug("AAA");
}
gint
@@ -391,7 +537,6 @@
if(!lxa_open_archive(archive_path, &window->lp_xa_archive))
{
- 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;
@@ -416,39 +561,42 @@
GtkListStore *liststore = NULL;
gint x = 0;
XAMainWindow *main_window = XA_MAIN_WINDOW(userdata);
+ gchar *status_message = NULL;
switch(archive->status)
{
case(LXA_ARCHIVESTATUS_INIT):
- gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Initializing archive..."));
+ status_message = g_strdup(_("Initializing archive..."));
break;
case(LXA_ARCHIVESTATUS_REFRESH):
- gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Reading archive contents..."));
+ status_message = g_strdup( _("Reading archive contents..."));
break;
case(LXA_ARCHIVESTATUS_EXTRACT):
- gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Extracting archive..."));
+ status_message = g_strdup(_("Extracting archive..."));
break;
case(LXA_ARCHIVESTATUS_ADD):
- gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Adding file(s) to archive..."));
+ status_message = g_strdup(_("Adding file(s) to archive..."));
break;
case(LXA_ARCHIVESTATUS_REMOVE):
- gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, _("Removing file(s) from archive..."));
+ status_message = g_strdup(_("Removing file(s) from archive..."));
break;
+ case(LXA_ARCHIVESTATUS_ERROR):
+ status_message = g_strdup(_("Error"));
+ break;
+ case(LXA_ARCHIVESTATUS_USERBREAK):
+ status_message = g_strdup(_("Cancelled"));
+ 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);
-
- 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);
+ status_message = g_strdup(_("Done"));
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->menubar.menu_item_close), 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);
+
GList *columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(main_window->treeview));
while(columns)
{
@@ -477,43 +625,6 @@
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) &&
(archive->status != LXA_ARCHIVESTATUS_ERROR) &&
@@ -534,6 +645,16 @@
gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), TRUE);
}
+ else
+ {
+ 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);
+ gtk_widget_set_sensitive(GTK_WIDGET(main_window->toolbar.tool_item_stop), FALSE);
+ }
+ gtk_statusbar_push(GTK_STATUSBAR(main_window->statusbar), 1, status_message);
}
@@ -632,3 +753,4 @@
g_value_reset(value);
g_free(value);
}
+
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-09-25 13:14:17 UTC (rev 23203)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-09-25 13:23:21 UTC (rev 23204)
@@ -61,6 +61,7 @@
GtkWidget *menu_item_new;
GtkWidget *menu_item_open;
GtkWidget *menu_item_properties;
+ GtkWidget *menu_item_close;
GtkWidget *menu_item_quit;
GtkWidget *menu_item_action;
@@ -93,6 +94,9 @@
LXAArchive *lp_xa_archive;
GValue *parent_node;
GSList *working_node;
+ struct {
+ gboolean _show_icons;
+ } props;
};
typedef struct _XAMainWindowClass XAMainWindowClass;
@@ -102,7 +106,7 @@
GtkWindowClass parent;
};
-GtkWidget *xa_main_window_new();
+GtkWidget *xa_main_window_new(GtkIconTheme *icon_theme);
GtkWidget *xa_main_window_find_image(gchar *, GtkIconSize);
GType xa_main_window_get_type ();
Added: xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c 2006-09-25 13:23:21 UTC (rev 23204)
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libxarchiver/libxarchiver.h>
+#include "preferences_dialog.h"
+
+static void
+xa_preferences_dialog_class_init(XAPreferencesDialogClass *archive_class);
+
+static void
+xa_preferences_dialog_init(XAPreferencesDialog *archive);
+
+GType
+xa_preferences_dialog_get_type ()
+{
+ static GType xa_preferences_dialog_type = 0;
+
+ if (!xa_preferences_dialog_type)
+ {
+ static const GTypeInfo xa_preferences_dialog_info =
+ {
+ sizeof (XAPreferencesDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) xa_preferences_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (XAPreferencesDialog),
+ 0,
+ (GInstanceInitFunc) xa_preferences_dialog_init,
+ NULL
+ };
+
+ xa_preferences_dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "XAPreferencesDialog", &xa_preferences_dialog_info, 0);
+ }
+ return xa_preferences_dialog_type;
+}
+
+static void
+xa_preferences_dialog_class_init(XAPreferencesDialogClass *dialog_class)
+{
+}
+
+static void
+xa_preferences_dialog_init(XAPreferencesDialog *dialog)
+{
+ gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_APPLY, GTK_RESPONSE_OK,
+ NULL);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
+}
+
+GtkWidget *
+xa_preferences_dialog_new()
+{
+ GtkWidget *dialog;
+
+ dialog = g_object_new(xa_preferences_dialog_get_type(),
+ "title", _("Preferences"),
+ NULL);
+
+ return dialog;
+}
Added: xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h 2006-09-25 13:23:21 UTC (rev 23204)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XARCHIVER_PREFERENCES_DIALOG_H__
+#define __XARCHIVER_PREFERENCES_DIALOG_H__
+G_BEGIN_DECLS
+
+#define XA_PREFERENCES_DIALOG(obj) ( \
+ G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ xa_preferences_dialog_get_type(), \
+ XAPreferencesDialog))
+
+#define XA_IS_PREFERENCES_DIALOG(obj) ( \
+ G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ xa_preferences_dialog_get_type()))
+
+#define XA_PREFERENCES_DIALOG_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_CAST ((class), \
+ xa_preferences_dialog_get_type(), \
+ XAPreferencesDialogClass))
+
+#define XA_IS_PREFERENCES_DIALOG_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_TYPE ((class), \
+ xa_preferences_dialog_get_type()))
+
+typedef struct _XAPreferencesDialog XAPreferencesDialog;
+
+struct _XAPreferencesDialog
+{
+ GtkDialog parent;
+};
+
+typedef struct _XAPreferencesDialogClass XAPreferencesDialogClass;
+
+struct _XAPreferencesDialogClass
+{
+ GtkDialogClass parent;
+};
+
+GtkWidget *xa_preferences_dialog_new();
+
+G_END_DECLS
+#endif /* __XARCHIVER_PREFERENCES_DIALOG_H__ */
More information about the Xfce4-commits
mailing list