Author: colossus
Date: 2007-07-27 12:56:55 +0000 (Fri, 27 Jul 2007)
New Revision: 25936
Modified:
xarchiver/trunk/configure.in.in
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/archive.h
xarchiver/trunk/src/interface.c
xarchiver/trunk/src/window.c
Log:
Get rid of g_hash_table with a code of mine, still to be polished.
GTK requirement version is now 2.10.x
Removed gtk_check_version in interface.c
Get rid of some browsers for displaying the HTML help; they were too many.
Modified: xarchiver/trunk/configure.in.in
===================================================================
--- xarchiver/trunk/configure.in.in 2007-07-24 10:29:04 UTC (rev 25935)
+++ xarchiver/trunk/configure.in.in 2007-07-27 12:56:55 UTC (rev 25936)
@@ -80,8 +80,8 @@
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.6.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.10.0])
dnl ***********************************
dnl *** Check for debugging support ***
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2007-07-24 10:29:04 UTC (rev 25935)
+++ xarchiver/trunk/src/archive.c 2007-07-27 12:56:55 UTC (rev 25936)
@@ -78,10 +78,8 @@
g_io_channel_set_flags ( ioc , G_IO_FLAG_NONBLOCK , NULL );
if ( archive->parse_output )
- {
- filename_paths_buffer = g_hash_table_new (g_str_hash,
g_str_equal);
g_io_add_watch (ioc,
G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, xa_process_output, archive);
- }
+
g_child_watch_add ( archive->child_pid,
(GChildWatchFunc)xa_watch_child, archive);
err_ioc = g_io_channel_unix_new ( archive->error_fd );
@@ -104,7 +102,7 @@
if (line != NULL)
{
(*archive->parse_output) (line,archive);
- archive->error_output = g_slist_prepend
(archive->error_output,g_strdup(line) );
+ //archive->error_output = g_slist_prepend
(archive->error_output,g_strdup(line) );
g_free (line);
}
while (gtk_events_pending())
@@ -120,7 +118,7 @@
g_io_channel_shutdown (ioc, TRUE, NULL);
g_io_channel_unref (ioc);
- xa_update_window_with_archive_entries (archive,"/");
+ xa_update_window_with_archive_entries (archive,NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW(archive->treeview),
archive->model);
g_object_unref (archive->model);
return FALSE;
@@ -141,7 +139,7 @@
status = g_io_channel_read_line (ioc, &line, NULL,
NULL, NULL);
if (line != NULL)
{
- archive->error_output = g_slist_prepend
(archive->error_output,g_strdup(line) );
+ //archive->error_output = g_slist_prepend
(archive->error_output,g_strdup(line) );
g_free (line);
}
}
@@ -289,6 +287,26 @@
return entry;
}
+XEntry *xa_find_archive_entry(XEntry *entry, gchar *string)
+{
+ if (entry == NULL)
+ return NULL;
+
+ if (strcmp(entry->filename, string) == 0)
+ return entry;
+
+ XEntry *found_entry;
+
+ found_entry = xa_find_archive_entry(entry->child, string);
+
+ if (found_entry != NULL)
+ return found_entry;
+
+ found_entry = xa_find_archive_entry(entry->next, string);
+
+ return found_entry;
+}
+
XEntry *xa_set_archive_entries_for_each_row (XArchive *archive,gchar
*filename,gpointer *items)
{
XEntry *child_entry= NULL;
@@ -298,35 +316,39 @@
gchar *filename_only = NULL;
gchar *p = NULL;
- if (strchr(filename,'/') != NULL)
+ p = strchr(filename,'/');
+ if (p != NULL)
{
- p = strchr(filename,'/');
full_path_name = g_strndup(filename,(p-filename));
- last_entry =
g_hash_table_lookup(filename_paths_buffer,full_path_name);
+
+ if (archive->entries != NULL)
+ last_entry =
xa_find_archive_entry(archive->entries->data,full_path_name);
+ else
+ last_entry = xa_find_archive_entry(NULL,full_path_name);
if (last_entry == NULL)
{
last_entry =
xa_alloc_memory_for_each_row(archive->nc,archive->column_types);
last_entry->filename = full_path_name;
last_entry->columns =
xa_fill_archive_entry_columns_for_each_row(archive,last_entry,items);
- g_hash_table_insert
(filename_paths_buffer,last_entry->filename,last_entry);
- archive->entries = g_list_prepend
(archive->entries,last_entry);
+ archive->entries = g_slist_prepend
(archive->entries,last_entry);
}
p++;
while ( (p = strchr(p,'/')) )
{
full_path_name = g_strndup(filename,(p-filename));
- //g_print ("%s\t%s\n",filename,full_path_name);
- child_entry =
g_hash_table_lookup(filename_paths_buffer,full_path_name);
+ child_entry =
xa_find_archive_entry(last_entry,full_path_name);
if (child_entry == NULL)
{
+ //g_print ("child_entry è null per
%s\n",full_path_name);
child_entry = xa_alloc_memory_for_each_row
(archive->nc,archive->column_types);
child_entry->filename = full_path_name;
+ //g_print ("** %s\n",full_path_name);
child_entry->columns =
xa_fill_archive_entry_columns_for_each_row(archive,child_entry,items);
- g_hash_table_insert
(filename_paths_buffer,child_entry->filename,child_entry);
-
child_entry->next = last_entry->child;
last_entry->child = child_entry;
+ //questa entry last_entry->child contiene tutte
le dir
+ //g_message (child_entry->filename);
}
last_entry = child_entry;
p++;
@@ -337,6 +359,7 @@
filename_only = g_strndup(++p,strlen(p));
child_entry = xa_alloc_memory_for_each_row
(archive->nc,archive->column_types);
child_entry->filename = filename_only;
+ //g_print ("%s\n",filename_only);
child_entry->columns =
xa_fill_archive_entry_columns_for_each_row(archive,child_entry,items);
child_entry->next = last_entry->child;
@@ -349,13 +372,10 @@
last_entry = xa_alloc_memory_for_each_row
(archive->nc,archive->column_types);
if (last_entry == NULL)
return NULL;
+
last_entry->filename = g_strdup(filename);
last_entry->columns =
xa_fill_archive_entry_columns_for_each_row(archive,last_entry,items);
- last_entry->child = NULL;
-
- archive->entries = g_list_prepend (archive->entries,last_entry);
- if (archive->entries->prev != NULL)
- last_entry->next = archive->entries->prev->data;
+ archive->entries = g_slist_prepend
(archive->entries,last_entry);
}
return last_entry;
}
@@ -389,21 +409,22 @@
void xa_update_window_with_archive_entries (XArchive *archive,gchar *path)
{
- GList *s = NULL;
+ GSList *s = NULL;
XEntry *entry = NULL;
GtkTreeIter iter;
unsigned short int i;
gpointer current_column;
- if (*path == '/')
+ s = archive->entries;
+ if (path == NULL)
{
gtk_list_store_clear(archive->liststore);
- s = archive->entries;
for (; s; s = s->next)
{
entry = s->data;
current_column = entry->columns;
gtk_list_store_append (archive->liststore, &iter);
+
//TODO: free the char in g_convert and also at line 445
if(!g_utf8_validate(entry->filename, -1, NULL) )
gtk_list_store_set
(archive->liststore,&iter,0,GTK_STOCK_DIRECTORY,1,g_convert(entry->filename,
-1, "UTF-8", "WINDOWS-1252", NULL, NULL, NULL),-1);
@@ -434,7 +455,7 @@
}
else
{
- entry = g_hash_table_lookup (filename_paths_buffer,path);
+ entry = xa_find_archive_entry(s->data,path);
if (entry == NULL || entry->child == NULL)
return;
@@ -447,13 +468,25 @@
archive->location_entry_path = NULL;
entry = entry->child;
+ //g_print ("entry->child = %s\n",entry->filename);
}
gtk_list_store_clear(archive->liststore);
-
+
while (entry)
{
+ /* Remove the path from the filename */
+ gchar *slash = strrchr(entry->filename,'/');
+ if (slash != NULL)
+ {
+ slash++;
+ gchar *dummy = g_strdup(slash);
+ g_free (entry->filename);
+ entry->filename = dummy;
+ }
+
current_column = entry->columns;
gtk_list_store_append (archive->liststore, &iter);
+
if(!g_utf8_validate(entry->filename, -1, NULL))
gtk_list_store_set
(archive->liststore,&iter,0,GTK_STOCK_DIRECTORY,1,g_convert(entry->filename,
-1, "UTF-8", "WINDOWS-1252", NULL, NULL, NULL),-1);
else
@@ -476,7 +509,9 @@
break;
}
}
- entry=entry->next;
+ entry = entry->next;
+ /*if (entry != NULL)
+ g_print ("entry->next = %s\n",entry->filename);*/
}
}
Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h 2007-07-24 10:29:04 UTC (rev 25935)
+++ xarchiver/trunk/src/archive.h 2007-07-27 12:56:55 UTC (rev 25936)
@@ -91,7 +91,7 @@
//TODO: remove this once you fix the various arj,rar,etc
GList *cmd_line_output;
GSList *error_output;
- GList *entries;
+ GSList *entries;
GType *column_types;
gboolean add_recurse;
gboolean overwrite;
@@ -124,6 +124,7 @@
gint xa_get_new_archive_idx();
//gint xa_read_line (XArchive *archive, FILE *stream, gchar **return_string);
XEntry *xa_alloc_memory_for_each_row ( guint nc,GType column_types[]);
+XEntry *xa_find_archive_entry(XEntry *entry, gchar *string);
XEntry *xa_set_archive_entries_for_each_row (XArchive *archive,gchar
*filename,gpointer *items);
gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *archive,XEntry
*entry,gpointer *items);
void xa_update_window_with_archive_entries (XArchive *archive,gchar *path);
Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c 2007-07-24 10:29:04 UTC (rev 25935)
+++ xarchiver/trunk/src/interface.c 2007-07-27 12:56:55 UTC (rev 25936)
@@ -586,10 +586,7 @@
gtk_misc_set_alignment(GTK_MISC(tab_label), 0.0, 0);
gtk_notebook_append_page_menu (notebook, archive->scrollwindow,
page_hbox, tab_label);
gtk_notebook_set_current_page(notebook, -1);
- #if GTK_CHECK_VERSION(2, 10, 0)
- if (gtk_check_version(2, 10, 0) == NULL)
- gtk_notebook_set_tab_reorderable(notebook,
archive->scrollwindow, TRUE);
- #endif
+ gtk_notebook_set_tab_reorderable(notebook, archive->scrollwindow, TRUE);
archive->treeview = gtk_tree_view_new ();
gtk_container_add (GTK_CONTAINER (archive->scrollwindow),
archive->treeview);
gtk_widget_show (archive->treeview);
@@ -928,7 +925,7 @@
/* Root */
case 0:
archive[idx]->location_entry_path = NULL;
- xa_update_window_with_archive_entries(archive[idx],"/");
+
xa_update_window_with_archive_entries(archive[idx],NULL);
break;
/* Up */
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2007-07-24 10:29:04 UTC (rev 25935)
+++ xarchiver/trunk/src/window.c 2007-07-27 12:56:55 UTC (rev 25936)
@@ -909,7 +909,7 @@
{
static GtkWidget *about = NULL;
const char *authors[] = {"\nMain developer:\nGiuseppe Torelli <[EMAIL
PROTECTED]>\n\nLHA and DEB support:\nŁukasz Zemczak <[EMAIL PROTECTED]>\n\nLZMA
support:\nThomas Dy <[EMAIL PROTECTED]>",NULL};
- const char *documenters[] = {"\nVery special thanks to John Berthels
for\nhelping me in fixing archive navigation code.\n\nSpecial thanks to Bjoern
Martensen for\nbugs hunting and Xarchiver Tango logo.\n\nThanks to:\nBenedikt
Meurer\nStephan Arts\nEnrico Tröger\nUracile for the stunning logo\nThe people
of gtk-app-devel-list.", NULL};
+ const char *documenters[] = {"\nVery special thanks to John Berthels
for\nhelping me in fixing archive navigation code.\n\nSpecial thanks to Bjoern
Martensen for\nbugs hunting and Xarchiver Tango logo.\n\nThanks to:\nBenedikt
Meurer\nStephan Arts\nEnrico Tröger\nUracile for the stunning logo\n", NULL};
if (about == NULL)
{
@@ -2120,28 +2120,11 @@
gchar *browser_path;
//TODO: retrieve the user set browser from prefs and use it
- browser_path = g_find_program_in_path ("exo-open");
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("htmlview");
+ browser_path = g_find_program_in_path ("xelp");
if ( browser_path == NULL)
browser_path = g_find_program_in_path ("firefox");
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("opera");
-
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("mozilla");
-
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("epiphany");
-
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("konqueror");
-
- if ( browser_path == NULL)
- browser_path = g_find_program_in_path ("seamonkey");
-
argv[0] = browser_path;
argv[1] = (gchar *) link;
argv[2] = NULL;
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits