[Xfce4-commits] r23779 - in xarchiver/branches/xarchiver-psybsd: . po src
Stephan Arts
stephan at xfce.org
Tue Nov 7 22:06:32 CET 2006
Author: stephan
Date: 2006-11-07 21:06:31 +0000 (Tue, 07 Nov 2006)
New Revision: 23779
Added:
xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
xarchiver/branches/xarchiver-psybsd/src/widget_factory.h
Modified:
xarchiver/branches/xarchiver-psybsd/AUTHORS
xarchiver/branches/xarchiver-psybsd/TODO
xarchiver/branches/xarchiver-psybsd/po/nl.po
xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
xarchiver/branches/xarchiver-psybsd/src/add_dialog.c
xarchiver/branches/xarchiver-psybsd/src/add_dialog.h
xarchiver/branches/xarchiver-psybsd/src/application.c
xarchiver/branches/xarchiver-psybsd/src/archive_store.c
xarchiver/branches/xarchiver-psybsd/src/archive_store.h
xarchiver/branches/xarchiver-psybsd/src/main.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
xarchiver/branches/xarchiver-psybsd/src/main_window.h
xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c
xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h
xarchiver/branches/xarchiver-psybsd/src/path_bar.c
xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
Log:
Added Peter to AUTHORS file.
Applied patch from Peter de Ridder <pc.ridder at zonnet.nl>
Cleaned some stuff up.
Modified: xarchiver/branches/xarchiver-psybsd/AUTHORS
===================================================================
--- xarchiver/branches/xarchiver-psybsd/AUTHORS 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/AUTHORS 2006-11-07 21:06:31 UTC (rev 23779)
@@ -1,2 +1,3 @@
Stephan Arts - psyBSD - <psybsd at gmail.com>
+Peter de Ridder - cavalier - <pc.ridder at zonnet.nl>
Giuseppe Torelli - Colossus - <colossus73 at gmail.com>
Modified: xarchiver/branches/xarchiver-psybsd/TODO
===================================================================
--- xarchiver/branches/xarchiver-psybsd/TODO 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/TODO 2006-11-07 21:06:31 UTC (rev 23779)
@@ -15,7 +15,7 @@
Close Buttons - DONE
- Fix Command-line options
+ Fix Command-line options - DONE
Add Dialog
Modified: xarchiver/branches/xarchiver-psybsd/po/nl.po
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/po/nl.po 2006-11-07 21:06:31 UTC (rev 23779)
@@ -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-10-20 07:52+0200\n"
+"POT-Creation-Date: 2006-11-07 11:17+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,44 +16,44 @@
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: ../libxarchiver/archive.c:339
+#: ../libxarchiver/archive.c:398
msgid "Filename"
msgstr "Bestandsnaam"
-#: ../libxarchiver/archive.c:341
+#: ../libxarchiver/archive.c:401
msgid "Mime type"
msgstr "Mime type"
-#: ../libxarchiver/archive-support-gnu-tar.c:136
+#: ../libxarchiver/archive-support-gnu-tar.c:153
#: ../libxarchiver/archive-support-zip.c:118
msgid "Overwrite existing files"
msgstr "Bestaande bestanden overschrijven"
-#: ../libxarchiver/archive-support-gnu-tar.c:137
+#: ../libxarchiver/archive-support-gnu-tar.c:154
#: ../libxarchiver/archive-support-zip.c:119
msgid "Overwrite existing files on extraction"
msgstr "Bestaande bestanden overschrijven tijdens uitpakken"
-#: ../libxarchiver/archive-support-gnu-tar.c:417
+#: ../libxarchiver/archive-support-gnu-tar.c:433
msgid "Permissions"
msgstr "Rechten"
-#: ../libxarchiver/archive-support-gnu-tar.c:421
+#: ../libxarchiver/archive-support-gnu-tar.c:437
msgid "Owner/Group"
msgstr "Eigenaar/Groep"
-#: ../libxarchiver/archive-support-gnu-tar.c:425
-#: ../libxarchiver/archive-support-zip.c:327
+#: ../libxarchiver/archive-support-gnu-tar.c:441
+#: ../libxarchiver/archive-support-zip.c:305
msgid "Size"
msgstr "Grootte"
-#: ../libxarchiver/archive-support-gnu-tar.c:429
-#: ../libxarchiver/archive-support-zip.c:339
+#: ../libxarchiver/archive-support-gnu-tar.c:445
+#: ../libxarchiver/archive-support-zip.c:313
msgid "Date"
msgstr "Datum"
-#: ../libxarchiver/archive-support-gnu-tar.c:433
-#: ../libxarchiver/archive-support-zip.c:345
+#: ../libxarchiver/archive-support-gnu-tar.c:449
+#: ../libxarchiver/archive-support-zip.c:317
msgid "Time"
msgstr "Tijd"
@@ -62,13 +62,21 @@
msgid "Password"
msgstr "Wachtwoord"
-#: ../libxarchiver/archive-support-zip.c:315
+#: ../libxarchiver/archive-support-zip.c:297
msgid "Length"
-msgstr ""
+msgstr "Lengte"
+#: ../libxarchiver/archive-support-zip.c:301
+msgid "Method"
+msgstr "Methode"
+
+#: ../libxarchiver/archive-support-zip.c:309
+msgid "Ratio"
+msgstr "Verhouding"
+
#: ../libxarchiver/archive-support-zip.c:321
-msgid "Compression method"
-msgstr "Compressie methode"
+msgid "CRC-32"
+msgstr "CRC-32"
#: ../src/main.c:51
msgid "[destination path]"
@@ -86,11 +94,11 @@
msgid "Version information"
msgstr "Versie informatie"
-#: ../src/main.c:124
+#: ../src/main.c:118
msgid "[archive name]"
msgstr "[archief naam]"
-#: ../src/main.c:128
+#: ../src/main.c:122
#, c-format
msgid ""
"%s: %s\n"
@@ -100,91 +108,18 @@
"Probeer xarchiver --help om een volledige lijst te zien met beschikbare "
"opties.\n"
-#.
-#. * Could not create archive (mime type unsupported)
-#.
-#: ../src/main.c:199
-msgid "Could not create archive, MIME-type unsupported"
-msgstr "Kan archief niet maken, MIME-type wordt niet ondersteund"
-
-#.
-#. * Could not open archive (mime type not supported or file did not exist)
-#. * Should be a more specific error message.
-#.
-#: ../src/main.c:216
-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.c:256
-#, c-format
-msgid ""
-"Xarchiver\n"
-"ERROR: Could not open file \"%s\""
-msgstr ""
-
-#: ../src/main_window.c:121 ../src/main_window.c:122
-msgid "Show icons"
-msgstr ""
-
-#: ../src/main_window.c:179
-msgid "_Archive"
-msgstr "_Archief"
-
-#: ../src/main_window.c:180
-msgid "A_ction"
-msgstr "A_ctie"
-
-#: ../src/main_window.c:181
-msgid "_Help"
-msgstr "_Help"
-
-#: ../src/main_window.c:225 ../src/main_window.c:270
+#: ../src/main_window.c:194
msgid "Add"
msgstr "Toevoegen"
-#: ../src/main_window.c:230 ../src/main_window.c:274
-#: ../src/extract_dialog.c:101
+#: ../src/main_window.c:198 ../src/extract_dialog.c:101
msgid "Extract"
msgstr "Uitpakken"
-#: ../src/main_window.c:523
+#: ../src/main_window.c:393
msgid "Open archive"
msgstr "Archief openen"
-#: ../src/main_window.c:680
-msgid "Initializing archive..."
-msgstr "Bezig met initialiseren van archief..."
-
-#: ../src/main_window.c:683
-msgid "Reading archive contents..."
-msgstr "Bezig met lezen van archief..."
-
-#: ../src/main_window.c:686
-msgid "Extracting archive..."
-msgstr "Archief uitpakken..."
-
-#: ../src/main_window.c:689
-msgid "Adding file(s) to archive..."
-msgstr "Bestand(en) toevoegen aan archief..."
-
-#: ../src/main_window.c:692
-msgid "Removing file(s) from archive..."
-msgstr "Bestand(en) toevoegen aan archief..."
-
-#: ../src/main_window.c:695
-msgid "Error"
-msgstr "Fout"
-
-#: ../src/main_window.c:698
-msgid "Cancelled"
-msgstr "Geannuleerd"
-
-#: ../src/main_window.c:701
-msgid "Done"
-msgstr "Klaar"
-
#: ../src/new_dialog.c:87
msgid "Create new archive"
msgstr "Maak nieuw archief"
@@ -216,3 +151,47 @@
#: ../src/extract_dialog.c:113
msgid "Extract archive"
msgstr "Archief uitpakken"
+
+#~ msgid "Compression method"
+#~ msgstr "Compressie methode"
+
+#~ msgid "Could not create archive, MIME-type unsupported"
+#~ msgstr "Kan archief niet maken, MIME-type wordt niet ondersteund"
+
+#~ 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"
+
+#~ msgid "_Archive"
+#~ msgstr "_Archief"
+
+#~ msgid "A_ction"
+#~ msgstr "A_ctie"
+
+#~ msgid "_Help"
+#~ msgstr "_Help"
+
+#~ msgid "Initializing archive..."
+#~ msgstr "Bezig met initialiseren van archief..."
+
+#~ msgid "Reading archive contents..."
+#~ msgstr "Bezig met lezen van archief..."
+
+#~ msgid "Extracting archive..."
+#~ msgstr "Archief uitpakken..."
+
+#~ msgid "Adding file(s) to archive..."
+#~ msgstr "Bestand(en) toevoegen aan archief..."
+
+#~ msgid "Removing file(s) from archive..."
+#~ msgstr "Bestand(en) toevoegen aan archief..."
+
+#~ msgid "Error"
+#~ msgstr "Fout"
+
+#~ msgid "Cancelled"
+#~ msgstr "Geannuleerd"
+
+#~ msgid "Done"
+#~ msgstr "Klaar"
Modified: xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot
===================================================================
--- xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/po/xarchiver.pot 2006-11-07 21:06:31 UTC (rev 23779)
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: psybsd at gmail.com\n"
-"POT-Creation-Date: 2006-10-20 07:52+0200\n"
+"POT-Creation-Date: 2006-11-07 11:17+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,44 +16,44 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../libxarchiver/archive.c:339
+#: ../libxarchiver/archive.c:398
msgid "Filename"
msgstr ""
-#: ../libxarchiver/archive.c:341
+#: ../libxarchiver/archive.c:401
msgid "Mime type"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:136
+#: ../libxarchiver/archive-support-gnu-tar.c:153
#: ../libxarchiver/archive-support-zip.c:118
msgid "Overwrite existing files"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:137
+#: ../libxarchiver/archive-support-gnu-tar.c:154
#: ../libxarchiver/archive-support-zip.c:119
msgid "Overwrite existing files on extraction"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:417
+#: ../libxarchiver/archive-support-gnu-tar.c:433
msgid "Permissions"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:421
+#: ../libxarchiver/archive-support-gnu-tar.c:437
msgid "Owner/Group"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:425
-#: ../libxarchiver/archive-support-zip.c:327
+#: ../libxarchiver/archive-support-gnu-tar.c:441
+#: ../libxarchiver/archive-support-zip.c:305
msgid "Size"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:429
-#: ../libxarchiver/archive-support-zip.c:339
+#: ../libxarchiver/archive-support-gnu-tar.c:445
+#: ../libxarchiver/archive-support-zip.c:313
msgid "Date"
msgstr ""
-#: ../libxarchiver/archive-support-gnu-tar.c:433
-#: ../libxarchiver/archive-support-zip.c:345
+#: ../libxarchiver/archive-support-gnu-tar.c:449
+#: ../libxarchiver/archive-support-zip.c:317
msgid "Time"
msgstr ""
@@ -62,12 +62,20 @@
msgid "Password"
msgstr ""
-#: ../libxarchiver/archive-support-zip.c:315
+#: ../libxarchiver/archive-support-zip.c:297
msgid "Length"
msgstr ""
+#: ../libxarchiver/archive-support-zip.c:301
+msgid "Method"
+msgstr ""
+
+#: ../libxarchiver/archive-support-zip.c:309
+msgid "Ratio"
+msgstr ""
+
#: ../libxarchiver/archive-support-zip.c:321
-msgid "Compression method"
+msgid "CRC-32"
msgstr ""
#: ../src/main.c:51
@@ -86,100 +94,29 @@
msgid "Version information"
msgstr ""
-#: ../src/main.c:124
+#: ../src/main.c:118
msgid "[archive name]"
msgstr ""
-#: ../src/main.c:128
+#: ../src/main.c:122
#, c-format
msgid ""
"%s: %s\n"
"Try xarchiver --help to see a full list of available command line options.\n"
msgstr ""
-#.
-#. * Could not create archive (mime type unsupported)
-#.
-#: ../src/main.c:199
-msgid "Could not create archive, MIME-type unsupported"
-msgstr ""
-
-#.
-#. * Could not open archive (mime type not supported or file did not exist)
-#. * Should be a more specific error message.
-#.
-#: ../src/main.c:216
-msgid "Could not open archive, MIME-type unsupported or file did not exist"
-msgstr ""
-
-#: ../src/main.c:256
-#, c-format
-msgid ""
-"Xarchiver\n"
-"ERROR: Could not open file \"%s\""
-msgstr ""
-
-#: ../src/main_window.c:121 ../src/main_window.c:122
-msgid "Show icons"
-msgstr ""
-
-#: ../src/main_window.c:179
-msgid "_Archive"
-msgstr ""
-
-#: ../src/main_window.c:180
-msgid "A_ction"
-msgstr ""
-
-#: ../src/main_window.c:181
-msgid "_Help"
-msgstr ""
-
-#: ../src/main_window.c:225 ../src/main_window.c:270
+#: ../src/main_window.c:194
msgid "Add"
msgstr ""
-#: ../src/main_window.c:230 ../src/main_window.c:274
-#: ../src/extract_dialog.c:101
+#: ../src/main_window.c:198 ../src/extract_dialog.c:101
msgid "Extract"
msgstr ""
-#: ../src/main_window.c:523
+#: ../src/main_window.c:393
msgid "Open archive"
msgstr ""
-#: ../src/main_window.c:680
-msgid "Initializing archive..."
-msgstr ""
-
-#: ../src/main_window.c:683
-msgid "Reading archive contents..."
-msgstr ""
-
-#: ../src/main_window.c:686
-msgid "Extracting archive..."
-msgstr ""
-
-#: ../src/main_window.c:689
-msgid "Adding file(s) to archive..."
-msgstr ""
-
-#: ../src/main_window.c:692
-msgid "Removing file(s) from archive..."
-msgstr ""
-
-#: ../src/main_window.c:695
-msgid "Error"
-msgstr ""
-
-#: ../src/main_window.c:698
-msgid "Cancelled"
-msgstr ""
-
-#: ../src/main_window.c:701
-msgid "Done"
-msgstr ""
-
#: ../src/new_dialog.c:87
msgid "Create new archive"
msgstr ""
Modified: xarchiver/branches/xarchiver-psybsd/src/add_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/add_dialog.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/add_dialog.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -64,19 +64,22 @@
xa_add_dialog_init(XAAddDialog *dialog)
{
GtkWidget *frame = gtk_frame_new(_("Drag Files and folders to bottom list"));
- GtkWidget *vbox = gtk_vpaned_new();
+ dialog->optionframe = gtk_frame_new(_("Options:"));
+ GtkWidget *vpaned = gtk_vpaned_new();
GtkWidget *chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN);
GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
- gtk_paned_pack1(GTK_PANED(vbox), chooser, TRUE, FALSE);
- gtk_paned_pack2(GTK_PANED(vbox), scrolled_window, TRUE, FALSE);
+ gtk_paned_pack1(GTK_PANED(vpaned), chooser, TRUE, FALSE);
+ gtk_paned_pack2(GTK_PANED(vpaned), scrolled_window, TRUE, FALSE);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+ gtk_container_add(GTK_CONTAINER(frame), vpaned);
+ gtk_container_set_border_width(GTK_CONTAINER(vpaned), 5);
gtk_widget_show_all(frame);
- gtk_widget_show_all(vbox);
+ gtk_widget_show_all(dialog->optionframe);
+ gtk_widget_show_all(vpaned);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), dialog->optionframe, TRUE, TRUE, 0);
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_OK,
@@ -85,13 +88,48 @@
}
GtkWidget *
-xa_add_dialog_new()
+xa_add_dialog_new(LXAArchiveSupport *support)
{
- GtkWidget *dialog;
+ GSList *add_options;
+ XAAddDialog *dialog;
+ GtkWidget *optionbox, *test, *hbox;
dialog = g_object_new(xa_add_dialog_get_type(),
"title", _("Add file(s) to archive"),
NULL);
- return dialog;
+ optionbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(dialog->optionframe), optionbox);
+
+ dialog->support = support;
+ if(support)
+ {
+ add_options = lxa_archive_support_list_properties(support, "add");
+ while(add_options)
+ {
+ switch(G_PARAM_SPEC(add_options->data)->value_type)
+ {
+ case G_TYPE_BOOLEAN:
+ test = gtk_check_button_new_with_label(g_param_spec_get_nick(G_PARAM_SPEC(add_options->data)));
+ // g_signal_connect(G_OBJECT(test), "toggled", G_CALLBACK(cb_xa_add_dialog_option_toggled), g_param_spec_get_name(G_PARAM_SPEC(add_options->data)));
+ gtk_box_pack_start(GTK_BOX(optionbox), test, FALSE, FALSE, 0);
+ break;
+ case G_TYPE_STRING:
+ hbox = gtk_hbox_new(FALSE, 4);
+ test = gtk_label_new(g_param_spec_get_nick(G_PARAM_SPEC(add_options->data)));
+ gtk_box_pack_start(GTK_BOX(hbox), test, FALSE, FALSE, 3);
+
+ test = gtk_entry_new();
+ gtk_box_pack_start(GTK_BOX(hbox), test, TRUE, TRUE, 3);
+
+ // g_signal_connect(G_OBJECT(test), "child_notify", G_CALLBACK(cb_xa_add_dialog_option_child_norify), g_param_spec_get_name(G_PARAM_SPEC(add_options->data)));
+ gtk_box_pack_start(GTK_BOX(optionbox), hbox, FALSE, FALSE, 0);
+ break;
+ }
+ add_options = add_options->next;
+ }
+ }
+
+ gtk_widget_show_all(optionbox);
+ return (GtkWidget*)dialog;
}
Modified: xarchiver/branches/xarchiver-psybsd/src/add_dialog.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/add_dialog.h 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/add_dialog.h 2006-11-07 21:06:31 UTC (rev 23779)
@@ -44,6 +44,8 @@
{
GtkDialog parent;
GtkWidget *scrolled_window;
+ GtkWidget *optionframe;
+ LXAArchiveSupport *support;
};
typedef struct _XAAddDialogClass XAAddDialogClass;
@@ -53,7 +55,7 @@
GtkDialogClass parent;
};
-GtkWidget *xa_add_dialog_new();
+GtkWidget *xa_add_dialog_new(LXAArchiveSupport *support);
G_END_DECLS
#endif /* __XARCHIVER_ADD_DIALOG_H__ */
Modified: xarchiver/branches/xarchiver-psybsd/src/application.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/application.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/application.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -38,9 +38,9 @@
xa_application_class_init(XAApplicationClass *archive_class);
static void
-xa_application_init(XAApplication *archive);
+xa_application_init(XAApplication *);
static void
-xa_application_finalize(GObject *object);
+xa_application_finalize(GObject *);
static void
xa_application_dispose(GObject *object);
@@ -98,6 +98,7 @@
xa_settings_set_group(application->settings, "Global");
application->props._tabs = xa_settings_read_bool_entry(application->settings, "UseTabs", TRUE);
+
}
static void
@@ -107,11 +108,17 @@
}
static void
-xa_application_finalize(GObject *object)
+xa_application_finalize(GObject *object )
{
+ XAApplication *application = XA_APPLICATION(object);
#ifdef DEBUG
g_debug("Application Destroyed");
#endif
+ xa_settings_set_group(application->settings, "Global");
+
+ xa_settings_write_bool_entry(application->settings, "UseTabs", application->props._tabs);
+
+ xa_settings_save(application->settings);
}
XAApplication *
@@ -249,14 +256,20 @@
gint
xa_application_open_archive(XAApplication *app, GtkWidget *window, gchar *path)
{
+ gint retval = 0;
+
if(!window)
{
window = xa_application_new_window(app);
}
if(app->props._tabs)
- xa_main_window_open_archive(XA_MAIN_WINDOW(window), path, -1);
+ {
+ retval = xa_main_window_open_archive(XA_MAIN_WINDOW(window), path, -1);
+ }
else
- xa_main_window_open_archive(XA_MAIN_WINDOW(window), path, 0);
- gtk_widget_show_all(window);
- return 0;
+ {
+ retval = xa_main_window_open_archive(XA_MAIN_WINDOW(window), path, 0);
+ }
+ gtk_widget_show(window);
+ return retval;
}
Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -27,6 +27,10 @@
#include "archive_store.h"
+#ifndef XA_ARCHIVE_STORE_MAX_HISTORY
+#define XA_ARCHIVE_STORE_MAX_HISTORY 10
+#endif
+
static void
xa_archive_store_class_init(XAArchiveStoreClass *as_class);
@@ -113,6 +117,9 @@
static void
xa_archive_store_sort(XAArchiveStore *store);
+static void
+xa_archive_store_append_history(XAArchiveStore *store, GSList *entry);
+
GType
xa_archive_store_get_type()
{
@@ -192,7 +199,6 @@
{
as->stamp = g_random_int();
as->archive = NULL;
- as->current_entry = NULL;
as->props._show_icons = 0;
as->props._show_up_dir = 1;
as->props._sort_folders_first = 1;
@@ -200,6 +206,9 @@
as->sort_column = GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID;
as->sort_order = GTK_SORT_ASCENDING;
as->sort_list = NULL;
+ as->navigation.history = NULL;
+ as->navigation.present = NULL;
+ as->navigation.maxhistory = XA_ARCHIVE_STORE_MAX_HISTORY;
}
static void
@@ -278,8 +287,8 @@
case XA_ARCHIVE_STORE_SHOW_ICONS:
if(XA_ARCHIVE_STORE(object)->props._show_icons != g_value_get_boolean(value)?1:0)
{
- if(store->current_entry)
- prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
+ if(store->navigation.present)
+ prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
XA_ARCHIVE_STORE(object)->props._show_icons = g_value_get_boolean(value)?1:0;
xa_archive_store_refresh(XA_ARCHIVE_STORE(object), prev_size);
}
@@ -287,8 +296,8 @@
case XA_ARCHIVE_STORE_SHOW_UP_DIR:
if(XA_ARCHIVE_STORE(object)->props._show_up_dir != g_value_get_boolean(value)?1:0)
{
- if(store->current_entry)
- prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
+ if(store->navigation.present)
+ prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
XA_ARCHIVE_STORE(object)->props._show_up_dir = g_value_get_boolean(value)?1:0;
xa_archive_store_refresh(XA_ARCHIVE_STORE(object), prev_size);
}
@@ -388,10 +397,10 @@
LXAArchive *archive = store->archive;
LXAArchiveIter *entry = NULL;
- if(!store->current_entry)
+ if(!store->navigation.present)
return FALSE;
- entry = store->current_entry->data;
+ entry = ((GSList*)store->navigation.present->data)->data;
gint *indices = gtk_tree_path_get_indices(path);
@@ -423,7 +432,7 @@
iter->stamp = store->stamp;
iter->user_data = entry;
- iter->user_data2 = store->current_entry->data;
+ iter->user_data2 = ((GSList*)store->navigation.present->data)->data;
iter->user_data3 = GINT_TO_POINTER(index);
return TRUE;
@@ -540,7 +549,7 @@
XAArchiveStore *store = XA_ARCHIVE_STORE(tree_model);
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_val_if_fail(archive, FALSE);
g_return_val_if_fail(entry, FALSE);
@@ -567,7 +576,7 @@
iter->stamp = store->stamp;
iter->user_data = entry;
- iter->user_data2 = store->current_entry->data;
+ iter->user_data2 = ((GSList*)store->navigation.present->data)->data;
return TRUE;
}
@@ -585,7 +594,7 @@
XAArchiveStore *store = XA_ARCHIVE_STORE(tree_model);
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_val_if_fail(archive, 0);
g_return_val_if_fail(entry, 0);
@@ -603,7 +612,7 @@
XAArchiveStore *store = XA_ARCHIVE_STORE(tree_model);
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_val_if_fail(archive, FALSE);
g_return_val_if_fail(entry, FALSE);
@@ -631,7 +640,7 @@
iter->stamp = store->stamp;
iter->user_data = entry;
- iter->user_data2 = store->current_entry->data;
+ iter->user_data2 = ((GSList*)store->navigation.present->data)->data;
iter->user_data3 = GINT_TO_POINTER(n);
return TRUE;
@@ -781,7 +790,7 @@
if(store->sort_column < 0)
return;
- LXAArchiveIter *pentry = (LXAArchiveIter*)store->current_entry->data;
+ LXAArchiveIter *pentry = (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data;
gint psize = lxa_archive_iter_n_children(store->archive, pentry);
gint i = 0;
@@ -890,7 +899,7 @@
xa_archive_store_refresh(XAArchiveStore *store, gint prev_size)
{
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_if_fail(archive);
g_return_if_fail(entry);
@@ -956,11 +965,11 @@
g_return_if_fail(XA_IS_ARCHIVE_STORE(user_data));
XAArchiveStore *store = XA_ARCHIVE_STORE(user_data);
- g_return_if_fail(store->current_entry);
+ g_return_if_fail(store->navigation.present->data);
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_if_fail(archive);
g_return_if_fail(entry);
@@ -974,6 +983,8 @@
gint prev_size = lxa_archive_iter_n_children(archive, entry);
gint index = indices[depth];
+ GSList *current_entry = store->navigation.present->data;
+
if(store->props._show_up_dir && lxa_archive_get_iter(archive, NULL) != entry)
{
prev_size++;
@@ -982,8 +993,9 @@
if(index == -1)
{
- store->current_entry = g_slist_delete_link(store->current_entry, store->current_entry);
- entry = store->current_entry->data;
+ current_entry = g_slist_copy(current_entry->next);
+ entry = current_entry->data;
+ xa_archive_store_append_history(store, current_entry);
}
else
{
@@ -1003,7 +1015,8 @@
return;
}
- store->current_entry = g_slist_prepend(store->current_entry, entry);
+ current_entry = g_slist_prepend(g_slist_copy(current_entry), entry);
+ xa_archive_store_append_history(store, current_entry);
}
xa_archive_store_sort(store);
@@ -1016,23 +1029,24 @@
xa_archive_store_go_up(XAArchiveStore *store)
{
LXAArchive *archive = store->archive;
- LXAArchiveIter *entry = store->current_entry->data;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
g_return_if_fail(archive);
g_return_if_fail(entry);
gint prev_size = lxa_archive_iter_n_children(archive, entry);
+ GSList *current_entry = store->navigation.present->data;
+
if(store->props._show_up_dir && lxa_archive_get_iter(archive, NULL) != entry)
{
prev_size++;
}
- /* TODO: signal or something */
- g_return_if_fail(store->current_entry->next);
+ g_return_if_fail(((GSList*)store->navigation.present->data)->next);
- store->current_entry = g_slist_delete_link(store->current_entry, store->current_entry);
- entry = store->current_entry->data;
+ current_entry = g_slist_copy(current_entry->next);
+ xa_archive_store_append_history(store, current_entry);
xa_archive_store_sort(store);
@@ -1050,23 +1064,23 @@
LXAArchiveIter *entry = NULL;
gint prev_size = 0;
+ GList *list_iter;
+ GSList *current_entry = store->navigation.present->data;
+
if(store->sort_list)
{
g_free(store->sort_list);
store->sort_list = NULL;
}
- if(store->current_entry)
+ if(store->navigation.present)
{
- entry = store->current_entry->data;
+ entry = ((GSList*)store->navigation.present->data)->data;
prev_size = lxa_archive_iter_n_children(archive, entry);
-
if(store->props._show_up_dir && lxa_archive_get_iter(store->archive, NULL) != entry)
prev_size++;
-
- g_slist_free(store->current_entry);
}
for(i = prev_size - 1; i >= 0; i--)
@@ -1082,18 +1096,28 @@
if(store->archive)
g_object_unref(store->archive);
+ for(list_iter = store->navigation.history; list_iter; list_iter = list_iter->next)
+ g_slist_free(list_iter->data);
+
+ g_list_free(store->navigation.history);
+
+ store->navigation.history = NULL;
+ store->navigation.present = NULL;
+
if(!archive)
{
store->archive = NULL;
- store->current_entry = NULL;
+
g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_NEW_ARCHIVE], 0,NULL);
return;
}
g_object_ref(archive);
store->archive = archive;
- store->current_entry = g_slist_prepend(NULL, lxa_archive_get_iter(archive, NULL));
+ current_entry = g_slist_prepend(NULL, lxa_archive_get_iter(archive, NULL));
+ xa_archive_store_append_history(store, current_entry);
+
xa_archive_store_sort(store);
for(i = 0; i < lxa_archive_iter_n_children(archive, lxa_archive_get_iter(archive, NULL)); i++)
@@ -1126,7 +1150,7 @@
GValue *basename = g_new0(GValue, 1);
gchar *path = NULL;
gchar **buf = NULL;
- GSList *iter = store->current_entry;
+ GSList *iter = store->navigation.present->data;
gint i = g_slist_length(iter);
gchar *lastfile = NULL;
gint namelen = 0;
@@ -1185,7 +1209,7 @@
g_return_val_if_fail(store, NULL);
GValue *basename = g_new0(GValue, 1);
- GSList *iter = store->current_entry;
+ GSList *iter = store->navigation.present->data;
GSList *path = NULL;
if(!iter)
@@ -1206,16 +1230,14 @@
}
gboolean
-xa_archive_store_set_pwd(XAArchiveStore *store, const gchar *path)
+xa_archive_store_set_pwd_silent(XAArchiveStore *store, const gchar *path)
{
- gint result = xa_archive_store_set_pwd_silent(store, path);
-
- g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
- return result;
+ g_critical("depricated %s", __FUNCTION__);
+ return FALSE;
}
gboolean
-xa_archive_store_set_pwd_silent(XAArchiveStore *store, const gchar *path)
+xa_archive_store_set_pwd(XAArchiveStore *store, const gchar *path)
{
g_return_val_if_fail(store, -1);
@@ -1226,9 +1248,9 @@
gchar **iter = buf;
LXAArchiveIter *entry = lxa_archive_get_iter(store->archive, NULL);
GSList *stack = g_slist_prepend(NULL, entry);
- gint prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
+ gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
- if(store->props._show_up_dir && lxa_archive_get_iter(store->archive, NULL) != store->current_entry->data)
+ if(store->props._show_up_dir && lxa_archive_get_iter(store->archive, NULL) != ((GSList*)store->navigation.present->data)->data)
prev_size++;
if(path[0] == '/' && lxa_archive_iter_get_child(store->archive, entry, "/"))
@@ -1254,13 +1276,13 @@
g_strfreev(buf);
- g_slist_free(store->current_entry);
- store->current_entry = stack;
+ xa_archive_store_append_history(store, stack);
xa_archive_store_sort(store);
xa_archive_store_refresh(store, prev_size);
-
+
+ g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
return TRUE;
}
@@ -1294,7 +1316,7 @@
{
GtkSortType sort_order;
gint sort_col = 0;
- gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAEntry*)store->current_entry->data);
+ gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
store->props._show_icons = show?1:0;
if(show)
{
@@ -1316,7 +1338,7 @@
if(store->archive)
{
- gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAEntry*)store->current_entry->data);
+ gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
xa_archive_store_refresh(store, prev_size);
}
}
@@ -1328,7 +1350,7 @@
if(store->archive)
{
- gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAEntry*)store->current_entry->data);
+ gint prev_size = lxa_archive_iter_n_children(store->archive, (LXAArchiveIter*)((GSList*)store->navigation.present->data)->data);
xa_archive_store_refresh(store, prev_size);
}
}
@@ -1352,16 +1374,108 @@
xa_archive_store_set_history(XAArchiveStore *store, GList *history, GList *pwd)
{
store->navigation.history = history;
- store->navigation.pwd = pwd;
+ store->navigation.present = pwd;
}
void
xa_archive_store_get_history(XAArchiveStore *store, GList **history, GList **pwd)
{
(*history)=store->navigation.history;
- (*pwd) = store->navigation.pwd;
+ (*pwd) = store->navigation.present;
}
+gboolean
+xa_archive_store_has_history(XAArchiveStore *store)
+{
+ return store->navigation.present->prev?TRUE:FALSE;
+}
+
+gboolean
+xa_archive_store_has_future(XAArchiveStore *store)
+{
+ return store->navigation.present->next?TRUE:FALSE;
+}
+
+void
+xa_archive_store_go_back(XAArchiveStore *store)
+{
+ LXAArchive *archive = store->archive;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
+
+ g_return_if_fail(archive);
+ g_return_if_fail(entry);
+
+ gint prev_size = lxa_archive_iter_n_children(archive, entry);
+
+ if(xa_archive_store_has_history(store))
+ store->navigation.present = store->navigation.present->prev;
+
+ if(store->props._show_up_dir && lxa_archive_get_iter(archive, NULL) != entry)
+ {
+ prev_size++;
+ }
+
+ xa_archive_store_sort(store);
+
+ xa_archive_store_refresh(store, prev_size);
+
+ g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
+}
+
+void
+xa_archive_store_go_forward(XAArchiveStore *store)
+{
+ LXAArchive *archive = store->archive;
+ LXAArchiveIter *entry = ((GSList*)store->navigation.present->data)->data;
+
+ g_return_if_fail(archive);
+ g_return_if_fail(entry);
+
+ gint prev_size = lxa_archive_iter_n_children(archive, entry);
+
+ if(xa_archive_store_has_future(store))
+ store->navigation.present = store->navigation.present->next;
+
+ if(store->props._show_up_dir && lxa_archive_get_iter(archive, NULL) != entry)
+ {
+ prev_size++;
+ }
+
+ xa_archive_store_sort(store);
+
+ xa_archive_store_refresh(store, prev_size);
+
+ g_signal_emit(store, xa_archive_store_signals[XA_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
+}
+
+static void
+xa_archive_store_append_history(XAArchiveStore *store, GSList *entry)
+{
+ GList *iter = store->navigation.present;
+
+ if(store->navigation.present)
+ {
+ if(store->navigation.present->next)
+ store->navigation.present->next->prev = NULL;
+
+ while((gboolean)(iter = iter->next))
+ g_slist_free(iter->data);
+
+ g_list_free(store->navigation.present->next);
+
+ store->navigation.present->next = NULL;
+ }
+
+ store->navigation.history = g_list_append(store->navigation.history, entry);
+ store->navigation.present = g_list_last(store->navigation.history);
+
+ while(g_list_length(store->navigation.history) > store->navigation.maxhistory)
+ {
+ g_slist_free(g_list_first(store->navigation.history)->data);
+ store->navigation.history = g_list_delete_link(store->navigation.history, g_list_first(store->navigation.history));
+ }
+}
+
LXAArchive *
xa_archive_store_get_archive(XAArchiveStore *archive_store)
{
Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.h 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.h 2006-11-07 21:06:31 UTC (rev 23779)
@@ -46,7 +46,6 @@
gint stamp;
LXAArchive *archive;
LXAArchiveSupport *support;
- GSList *current_entry;
gint sort_column;
GtkSortType sort_order;
LXAEntry **sort_list;
@@ -59,7 +58,8 @@
} props;
struct {
GList *history;
- GList *pwd;
+ GList *present;
+ guint maxhistory;
} navigation;
};
@@ -79,7 +79,7 @@
GSList * xa_archive_store_get_pwd_list(XAArchiveStore *store);
gchar * xa_archive_store_get_basename(XAArchiveStore *store);
gboolean xa_archive_store_set_pwd(XAArchiveStore *store, const gchar *path);
-gboolean xa_archive_store_set_pwd_silent(XAArchiveStore *store, const gchar *path);
+/* depricated */gboolean xa_archive_store_set_pwd_silent(XAArchiveStore *store, const gchar *path);
void xa_archive_store_set_icon_theme(XAArchiveStore *store, GtkIconTheme *icon_theme);
gboolean xa_archive_store_get_show_icons(XAArchiveStore *store);
@@ -93,10 +93,21 @@
gchar *
xa_archive_store_get_filename(XAArchiveStore *store, GtkTreeIter *iter);
-void
+/* want to depricate these */
+/*void
xa_archive_store_set_history(XAArchiveStore *store, GList *history, GList *pwd);
void
xa_archive_store_get_history(XAArchiveStore *store, GList **history, GList **pwd);
+*/
+/* these replace them */
+gboolean
+xa_archive_store_has_history(XAArchiveStore *store);
+gboolean
+xa_archive_store_has_future(XAArchiveStore *store);
+void
+xa_archive_store_go_back(XAArchiveStore *store);
+void
+xa_archive_store_go_forward(XAArchiveStore *store);
LXAArchive *
xa_archive_store_get_archive(XAArchiveStore *archive_store);
Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -112,6 +112,7 @@
#ifdef G_THREADS_ENABLED
g_thread_init(NULL);
+ gdk_threads_init();
#endif /* G_THREADS_ENABLED */
if(!gtk_init_with_args(&argc, &argv, _("[archive name]"), entries, PACKAGE, &cli_error))
@@ -126,17 +127,18 @@
lxa_init();
+ xa_icon_theme = gtk_icon_theme_get_default();
+ xa_app = xa_application_new(xa_icon_theme);
+
+ g_signal_connect(G_OBJECT(xa_app), "destroy", G_CALLBACK(gtk_main_quit), NULL);
+
if(version)
{
g_print("%s\n", PACKAGE_STRING);
return 0;
}
- xa_icon_theme = gtk_icon_theme_get_default();
- xa_app = xa_application_new(xa_icon_theme);
- g_signal_connect(G_OBJECT(xa_app), "destroy", G_CALLBACK(gtk_main_quit), NULL);
-
if(extract_archive_path || extract_archive)
{
if(argc == 1)
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -115,6 +115,11 @@
xa_settings_set_group(window->settings, "Global");
+ if(window->menu_bar)
+ xa_settings_write_bool_entry(window->settings, "MenuBar", TRUE);
+ else
+ xa_settings_write_bool_entry(window->settings, "MenuBar", FALSE);
+
if(!window->navigationbar)
{
xa_settings_write_entry(window->settings, "NavigationBar", "None");
@@ -155,11 +160,21 @@
gboolean sort_case = TRUE;
gboolean sort_folders = TRUE;
gboolean use_tabs = TRUE;
+ gboolean show_menubar = TRUE;
window->settings = xa_settings_new();
+ xa_settings_set_group(window->settings, "Global");
+
main_vbox = gtk_vbox_new(FALSE, 0);
+ show_menubar = xa_settings_read_bool_entry(window->settings, "MenuBar", TRUE);
+
+ if(show_menubar)
+ {
+
+ }
+
toolbar = gtk_toolbar_new();
/* Archive pane */
@@ -205,7 +220,6 @@
g_signal_connect(G_OBJECT(window->toolbar.tool_item_stop), "clicked", G_CALLBACK(cb_xa_main_stop_archive), window);
- xa_settings_set_group(window->settings, "Global");
nav_bar = xa_settings_read_entry(window->settings, "NavigationBar", "None");
window->navigationbar = NULL;
@@ -245,6 +259,9 @@
window->statusbar = gtk_statusbar_new();
+ if(show_menubar)
+ gtk_box_pack_start(GTK_BOX(main_vbox), window->menu_bar, FALSE, FALSE, 0);
+
gtk_box_pack_start(GTK_BOX(main_vbox), toolbar, FALSE, FALSE, 0);
if(window->navigationbar)
@@ -256,8 +273,9 @@
gtk_box_pack_start(GTK_BOX(main_vbox), window->notebook, TRUE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(main_vbox), window->statusbar, FALSE, FALSE, 0);
- gtk_widget_show(main_vbox);
+ gtk_widget_show_all(main_vbox);
gtk_widget_show_all(toolbar);
+ gtk_widget_show_all(GTK_WIDGET(window->navigationbar));
gtk_widget_show_all(window->notebook);
gtk_widget_show_all(window->statusbar);
@@ -450,6 +468,13 @@
static void
cb_xa_main_add_to_archive(GtkWidget *widget, gpointer userdata)
{
+ XAMainWindow *window = XA_MAIN_WINDOW(userdata);
+
+ LXAArchive *lp_archive = NULL;
+ LXAArchiveSupport *lp_support = NULL;
+
+ xa_notebook_get_active_archive(XA_NOTEBOOK(window->notebook), &lp_archive, &lp_support);
+ gtk_dialog_run (GTK_DIALOG (xa_add_dialog_new(lp_support)));
}
static void
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.h 2006-11-07 21:06:31 UTC (rev 23779)
@@ -53,6 +53,8 @@
GtkWindow parent;
XASettings *settings;
GtkIconTheme *icon_theme;
+ XAApplication *app;
+ GtkWidget *menu_bar;
struct {
GtkWidget *menu_item_archive;
GtkWidget *menu_archive;
@@ -97,7 +99,7 @@
XANavigationBar *navigationbar;
GtkWidget *notebook;
GtkWidget *statusbar;
- XAApplication *app;
+ GtkWidget *about_dlg;
};
typedef struct _XAMainWindowClass XAMainWindowClass;
Modified: xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/navigation_bar.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -24,11 +24,7 @@
#include "archive_store.h"
#include "navigation_bar.h"
-#ifndef XA_NAVIGATION_BAR_MAX_HISTORY
-#define XA_NAVIGATION_BAR_MAX_HISTORY 10
-#endif
-
static void
xa_navigation_bar_class_init(XANavigationBarClass *archive_class);
@@ -43,18 +39,11 @@
static void
cb_xa_navigation_bar_new_archive(XAArchiveStore *store, XANavigationBar *bar);
-static void
-xa_navigation_bar_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void
-xa_navigation_bar_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
/* properties */
enum {
XA_NAVIGATION_BAR_NAV_HISTORY = 1
};
-static gint xa_navigation_bar_signals[1];
-
GType
xa_navigation_bar_get_type ()
{
@@ -85,31 +74,8 @@
xa_navigation_bar_class_init(XANavigationBarClass *navigation_bar_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (navigation_bar_class);
- GParamSpec *pspec = NULL;
- object_class->set_property = xa_navigation_bar_set_property;
- object_class->get_property = xa_navigation_bar_get_property;
object_class->finalize = xa_navigation_bar_finalize;
-
- pspec = g_param_spec_uint("navigation_history",
- "",
- "",
- 0,
- G_MAXUINT,
- XA_NAVIGATION_BAR_MAX_HISTORY,
- G_PARAM_READWRITE);
- g_object_class_install_property(object_class, XA_NAVIGATION_BAR_NAV_HISTORY, pspec);
-
- xa_navigation_bar_signals[0] = g_signal_new("xa_store_set",
- G_TYPE_FROM_CLASS(navigation_bar_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0,
- NULL);
}
static void
@@ -120,9 +86,6 @@
navigation_bar->_cb_pwd_changed = cb_xa_navigation_bar_pwd_changed;
navigation_bar->_cb_new_archive = cb_xa_navigation_bar_new_archive;
- navigation_bar->max_history = XA_NAVIGATION_BAR_MAX_HISTORY;
- navigation_bar->pwd = NULL;
- navigation_bar->history = NULL;
}
static void
@@ -147,8 +110,6 @@
g_signal_handlers_disconnect_by_func(navigation_bar->store, navigation_bar->_cb_pwd_changed, navigation_bar);
if(navigation_bar->_cb_new_archive)
g_signal_handlers_disconnect_by_func(navigation_bar->store, navigation_bar->_cb_new_archive, navigation_bar);
-
- xa_archive_store_set_history(navigation_bar->store, navigation_bar->history, navigation_bar->pwd);
}
navigation_bar->store = store;
@@ -158,13 +119,9 @@
g_return_if_fail(XA_IS_NAVIGATION_BAR(navigation_bar));
g_signal_connect(G_OBJECT(store), "xa-pwd-changed", (GCallback)navigation_bar->_cb_pwd_changed, navigation_bar);
g_signal_connect(G_OBJECT(store), "xa-new-archive", (GCallback)navigation_bar->_cb_new_archive, navigation_bar);
- xa_archive_store_get_history(store, &navigation_bar->history, &navigation_bar->pwd);
}
- else
- {
- xa_navigation_bar_clear_history(navigation_bar);
- }
- g_signal_emit(G_OBJECT(navigation_bar), xa_navigation_bar_signals[0], 0, navigation_bar);
+
+ navigation_bar->_cb_store_set(navigation_bar);
}
XANavigationBar *
@@ -183,119 +140,10 @@
static void
cb_xa_navigation_bar_pwd_changed(XAArchiveStore *store, XANavigationBar *bar)
{
- gchar *path = xa_archive_store_get_pwd(store);
- xa_navigation_bar_history_push(bar, path);
- g_free(path);
}
static void
cb_xa_navigation_bar_new_archive(XAArchiveStore *store, XANavigationBar *bar)
{
- xa_navigation_bar_clear_history(bar);
}
-void
-xa_navigation_bar_history_push(XANavigationBar *nav_bar, const gchar *path)
-{
- nav_bar->history = g_list_insert_before(nav_bar->history, nav_bar->pwd, g_strdup(path));
- if(!nav_bar->pwd)
- nav_bar->pwd = nav_bar->history;
-
- if(g_list_previous(nav_bar->pwd))
- nav_bar->pwd = g_list_previous(nav_bar->pwd);
- if(nav_bar->pwd)
- nav_bar->history = nav_bar->pwd;
-
- GList *temp_list = g_list_previous(nav_bar->pwd);
-
- if(nav_bar->history)
- nav_bar->history->prev = NULL;
- if(temp_list)
- {
- temp_list->next = NULL;
- temp_list = g_list_first(temp_list);
- g_list_foreach(temp_list, (GFunc)g_free, NULL);
- g_list_free(temp_list);
- }
- if(g_list_length(nav_bar->history) > nav_bar->max_history)
- {
- GList *last = g_list_last(nav_bar->history);
- nav_bar->history = g_list_remove(nav_bar->history, last->data);
- }
-}
-
-gint
-xa_navigation_bar_history_get_length(XANavigationBar *nav_bar)
-{
- return g_list_length(nav_bar->history);
-}
-
-gboolean
-xa_navigation_bar_history_back(XANavigationBar *nav_bar)
-{
- if(!g_list_next(nav_bar->pwd))
- return FALSE;
- nav_bar->pwd = g_list_next(nav_bar->pwd);
- xa_archive_store_set_pwd_silent(nav_bar->store, nav_bar->pwd->data);
- return TRUE;
-}
-
-gboolean
-xa_navigation_bar_history_forward(XANavigationBar *nav_bar)
-{
- if(!g_list_previous(nav_bar->pwd))
- return FALSE;
- nav_bar->pwd = g_list_previous(nav_bar->pwd);
- xa_archive_store_set_pwd_silent(nav_bar->store, nav_bar->pwd->data);
- return TRUE;
-}
-
-/* This *is* correct!!! */
-gboolean
-xa_navigation_bar_history_has_next(XANavigationBar *nav_bar)
-{
- if(nav_bar->pwd)
- return (g_list_previous(nav_bar->pwd)?TRUE:FALSE);
- return FALSE;
-}
-
-/* idem */
-gboolean
-xa_navigation_bar_history_has_previous(XANavigationBar *nav_bar)
-{
- if(nav_bar->pwd)
- return (g_list_next(nav_bar->pwd)?TRUE:FALSE);
- return FALSE;
-}
-
-void
-xa_navigation_bar_clear_history(XANavigationBar *nav_bar)
-{
- nav_bar->pwd = g_list_first(nav_bar->history);
- g_list_foreach(nav_bar->pwd, (GFunc)g_free, NULL);
- g_list_free(nav_bar->pwd);
- nav_bar->history = NULL;
- nav_bar->pwd = NULL;
-}
-
-static void
-xa_navigation_bar_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- switch(prop_id)
- {
- case XA_NAVIGATION_BAR_NAV_HISTORY:
- XA_NAVIGATION_BAR(object)->max_history = g_value_get_uint(value);
- break;
- }
-}
-
-static void
-xa_navigation_bar_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- switch(prop_id)
- {
- case XA_NAVIGATION_BAR_NAV_HISTORY:
- g_value_set_uint(value, XA_NAVIGATION_BAR(object)->max_history);
- break;
- }
-}
Modified: xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/navigation_bar.h 2006-11-07 21:06:31 UTC (rev 23779)
@@ -46,9 +46,6 @@
{
GtkContainer parent;
XAArchiveStore *store;
- GList *history;
- GList *pwd;
- gint max_history;
void (*_cb_pwd_changed)(XAArchiveStore *, XANavigationBar *);
void (*_cb_new_archive)(XAArchiveStore *, XANavigationBar *);
void (*_cb_store_set)(XANavigationBar *);
@@ -63,14 +60,7 @@
GType xa_navigation_bar_get_type();
XANavigationBar *xa_navigation_bar_new();
-void xa_navigation_bar_history_push(XANavigationBar *nav_bar, const gchar *path);
void xa_navigation_bar_set_store(XANavigationBar *navigation_bar, XAArchiveStore *store);
-gint xa_navigation_bar_history_get_length(XANavigationBar *nav_bar);
-gboolean xa_navigation_bar_history_back(XANavigationBar *nav_bar);
-gboolean xa_navigation_bar_history_forward(XANavigationBar *nav_bar);
-gboolean xa_navigation_bar_history_has_next(XANavigationBar *nav_bar);
-gboolean xa_navigation_bar_history_has_previous(XANavigationBar *nav_bar);
-void xa_navigation_bar_clear_history(XANavigationBar *nav_bar);
G_END_DECLS
#endif /* __XARCHIVER_NAVIGATION_BAR_H__*/
Modified: xarchiver/branches/xarchiver-psybsd/src/path_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/path_bar.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/path_bar.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -198,6 +198,7 @@
path_bar->scroll_click = TRUE;
gtk_widget_ref(GTK_WIDGET(path_bar));
+ g_signal_connect(G_OBJECT(path_bar), "xa-store-set", (GCallback)cb_xa_path_bar_store_set, NULL);
}
XANavigationBar *
@@ -502,7 +503,6 @@
const gchar *label = xa_archive_store_get_pwd(store);
gint cmp = 0;
- xa_navigation_bar_history_push(bar, label);
g_free((gchar*)label);
while(iter && buttons)
@@ -512,6 +512,7 @@
cmp = strcmp(label, (gchar*)iter->data);
if(cmp != 0)
{
+ /* Remove wrong trailing buttons */
while(buttons)
{
gtk_container_remove(GTK_CONTAINER(path_bar), GTK_WIDGET(buttons->data));
@@ -583,10 +584,6 @@
xa_archive_store_set_pwd_silent(XA_NAVIGATION_BAR(path_bar)->store, path);
g_free(path);
-
- path = xa_archive_store_get_pwd(XA_NAVIGATION_BAR(path_bar)->store);
- xa_navigation_bar_history_push(XA_NAVIGATION_BAR(path_bar), path);
- g_free(path);
}
static void
@@ -698,49 +695,9 @@
static void
cb_xa_path_bar_store_set(XANavigationBar *bar)
{
- GtkRadioButton *button = NULL;
- XAPathBar *path_bar = XA_PATH_BAR(bar);
- GSList *buttons = path_bar->path_button->next;
+ cb_xa_path_bar_new_archive(bar->store, bar);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(path_bar->path_button->data), TRUE);
-
- while(buttons)
- {
- gtk_container_remove(GTK_CONTAINER(path_bar), GTK_WIDGET(buttons->data));
- gtk_widget_unref(GTK_WIDGET(buttons->data));
- buttons = buttons->next;
- }
- g_slist_free(path_bar->path_button->next);
- path_bar->path_button->next = NULL;
-
if(bar->store)
- {
- GSList *path = xa_archive_store_get_pwd_list(bar->store);
- GSList *iter = path;
-
- while(iter)
- {
- button = GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(path_bar->path_button, (const gchar*)iter->data));
- gtk_widget_ref(GTK_WIDGET(button));
- gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
- path_bar->path_button = g_slist_append(path_bar->path_button, button);
-
- g_signal_connect(G_OBJECT(button), "clicked", (GCallback)cb_xa_path_bar_path_button_clicked, path_bar);
-
- gtk_container_add(GTK_CONTAINER(path_bar), GTK_WIDGET(button));
- gtk_widget_show(GTK_WIDGET(button));
-
- g_free(iter->data);
- iter = iter->next;
- }
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-
- g_slist_free(path);
-
- path_bar->first_button = g_slist_last(path_bar->path_button);
- }
-
- gtk_widget_set_sensitive(GTK_WIDGET(path_bar->home_button), bar->store?TRUE:FALSE);
+ cb_xa_path_bar_pwd_changed(bar->store, bar);
}
Modified: xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/tool_bar.c 2006-11-07 21:02:58 UTC (rev 23778)
+++ xarchiver/branches/xarchiver-psybsd/src/tool_bar.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -169,7 +169,7 @@
gtk_widget_show_all(GTK_WIDGET(tool_bar->bar));
- g_signal_connect(G_OBJECT(tool_bar), "xa_store_set", (GCallback)cb_xa_tool_bar_store_set, NULL);
+ g_signal_connect(G_OBJECT(tool_bar), "xa-store-set", (GCallback)cb_xa_tool_bar_store_set, NULL);
}
XANavigationBar *
@@ -191,6 +191,7 @@
gtk_entry_set_text(GTK_ENTRY(tool_bar->path_field), path);
gtk_editable_set_position(GTK_EDITABLE(tool_bar->path_field), -1);
+ /* FIXME: the part about path[0] '/' could be bugged */
if(strlen(path) < 1 || (strlen(path) == 1 && path[0] == '/'))
{
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->up_button), 0);
@@ -201,23 +202,15 @@
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->up_button), 1);
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->home_button), 1);
}
- if(xa_navigation_bar_history_get_length(XA_NAVIGATION_BAR(tool_bar)) <= 1)
- {
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->back_button), 0);
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->forward_button), 0);
- }
+ if(xa_archive_store_has_future(XA_NAVIGATION_BAR(tool_bar)->store))
+ gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->forward_button), 1);
else
- {
- if(xa_navigation_bar_history_has_next(XA_NAVIGATION_BAR(tool_bar)))
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->forward_button), 1);
- else
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->forward_button), 0);
+ gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->forward_button), 0);
- if(xa_navigation_bar_history_has_previous(XA_NAVIGATION_BAR(tool_bar)))
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->back_button), 1);
- else
- gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->back_button), 0);
- }
+ if(xa_archive_store_has_history(XA_NAVIGATION_BAR(tool_bar)->store))
+ gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->back_button), 1);
+ else
+ gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->back_button), 0);
}
static void
@@ -305,7 +298,6 @@
XAToolBar *tool_bar = XA_TOOL_BAR(bar);
gchar *path= xa_archive_store_get_pwd(store);
- xa_navigation_bar_history_push(bar, path);
xa_tool_bar_refresh(tool_bar, path);
g_free(path);
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->hbox), TRUE);
@@ -316,7 +308,6 @@
{
XAToolBar *tool_bar = XA_TOOL_BAR(bar);
- xa_navigation_bar_clear_history(bar);
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->hbox), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->up_button), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(tool_bar->home_button), FALSE);
@@ -327,7 +318,7 @@
static void
cb_xa_tool_bar_history_back(GtkWidget *back_button, XAToolBar *tool_bar)
{
- xa_navigation_bar_history_back(XA_NAVIGATION_BAR(tool_bar));
+ xa_archive_store_go_back(XA_NAVIGATION_BAR(tool_bar)->store);
gchar *path= xa_archive_store_get_pwd(XA_NAVIGATION_BAR(tool_bar)->store);
xa_tool_bar_refresh(tool_bar, path);
g_free(path);
@@ -336,7 +327,7 @@
static void
cb_xa_tool_bar_history_forward(GtkWidget *forward_button, XAToolBar *tool_bar)
{
- xa_navigation_bar_history_forward(XA_NAVIGATION_BAR(tool_bar));
+ xa_archive_store_go_forward(XA_NAVIGATION_BAR(tool_bar)->store);
gchar *path= xa_archive_store_get_pwd(XA_NAVIGATION_BAR(tool_bar)->store);
xa_tool_bar_refresh(tool_bar, path);
g_free(path);
@@ -351,6 +342,7 @@
static void
cb_xa_tool_bar_home(GtkWidget *forward_button, XAToolBar *tool_bar)
{
+ /* FIXME: the part about "/" could be bugged */
xa_archive_store_set_pwd(XA_NAVIGATION_BAR(tool_bar)->store, "/");
}
Added: xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/widget_factory.c (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/widget_factory.c 2006-11-07 21:06:31 UTC (rev 23779)
@@ -0,0 +1,193 @@
+/* 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 <string.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <gettext.h>
+
+#include "widget_factory.h"
+
+static GtkWidget*
+xa_widget_factory_create_boolean_widget(XAWidgetFactory *factory, GObject *obj, GParamSpecs *pspec, GValue *value);
+static GtkWidget*
+xa_widget_factory_create_numeric_widget(XAWidgetFactory *factory, GObject *obj, GParamSpecs *pspec, GValue *value);
+
+static GtkWidget*
+xa_widget_factory_create_boolean_widget(XAWidgetFactory *factory, GObject *obj, GParamSpecs *pspec, GValue *value)
+{
+ GtkWidget *check = gtk_check_button_new_with_label(g_param_specs_get_nick(pspec));
+
+ const gchar *large_tip = g_param_specs_get_blurb(pspec);
+ gchar *small_tip = g_strndup(large_tip, strchr(large_tip, '\n') - large_tip);
+ large_tip = strchr(large_tip, '\n') + 1;
+
+ gtk_tooltips_set_tip(factory->tips, check, small_tip, large_tip);
+
+ g_free(small_tip);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), g_value_get_boolean(value));
+
+ return check;
+}
+
+static GtkWidget*
+xa_widget_factory_create_numeric_widget(XAWidgetFactory *factory, GObject *obj, GParamSpecs *pspec, GValue *value)
+{
+ GtkWidget *box = gtk_hbox(FALSE, 3);
+ GtkWidget *label = gtk_label_new(g_param_specs_get_nick(pspec));
+ GValue double_value;
+ gdouble min = 0, max = 0, inc = 0, step = 0;
+ guint digit = 0;
+ GtkAdjustment *adjust;
+ GtkWidget *spin;
+
+ g_value_init(&double_value, G_TYPE_DOUBLE);
+ g_return_val_if_fail(g_value_transform(&value, &double_value), NULL);
+
+ switch(pspec->value_type)
+ {
+ /*case G_TYPE_CHAR:
+ break;
+ case G_TYPE_UCHAR:
+ break;*/
+ case G_TYPE_INT:
+ min = G_PARAM_SPEC_INT(pspec)->minimum;
+ max = G_PARAM_SPEC_INT(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:gint((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_UINT:
+ min = G_PARAM_SPEC_UINT(pspec)->minimum;
+ max = G_PARAM_SPEC_UINT(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:guint((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_LONG:
+ min = G_PARAM_SPEC_LONG(pspec)->minimum;
+ max = G_PARAM_SPEC_LONG(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:glong((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_ULONG:
+ min = G_PARAM_SPEC_ULONG(pspec)->minimum;
+ max = G_PARAM_SPEC_ULONG(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:gulong((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_INT64:
+ min = G_PARAM_SPEC_INT64(pspec)->minimum;
+ max = G_PARAM_SPEC_INT64(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:gint64((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_UINT64:
+ min = G_PARAM_SPEC_UINT64(pspec)->minimum;
+ max = G_PARAM_SPEC_UINT64(pspec)->maximum;
+ inc = 1;
+ step = ((max-min)/5)>10?10:guint64((man-min)/5);
+ digits = 1;
+ break;
+ case G_TYPE_FLOAT:
+ min = G_PARAM_SPEC_FLOAT(pspec)->minimum;
+ max = G_PARAM_SPEC_FLOAT(pspec)->maximum;
+ inc = 0.000001;
+ step = ((max-min)/5)>0.1?0.1:gfloat((man-min)/5);
+ digits = 6;
+ break;
+ case G_TYPE_DOUBLE:
+ min = G_PARAM_SPEC_DOUBLE(pspec)->minimum;
+ max = G_PARAM_SPEC_DOUBLE(pspec)->maximum;
+ inc = 0.0000000000000000001;
+ step = ((max-min)/5)>0.01?0.01:((man-min)/5);
+ digits = 20;
+ break;
+ }
+
+ adjust = gtk_adjust_new(g_value_get_double(double_value), min, max, inc, step, step);
+ spin = gtk_spin_button_new(adjust, step, digit);
+
+ const gchar *large_tip = g_param_specs_get_blurb(pspec);
+ gchar *small_tip = g_strndup(large_tip, strchr(large_tip, '\n') - large_tip);
+ large_tip = strchr(large_tip, '\n') + 1;
+
+ gtk_tooltips_set_tip(factory->tips, widget, small_tip, large_tip);
+
+ g_free(small_tip);
+
+ return box;
+}
+
+GtkWidget*
+xa_widget_factory_create_property_widget(GObject *obj, const gchar *prop)
+{
+ GtkWidget *widget = NULL;
+ GParamSpecs *pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj), prop);
+ GValue value;
+
+ if(!pspec)
+ return NULL;
+
+ g_object_get_property(obj, prop, &value);
+
+ switch(pspec->value_type)
+ {
+ case G_TYPE_BOOLEAN:
+ widget = xa_widget_create_boolean(obj, pspec, &value);
+ break;
+ case G_TYPE_CHAR:
+ break;
+ case G_TYPE_UCHAR:
+ break;
+ case G_TYPE_INT:
+ break;
+ case G_TYPE_UINT:
+ break;
+ case G_TYPE_LONG:
+ break;
+ case G_TYPE_ULONG:
+ break;
+ case G_TYPE_INT64:
+ break;
+ case G_TYPE_UINT64:
+ break;
+ case G_TYPE_FLOAT:
+ break;
+ case G_TYPE_DOUBLE:
+ break;
+ case G_TYPE_ENUM:
+ break;
+ case G_TYPE_FLAGS:
+ break;
+ case G_TYPE_STRING:
+ break;
+ }
+
+ g_value_unset(&value);
+
+ return widget;
+}
+
Added: xarchiver/branches/xarchiver-psybsd/src/widget_factory.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/widget_factory.h (rev 0)
+++ xarchiver/branches/xarchiver-psybsd/src/widget_factory.h 2006-11-07 21:06:31 UTC (rev 23779)
@@ -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 __XA_WIDGET_FACTORY_H__
+#define __XA_WIDGET_FACTORY_H__
+
+G_BEGIN_DECLS
+
+#define XA_WIDGET_FACTORY(obj) ( \
+ G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ xa_widget_factory_get_type(), \
+ LXAArchive))
+
+#define LXA_IS_ARCHIVE(obj) ( \
+ G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ xa_widget_factory_get_type()))
+
+#define XA_WIDGET_FACTORY_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_CAST ((class), \
+ xa_widget_factory_get_type(), \
+ LXAArchiveClass))
+
+#define LXA_IS_ARCHIVE_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_TYPE ((class), \
+ xa_widget_factory_get_type()))
+
+typedef struct
+{
+ GObject parent;
+} XAWidgetFactory;
+
+typedef struct
+{
+ GObjectClass parent;
+} XAWidgetFactoryClass;
+
+GType xa_widget_factory_get_type(void);
+XAWidgetFactory *xa_widget_factory_new();
+
+GtkWidget *xa_widget_factory_create_property_widget(GObject *obj, const gchar *prop);
+/*GtkWidget *xa_widget_factory_create_property_by_specs(GObject *obj, GParamSpec *prop);*/
+
+#endif /*__XA_WIDGET_FACTORY_H__*/
+
More information about the Xfce4-commits
mailing list