[Xfce4-commits] r23153 - in xarchiver/branches/xarchiver-psybsd: . libxarchiver src
Stephan Arts
stephan at xfce.org
Thu Sep 14 10:02:12 UTC 2006
Author: stephan
Date: 2006-09-14 10:02:11 +0000 (Thu, 14 Sep 2006)
New Revision: 23153
Removed:
xarchiver/branches/xarchiver-psybsd/src/main_window_menu_bar.c
xarchiver/branches/xarchiver-psybsd/src/main_window_menu_bar.h
xarchiver/branches/xarchiver-psybsd/src/main_window_status_bar.c
xarchiver/branches/xarchiver-psybsd/src/main_window_status_bar.h
xarchiver/branches/xarchiver-psybsd/src/main_window_tool_bar.c
xarchiver/branches/xarchiver-psybsd/src/main_window_tool_bar.h
Modified:
xarchiver/branches/xarchiver-psybsd/TODO
xarchiver/branches/xarchiver-psybsd/libxarchiver/Makefile.am
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c
xarchiver/branches/xarchiver-psybsd/src/Makefile.am
xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
Log:
:o it shows .tar* archive contents.
Modified: xarchiver/branches/xarchiver-psybsd/TODO
===================================================================
--- xarchiver/branches/xarchiver-psybsd/TODO 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/TODO 2006-09-14 10:02:11 UTC (rev 23153)
@@ -9,10 +9,16 @@
---------------------------------------------------------------
+-+-+-+
- Speedup GUI
+
+ Fix table column stuff work correctly
++-+-+-+
+ Implement table-columns to gnu-tar archive;
+-+-+-+
+ Speedup GUI
++-+-+-+
+
Implement View support (for all support-objects)
Use Path-entries for path-components. (Should reduce mem-usage on large archives tremendously)
+-+-+-+
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/Makefile.am
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/Makefile.am 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/Makefile.am 2006-09-14 10:02:11 UTC (rev 23153)
@@ -6,8 +6,6 @@
archive.c archive.h \
archive-support.c archive-support.h \
archive-support-zip.c archive-support-zip.h \
- archive-support-rar.c archive-support-rar.h \
- archive-support-unrar.c archive-support-unrar.h \
archive-support-gnu-tar.c archive-support-gnu-tar.h
libxarchiver_a_CFLAGS = \
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-14 10:02:11 UTC (rev 23153)
@@ -345,6 +345,7 @@
lxa_execute(command, archive, NULL, NULL, lxa_archive_support_gnu_tar_refresh_parse_output, NULL);
g_free(command);
}
+ return 0;
}
void
@@ -374,16 +375,8 @@
lxa_archive_support_gnu_tar_refresh_parse_output(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
GIOStatus status = G_IO_STATUS_NORMAL;
- FILE *out_file = NULL;
LXAArchive *archive = data;
gchar *line = NULL;
- gchar **line_items = NULL;
- guint read = 0;
- GError *error = NULL;
- gchar *command = NULL;
- GSList *tmp_list = NULL;
- GSList *parent_list = NULL;
- gint i = 0, n = 0;
LXAEntry *entry;
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-14 10:02:11 UTC (rev 23153)
@@ -157,7 +157,7 @@
GSList *tmp_list;
GSList *tmp_list_children;
gchar **path_items;
- LXAEntry *tmp_entry;
+ LXAEntry *tmp_entry = NULL;
path_items = g_strsplit_set(path, "/\n", -1);
tmp_list = g_slist_find_custom(archive->root_entries, path_items[0], (GCompareFunc)lxa_archive_lookup_dir);
if(!tmp_list)
@@ -187,12 +187,15 @@
return tmp_entry;
}
+/* FIXME: ***HACK*** ***HACK*** */
GSList *
lxa_archive_get_children(LXAArchive *archive, gchar *path)
{
- gint i;
+ gint i = 0;
GSList *tmp_list = archive->root_entries;
- gchar **path_items = g_strsplit_set(path, "/\n", -1);
+ if(path[0] == '/')
+ i++;
+ gchar **path_items = g_strsplit_set(&path[i], "/\n", -1);
for(i = 0; path_items[i]?strlen(path_items[i]):0; i++)
{
tmp_list = g_slist_find_custom(tmp_list, path_items[i], (GCompareFunc)lxa_archive_lookup_dir);
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/libxarchiver.c 2006-09-14 10:02:11 UTC (rev 23153)
@@ -37,8 +37,8 @@
lxa_mime_database = thunar_vfs_mime_database_get_default();
lxa_register_support(lxa_archive_support_zip_new());
+ /* TODO: Implement right commands in unrar
lxa_register_support(lxa_archive_support_rar_new());
- /* TODO: Implement right commands in unrar
lxa_register_support(lxa_archive_support_unrar_new());
*/
lxa_register_support(lxa_archive_support_gnu_tar_new());
Modified: xarchiver/branches/xarchiver-psybsd/src/Makefile.am
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/Makefile.am 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/src/Makefile.am 2006-09-14 10:02:11 UTC (rev 23153)
@@ -3,9 +3,6 @@
xarchiver_SOURCES = \
main.c main.h \
main_window.c main_window.h \
- main_window_menu_bar.c main_window_menu_bar.h \
- main_window_tool_bar.c main_window_tool_bar.h \
- main_window_status_bar.c main_window_status_bar.h \
new_dialog.c new_dialog.h \
add_dialog.c add_dialog.h \
extract_dialog.c extract_dialog.h
Modified: xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/src/extract_dialog.c 2006-09-14 10:02:11 UTC (rev 23153)
@@ -20,6 +20,7 @@
*/
#include <config.h>
+#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <libxarchiver/libxarchiver.h>
@@ -151,7 +152,6 @@
xa_extract_dialog_option_toggled (GtkWidget *widget, gpointer data)
{
GValue *val = g_new0(GValue, 1);
- gboolean active;
val = g_value_init(val, G_TYPE_BOOLEAN);
@@ -166,7 +166,6 @@
xa_extract_dialog_option_child_notify (GtkWidget *widget, GParamSpec *pspec, gpointer data)
{
GValue *val = g_new0(GValue, 1);
- gboolean active;
if(strcmp(g_param_spec_get_name(pspec), "text"))
{
val = g_value_init(val, G_TYPE_STRING);
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-14 08:59:13 UTC (rev 23152)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-14 10:02:11 UTC (rev 23153)
@@ -31,6 +31,9 @@
static void
xa_main_window_init(XAMainWindow *);
+void
+cb_xa_main_item_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column, gpointer userdata);
+
GType
xa_main_window_get_type ()
{
@@ -72,6 +75,8 @@
GtkWidget *tmp_image;
GtkAccelGroup *accel_group = gtk_accel_group_new();
+ window->working_dir = NULL;
+
gtk_window_set_default_icon_from_file(DATADIR "/pixmaps/xarchiver.png", NULL);
main_vbox = gtk_vbox_new(FALSE, 0);
@@ -182,6 +187,7 @@
gtk_widget_show(window->scrollwindow);
gtk_widget_show(window->treeview);
+ g_signal_connect(G_OBJECT(window->treeview), "row-activated", G_CALLBACK(cb_xa_main_item_activated), window);
/* Statusbar */
statusbar = gtk_statusbar_new();
@@ -324,12 +330,30 @@
void
xa_main_window_archive_status_changed(LXAArchive *archive, gpointer userdata)
{
+ GtkCellRenderer *renderer = NULL;
+ GtkTreeViewColumn *column = NULL;
+ GtkListStore *liststore = NULL;
+ gint x = 0;
XAMainWindow *main_window = XA_MAIN_WINDOW(userdata);
if(archive->old_status == LXA_ARCHIVESTATUS_REFRESH)
{
- LXAArchiveSupport *lpSupport = lxa_get_support_for_mime(archive->mime);
- GSList *items = lxa_archive_get_children(archive, "/");
- xa_main_window_set_contents(main_window, archive, items, "/");
+ liststore = gtk_list_store_newv(archive->column_number, archive->column_types);
+ for(x = 0; x < archive->column_number; x++)
+ {
+ switch(archive->column_types[x])
+ {
+ case(G_TYPE_STRING):
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(archive->column_names[x], renderer, "text", x, NULL);
+ break;
+ }
+ gtk_tree_view_column_set_resizable(column, TRUE);
+ gtk_tree_view_column_set_sort_column_id(column, x);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(main_window->treeview), column);
+ }
+ gtk_tree_view_set_model(GTK_TREE_VIEW(main_window->treeview), GTK_TREE_MODEL(liststore));
+ GSList *items = lxa_archive_get_children(archive, "");
+ xa_main_window_set_contents(main_window, archive, items, "");
}
}
@@ -342,32 +366,44 @@
void
xa_main_window_set_contents(XAMainWindow *main_window, LXAArchive *archive, GSList *items, gchar *path)
{
- gint x;
GtkTreeIter iter;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkListStore *liststore = gtk_list_store_newv(archive->column_number, archive->column_types);
+ GtkTreeModel *liststore = gtk_tree_view_get_model(GTK_TREE_VIEW(main_window->treeview));
+ gtk_list_store_clear(GTK_LIST_STORE(liststore));
+
main_window->working_dir = path;
- for(x = 0; x < archive->column_number; x++)
- {
- switch(archive->column_types[x])
- {
- case(G_TYPE_STRING):
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(archive->column_names[x], renderer, "text", x, NULL);
- break;
- }
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_column_set_sort_column_id(column, x);
- gtk_tree_view_append_column(GTK_TREE_VIEW(main_window->treeview), column);
- }
while(items)
{
- gtk_list_store_append(liststore, &iter);
- gtk_list_store_set_value(liststore, &iter, 0, ((LXAEntry *)items->data)->filename);
+ gtk_list_store_append(GTK_LIST_STORE(liststore), &iter);
+ gtk_list_store_set_value(GTK_LIST_STORE(liststore), &iter, 0, ((LXAEntry *)items->data)->filename);
items = items->next;
}
gtk_tree_view_set_model(GTK_TREE_VIEW(main_window->treeview), GTK_TREE_MODEL(liststore));
}
+
+void
+cb_xa_main_item_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column, gpointer userdata)
+{
+ GtkTreeIter iter;
+ GValue *value = g_new0(GValue, 1);
+ XAMainWindow *main_window = userdata;
+
+ GtkTreeModel *tree_model = gtk_tree_view_get_model(treeview);
+
+ gtk_tree_model_get_iter(tree_model, &iter, treepath);
+ gtk_tree_model_get_value(tree_model, &iter, 0, value);
+
+ gchar *path = g_strconcat(main_window->working_dir, "/", g_value_get_string(value), NULL);
+
+ g_debug("%s\n", path);
+
+ GSList *items = lxa_archive_get_children(lp_xa_archive, path);
+ if(items)
+ xa_main_window_set_contents(main_window, lp_xa_archive, items, path);
+/* else*/
+ /* 'view' */
+
+g_free(value);
+
+}
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_menu_bar.c
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_menu_bar.h
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_status_bar.c
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_status_bar.h
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_tool_bar.c
Deleted: xarchiver/branches/xarchiver-psybsd/src/main_window_tool_bar.h
More information about the Xfce4-commits
mailing list