summarylogtreecommitdiffstats
path: root/explicit-extension.patch
diff options
context:
space:
mode:
authorConnor Behan2015-06-08 18:41:46 -0400
committerConnor Behan2015-06-08 18:41:46 -0400
commit7bbb12c64936b0c786d5f0557380c361c0bfe2c8 (patch)
treef375b1dd4b4ad97611259b87a23c9135cfd74f35 /explicit-extension.patch
downloadaur-7bbb12c64936b0c786d5f0557380c361c0bfe2c8.tar.gz
Initial import
Diffstat (limited to 'explicit-extension.patch')
-rw-r--r--explicit-extension.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/explicit-extension.patch b/explicit-extension.patch
new file mode 100644
index 000000000000..fe5bb70c7851
--- /dev/null
+++ b/explicit-extension.patch
@@ -0,0 +1,88 @@
+diff -rudp xarchiver-0.5.3.orig/src/new_dialog.c xarchiver-0.5.3/src/new_dialog.c
+--- xarchiver-0.5.3.orig/src/new_dialog.c 2014-02-09 07:26:24.000000000 -0800
++++ xarchiver-0.5.3/src/new_dialog.c 2014-02-21 19:41:06.000000000 -0800
+@@ -30,13 +30,34 @@ gchar *current_new_directory = NULL;
+ gint new_combo_box = -1;
+ gchar *ComboArchiveType;
+
++void xa_change_archive_extension (GtkComboBox *combo_box, GtkWidget *xa_file_chooser) {
++ GList *Name;
++ gchar *path;
++
++ Name = g_list_last(ArchiveType);
++ path = g_path_get_basename ( gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER (xa_file_chooser) ));
++
++ while (Name)
++ {
++ if (g_str_has_suffix(path, Name->data)) {
++ ComboArchiveType = gtk_combo_box_get_active_text (combo_box);
++ /* Replaces the valid extension present in the filename with the one just selected */
++ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (xa_file_chooser), g_strconcat(g_strndup(path, strlen(path) - strlen(Name->data)), ComboArchiveType, NULL));
++ return;
++ }
++ Name = g_list_previous (Name);
++ }
++
++ /* Appends the extension without taking anything out */
++ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (xa_file_chooser), g_strconcat(path, ComboArchiveType, NULL));
++}
++
+ XArchive *xa_new_archive_dialog (gchar *path, XArchive *archive_open[], gboolean flag)
+ {
+ XArchive *archive = NULL;
+ GtkWidget *xa_file_chooser;
+ GtkWidget *hbox = NULL;
+ GtkWidget *combo_box = NULL;
+- GtkWidget *add_extension_cb = NULL;
+ GtkFileFilter *xa_new_archive_dialog_filter;
+ GtkTooltips *filter_tooltip;
+ GList *Suffix,*Name;
+@@ -112,23 +133,25 @@ XArchive *xa_new_archive_dialog (gchar *
+
+ gtk_box_pack_start (GTK_BOX (hbox), combo_box, TRUE, TRUE, 0);
+
+- add_extension_cb = gtk_check_button_new_with_label (_("Add the archive extension to the filename"));
+- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(add_extension_cb),TRUE);
+- gtk_box_pack_start (GTK_BOX (hbox), add_extension_cb, TRUE, TRUE, 0);
+ gtk_widget_show_all (hbox);
+ gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (xa_file_chooser), hbox);
+-
++ ComboArchiveType = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_box));
++ g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(xa_change_archive_extension), xa_file_chooser);
++
+ if (path != NULL)
+ {
+ basepath = g_path_get_basename (path);
+- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (xa_file_chooser),basepath);
++ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (xa_file_chooser), g_strconcat(basepath, ".", ComboArchiveType, NULL));
+
+ current_dir = g_get_current_dir ();
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (xa_file_chooser),current_dir);
+
+ g_free (basepath);
+ g_free (current_dir);
++ } else {
++ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (xa_file_chooser), g_strconcat(".", ComboArchiveType, NULL));
+ }
++
+ gtk_window_set_modal (GTK_WINDOW (xa_file_chooser),TRUE);
+ if (current_new_directory != NULL)
+ gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER (xa_file_chooser),current_new_directory);
+@@ -138,17 +161,6 @@ XArchive *xa_new_archive_dialog (gchar *
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ my_path = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER (xa_file_chooser) );
+- ComboArchiveType = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_box));
+-
+- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (add_extension_cb)))
+- {
+- if ( ! g_str_has_suffix (my_path,ComboArchiveType))
+- {
+- my_path_ext = g_strconcat (my_path, ".",ComboArchiveType,NULL);
+- g_free (my_path);
+- my_path = my_path_ext;
+- }
+- }
+
+ if (xa_main_window)
+ {