Author: colossus
Date: 2007-09-10 08:25:29 +0000 (Mon, 10 Sep 2007)
New Revision: 26062
Modified:
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/interface.c
xarchiver/trunk/src/interface.h
xarchiver/trunk/src/pref_dialog.c
xarchiver/trunk/src/string_utils.c
xarchiver/trunk/src/string_utils.h
xarchiver/trunk/src/window.c
Log:
Applied patch of Diego Ontaro.
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/archive.c 2007-09-10 08:25:29 UTC (rev 26062)
@@ -133,7 +133,7 @@
gboolean xa_dump_child_error_messages (GIOChannel *ioc, GIOCondition cond,
gpointer data)
{
- XArchive *archive = data;
+ //XArchive *archive = data;
GIOStatus status;
gchar *line = NULL;
Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/interface.c 2007-09-10 08:25:29 UTC (rev 26062)
@@ -348,7 +348,7 @@
gtk_widget_set_sensitive (View_button,FALSE);
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (View_button), FALSE);
gtk_container_add (GTK_CONTAINER (toolbar1), View_button);
- gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (View_button), tooltips,
_("View file content in the current archive"), NULL);
+ gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (View_button), tooltips,
_("View file with an external editor/viewer"), NULL);
separatortoolitem2 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem2);
@@ -680,14 +680,14 @@
}
-GtkWidget *view_win ( gchar *title)
+GtkWidget *xa_create_comment_window()
{
GtkWidget *view_window;
GtkWidget *scrolledwindow2;
GtkWidget *textview1;
view_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (view_window), title);
+ gtk_window_set_title (GTK_WINDOW (view_window), _("Archive comment
window"));
gtk_window_set_destroy_with_parent (GTK_WINDOW (view_window), TRUE);
gtk_window_set_type_hint (GTK_WINDOW (view_window),
GDK_WINDOW_TYPE_HINT_UTILITY);
gtk_window_set_position (GTK_WINDOW (view_window), GTK_WIN_POS_CENTER);
Modified: xarchiver/trunk/src/interface.h
===================================================================
--- xarchiver/trunk/src/interface.h 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/interface.h 2007-09-10 08:25:29 UTC (rev 26062)
@@ -117,7 +117,7 @@
void set_label (GtkWidget *label,gchar *text);
int xa_progressbar_pulse (gpointer data);
-GtkWidget *view_win ( gchar *title);
+GtkWidget *xa_create_comment_window();
void xa_create_mainwindow (GtkWidget *MainWindow,gboolean show_location);
GtkWidget *create_archive_properties_window (void);
void xa_handle_navigation_buttons (GtkMenuItem *menuitem, gpointer user_data);
Modified: xarchiver/trunk/src/pref_dialog.c
===================================================================
--- xarchiver/trunk/src/pref_dialog.c 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/pref_dialog.c 2007-09-10 08:25:29 UTC (rev 26062)
@@ -54,7 +54,8 @@
//TODO: fix the absolute path
icon_pixbuf = gdk_pixbuf_new_from_file
("./pixmaps/xarchiver-behaviour.svg", NULL);
gtk_list_store_set (prefs_data->prefs_liststore, &iter, 0, icon_pixbuf,
1, _("Behaviour"),2,0,-1);
- g_object_unref (icon_pixbuf);
+ if(icon_pixbuf != NULL)
+ g_object_unref (icon_pixbuf);
gtk_list_store_append (prefs_data->prefs_liststore, &iter);
icon_pixbuf = gtk_widget_render_icon (prefs_data->dialog1, "gtk-find",
GTK_ICON_SIZE_DND, NULL);
@@ -62,7 +63,7 @@
g_object_unref (icon_pixbuf);
gtk_list_store_append (prefs_data->prefs_liststore, &iter);
- icon_pixbuf = gtk_widget_render_icon (prefs_data->dialog1, "gtk-execute",
GTK_ICON_SIZE_DND, NULL);
+ icon_pixbuf = gtk_widget_render_icon (prefs_data->dialog1,
"gtk-execute", GTK_ICON_SIZE_DND, NULL);
gtk_list_store_set (prefs_data->prefs_liststore, &iter, 0, icon_pixbuf,
1, _("Advanced"),2,2,-1);
g_object_unref (icon_pixbuf);
Modified: xarchiver/trunk/src/string_utils.c
===================================================================
--- xarchiver/trunk/src/string_utils.c 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/string_utils.c 2007-09-10 08:25:29 UTC (rev 26062)
@@ -276,7 +276,7 @@
return local_escaped_path;
}
-gchar *xa_get_parent_dir (gchar *current_dir)
+gchar *xa_get_parent_dir (const gchar *current_dir)
{
gchar *first_slash = NULL;
gchar *second_slash = NULL;
Modified: xarchiver/trunk/src/string_utils.h
===================================================================
--- xarchiver/trunk/src/string_utils.h 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/string_utils.h 2007-09-10 08:25:29 UTC (rev 26062)
@@ -37,7 +37,7 @@
char **split_line (char *line,int n_fields);
char *escape_str_common (const char *str, const char *meta_chars, const char
prefix, const char postfix);
char *eat_spaces (char *line);
-gchar *xa_get_parent_dir (gchar *current_dir);
+gchar *xa_get_parent_dir (const gchar *current_dir);
gchar *remove_level_from_path (const gchar *path);
gboolean file_extension_is (const char *filename, const char *ext);
gchar *extract_local_path (gchar *path);
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2007-09-09 22:43:39 UTC (rev 26061)
+++ xarchiver/trunk/src/window.c 2007-09-10 08:25:29 UTC (rev 26062)
@@ -1251,27 +1251,19 @@
void xa_view_file_inside_archive ( GtkMenuItem *menuitem , gpointer user_data )
{
- gchar *filename = NULL;
- GError *error = NULL;
- gchar *string = NULL;
gchar *command = NULL;
+ gchar tmp_dir[14] = "";
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
- gchar *dir;
- gchar *dummy_name;
- gchar *t;
+ gchar *name = NULL;
+ XEntry *entry = NULL;
+ gchar *full_pathname;
GList *row_list = NULL;
- GString *names;
- gchar *content;
- unsigned short int COL_NAME;
- gboolean is_dir = FALSE;
- gboolean tofree = FALSE;
gboolean result = FALSE;
- gsize length;
- gsize new_length;
gint current_page;
gint idx;
+ GString *names = g_string_new ( " " );
current_page = gtk_notebook_get_current_page (notebook);
idx = xa_find_archive_index (current_page);
@@ -1297,66 +1289,54 @@
gtk_tree_path_free(row_list->data);
g_list_free (row_list);
- switch (archive[idx]->type)
- {
- case XARCHIVETYPE_RAR:
- case XARCHIVETYPE_ARJ:
- COL_NAME = 6;
- break;
+ gtk_tree_model_get (model, &iter, 1, &name, -1);
+ entry = xa_find_archive_entry(archive[idx]->entries->data,name);
+ g_print ("Cerco %s\n",name);
- case XARCHIVETYPE_ZIP:
- COL_NAME = 0;
- break;
-
- case XARCHIVETYPE_7ZIP:
- COL_NAME = 3;
- break;
-
- default:
- COL_NAME = 1;
- }
- gtk_tree_model_get (model, &iter, COL_NAME, &dir, -1);
- if (archive[idx]->type == XARCHIVETYPE_ZIP)
+ if (entry == NULL || entry->is_dir)
{
- if ( g_str_has_suffix (dir,"/") == TRUE )
- is_dir = TRUE;
- }
- else if ( strstr ( dir , "d" ) || strstr ( dir , "D" ) ) is_dir = TRUE;
- if (is_dir)
- {
- response = xa_show_message_dialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,"Can't perform
the action:",_("Please select a file, not a directory!") );
- g_free ( dir );
+ g_print ("Ritorno\n");
+ g_free (name);
return;
}
- g_free ( dir );
+ full_pathname =
g_strconcat(gtk_entry_get_text(GTK_ENTRY(location_entry)),name,NULL);
+ g_free (name);
+ g_print ("%s\n",full_pathname);
+
full_path = archive[idx]->full_path;
overwrite = archive[idx]->overwrite;
archive[idx]->full_path = 0;
archive[idx]->overwrite = 1;
- names = g_string_new (" ");
- gtk_tree_model_get (model, &iter, 0, &dummy_name, -1);
- archive[idx]->status = XA_ARCHIVESTATUS_EXTRACT;
- ConcatenateFileNames2 ( dummy_name , names );
+ if (archive[idx]->tmp == NULL)
+ {
+ result = xa_create_temp_directory(tmp_dir);
+ archive[idx]->tmp = g_strdup(tmp_dir);
+ }
+ g_print ("%s\n",archive[idx]->tmp);
+ names = g_string_append(names,full_pathname);
+ command = xa_extract_single_files(archive[idx],names,archive[idx]->tmp);
+ g_print ("%s\n",command);
+ g_string_free (names,TRUE);
- command = xa_extract_single_files ( archive[idx] , names, "/tmp");
-
archive[idx]->full_path = full_path;
archive[idx]->overwrite = overwrite;
if (command != NULL)
{
result = xa_run_command (archive[idx],command,0);
g_free (command);
- if ( result == 0 )
+ if (result == 0)
{
- unlink (dummy_name);
+ /*unlink (dummy_name);
g_free (dummy_name);
- g_string_free (names,TRUE);
+ g_string_free (names,TRUE);*/
return;
}
}
+ g_free(full_pathname);
+ /*
g_message ("xa_view_file_inside_archive: %s",archive[idx]->tmp);
view_window = view_win(names->str);
g_string_free (names,TRUE);
@@ -1400,7 +1380,7 @@
gtk_text_buffer_insert (viewtextbuf, &viewenditer, t,
new_length );
}
unlink ( filename );
- g_free (filename);
+ g_free (filename);*/
Update_StatusBar (_("Operation completed."));
}
@@ -1683,7 +1663,7 @@
gdk_atom_intern ("XdndDirectSave0", FALSE),
gdk_atom_intern ("text/plain", FALSE), 8,
GDK_PROP_MODE_REPLACE,
- (const guchar *) no_slashes != NULL
? no_slashes : name, no_slashes != NULL ? strlen (no_slashes) : strlen (name) );
+ (const guchar *) (no_slashes != NULL
? no_slashes : name), no_slashes != NULL ? strlen (no_slashes) : strlen (name)
);
g_list_foreach (row_list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (row_list);
@@ -2017,7 +1997,7 @@
current_page = gtk_notebook_get_current_page(notebook);
idx = xa_find_archive_index (current_page);
- comment_window = view_win ( _("Archive comment window") );
+ comment_window = xa_create_comment_window();
gtk_text_buffer_create_tag (viewtextbuf, "bold","weight",
PANGO_WEIGHT_BOLD, NULL);
gtk_text_buffer_insert (viewtextbuf, &viewenditer, "\n", 1);
gtk_text_buffer_insert_with_tags_by_name (viewtextbuf, &viewenditer,
archive[idx]->comment->str, archive[idx]->comment->len, "bold", NULL);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits