Author: colossus
Date: 2008-07-22 11:42:38 +0000 (Tue, 22 Jul 2008)
New Revision: 27365

Modified:
   xarchiver/trunk/ChangeLog
   xarchiver/trunk/TODO
   xarchiver/trunk/src/add_dialog.c
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/interface.h
   xarchiver/trunk/src/lha.c
   xarchiver/trunk/src/main.c
   xarchiver/trunk/src/new_dialog.c
   xarchiver/trunk/src/pref_dialog.c
   xarchiver/trunk/src/rar.c
   xarchiver/trunk/src/rar.h
   xarchiver/trunk/src/rpm.c
   xarchiver/trunk/src/window.c
   xarchiver/trunk/src/window.h
Log:
The archive comment window now allows to edit a comment and to insert it into 
the archive,zip todo yet.
Fixed missed visualization of archiver error output when using xa_run_command()
Fixed missed space in the rar extraction string.
Made the "file selected status bar" to be displayed only when selecting entries.
Made rar archive comment to be detected.
Made the nice Xarchiver icon to be visible when dragging from Xarchiver.
Removed Update_StatusBar() function.
Fixed some UI matters related to the status bar and menus.
Updated ChangeLog file.
Updated TODO file.


Modified: xarchiver/trunk/ChangeLog
===================================================================
--- xarchiver/trunk/ChangeLog   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/ChangeLog   2008-07-22 11:42:38 UTC (rev 27365)
@@ -1,12 +1,16 @@
 Xarchiver changelog:
 
 xx/08/08 - 0.5:
-               - Archive directories can be browsed just like a file manager.
+               - Archive content can be browsed just like a file manager.
                - Mime icon for each of the archive entries.
                - New archive type support: lzma and tar.lzma.
+               - Archive directories can be browsed through a sidepane.
+               - Files and directories can be added into archive directories.
+               - Files can be directly opened with the registered application 
within Xarchiver.
+               - Ability to create a comment for those archives supporting it.
                - Added a brand new preferences dialog to set Xarchiver's 
options.
                - The add and extract dialogs layout have been redesigned.
-               - Context menu on each of the archive entries.
+               - Context menu on each of the entries with cut/copy/paste 
ability from and to archives.
                - Ability to rename entries in the archives.
                - The cmd-line output window now displays each archiver's 
output.
                - The cmd-line output window has a close button and a better 
layout.

Modified: xarchiver/trunk/TODO
===================================================================
--- xarchiver/trunk/TODO        2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/TODO        2008-07-22 11:42:38 UTC (rev 27365)
@@ -1,4 +1,6 @@
+- fix sorting of directories before the files
 - fix store output when test archives
+- handle the matter of the password in window.c:xa_reset_password()
 - fix segfault in xa_launch_external_command
 - recurse with opendir for arj when using the switches from cmd-line
 - fix the remaining bugs in bugzilla.xfce.org

Modified: xarchiver/trunk/src/add_dialog.c
===================================================================
--- xarchiver/trunk/src/add_dialog.c    2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/add_dialog.c    2008-07-22 11:42:38 UTC (rev 27365)
@@ -340,6 +340,7 @@
        gchar *compression_string = NULL;
        gboolean done = FALSE;
        GSList *list = NULL;
+       int response;
 
        while ( ! done )
        {

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c       2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/archive.c       2008-07-22 11:42:38 UTC (rev 27365)
@@ -78,7 +78,7 @@
                xa_set_button_state 
(1,1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties);
                return;
        }
-       g_strfreev ( argv );
+       g_strfreev (argv);
 
        if (archive->pb_source == 0)
                archive->pb_source = g_timeout_add 
(350,xa_flash_led_indicator,archive);
@@ -88,16 +88,14 @@
                g_slist_foreach (archive->error_output, (GFunc) g_free, NULL);
                g_slist_free (archive->error_output);
                archive->error_output = NULL;
+               archive->list_reversed = FALSE;
        }
-       if (archive->parse_output)
-       {
-               ioc = g_io_channel_unix_new (archive->output_fd);
-               g_io_channel_set_encoding (ioc, NULL , NULL);
-               g_io_channel_set_flags ( ioc , G_IO_FLAG_NONBLOCK , NULL );
+       ioc = g_io_channel_unix_new (archive->output_fd);
+       g_io_channel_set_encoding (ioc, NULL , NULL);
+       g_io_channel_set_flags ( ioc , G_IO_FLAG_NONBLOCK , NULL );
 
-               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);
-       }
+       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);
        g_io_channel_set_encoding (err_ioc,locale,NULL);
@@ -120,7 +118,9 @@
                        {
                                if 
(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_window->store_output)))
                                        archive->error_output = g_slist_prepend 
(archive->error_output,g_strdup(line));
-                               (*archive->parse_output) (line,archive);
+
+                               if (*archive->parse_output)
+                                       (*archive->parse_output) (line,archive);
                                g_free(line);
                        }
                        while (gtk_events_pending())
@@ -136,9 +136,12 @@
                g_io_channel_shutdown (ioc,TRUE,NULL);
                g_io_channel_unref (ioc);
 
-               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);
+               if (*archive->parse_output)
+               {
+                       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;
        }
        return TRUE;
@@ -228,7 +231,7 @@
        {
                if (archive->comment != NULL)
                {
-                       g_string_free (archive->comment,FALSE);
+                       g_string_free (archive->comment,TRUE);
                        archive->comment = NULL;
                }
        }
@@ -249,6 +252,7 @@
 {
        gchar *tmp_dir;
        gchar *value;
+       int response;
 
        if (archive->tmp != NULL)
                return TRUE;
@@ -274,6 +278,7 @@
        int ps,argcp;
        gboolean waiting = TRUE;
        gboolean result = FALSE;
+       int response;
        GSList *_commands = commands;
 
        GError *error = NULL;

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c        2008-07-22 08:17:27 UTC (rev 
27364)
+++ xarchiver/trunk/src/extract_dialog.c        2008-07-22 11:42:38 UTC (rev 
27365)
@@ -332,7 +332,7 @@
        if (result == -1)
        {
                gchar *msg = g_strdup_printf(_("Can't create directory 
\"%s\""),fullname);
-               response = xa_show_message_dialog (GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,msg,g_strerror(errno
 ));
+               result = xa_show_message_dialog (GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,msg,g_strerror(errno
 ));
                g_free (msg);
                gtk_tree_store_remove(GTK_TREE_STORE(model),&iter);
        }
@@ -382,6 +382,7 @@
        gchar *destination_path = NULL;
        gboolean done = FALSE;
        GSList *names = NULL;
+       int response;
 
        if (unrar)
                rar = "unrar";

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c     2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/interface.c     2008-07-22 11:42:38 UTC (rev 27365)
@@ -129,7 +129,7 @@
        gtk_widget_show (quit1);
        gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit1);
 
-       menuitem2 = gtk_menu_item_new_with_mnemonic (_("_Action"));
+       menuitem2 = gtk_menu_item_new_with_mnemonic (_("A_ction"));
        gtk_widget_show (menuitem2);
        gtk_container_add (GTK_CONTAINER (menubar1), menuitem2);
 
@@ -177,7 +177,7 @@
        gtk_widget_show (image2);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (exe_menu), image2);
 
-       comment_menu = gtk_image_menu_item_new_with_mnemonic (_("_Show 
comment"));
+       comment_menu = gtk_image_menu_item_new_with_mnemonic (_("Archive 
comment"));
        gtk_widget_set_sensitive (comment_menu, FALSE);
        gtk_widget_show (comment_menu);
        gtk_container_add (GTK_CONTAINER (menuitem2_menu), comment_menu);
@@ -192,7 +192,7 @@
        gtk_container_add (GTK_CONTAINER (menuitem2_menu), separatormenuitem4);
        gtk_widget_set_sensitive (separatormenuitem4, FALSE);
 
-       select_all = gtk_image_menu_item_new_with_mnemonic (_("Sele_ct All"));
+       select_all = gtk_image_menu_item_new_with_mnemonic (_("Select _all"));
        gtk_widget_show (select_all);
        gtk_container_add (GTK_CONTAINER (menuitem2_menu), select_all);
        gtk_widget_set_sensitive (select_all, FALSE);
@@ -202,7 +202,7 @@
        gtk_widget_show (tmp_image);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (select_all), 
tmp_image);
 
-       deselect_all = gtk_image_menu_item_new_with_mnemonic (_("Dese_lect 
All"));
+       deselect_all = gtk_image_menu_item_new_with_mnemonic (_("Dese_lect 
all"));
        gtk_widget_show (deselect_all);
        gtk_container_add (GTK_CONTAINER (menuitem2_menu), deselect_all);
        gtk_widget_set_sensitive (deselect_all, FALSE);
@@ -459,7 +459,6 @@
        gtk_container_add (GTK_CONTAINER (frame1), total_label);
        
        frame2 = gtk_frame_new (NULL);
-       gtk_widget_show (frame2);
        gtk_box_pack_start (GTK_BOX (hbox_sb), frame2, TRUE, TRUE, 0);
        gtk_frame_set_label_align (GTK_FRAME (frame2), 0, 0);
        gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
@@ -473,7 +472,7 @@
        gtk_widget_show (green_led);
        gtk_box_pack_start (GTK_BOX (hbox_sb), green_led, FALSE, FALSE, 0);
        gtk_misc_set_alignment (GTK_MISC (green_led), 1, 1);
-       gtk_tooltips_set_tip (tooltips,green_led, _("This is Xarchiver led 
status indicator. When the red light is on Xarchiver is busy"), NULL);
+       gtk_tooltips_set_tip (tooltips,green_led, _("This is Xarchiver led 
status. When it's flashing Xarchiver is busy"), NULL);
 
        red_led = gtk_image_new_from_icon_name ("gtk-no", GTK_ICON_SIZE_BUTTON);
        gtk_box_pack_start (GTK_BOX (hbox_sb),red_led,FALSE, FALSE, 0);
@@ -487,7 +486,7 @@
        g_signal_connect ((gpointer) extract_menu, "activate", G_CALLBACK 
(xa_extract_archive), NULL);
        g_signal_connect ((gpointer) exe_menu, "activate", G_CALLBACK 
(xa_convert_sfx), NULL);
        g_signal_connect ((gpointer) addfile, "activate", G_CALLBACK 
(xa_add_files_archive), NULL);
-       g_signal_connect ((gpointer) view_shell_output1, "activate", G_CALLBACK 
(xa_show_cmd_line_output), NULL);
+       g_signal_connect ((gpointer) view_shell_output1, "activate", G_CALLBACK 
(xa_show_cmd_line_output), (gpointer) 0);
        g_signal_connect ((gpointer) select_all, "activate", G_CALLBACK 
(xa_select_all), NULL);
        g_signal_connect ((gpointer) deselect_all, "activate", G_CALLBACK 
(xa_deselect_all), NULL);
        g_signal_connect ((gpointer) select_pattern, "activate", G_CALLBACK 
(xa_create_delete_dialog), NULL);
@@ -568,7 +567,7 @@
 here:
        xa_restore_navigation(id);
 
-       if (archive[id]->has_comment)
+       if (archive[id]->type == XARCHIVETYPE_7ZIP || archive[id]->type == 
XARCHIVETYPE_ZIP || archive[id]->type == XARCHIVETYPE_RAR || archive[id]->type 
== XARCHIVETYPE_ARJ)
                gtk_widget_set_sensitive (comment_menu,TRUE);
        else
                gtk_widget_set_sensitive (comment_menu,FALSE);
@@ -675,6 +674,7 @@
        GtkWidget 
*password_dialog,*dialog_vbox1,*vbox1,*hbox2,*image2,*vbox2,*label_pwd_required,*label_filename,*hbox1,*label34,*pw_password_entry;
        gchar *password = NULL;
        gboolean done = FALSE;
+       int response;
 
        password_dialog = gtk_dialog_new_with_buttons ("Xarchiver " VERSION,
                                                                        
GTK_WINDOW (xa_main_window), GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -766,38 +766,6 @@
        return password;
 }
 
-widget_data *xa_create_output_window(gchar *title)
-{
-       GtkWidget *vbox,*textview,*scrolledwindow;
-       widget_data *data;
-
-       data = g_new0(widget_data,1);
-       data->dialog1 = gtk_dialog_new_with_buttons (title,
-                                                                       
GTK_WINDOW (xa_main_window), GTK_DIALOG_NO_SEPARATOR,
-                                                                       
GTK_STOCK_CLOSE,GTK_RESPONSE_CLOSE, NULL);
-       gtk_dialog_set_default_response (GTK_DIALOG (data->dialog1), 
GTK_RESPONSE_CLOSE);
-       gtk_widget_set_size_request (data->dialog1, 400, 250);
-       vbox = GTK_DIALOG (data->dialog1)->vbox;
-
-       scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-       gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 4);
-       g_object_set (G_OBJECT (scrolledwindow),"hscrollbar-policy", 
GTK_POLICY_AUTOMATIC,"shadow-type", GTK_SHADOW_IN,"vscrollbar-policy", 
GTK_POLICY_AUTOMATIC, NULL);
-
-       data->textbuffer = gtk_text_buffer_new (NULL);
-       gtk_text_buffer_create_tag (data->textbuffer, "font","family", 
"monospace", NULL);
-       gtk_text_buffer_get_iter_at_offset (data->textbuffer, &data->iter, 0);
-
-       textview = gtk_text_view_new_with_buffer (data->textbuffer);
-       g_object_unref (data->textbuffer);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
-       gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
-       gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
-
-       gtk_widget_show_all (data->dialog1);
-       return data;
-}
-
 void xa_create_popup_menu()
 {
        GtkWidget *cut;
@@ -975,9 +943,9 @@
                        if (strlen(string) == 0)
                        {
                                xa_deselect_all(NULL,NULL);
-                               done = TRUE;
-                               break;
+                               goto destroy_delete_dialog;
                        }
+                       gtk_widget_set_sensitive(deselect_all,TRUE);
                        done = TRUE;
                        break;
                }
@@ -1030,6 +998,7 @@
        gtk_window_set_resizable (GTK_WINDOW (archive_properties_window), 
FALSE);
        gtk_window_set_modal (GTK_WINDOW (archive_properties_window), TRUE);
        gtk_window_set_type_hint (GTK_WINDOW (archive_properties_window), 
GDK_WINDOW_TYPE_HINT_UTILITY);
+       
gtk_dialog_set_has_separator(GTK_DIALOG(archive_properties_window),FALSE);
 
        table1 = gtk_table_new (10, 2, TRUE);
        gtk_container_add (GTK_CONTAINER (GTK_DIALOG 
(archive_properties_window)->vbox), table1);
@@ -1316,6 +1285,7 @@
        GtkTreeIter parent;
        GString *full_pathname = g_string_new("");
        gboolean full_path,add_recurse,dummy_password;
+       int response;
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
        current_page = gtk_notebook_get_current_page(notebook);
@@ -1445,8 +1415,9 @@
        return TRUE;
 }
 
-void xa_show_cmd_line_output(GtkMenuItem *menuitem)
+void xa_show_cmd_line_output(GtkMenuItem *menuitem,gpointer data)
 {
+       gboolean create_image = GPOINTER_TO_INT(data);
        GSList *output = NULL;
        gchar *line = NULL;
        gchar *utf8_line;
@@ -1460,9 +1431,9 @@
        current_page = gtk_notebook_get_current_page(notebook);
        idx = xa_find_archive_index (current_page);
 
-       dialog = gtk_dialog_new_with_buttons ("",
-                                             
GTK_WINDOW(xa_main_window),GTK_DIALOG_MODAL,GTK_STOCK_OK, GTK_RESPONSE_OK,NULL);
-       gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+       dialog = gtk_dialog_new_with_buttons (_("Archiver output"),
+                                             
GTK_WINDOW(xa_main_window),GTK_DIALOG_MODAL,GTK_STOCK_OK,GTK_RESPONSE_OK,NULL);
+       gtk_dialog_set_default_response (GTK_DIALOG (dialog),GTK_RESPONSE_OK);
 
        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
@@ -1470,16 +1441,9 @@
        gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 8);
        gtk_widget_set_size_request (dialog, 400, -1);
 
-       image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, 
GTK_ICON_SIZE_DIALOG);
-       gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-
-       label = gtk_label_new (_("An error occurred while accessing the 
archive:"));
-       gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-       gtk_label_set_selectable (GTK_LABEL (label), TRUE);
-
        scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-       gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 4);
        g_object_set (G_OBJECT (scrolledwindow),"hscrollbar-policy", 
GTK_POLICY_AUTOMATIC,"shadow-type", GTK_SHADOW_IN,"vscrollbar-policy", 
GTK_POLICY_AUTOMATIC, NULL);
+       gtk_widget_set_size_request (scrolledwindow,-1,200);
 
        textbuffer = gtk_text_buffer_new (NULL);
        gtk_text_buffer_create_tag (textbuffer, "font","family", "monospace", 
NULL);
@@ -1492,20 +1456,27 @@
 
        vbox = gtk_vbox_new (FALSE, 6);
        gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+       
+       if (create_image)
+       {
+               create_image = FALSE;
+               image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, 
GTK_ICON_SIZE_DIALOG);
+               gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
 
-       hbox = gtk_hbox_new (FALSE, 6);
-       gtk_box_pack_start (GTK_BOX (hbox), image,FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), label,FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox), hbox,TRUE, TRUE, 0);
-       hbox = gtk_hbox_new (FALSE, 6);
-       gtk_box_pack_start (GTK_BOX (vbox), hbox,TRUE, TRUE, 0);
+               label = gtk_label_new (_("An error occurred while accessing the 
archive:"));
+               gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+               gtk_label_set_selectable (GTK_LABEL (label), TRUE);
 
+               hbox = gtk_hbox_new (FALSE, 6);
+               gtk_box_pack_start (GTK_BOX (hbox), image,FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (hbox), label,FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (vbox), hbox,TRUE, TRUE, 0);
+       }
        gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
        gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow,FALSE, FALSE,0);
-
        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),vbox,FALSE, 
FALSE, 0);
 
-       if ( ! archive[idx]->list_reversed)
+       if ( archive[idx]->list_reversed == FALSE)
        {
                archive[idx]->error_output = 
g_slist_reverse(archive[idx]->error_output);
                archive[idx]->list_reversed = TRUE;

Modified: xarchiver/trunk/src/interface.h
===================================================================
--- xarchiver/trunk/src/interface.h     2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/interface.h     2008-07-22 11:42:38 UTC (rev 27365)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2006 Giuseppe Torelli <[EMAIL PROTECTED]>
+ *  Copyright (c) 2008 Giuseppe Torelli <[EMAIL PROTECTED]>
  *
  *  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
@@ -116,19 +116,10 @@
 GtkAccelGroup *accel_group;
 GtkTooltips *tooltips;
 
-
-typedef struct
-{
-       GtkWidget *dialog1;
-       GtkTextBuffer *textbuffer;
-       GtkTextIter iter;
-} widget_data;
-
 gchar *xa_create_password_dialog(gchar *);
 void set_label (GtkWidget *label,gchar *);
 int xa_flash_led_indicator (gpointer );
 void xa_create_popup_menu();
-widget_data *xa_create_output_window(gchar *);
 void xa_create_main_window (GtkWidget *,gboolean,gboolean,gboolean);
 GtkWidget *create_archive_properties_window();
 gboolean select_matched_rows(GtkTreeModel *,GtkTreePath *,GtkTreeIter 
*,gpointer );
@@ -143,5 +134,5 @@
 void xa_sidepane_drag_data_received (GtkWidget *,GdkDragContext *,int x,int 
y,GtkSelectionData *, unsigned int info,unsigned int time,gpointer );
 gboolean xa_sidepane_drag_motion_expand_timeout (GtkTreePath **);
 gboolean xa_sidepane_drag_motion (GtkWidget *,GdkDragContext *,gint x,gint 
y,guint ,gpointer );
-void xa_show_cmd_line_output(GtkMenuItem *menuitem);
+void xa_show_cmd_line_output(GtkMenuItem *menuitem,gpointer data);
 #endif

Modified: xarchiver/trunk/src/lha.c
===================================================================
--- xarchiver/trunk/src/lha.c   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/lha.c   2008-07-22 11:42:38 UTC (rev 27365)
@@ -118,7 +118,6 @@
        filename = line + 51;
 
        entry = xa_set_archive_entries_for_each_row (archive,filename,item);
-       g_print ("%s\n",entry->filename);
 }
 
 gboolean isLha ( FILE *ptr )

Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c  2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/main.c  2008-07-22 11:42:38 UTC (rev 27365)
@@ -35,6 +35,7 @@
 gboolean batch_mode = FALSE;
 gboolean unrar = FALSE;
 gboolean sevenzr = FALSE, sevenza = FALSE, xdg_open = FALSE;
+int response;
 extern gchar *current_open_directory;
 extern int status;
 Prefs_dialog_data *prefs_window = NULL;
@@ -223,6 +224,7 @@
                        gtk_window_set_default_size 
(GTK_WINDOW(xa_main_window), 600, 400);
                        gtk_paned_set_position (GTK_PANED (hpaned1),200);
                }
+               gtk_label_set_text(GTK_LABEL(total_label),"Select \"New\" to 
create or \"Open\" to open an archive");
                gtk_widget_show (xa_main_window);
 
                /* This to open the archive from the command line */

Modified: xarchiver/trunk/src/new_dialog.c
===================================================================
--- xarchiver/trunk/src/new_dialog.c    2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/new_dialog.c    2008-07-22 11:42:38 UTC (rev 27365)
@@ -44,7 +44,7 @@
        gchar *my_path_ext = NULL;
        gchar *basepath = NULL;
        gchar *current_dir = NULL;
-       gint current_page, type = 0;
+       gint current_page, response,type = 0;
        unsigned short int x;
 
        xa_file_chooser = gtk_file_chooser_dialog_new ( _("Create a new 
archive"),

Modified: xarchiver/trunk/src/pref_dialog.c
===================================================================
--- xarchiver/trunk/src/pref_dialog.c   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/pref_dialog.c   2008-07-22 11:42:38 UTC (rev 27365)
@@ -38,8 +38,9 @@
        prefs_data->dialog1 = gtk_dialog_new_with_buttons (_("Preferences"),
                                                                        
GTK_WINDOW (xa_main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                                        
GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OK,GTK_RESPONSE_OK, NULL);
-       tooltips = gtk_tooltips_new ();
+       tooltips = gtk_tooltips_new();
        gtk_dialog_set_default_response (GTK_DIALOG (prefs_data->dialog1), 
GTK_RESPONSE_OK);
+       gtk_window_set_position 
(GTK_WINDOW(prefs_data->dialog1),GTK_WIN_POS_CENTER_ON_PARENT);
 
        vbox1 = GTK_DIALOG (prefs_data->dialog1)->vbox;
        hbox1 = gtk_hbox_new (FALSE, 6);

Modified: xarchiver/trunk/src/rar.c
===================================================================
--- xarchiver/trunk/src/rar.c   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/rar.c   2008-07-22 11:42:38 UTC (rev 27365)
@@ -79,6 +79,21 @@
 
        if (jump_header == FALSE)
        {
+               if (strncmp(line,"Comment:",8) == 0)
+               {
+                       jump_comment = archive->has_comment = TRUE;
+                       archive->comment = g_string_new("");
+                       archive->comment = 
g_string_append(archive->comment,&line[9]);
+                       return;
+               }
+               if (jump_comment == TRUE)
+               {
+                       if (strncmp(line,"Pathname/Comment",16) != 0)
+                       {       archive->comment = 
g_string_append(archive->comment,line);
+                               return;
+                       }
+                       jump_comment = FALSE;
+               }
                if (line[0] == '-')
                {
                        jump_header = TRUE;
@@ -86,6 +101,7 @@
                }
                return;
        }
+
        if (read_filename == FALSE)
        {
                linesize = strlen(line);
@@ -304,13 +320,13 @@
                                                                                
" -p",archive->passwd,
                                                                                
archive->overwrite ? " -o+" : " -o-",
                                                                                
" -idp ",
-                                                                               
archive->escaped_path , " " ,names->str,archive->extraction_path , NULL );
+                                                                               
archive->escaped_path , " " ,names->str," ",archive->extraction_path , NULL );
        else
                command = g_strconcat (rar," ",archive->full_path ? "x " : "e ",
                                                                                
archive->freshen ? "-f " : "" , archive->update ? "-u " : "",
                                                                                
archive->overwrite ? "-o+" : "-o-",
                                                                                
" -idp ",
-                                                                               
archive->escaped_path , " " ,names->str,archive->extraction_path , NULL );
+                                                                               
archive->escaped_path , " " ,names->str," ",archive->extraction_path , NULL );
        g_string_free(names,TRUE);
        list = g_slist_append(list,command);
 

Modified: xarchiver/trunk/src/rar.h
===================================================================
--- xarchiver/trunk/src/rar.h   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/rar.h   2008-07-22 11:42:38 UTC (rev 27365)
@@ -25,7 +25,7 @@
 #include "string_utils.h"
 #include "support.h"
 #include "archive.h"
-gboolean jump_header,read_filename, last_line, encrypted;
+gboolean jump_header,jump_comment,read_filename, last_line, encrypted;
 void xa_rar_delete (XArchive *,GSList *);
 void xa_rar_add (XArchive *,GSList *,gchar *);
 void xa_rar_extract(XArchive *,GSList *);

Modified: xarchiver/trunk/src/rpm.c
===================================================================
--- xarchiver/trunk/src/rpm.c   2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/rpm.c   2008-07-22 11:42:38 UTC (rev 27365)
@@ -24,7 +24,7 @@
 {
        unsigned char bytes[8];
        unsigned short int i;
-    int dl,il,sigsize,offset;
+    int dl,il,sigsize,offset,response;
     gchar *ibs;
     gchar *gzip_tmp = NULL;
        GSList *list = NULL;
@@ -130,7 +130,7 @@
            if ( WEXITSTATUS (exit_code) )
        {
                xa_set_window_title (xa_main_window , NULL);
-                   xa_show_cmd_line_output (NULL);
+                   xa_show_cmd_line_output (NULL,GINT_TO_POINTER(1));
                        xa_set_button_state 
(1,1,GTK_WIDGET_IS_SENSITIVE(save1),GTK_WIDGET_IS_SENSITIVE(close1),0,0,0,0,0);
                        return FALSE;
                }
@@ -238,8 +238,7 @@
 
 void xa_open_temp_file (gchar *tmp_dir,gchar *temp_path)
 {
-       gint current_page;
-       gint idx;
+       gint current_page,idx,response;
        gchar *tmp = NULL;
        FILE *stream;
 
@@ -285,6 +284,7 @@
        gsize bytes_read;
        GIOStatus _status;
        GError *error = NULL;
+       int response;
 
        if (cond & (G_IO_IN | G_IO_PRI) )
        {

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c        2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/window.c        2008-07-22 11:42:38 UTC (rev 27365)
@@ -43,6 +43,8 @@
 
 gboolean xa_check_child_for_error_on_exit(XArchive *archive,gint status)
 {
+       int response;
+
        archive->child_pid = archive->pb_source = 0;
        if (xa_main_window)
        {
@@ -60,7 +62,7 @@
                                return FALSE;
                        }
                        xa_set_button_state 
(1,1,1,1,archive->can_add,archive->can_extract,0,archive->has_test,archive->has_properties);
-                       xa_show_cmd_line_output (NULL);
+                       xa_show_cmd_line_output (NULL,GINT_TO_POINTER(1));
                        /* In case the user supplies a wrong password we reset 
it so he can try again */
                        if ( (archive->status == XA_ARCHIVESTATUS_TEST || 
archive->status == XA_ARCHIVESTATUS_SFX) && archive->passwd != NULL)
                        {
@@ -76,11 +78,13 @@
 
 void xa_archive_operation_finished(XArchive *archive)
 {
+       int response;
+
        if(xa_main_window)
        {
                gtk_widget_set_sensitive(Stop_button,FALSE);
 
-               if (archive->has_comment)
+               if (archive->type == XARCHIVETYPE_7ZIP || archive->type == 
XARCHIVETYPE_ZIP || archive->type == XARCHIVETYPE_RAR || archive->type == 
XARCHIVETYPE_ARJ)
                        gtk_widget_set_sensitive (comment_menu,TRUE);
                else
                        gtk_widget_set_sensitive (comment_menu,FALSE);
@@ -101,8 +105,8 @@
                        gtk_widget_set_sensitive ( exe_menu, FALSE);
                response = xa_show_message_dialog (GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_INFO,GTK_BUTTONS_OK,_("The sfx 
archive was saved as:"),archive->tmp );
        }
-       if (archive->status == XA_ARCHIVESTATUS_TEST)
-               xa_show_cmd_line_output (NULL);
+       else if (archive->status == XA_ARCHIVESTATUS_TEST)
+               xa_show_cmd_line_output (NULL,FALSE);
 
        archive->status = XA_ARCHIVESTATUS_IDLE;
 }
@@ -168,6 +172,7 @@
 void xa_watch_child (GPid pid,gint status,gpointer data)
 {
        XArchive *archive = data;
+       int response;
        gboolean result;
 
        archive->child_pid = archive->pb_source = 0;
@@ -228,6 +233,8 @@
 
 int xa_show_message_dialog (GtkWindow *window,int mode,int type,int 
button,const gchar *message1,const gchar *message2)
 {
+       int response;
+
        dialog = gtk_message_dialog_new (window, mode, type, button,message1);
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), 
message2);
@@ -242,13 +249,13 @@
        gint idx;
        GtkWidget *save = NULL;
        gchar *path = NULL,*command,*filename;
-       gboolean response;
+       int response;
        GSList *list = NULL;
 
        current_page = gtk_notebook_get_current_page(notebook);
        idx = xa_find_archive_index (current_page);
 
-       save = gtk_file_chooser_dialog_new ( _("Save the archive as"),
+       save = gtk_file_chooser_dialog_new (_("Save the archive as"),
                                                GTK_WINDOW (xa_main_window),
                                                GTK_FILE_CHOOSER_ACTION_SAVE,
                                                GTK_STOCK_CANCEL,
@@ -266,6 +273,7 @@
        if (path != NULL)
        {
                command = g_strconcat ("cp ",archive[idx]->escaped_path," 
",path,NULL);
+               g_free(path);
                list = g_slist_append(list,command);
                xa_run_command(archive[idx],list);
        }
@@ -275,7 +283,7 @@
 {
        gchar *path = NULL;
        gint current_page;
-       gint x;
+       gint x,response;
        XArchiveType type;
 
        path = (gchar *)data;
@@ -460,12 +468,15 @@
                gtk_widget_set_sensitive (properties,FALSE);
                gtk_widget_set_sensitive (up_button,FALSE);
                gtk_widget_set_sensitive (home_button,FALSE);
+               gtk_widget_set_sensitive (view_shell_output1,FALSE);
                gtk_widget_set_sensitive (deselect_all,FALSE);
                xa_disable_delete_buttons (FALSE);
                xa_set_button_state (1,1,0,0,0,0,0,0,0);
                xa_set_window_title (xa_main_window,NULL);
                gtk_tree_store_clear(GTK_TREE_STORE(archive_dir_model));
                gtk_entry_set_text(GTK_ENTRY(location_entry),"");
+               gtk_label_set_text(GTK_LABEL(total_label),"Select \"New\" to 
create or \"Open\" to open an archive");
+               gtk_widget_hide(frame2);
        }
        else if ( current_page == 1)
                gtk_notebook_set_show_tabs (notebook,FALSE);
@@ -474,7 +485,6 @@
 
        xa_clean_archive_structure (archive[idx]);
        archive[idx] = NULL;
-       gtk_label_set_text(GTK_LABEL(total_label),"");
 }
 
 void xa_quit_application (GtkMenuItem *menuitem, gpointer user_data)
@@ -519,7 +529,7 @@
        XEntry *entry = NULL;
        GtkTreeIter iter;
        GSList *list = NULL;
-       gint current_page,id;
+       gint current_page,id,response;
 
        current_page = gtk_notebook_get_current_page (notebook);
        id = xa_find_archive_index (current_page);
@@ -601,7 +611,7 @@
 
 void xa_show_prefs_dialog (GtkMenuItem *menuitem,gpointer user_data)
 {
-       gboolean response;
+       int response;
 
        if (prefs_window == NULL)
                prefs_window = xa_create_prefs_dialog();
@@ -667,6 +677,7 @@
             GError *error = NULL;
                        gchar *unzipsfx_path = NULL;
                        gchar buffer[1024];
+                       int response;
 
                        archive_name = xa_open_sfx_file_selector ();
 
@@ -692,14 +703,14 @@
                                g_free (unzipsfx_path);
 
                                /* Write unzipsfx to a new file */
-                               sfx_archive = g_fopen ( archive_name ,"w" );
+                               sfx_archive = fopen ( archive_name ,"w" );
                                if (sfx_archive == NULL)
                                {
                                        gtk_widget_set_sensitive 
(Stop_button,FALSE);
                                        response = xa_show_message_dialog 
(GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't 
write the unzipsfx module to the archive:"),g_strerror(errno) );
                                        return;
                                }
-                               archive_not_sfx = g_fopen ( archive[idx]->path 
,"r" );
+                               archive_not_sfx = fopen ( archive[idx]->path 
,"r" );
                                fwrite (content, 1, length, sfx_archive);
                                g_free (content);
 
@@ -734,7 +745,7 @@
             GError *error = NULL;
                        gchar *sfx_path = NULL;
                        gchar buffer[1024];
-                       gboolean response;
+                       int response;
                        GtkWidget *locate_7zcon = NULL;
                        GtkFileFilter *sfx_filter;
 
@@ -796,13 +807,13 @@
                                g_free (sfx_path);
 
                                /* Write 7zCon.sfx to a new file */
-                               sfx_archive = g_fopen ( archive_name ,"w" );
+                               sfx_archive = fopen ( archive_name ,"w" );
                                if (sfx_archive == NULL)
                                {
                                        response = xa_show_message_dialog 
(GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't 
write the unzipsfx module to the archive:"),g_strerror(errno) );
                                        return;
                                }
-                               archive_not_sfx = g_fopen ( archive[idx]->path 
,"r" );
+                               archive_not_sfx = fopen ( archive[idx]->path 
,"r" );
                                fwrite (content, 1, length, sfx_archive);
                                g_free (content);
 
@@ -873,7 +884,7 @@
                                        "write to the Free Software Foundation, 
Inc., 59 Temple Place - Suite 330,\n"
                                        "Boston, MA 02111-1307, USA.\n",
                      NULL);
-               gtk_window_set_position (GTK_WINDOW (about), 
GTK_WIN_POS_CENTER);
+               gtk_window_set_position (GTK_WINDOW (about),GTK_WIN_POS_CENTER);
        }
        gtk_dialog_run ( GTK_DIALOG(about) );
        gtk_widget_hide (about);
@@ -883,7 +894,7 @@
 {
        gchar *sfx_name = NULL;
        GtkWidget *sfx_file_selector = NULL;
-       gboolean response;
+       int response;
 
        sfx_file_selector = gtk_file_chooser_dialog_new ( _("Save the 
self-extracting archive as"),
                                                GTK_WINDOW (xa_main_window),
@@ -909,6 +920,7 @@
        static GtkWidget *File_Selector = NULL;
        GtkFileFilter *filter;
        gchar *path = NULL;
+       int response;
 
        if (File_Selector == NULL)
        {
@@ -980,7 +992,7 @@
 int xa_detect_archive_type (gchar *filename)
 {
        FILE *dummy_ptr = NULL;
-    int xx = -1;
+    int response,xx = -1;
        unsigned char magic[14]={0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* avoid 
problems with garbage */
 
        if (filename != NULL)
@@ -1032,7 +1044,7 @@
 gboolean xa_detect_archive_comment (int type, gchar *filename, XArchive 
*archive)
 {
        FILE *stream;
-       char sig;
+       char sig = '1';
        guint cmt_len = 0;
        int byte;
        unsigned char eocds[] = { 0x50, 0x4b, 0x05, 0x06 };
@@ -1111,7 +1123,7 @@
                                return FALSE;
                        }
                        else
-                               g_string_append (archive->comment,&sig);
+                               g_string_append_c (archive->comment,sig);
                }
                return TRUE;
        }
@@ -1200,8 +1212,7 @@
 
 void xa_cancel_archive (GtkMenuItem *menuitem,gpointer data)
 {
-       gint current_page;
-       gint idx;
+       gint current_page,idx,response;
 
        current_page = gtk_notebook_get_current_page(notebook);
        idx = xa_find_archive_index (current_page);
@@ -1442,12 +1453,14 @@
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(archive->treeview));
        selected = gtk_tree_selection_count_selected_rows (selection);
 
-       if (selected == 0 )
+       if (selected == 0)
        {
+               
                xa_disable_delete_buttons (FALSE);
-               gtk_label_set_text (GTK_LABEL(selected_label),_("No files 
selected"));
+               gtk_widget_hide(frame2);
                return;
        }
+       gtk_widget_show(frame2);
        if (archive->type == XARCHIVETYPE_RAR && unrar)
                gtk_widget_set_sensitive (delete_menu,FALSE);
        else if ( archive->type != XARCHIVETYPE_RPM && archive->type != 
XARCHIVETYPE_DEB)
@@ -1502,13 +1515,6 @@
        return info;
 }
 
-void Update_StatusBar (gchar *msg)
-{
-       if (xa_main_window == NULL)
-               return;
-       gtk_label_set_text (GTK_LABEL(total_label),msg);
-}
-
 void drag_begin (GtkWidget *treeview1,GdkDragContext *context, gpointer data)
 {
        XArchive *archive = data;
@@ -1518,11 +1524,11 @@
     GList            *row_list;
        XEntry *entry;
        
-       //gtk_drag_source_set_icon_name (treeview1, DATADIR 
"/pixmaps/xarchiver.png" );
+       gtk_drag_source_set_icon_name (archive->treeview, "xarchiver" );
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW 
(archive->treeview));
 
        row_list = gtk_tree_selection_get_selected_rows (selection, NULL);
-       if ( row_list == NULL)
+       if (row_list == NULL)
                return;
 
        gtk_tree_model_get_iter(archive->model,&iter,(GtkTreePath*) 
(row_list->data));
@@ -1552,7 +1558,7 @@
        XArchive *archive = data;
        GtkTreeSelection *selection;
        guchar *fm_path;
-       int fm_path_len;
+       int fm_path_len,response;
        gchar *no_uri_path;
        gchar *to_send = "E";
        GList *row_list = NULL;
@@ -1636,8 +1642,7 @@
        gboolean dummy_password;
        gboolean full_path,add_recurse;
        unsigned int len = 0;
-       gint current_page;
-       gint idx;
+       gint current_page,idx,response;
 
        current_page = gtk_notebook_get_current_page(notebook);
        idx = xa_find_archive_index (current_page);
@@ -1784,6 +1789,7 @@
 void xa_activate_link (GtkAboutDialog *about,const gchar *link,gpointer data)
 {
        gboolean result;
+       int response;
 
        if ( !xdg_open)
        {
@@ -1854,35 +1860,190 @@
        {
                g_free (archive[idx]->passwd);
                archive[idx]->passwd = NULL;
-               Update_StatusBar (_("The password has been reset."));
+               gtk_label_set_text(GTK_LABEL(total_label),(_("The password has 
been reset.")));
        }
        else
-               Update_StatusBar (_("Please enter the password first!"));
+               gtk_label_set_text(GTK_LABEL(total_label),(_("Please enter the 
password first!")));
 }
 
 void xa_show_archive_comment (GtkMenuItem *menuitem,gpointer user_data)
 {
-       widget_data *comment_window;
        gchar *utf8_line;
        gsize len;
        gint current_page;
        gint idx;
+       GtkWidget *textview;
+       GtkWidget *dialog_vbox1;
+       GtkWidget *scrolledwindow1;
+       GtkWidget *dialog_action_area1;
+       GtkWidget *file,*clear,*close,*cancel;
+       GtkTextBuffer *textbuffer;
+       GtkTextIter iter;
 
        current_page = gtk_notebook_get_current_page(notebook);
        idx = xa_find_archive_index (current_page);
 
-       comment_window = xa_create_output_window(_("Archive Comment"));
+       comment_dialog = gtk_dialog_new_with_buttons (_("Comment"),
+                                             
GTK_WINDOW(xa_main_window),GTK_DIALOG_MODAL,NULL);
+       gtk_window_set_position (GTK_WINDOW 
(comment_dialog),GTK_WIN_POS_CENTER);
+       gtk_window_set_type_hint (GTK_WINDOW 
(comment_dialog),GDK_WINDOW_TYPE_HINT_DIALOG);
+       gtk_dialog_set_has_separator (GTK_DIALOG (comment_dialog),FALSE);
+       dialog_vbox1 = GTK_DIALOG (comment_dialog)->vbox;
+       gtk_widget_set_size_request(comment_dialog,500,330);
 
-       gtk_text_buffer_insert (comment_window->textbuffer, 
&comment_window->iter, "\n", 1);
-       utf8_line = g_locale_to_utf8 (archive[current_page]->comment->str, -1, 
NULL, &len, NULL);
-       gtk_text_buffer_insert_with_tags_by_name (comment_window->textbuffer, 
&comment_window->iter, utf8_line, len, "font", NULL);
-       g_free(utf8_line);
+       scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+       gtk_widget_show (scrolledwindow1);
+       gtk_box_pack_start (GTK_BOX (dialog_vbox1),scrolledwindow1, TRUE, TRUE, 
0);
+       g_object_set (G_OBJECT 
(scrolledwindow1),"hscrollbar-policy",GTK_POLICY_AUTOMATIC,"shadow-type",GTK_SHADOW_IN,"vscrollbar-policy",GTK_POLICY_AUTOMATIC,NULL);
 
-       gtk_dialog_run (GTK_DIALOG(comment_window->dialog1));
-       gtk_widget_destroy (comment_window->dialog1);
-       g_free(comment_window);
+       textbuffer = gtk_text_buffer_new (NULL);
+       gtk_text_buffer_create_tag (textbuffer, "font","family", "monospace", 
NULL);
+       gtk_text_buffer_get_iter_at_offset (textbuffer,&iter,0);
+
+       textview = gtk_text_view_new_with_buffer (textbuffer);
+       g_object_unref (textbuffer);
+       gtk_container_add (GTK_CONTAINER (scrolledwindow1),textview);
+
+       dialog_action_area1 = GTK_DIALOG (comment_dialog)->action_area;
+       gtk_button_box_set_layout (GTK_BUTTON_BOX 
(dialog_action_area1),GTK_BUTTONBOX_END);
+
+       clear = gtk_button_new_from_stock ("gtk-clear");
+       gtk_dialog_add_action_widget (GTK_DIALOG (comment_dialog),clear,0);
+       g_signal_connect (G_OBJECT (clear),"clicked",G_CALLBACK 
(xa_clear_comment_window),textbuffer);
+
+       file = gtk_button_new_with_mnemonic (_("From File"));
+       gtk_dialog_add_action_widget (GTK_DIALOG (comment_dialog),file,0);
+       g_signal_connect (G_OBJECT (file),"clicked",G_CALLBACK 
(xa_load_comment_window_from_file),textbuffer);
+
+       cancel = gtk_button_new_from_stock ("gtk-cancel");
+       gtk_dialog_add_action_widget (GTK_DIALOG 
(comment_dialog),cancel,GTK_RESPONSE_CANCEL);
+       g_signal_connect (G_OBJECT (cancel),"clicked",G_CALLBACK 
(xa_destroy_comment_window),comment_dialog);
+
+       close = gtk_button_new_from_stock ("gtk-ok");
+       gtk_dialog_add_action_widget (GTK_DIALOG 
(comment_dialog),close,GTK_RESPONSE_OK);
+       g_signal_connect (G_OBJECT (close),"clicked",G_CALLBACK 
(xa_comment_window_insert_in_archive),textbuffer);
+
+       if (archive[idx]->comment)
+       {
+               utf8_line = g_locale_to_utf8 (archive[idx]->comment->str, -1, 
NULL, &len, NULL);
+               gtk_text_buffer_insert_with_tags_by_name (textbuffer, &iter, 
utf8_line, len, "font", NULL);
+               g_free(utf8_line);
+       }
+       gtk_widget_show_all(comment_dialog);
 }
 
+void xa_comment_window_insert_in_archive(GtkButton *button,gpointer data)
+{
+       GtkTextBuffer *buf = data;
+       GtkTextIter start,end;
+       FILE *stream;
+       gint current_page,idx;
+       gboolean result;
+       gchar *command = NULL,*content,*tmp = NULL;
+       GSList *list = NULL;
+
+       current_page = gtk_notebook_get_current_page(notebook);
+       idx = xa_find_archive_index (current_page);
+
+       gtk_text_buffer_get_iter_at_offset(buf,&start,0);
+       gtk_text_buffer_get_end_iter(buf,&end);
+       content = gtk_text_buffer_get_text(buf,&start,&end,FALSE);
+
+       result = xa_create_temp_directory(archive[idx]);
+       tmp = g_strconcat(archive[idx]->tmp,"/xa_tmp_file",NULL);
+       gtk_widget_destroy(comment_dialog);
+       if (strlen(content) > 0)
+       {
+               stream = fopen (tmp,"w");
+               fwrite (content,1,strlen(content),stream);
+               fclose (stream);
+               g_free(content);
+               switch (archive[idx]->type)
+               {
+                       case XARCHIVETYPE_ARJ:
+                       command = g_strconcat ("arj c 
",archive[idx]->escaped_path," -z",tmp,NULL);
+                       break;
+                       
+                       case XARCHIVETYPE_RAR:
+                       command = g_strconcat ("rar c 
",archive[idx]->escaped_path," -z",tmp,NULL);
+                       break;
+                       
+                       case XARCHIVETYPE_ZIP:
+                       break;
+                       
+                       default:
+                       break;
+               }
+               list = g_slist_append(list,command);
+               xa_run_command(archive[idx],list);
+       }
+       g_free(tmp);
+}
+
+void xa_load_comment_window_from_file(GtkButton *button,gpointer data)
+{
+       GtkTextBuffer *buf = data;
+       GtkTextMark *textmark;
+       GtkTextIter iter;
+       GtkWidget *file;
+       gchar *path = NULL;
+       gchar *utf8_data = NULL;
+       gchar *content = NULL;
+       GError *error = NULL;
+       gboolean response;
+       gsize bytes;
+
+       file = gtk_file_chooser_dialog_new (_("Open a text file"),
+                                               GTK_WINDOW (xa_main_window),
+                                               GTK_FILE_CHOOSER_ACTION_OPEN,
+                                               GTK_STOCK_CANCEL,
+                                               GTK_RESPONSE_CANCEL,
+                                               "gtk-open",
+                                               GTK_RESPONSE_ACCEPT,
+                                               NULL);
+
+       response = gtk_dialog_run (GTK_DIALOG(file));
+       if (response == GTK_RESPONSE_ACCEPT)
+               path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(file));
+       gtk_widget_destroy (file);
+       if (path != NULL)
+       {
+               response = g_file_get_contents(path,&content,NULL,&error);
+               if (response == FALSE)
+               {
+                       gchar *msg = g_strdup_printf (_("Can't open file 
%s:"),path);
+                       g_free(path);
+                       response = xa_show_message_dialog (GTK_WINDOW 
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
+                       msg,error->message);
+                       g_free (msg);
+                       g_error_free(error);
+                       return;
+               }
+               g_free(path);
+               utf8_data = g_locale_to_utf8 (content,-1,NULL,&bytes,NULL);
+               g_free(content);
+               textmark = gtk_text_buffer_get_insert(buf);
+               gtk_text_buffer_get_iter_at_mark(buf,&iter,textmark);
+               gtk_text_buffer_insert_with_tags_by_name 
(buf,&iter,utf8_data,bytes,"font",NULL);
+               g_free (utf8_data);
+       }
+}
+
+void xa_clear_comment_window(GtkButton *button,gpointer data)
+{
+       GtkTextBuffer *buf = data;
+       GtkTextIter start,end;
+
+       gtk_text_buffer_get_iter_at_offset(buf,&start,0);
+       gtk_text_buffer_get_end_iter(buf,&end);
+       gtk_text_buffer_delete(buf,&start,&end);
+}
+
+void xa_destroy_comment_window(GtkButton *button,gpointer data)
+{
+       gtk_widget_destroy(GTK_WIDGET(data));
+}
+
 void xa_location_entry_activated (GtkEntry *entry, gpointer user_data)
 {
        XEntry *prev_entry = NULL;

Modified: xarchiver/trunk/src/window.h
===================================================================
--- xarchiver/trunk/src/window.h        2008-07-22 08:17:27 UTC (rev 27364)
+++ xarchiver/trunk/src/window.h        2008-07-22 11:42:38 UTC (rev 27365)
@@ -52,12 +52,11 @@
 #include "add_dialog.h"
 #include "pref_dialog.h"
 
-short int response;
 double content_size;
 unsigned long long int file_size, file_offset;
 Extract_dialog_data *extract_window;
 Add_dialog_data *add_window;
-GtkWidget *dialog, *scrollwin, *view_window, *_properties_win;
+GtkWidget *dialog, *scrollwin, *view_window, *_properties_win,*comment_dialog;
 
 void xa_new_archive (GtkMenuItem *, gpointer);
 void xa_save_archive (GtkMenuItem *,gpointer);
@@ -101,12 +100,14 @@
 void xa_remove_columns();
 void xa_create_liststore (XArchive *,gchar *[]);
 gchar *xa_get_statusbar_message(unsigned long int,gint,gint,gboolean);
-void Update_StatusBar (gchar *);
-
 gchar *xa_open_file_dialog ();
 gchar *xa_open_sfx_file_selector ();
-void xa_activate_link (GtkAboutDialog *about,const gchar *,gpointer );
-void xa_location_entry_activated (GtkEntry *entry,gpointer );
+void xa_activate_link (GtkAboutDialog *,const gchar *,gpointer );
+void xa_comment_window_insert_in_archive(GtkButton *,gpointer );
+void xa_load_comment_window_from_file(GtkButton *,gpointer );
+void xa_clear_comment_window(GtkButton *,gpointer );
+void xa_destroy_comment_window(GtkButton *,gpointer);
+void xa_location_entry_activated (GtkEntry *,gpointer );
 int xa_mouse_button_event(GtkWidget *,GdkEventButton *,gpointer );
 void xa_treeview_row_activated(GtkTreeView *,GtkTreePath *,GtkTreeViewColumn 
*,gpointer );
 void xa_update_window_with_archive_entries(XArchive *,XEntry *);

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to