Include a Other Software section in Help file
[geeqie.git] / src / ui_pathsel.c
index f0bc582..c821330 100644 (file)
@@ -1,13 +1,22 @@
 /*
- * (SLIK) SimpLIstic sKin functions
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
  * Author: John Ellis
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -40,6 +49,7 @@
 #include "ui_tabcomp.h"
 #include "ui_tree_edit.h"
 #include "uri_utils.h"
+#include "utilops.h"
 
 
 #define DEST_WIDTH 250
@@ -135,7 +145,8 @@ static gboolean dest_check_filter(const gchar *filter, const gchar *file)
                        }
                if (*f_ptr != '\0' && f_ptr[1] == ' ') f_ptr++; /* skip space immediately after separator */
                f_ptr++;
-               /* FIXME: utf8 */
+               /**
+                * @FIXME utf8 */
                if (l >= i && g_ascii_strncasecmp(file + l - i, strt_ptr, i) == 0) return TRUE;
                }
        return FALSE;
@@ -291,7 +302,7 @@ static void dest_change_dir(Dest_Data *dd, const gchar *path, gboolean retain_na
                new_directory = g_path_get_dirname(full_path);
        else
                new_directory = g_strdup(full_path);
-       
+
        gtk_entry_set_text(GTK_ENTRY(dd->entry), full_path);
 
        dest_populate(dd, new_directory);
@@ -344,7 +355,7 @@ static void dest_dnd_set_data(GtkWidget *view,
 
        list = g_list_append(list, path);
 
-       gchar **uris = uris_from_filelist(list);
+       gchar **uris = uris_from_pathlist(list);
        gboolean ret = gtk_selection_data_set_uris(selection_data, uris);
        if (!ret)
                {
@@ -533,7 +544,7 @@ static void dest_view_delete(Dest_Data *dd, GtkTreeView *view)
 
        text = g_strdup_printf(_("About to delete the file:\n %s"), path);
        generic_dialog_add_message(dd->gd, GTK_STOCK_DIALOG_QUESTION,
-                                  _("Delete file"), text);
+                                  _("Delete file"), text, TRUE);
        g_free(text);
 
        gtk_widget_show(dd->gd->dialog);
@@ -689,6 +700,7 @@ static gboolean dest_keypress_cb(GtkWidget *view, GdkEventKey *event, gpointer d
                {
                case GDK_KEY_F10:
                        if (!(event->state & GDK_CONTROL_MASK)) return FALSE;
+                       /* fall through */
                case GDK_KEY_Menu:
                        dest_view_store_selection(dd, GTK_TREE_VIEW(view));
                        dest_popup_menu(dd, GTK_TREE_VIEW(view), 0, event->time, TRUE);
@@ -724,24 +736,21 @@ static void dest_new_dir_cb(GtkWidget *widget, gpointer data)
 {
        Dest_Data *dd = data;
        gchar *path;
-       gchar *buf;
-       const gchar *tmp;
-       gboolean from_text = FALSE;
+       GtkWidget *dialog_window;
 
-       tmp = gtk_entry_get_text(GTK_ENTRY(dd->entry));
-       if (!isname(tmp))
-               {
-               buf = remove_trailing_slash(tmp);
-               path = g_strdup(buf);
-               g_free(buf);
-               buf = remove_level_from_path(path);
-               from_text = TRUE;
-               }
-       else
+/**
+ * @FIXME on exit from the "new folder" modal dialog, focus returns to the main Geeqie
+ * window rather than the file dialog window. gtk_window_present() does not seem to
+ * function unless the window was previously minimized.
+ */
+       dialog_window = gtk_widget_get_toplevel(widget);
+       gtk_window_iconify(GTK_WINDOW(dialog_window));
+       path = new_folder(GTK_WINDOW(dialog_window), dd->path);
+       gtk_window_present(GTK_WINDOW(dialog_window));
+
+       if (path == NULL)
                {
-               buf = g_build_filename(dd->path, _("New folder"), NULL);
-               path = unique_filename(buf, NULL, " ", FALSE);
-               g_free(buf);
+               return;
                }
 
        if (!mkdir_utf8(path, 0755))
@@ -759,12 +768,6 @@ static void dest_new_dir_cb(GtkWidget *widget, gpointer data)
                GtkListStore *store;
                const gchar *text;
 
-               if (from_text)
-                       {
-                       dest_populate(dd, buf);
-                       g_free(buf);
-                       }
-
                store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dd->d_view)));
 
                text = filename_from_path(path);
@@ -775,10 +778,11 @@ static void dest_new_dir_cb(GtkWidget *widget, gpointer data)
                if (dd->right_click_path) gtk_tree_path_free(dd->right_click_path);
                dd->right_click_path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
 
-               tree_edit_by_path(GTK_TREE_VIEW(dd->d_view), dd->right_click_path, 0, text,
-                                 dest_view_rename_cb, dd);
+               gtk_entry_set_text(GTK_ENTRY(dd->entry), path);
                }
 
+       gtk_widget_grab_focus(GTK_WIDGET(dd->entry));
+
        g_free(path);
 }
 
@@ -1057,6 +1061,7 @@ GtkWidget *path_selection_new_with_files(GtkWidget *entry, const gchar *path,
        if (filter)
                {
                paned = gtk_hpaned_new();
+               DEBUG_NAME(paned);
                gtk_table_attach(GTK_TABLE(table), paned, 0, 3, 1, 2,
                                 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
                gtk_widget_show(paned);
@@ -1136,6 +1141,9 @@ GtkWidget *path_selection_new_with_files(GtkWidget *entry, const gchar *path,
                store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
 
                dd->filter_combo = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store));
+               gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(dd->filter_combo),
+                                                                                                               FILTER_COLUMN_FILTER);
+
                g_object_unref(store);
                gtk_cell_layout_clear(GTK_CELL_LAYOUT(dd->filter_combo));
                renderer = gtk_cell_renderer_text_new();