From 0d007363d7ddebcd173cbc76d4fa6f03daa006ac Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 16 Jun 2008 10:14:57 +0000 Subject: gtk+: remove 2.6.10 git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4660 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- .../gtk+/gtk+-2.6.10/automake-lossage.patch | 24 - .../gtk+/gtk+-2.6.10/combo-arrow-size.patch | 67 - .../gtk+/gtk+-2.6.10/disable-tooltips.patch | 11 - .../gtk+/gtk+-2.6.10/filechooser-default.patch | 4609 -------------------- .../gtk+-2.6.10/filechooser-respect-style.patch | 77 - .../gtk+/gtk+-2.6.10/filesystem-volumes.patch | 182 - .../packages/gtk+/gtk+-2.6.10/gtk+-handhelds.patch | 236 - .../gtk+/gtk+-2.6.10/gtklabel-resize-patch | 10 - .../gtk+/gtk+-2.6.10/hardcoded_libtool.patch | 29 - .../gtk+/gtk+-2.6.10/menu-deactivate.patch | 50 - meta/packages/gtk+/gtk+-2.6.10/no-demos.patch | 10 - meta/packages/gtk+/gtk+-2.6.10/no-xwc.patch | 151 - .../gtk+/gtk+-2.6.10/range-no-redraw.patch | 18 - .../packages/gtk+/gtk+-2.6.10/scroll-timings.patch | 15 - .../gtk+/gtk+-2.6.10/smaller-filechooser.patch | 47 - meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff | 69 - meta/packages/gtk+/gtk+_2.6.10.bb | 54 - 17 files changed, 5659 deletions(-) delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/automake-lossage.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/disable-tooltips.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/filechooser-respect-style.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/filesystem-volumes.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/gtk+-handhelds.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/gtklabel-resize-patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/hardcoded_libtool.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/menu-deactivate.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/no-demos.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/no-xwc.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/range-no-redraw.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/scroll-timings.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/smaller-filechooser.patch delete mode 100644 meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff delete mode 100644 meta/packages/gtk+/gtk+_2.6.10.bb diff --git a/meta/packages/gtk+/gtk+-2.6.10/automake-lossage.patch b/meta/packages/gtk+/gtk+-2.6.10/automake-lossage.patch deleted file mode 100644 index 0d423ddbb9..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/automake-lossage.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- gtk+-2.4.1/docs/tutorial/Makefile.am~ 2003-05-06 22:54:20.000000000 +0100 -+++ gtk+-2.4.1/docs/tutorial/Makefile.am 2004-05-08 12:31:41.000000000 +0100 -@@ -52,21 +52,5 @@ - - dist-hook: html - cp -Rp $(srcdir)/html $(distdir) --else --html: -- echo "***" -- echo "*** Warning: Tutorial not built" -- echo "***" -- --pdf: -- echo "***" -- echo "*** Warning: Tutorial not built" -- echo "***" -- --dist-hook: -- echo "***" -- echo "*** Warning: Tutorial not built" -- echo "*** DISTRIBUTION IS INCOMPLETE" -- echo "***" - endif - diff --git a/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch b/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch deleted file mode 100644 index aecbd4366a..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/combo-arrow-size.patch +++ /dev/null @@ -1,67 +0,0 @@ -Index: gtk/gtkcombobox.c -=================================================================== -RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v -retrieving revision 1.185 -diff -u -p -r1.185 gtkcombobox.c ---- gtk/gtkcombobox.c 12 Oct 2006 13:48:07 -0000 1.185 -+++ gtk/gtkcombobox.c 1 Nov 2006 19:01:09 -0000 -@@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla - FALSE, - GTK_PARAM_READABLE)); - -+ /** -+ * GtkComboBox:arrow-size: -+ * -+ * Sets the minimum size of the arrow in the combo box. Note -+ * that the arrow size is coupled to the font size, so in case -+ * a larger font is used, the arrow will be larger than set -+ * by arrow size. -+ * -+ * Since: 2.12 -+ */ -+ gtk_widget_class_install_style_property (widget_class, -+ g_param_spec_int ("arrow-size", -+ P_("Arrow Size"), -+ P_("The minimum size of the arrow in the combo box"), -+ 0, -+ G_MAXINT, -+ 15, -+ G_PARAM_READABLE)); -+ - g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate)); - } - -@@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget - { - gint width, height; - gint focus_width, focus_pad; -+ gint font_size; -+ gint arrow_size; - GtkRequisition bin_req; -+ PangoContext *context; -+ PangoFontMetrics *metrics; -+ PangoFontDescription *font_desc; - - GtkComboBox *combo_box = GTK_COMBO_BOX (widget); - -@@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget - gtk_widget_style_get (GTK_WIDGET (widget), - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, -+ "arrow-size", &arrow_size, - NULL); -+ -+ font_desc = GTK_BIN (widget)->child->style->font_desc; -+ context = gtk_widget_get_pango_context (widget); -+ metrics = pango_context_get_metrics (context, font_desc, -+ pango_context_get_language (context)); -+ font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + -+ pango_font_metrics_get_descent (metrics)); -+ pango_font_metrics_unref (metrics); -+ -+ arrow_size = MAX (arrow_size, font_size); -+ -+ gtk_widget_set_size_request (combo_box->priv->arrow, arrow_size, arrow_size); - - if (!combo_box->priv->tree_view) - { diff --git a/meta/packages/gtk+/gtk+-2.6.10/disable-tooltips.patch b/meta/packages/gtk+/gtk+-2.6.10/disable-tooltips.patch deleted file mode 100644 index d71d839c3c..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/disable-tooltips.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gtk+-2.4.3/gtk/gtktooltips.c.old 2004-07-04 18:52:04.000000000 +0100 -+++ gtk+-2.4.3/gtk/gtktooltips.c 2004-07-04 18:52:08.000000000 +0100 -@@ -118,7 +118,7 @@ - tooltips->tips_data_list = NULL; - - tooltips->delay = DEFAULT_DELAY; -- tooltips->enabled = TRUE; -+ tooltips->enabled = FALSE; - tooltips->timer_tag = 0; - tooltips->use_sticky_delay = FALSE; - tooltips->last_popdown.tv_sec = -1; diff --git a/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch b/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch deleted file mode 100644 index 46931f7de9..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch +++ /dev/null @@ -1,4609 +0,0 @@ ---- - gtk/gtkfilechooserdefault.c | 3689 ++++---------------------------------------- - 1 file changed, 415 insertions(+), 3274 deletions(-) - -Index: gtk+-2.6.10/gtk/gtkfilechooserdefault.c -=================================================================== ---- gtk+-2.6.10.orig/gtk/gtkfilechooserdefault.c 2007-06-08 09:29:24.000000000 +0100 -+++ gtk+-2.6.10/gtk/gtkfilechooserdefault.c 2007-06-08 11:08:41.000000000 +0100 -@@ -31,7 +31,6 @@ - #include "gtkcombobox.h" - #include "gtkentry.h" - #include "gtkeventbox.h" --#include "gtkexpander.h" - #include "gtkfilechooserdefault.h" - #include "gtkfilechooserembed.h" - #include "gtkfilechooserentry.h" -@@ -50,7 +49,6 @@ - #include "gtkmarshalers.h" - #include "gtkmenuitem.h" - #include "gtkmessagedialog.h" --#include "gtkpathbar.h" - #include "gtkprivate.h" - #include "gtkscrolledwindow.h" - #include "gtkseparatormenuitem.h" -@@ -79,18 +77,23 @@ - #include - #include - -+#define DEFAULT_SPACING 5 -+ -+#define GTK26 - typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass; - - #define GTK_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass)) - #define GTK_IS_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT)) - #define GTK_FILE_CHOOSER_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass)) - -+#ifdef GTK26 - typedef enum { - LOAD_EMPTY, /* There is no model */ - LOAD_PRELOAD, /* Model is loading and a timer is running; model isn't inserted into the tree yet */ - LOAD_LOADING, /* Timeout expired, model is inserted into the tree, but not fully loaded yet */ - LOAD_FINISHED /* Model is fully loaded and inserted into the tree */ - } LoadState; -+#endif - - #define MAX_LOADING_TIME 500 - -@@ -109,63 +112,38 @@ struct _GtkFileChooserDefault - - /* Save mode widgets */ - GtkWidget *save_widgets; -- - GtkWidget *save_file_name_entry; -- GtkWidget *save_folder_label; -- GtkWidget *save_folder_combo; -- GtkWidget *save_expander; - - /* The file browsing widgets */ - GtkWidget *browse_widgets; -- GtkWidget *browse_shortcuts_tree_view; -- GtkWidget *browse_shortcuts_add_button; -- GtkWidget *browse_shortcuts_remove_button; - GtkWidget *browse_files_tree_view; -- GtkWidget *browse_files_popup_menu; -- GtkWidget *browse_files_popup_menu_add_shortcut_item; -- GtkWidget *browse_files_popup_menu_hidden_files_item; - GtkWidget *browse_new_folder_button; -- GtkWidget *browse_path_bar; -- -+ GtkWidget *bar; -+ GtkWidget * up_button; -+ - GtkFileSystemModel *browse_files_model; - -- GtkWidget *filter_combo_hbox; - GtkWidget *filter_combo; -- GtkWidget *preview_box; -- GtkWidget *preview_label; -- GtkWidget *preview_widget; -- GtkWidget *extra_align; -- GtkWidget *extra_widget; -- -- GtkListStore *shortcuts_model; -- GtkTreeModel *shortcuts_filter_model; -- -+ - GtkTreeModelSort *sort_model; - - LoadState load_state; - guint load_timeout_id; - - GSList *pending_select_paths; -- -+ GSList * path_history; -+ - GtkFileFilter *current_filter; - GSList *filters; - - GtkTooltips *tooltips; - -- gboolean has_home; -- gboolean has_desktop; -- - int num_volumes; -- int num_shortcuts; -- int num_bookmarks; - - gulong volumes_changed_id; -- gulong bookmarks_changed_id; - - GtkFilePath *current_volume_path; - GtkFilePath *current_folder; -- GtkFilePath *preview_path; -- char *preview_display_name; - - GtkTreeViewColumn *list_name_column; - GtkCellRenderer *list_name_renderer; -@@ -179,25 +157,15 @@ struct _GtkFileChooserDefault - gulong toplevel_set_focus_id; - GtkWidget *toplevel_last_focus_widget; - --#if 0 -- GdkDragContext *shortcuts_drag_context; -- GSource *shortcuts_drag_outside_idle; --#endif -- -+ gchar * root_folder; -+ - /* Flags */ - - guint local_only : 1; -- guint preview_widget_active : 1; -- guint use_preview_label : 1; - guint select_multiple : 1; - guint show_hidden : 1; - guint list_sort_ascending : 1; - guint changing_folder : 1; -- guint shortcuts_current_folder_active : 1; -- --#if 0 -- guint shortcuts_drag_outside : 1; --#endif - }; - - /* Signal IDs */ -@@ -211,17 +179,6 @@ enum { - - static guint signals[LAST_SIGNAL] = { 0 }; - --/* Column numbers for the shortcuts tree. Keep these in sync with shortcuts_model_create() */ --enum { -- SHORTCUTS_COL_PIXBUF, -- SHORTCUTS_COL_NAME, -- SHORTCUTS_COL_DATA, -- SHORTCUTS_COL_IS_VOLUME, -- SHORTCUTS_COL_REMOVABLE, -- SHORTCUTS_COL_PIXBUF_VISIBLE, -- SHORTCUTS_COL_NUM_COLUMNS --}; -- - /* Column numbers for the file list */ - enum { - FILE_LIST_COL_NAME, -@@ -236,23 +193,6 @@ enum { - TEXT_URI_LIST - }; - --/* Target types for dragging from the shortcuts list */ --static const GtkTargetEntry shortcuts_source_targets[] = { -- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW } --}; -- --static const int num_shortcuts_source_targets = (sizeof (shortcuts_source_targets) -- / sizeof (shortcuts_source_targets[0])); -- --/* Target types for dropping into the shortcuts list */ --static const GtkTargetEntry shortcuts_dest_targets[] = { -- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW }, -- { "text/uri-list", 0, TEXT_URI_LIST } --}; -- --static const int num_shortcuts_dest_targets = (sizeof (shortcuts_dest_targets) -- / sizeof (shortcuts_dest_targets[0])); -- - /* Target types for DnD from the file list */ - static const GtkTargetEntry file_list_source_targets[] = { - { "text/uri-list", 0, TEXT_URI_LIST } -@@ -270,22 +210,10 @@ static const int num_file_list_dest_targ - / sizeof (file_list_dest_targets[0])); - - --/* Interesting places in the shortcuts bar */ --typedef enum { -- SHORTCUTS_HOME, -- SHORTCUTS_DESKTOP, -- SHORTCUTS_VOLUMES, -- SHORTCUTS_SHORTCUTS, -- SHORTCUTS_BOOKMARKS_SEPARATOR, -- SHORTCUTS_BOOKMARKS, -- SHORTCUTS_CURRENT_FOLDER_SEPARATOR, -- SHORTCUTS_CURRENT_FOLDER --} ShortcutsIndex; -- - /* Icon size for if we can't get it from the theme */ - #define FALLBACK_ICON_SIZE 16 - --#define PREVIEW_HBOX_SPACING 12 -+#define LIST_HBOX_SPACING DEFAULT_SPACING - #define NUM_LINES 40 - #define NUM_CHARS 60 - -@@ -348,7 +276,6 @@ static gboolean gtk_file_chooser_d - const GtkFilePath *path, - GError **error); - static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser); -- - static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, - gint *default_width, - gint *default_height); -@@ -365,37 +292,11 @@ static void down_folder_handler (GtkF - static void home_folder_handler (GtkFileChooserDefault *impl); - static void update_appearance (GtkFileChooserDefault *impl); - --static void set_current_filter (GtkFileChooserDefault *impl, -- GtkFileFilter *filter); --static void check_preview_change (GtkFileChooserDefault *impl); -- - static void filter_combo_changed (GtkComboBox *combo_box, - GtkFileChooserDefault *impl); --static void shortcuts_row_activated_cb (GtkTreeView *tree_view, -- GtkTreePath *path, -- GtkTreeViewColumn *column, -- GtkFileChooserDefault *impl); -- --static gboolean shortcuts_key_press_event_cb (GtkWidget *widget, -- GdkEventKey *event, -- GtkFileChooserDefault *impl); -- --static gboolean shortcuts_select_func (GtkTreeSelection *selection, -- GtkTreeModel *model, -- GtkTreePath *path, -- gboolean path_currently_selected, -- gpointer data); --static gboolean shortcuts_get_selected (GtkFileChooserDefault *impl, -- GtkTreeIter *iter); --static void shortcuts_activate_iter (GtkFileChooserDefault *impl, -- GtkTreeIter *iter); --static int shortcuts_get_index (GtkFileChooserDefault *impl, -- ShortcutsIndex where); --static int shortcut_find_position (GtkFileChooserDefault *impl, -- const GtkFilePath *path); -- --static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl); - -+static void set_current_filter (GtkFileChooserDefault *impl, -+ GtkFileFilter *filter); - static gboolean list_select_func (GtkTreeSelection *selection, - GtkTreeModel *model, - GtkTreePath *path, -@@ -414,16 +315,6 @@ static void select_func (GtkFileSystemMo - GtkTreeIter *iter, - gpointer user_data); - --static void path_bar_clicked (GtkPathBar *path_bar, -- GtkFilePath *file_path, -- gboolean child_is_hidden, -- GtkFileChooserDefault *impl); -- --static void add_bookmark_button_clicked_cb (GtkButton *button, -- GtkFileChooserDefault *impl); --static void remove_bookmark_button_clicked_cb (GtkButton *button, -- GtkFileChooserDefault *impl); -- - static void list_icon_data_func (GtkTreeViewColumn *tree_column, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, -@@ -455,36 +346,6 @@ static void browse_files_center_selected - - static GObjectClass *parent_class; - -- -- --/* Drag and drop interface declarations */ -- --typedef struct { -- GtkTreeModelFilter parent; -- -- GtkFileChooserDefault *impl; --} ShortcutsModelFilter; -- --typedef struct { -- GtkTreeModelFilterClass parent_class; --} ShortcutsModelFilterClass; -- --#define SHORTCUTS_MODEL_FILTER_TYPE (_shortcuts_model_filter_get_type ()) --#define SHORTCUTS_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHORTCUTS_MODEL_FILTER_TYPE, ShortcutsModelFilter)) -- --static void shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface); -- --G_DEFINE_TYPE_WITH_CODE (ShortcutsModelFilter, -- _shortcuts_model_filter, -- GTK_TYPE_TREE_MODEL_FILTER, -- G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, -- shortcuts_model_filter_drag_source_iface_init)); -- --static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl, -- GtkTreeModel *child_model, -- GtkTreePath *root); -- -- - - GType - _gtk_file_chooser_default_get_type (void) -@@ -534,6 +395,11 @@ _gtk_file_chooser_default_get_type (void - return file_chooser_default_type; - } - -+enum -+{ -+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER = GTK_FILE_CHOOSER_PROP_LAST + 1, -+}; -+ - static void - gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) - { -@@ -631,6 +497,14 @@ gtk_file_chooser_default_class_init (Gtk - "home-folder", - 0); - -+ g_object_class_install_property (gobject_class, -+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER, -+ g_param_spec_string ("root-folder", -+ P_("File System Root"), -+ P_("Root folder for the file system below which the user should not be able to switch"), -+ NULL, -+ G_PARAM_WRITABLE)); -+ - _gtk_file_chooser_install_properties (gobject_class); - - gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend", -@@ -648,7 +522,6 @@ gtk_file_chooser_default_iface_init (Gtk - iface->select_all = gtk_file_chooser_default_select_all; - iface->unselect_all = gtk_file_chooser_default_unselect_all; - iface->get_paths = gtk_file_chooser_default_get_paths; -- iface->get_preview_path = gtk_file_chooser_default_get_preview_path; - iface->get_file_system = gtk_file_chooser_default_get_file_system; - iface->set_current_folder = gtk_file_chooser_default_set_current_folder; - iface->get_current_folder = gtk_file_chooser_default_get_current_folder; -@@ -656,9 +529,12 @@ gtk_file_chooser_default_iface_init (Gtk - iface->add_filter = gtk_file_chooser_default_add_filter; - iface->remove_filter = gtk_file_chooser_default_remove_filter; - iface->list_filters = gtk_file_chooser_default_list_filters; -+ -+ /* these are only stubs */ -+ iface->get_preview_path = gtk_file_chooser_default_get_preview_path; - iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder; - iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder; -- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders; -+ - } - - static void -@@ -673,71 +549,22 @@ static void - gtk_file_chooser_default_init (GtkFileChooserDefault *impl) - { - impl->local_only = TRUE; -- impl->preview_widget_active = TRUE; -- impl->use_preview_label = TRUE; - impl->select_multiple = FALSE; - impl->show_hidden = FALSE; - impl->icon_size = FALLBACK_ICON_SIZE; - impl->load_state = LOAD_EMPTY; - impl->pending_select_paths = NULL; -- -+ impl->path_history = NULL; -+ - gtk_widget_set_redraw_on_allocate (GTK_WIDGET (impl), TRUE); -- gtk_box_set_spacing (GTK_BOX (impl), 12); -+ gtk_box_set_spacing (GTK_BOX (impl), DEFAULT_SPACING); - - impl->tooltips = gtk_tooltips_new (); - g_object_ref (impl->tooltips); - gtk_object_sink (GTK_OBJECT (impl->tooltips)); --} -- --/* Frees the data columns for the specified iter in the shortcuts model*/ --static void --shortcuts_free_row_data (GtkFileChooserDefault *impl, -- GtkTreeIter *iter) --{ -- gpointer col_data; -- gboolean is_volume; -- -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter, -- SHORTCUTS_COL_DATA, &col_data, -- SHORTCUTS_COL_IS_VOLUME, &is_volume, -- -1); -- if (!col_data) -- return; -- -- if (is_volume) -- { -- GtkFileSystemVolume *volume; -- -- volume = col_data; -- gtk_file_system_volume_free (impl->file_system, volume); -- } -- else -- { -- GtkFilePath *path; -- -- path = col_data; -- gtk_file_path_free (path); -- } --} -- --/* Frees all the data columns in the shortcuts model */ --static void --shortcuts_free (GtkFileChooserDefault *impl) --{ -- GtkTreeIter iter; - -- if (!impl->shortcuts_model) -- return; -- -- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) -- do -- { -- shortcuts_free_row_data (impl, &iter); -- } -- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)); -- -- g_object_unref (impl->shortcuts_model); -- impl->shortcuts_model = NULL; -+ if (!impl->root_folder) -+ impl->root_folder = g_strdup ("/"); - } - - static void -@@ -757,6 +584,7 @@ pending_select_paths_free (GtkFileChoose - impl->pending_select_paths = NULL; - } - -+ - static void - pending_select_paths_add (GtkFileChooserDefault *impl, - const GtkFilePath *path) -@@ -796,20 +624,30 @@ pending_select_paths_store_selection (Gt - } - - static void --gtk_file_chooser_default_finalize (GObject *object) -+path_history_free (GtkFileChooserDefault *impl) - { -- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object); - GSList *l; - -- if (impl->shortcuts_filter_model) -- g_object_unref (impl->shortcuts_filter_model); -+ for (l = impl->path_history; l; l = l->next) -+ { -+ GtkFilePath *path; - -- shortcuts_free (impl); -+ path = l->data; -+ gtk_file_path_free (path); -+ } -+ -+ g_slist_free (impl->path_history); -+ impl->path_history = NULL; -+} -+ -+static void -+gtk_file_chooser_default_finalize (GObject *object) -+{ -+ GSList *l; -+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object); - - g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id); - impl->volumes_changed_id = 0; -- g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id); -- impl->bookmarks_changed_id = 0; - g_object_unref (impl->file_system); - - for (l = impl->filters; l; l = l->next) -@@ -830,11 +668,9 @@ gtk_file_chooser_default_finalize (GObje - if (impl->current_folder) - gtk_file_path_free (impl->current_folder); - -- if (impl->preview_path) -- gtk_file_path_free (impl->preview_path); -- - pending_select_paths_free (impl); -- -+ path_history_free (impl); -+ - load_remove_timer (impl); - - /* Free all the Models we have */ -@@ -844,12 +680,12 @@ gtk_file_chooser_default_finalize (GObje - if (impl->sort_model) - g_object_unref (impl->sort_model); - -- g_free (impl->preview_display_name); -- - g_free (impl->edited_new_text); - - g_object_unref (impl->tooltips); - -+ g_free (impl->root_folder); -+ - G_OBJECT_CLASS (parent_class)->finalize (object); - } - -@@ -930,28 +766,6 @@ error_getting_info_dialog (GtkFileChoose - path, error); - } - --/* Shows an error dialog about not being able to add a bookmark */ --static void --error_adding_bookmark_dialog (GtkFileChooserDefault *impl, -- const GtkFilePath *path, -- GError *error) --{ -- error_dialog (impl, -- _("Could not add a bookmark"), -- path, error); --} -- --/* Shows an error dialog about not being able to remove a bookmark */ --static void --error_removing_bookmark_dialog (GtkFileChooserDefault *impl, -- const GtkFilePath *path, -- GError *error) --{ -- error_dialog (impl, -- _("Could not remove bookmark"), -- path, error); --} -- - /* Shows an error dialog about not being able to create a folder */ - static void - error_creating_folder_dialog (GtkFileChooserDefault *impl, -@@ -963,21 +777,6 @@ error_creating_folder_dialog (GtkFileCho - path, error); - } - --/* Shows an error about not being able to create a folder because a file with -- * the same name is already there. -- */ --static void --error_creating_folder_over_existing_file_dialog (GtkFileChooserDefault *impl, -- const GtkFilePath *path, -- GError *error) --{ -- error_dialog (impl, -- _("The folder could not be created, as a file with the same name " -- "already exists. Try using a different name for the folder, " -- "or rename the file first."), -- path, error); --} -- - /* Shows an error dialog about not being able to create a filename */ - static void - error_building_filename_dialog (GtkFileChooserDefault *impl, -@@ -1007,6 +806,7 @@ change_folder_and_display_error (GtkFile - GError *error; - gboolean result; - GtkFilePath *path_copy; -+ gchar * file_name; - - /* We copy the path because of this case: - * -@@ -1019,6 +819,29 @@ change_folder_and_display_error (GtkFile - - path_copy = gtk_file_path_copy (path); - -+ file_name = gtk_file_system_path_to_filename (impl->file_system, path_copy); -+ -+ /* refuse to change below the root */ -+ if (file_name && impl->root_folder && -+ strcmp (file_name, impl->root_folder) && -+ !strncmp (file_name, impl->root_folder, strlen (file_name))) -+ { -+ -+ gtk_file_path_free (path_copy); -+ g_free (file_name); -+ return 0; -+ } -+ else if (file_name && impl->root_folder && -+ !strcmp (file_name, impl->root_folder)) -+ { -+ gtk_widget_set_sensitive (impl->up_button, FALSE); -+ } -+ else -+ { -+ gtk_widget_set_sensitive (impl->up_button, TRUE); -+ } -+ -+ - error = NULL; - result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, &error); - -@@ -1026,189 +849,11 @@ change_folder_and_display_error (GtkFile - error_changing_folder_dialog (impl, path_copy, error); - - gtk_file_path_free (path_copy); -- -+ g_free (file_name); -+ - return result; - } - --static void --update_preview_widget_visibility (GtkFileChooserDefault *impl) --{ -- if (impl->use_preview_label) -- { -- if (!impl->preview_label) -- { -- impl->preview_label = gtk_label_new (impl->preview_display_name); -- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_label, FALSE, FALSE, 0); -- gtk_box_reorder_child (GTK_BOX (impl->preview_box), impl->preview_label, 0); -- gtk_label_set_ellipsize (GTK_LABEL (impl->preview_label), PANGO_ELLIPSIZE_MIDDLE); -- gtk_widget_show (impl->preview_label); -- } -- } -- else -- { -- if (impl->preview_label) -- { -- gtk_widget_destroy (impl->preview_label); -- impl->preview_label = NULL; -- } -- } -- -- if (impl->preview_widget_active && impl->preview_widget) -- gtk_widget_show (impl->preview_box); -- else -- gtk_widget_hide (impl->preview_box); -- -- g_signal_emit_by_name (impl, "default-size-changed"); --} -- --static void --set_preview_widget (GtkFileChooserDefault *impl, -- GtkWidget *preview_widget) --{ -- if (preview_widget == impl->preview_widget) -- return; -- -- if (impl->preview_widget) -- gtk_container_remove (GTK_CONTAINER (impl->preview_box), -- impl->preview_widget); -- -- impl->preview_widget = preview_widget; -- if (impl->preview_widget) -- { -- gtk_widget_show (impl->preview_widget); -- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_widget, TRUE, TRUE, 0); -- gtk_box_reorder_child (GTK_BOX (impl->preview_box), -- impl->preview_widget, -- (impl->use_preview_label && impl->preview_label) ? 1 : 0); -- } -- -- update_preview_widget_visibility (impl); --} -- --/* Re-reads all the icons for the shortcuts, used when the theme changes */ --static void --shortcuts_reload_icons (GtkFileChooserDefault *impl) --{ -- GtkTreeIter iter; -- -- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) -- return; -- -- do { -- gpointer data; -- gboolean is_volume; -- gboolean pixbuf_visible; -- GdkPixbuf *pixbuf; -- -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, -- SHORTCUTS_COL_DATA, &data, -- SHORTCUTS_COL_IS_VOLUME, &is_volume, -- SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible, -- -1); -- -- if (pixbuf_visible && data) -- { -- if (is_volume) -- { -- GtkFileSystemVolume *volume; -- -- volume = data; -- pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl), -- impl->icon_size, NULL); -- } -- else -- { -- const GtkFilePath *path; -- -- path = data; -- pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), -- impl->icon_size, NULL); -- } -- -- gtk_list_store_set (impl->shortcuts_model, &iter, -- SHORTCUTS_COL_PIXBUF, pixbuf, -- -1); -- if (pixbuf) -- g_object_unref (pixbuf); -- } -- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter)); --} -- --static void --shortcuts_find_folder (GtkFileChooserDefault *impl, -- GtkFilePath *folder) --{ -- GtkTreeSelection *selection; -- int pos; -- GtkTreePath *path; -- -- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); -- -- g_assert (folder != NULL); -- pos = shortcut_find_position (impl, folder); -- if (pos == -1) -- { -- gtk_tree_selection_unselect_all (selection); -- return; -- } -- -- path = gtk_tree_path_new_from_indices (pos, -1); -- gtk_tree_selection_select_path (selection, path); -- gtk_tree_path_free (path); --} -- --/* If a shortcut corresponds to the current folder, selects it */ --static void --shortcuts_find_current_folder (GtkFileChooserDefault *impl) --{ -- shortcuts_find_folder (impl, impl->current_folder); --} -- --/* Convenience function to get the display name and icon info for a path */ --static GtkFileInfo * --get_file_info (GtkFileSystem *file_system, -- const GtkFilePath *path, -- gboolean name_only, -- GError **error) --{ -- GtkFilePath *parent_path; -- GtkFileFolder *parent_folder; -- GtkFileInfo *info; -- GError *tmp = NULL; -- -- parent_path = NULL; -- info = NULL; -- -- if (!gtk_file_system_get_parent (file_system, path, &parent_path, &tmp)) -- goto out; -- -- parent_folder = gtk_file_system_get_folder (file_system, parent_path ? parent_path : path, -- GTK_FILE_INFO_DISPLAY_NAME -- | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER), -- &tmp); -- if (!parent_folder) -- goto out; -- -- info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, &tmp); -- g_object_unref (parent_folder); -- -- out: -- if (parent_path) -- gtk_file_path_free (parent_path); -- -- if (tmp) -- { -- g_set_error (error, -- GTK_FILE_CHOOSER_ERROR, -- GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, -- _("Could not get information about '%s': %s"), -- gtk_file_path_get_string (path), -- tmp->message); -- g_error_free (tmp); -- } -- -- return info; --} - - /* Returns whether a path is a folder */ - static gboolean -@@ -1217,8 +862,11 @@ check_is_folder (GtkFileSystem *fil - GError **error) - { - GtkFileFolder *folder; -- -+#ifdef GTK26 - folder = gtk_file_system_get_folder (file_system, path, 0, error); -+#else -+ folder = gtk_file_system_get_folder (file_system, path, 0, NULL, NULL); -+#endif - if (!folder) - return FALSE; - -@@ -1226,515 +874,6 @@ check_is_folder (GtkFileSystem *fil - return TRUE; - } - --/* Inserts a path in the shortcuts tree, making a copy of it; alternatively, -- * inserts a volume. A position of -1 indicates the end of the tree. -- */ --static gboolean --shortcuts_insert_path (GtkFileChooserDefault *impl, -- int pos, -- gboolean is_volume, -- GtkFileSystemVolume *volume, -- const GtkFilePath *path, -- const char *label, -- gboolean removable, -- GError **error) --{ -- char *label_copy; -- GdkPixbuf *pixbuf; -- gpointer data; -- GtkTreeIter iter; -- -- if (is_volume) -- { -- data = volume; -- label_copy = gtk_file_system_volume_get_display_name (impl->file_system, volume); -- pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl), -- impl->icon_size, NULL); -- } -- else -- { -- if (!check_is_folder (impl->file_system, path, error)) -- return FALSE; -- -- if (label) -- label_copy = g_strdup (label); -- else -- { -- GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error); -- -- if (!info) -- return FALSE; -- -- label_copy = g_strdup (gtk_file_info_get_display_name (info)); -- gtk_file_info_free (info); -- } -- -- data = gtk_file_path_copy (path); -- pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), -- impl->icon_size, NULL); -- } -- -- if (pos == -1) -- gtk_list_store_append (impl->shortcuts_model, &iter); -- else -- gtk_list_store_insert (impl->shortcuts_model, &iter, pos); -- -- gtk_list_store_set (impl->shortcuts_model, &iter, -- SHORTCUTS_COL_PIXBUF, pixbuf, -- SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE, -- SHORTCUTS_COL_NAME, label_copy, -- SHORTCUTS_COL_DATA, data, -- SHORTCUTS_COL_IS_VOLUME, is_volume, -- SHORTCUTS_COL_REMOVABLE, removable, -- -1); -- -- g_free (label_copy); -- -- if (pixbuf) -- g_object_unref (pixbuf); -- -- return TRUE; --} -- --/* Appends an item for the user's home directory to the shortcuts model */ --static void --shortcuts_append_home (GtkFileChooserDefault *impl) --{ -- const char *home; -- GtkFilePath *home_path; -- GError *error; -- -- home = g_get_home_dir (); -- if (home == NULL) -- return; -- -- home_path = gtk_file_system_filename_to_path (impl->file_system, home); -- -- error = NULL; -- impl->has_home = shortcuts_insert_path (impl, -1, FALSE, NULL, home_path, _("Home"), FALSE, &error); -- if (!impl->has_home) -- error_getting_info_dialog (impl, home_path, error); -- -- gtk_file_path_free (home_path); --} -- --/* Appends the ~/Desktop directory to the shortcuts model */ --static void --shortcuts_append_desktop (GtkFileChooserDefault *impl) --{ -- char *name; -- GtkFilePath *path; -- --#ifdef G_OS_WIN32 -- name = _gtk_file_system_win32_get_desktop (); --#else -- const char *home = g_get_home_dir (); -- if (home == NULL) -- return; -- -- name = g_build_filename (home, "Desktop", NULL); --#endif -- -- path = gtk_file_system_filename_to_path (impl->file_system, name); -- g_free (name); -- -- impl->has_desktop = shortcuts_insert_path (impl, -1, FALSE, NULL, path, _("Desktop"), FALSE, NULL); -- /* We do not actually pop up an error dialog if there is no desktop directory -- * because some people may really not want to have one. -- */ -- -- gtk_file_path_free (path); --} -- --/* Appends a list of GtkFilePath to the shortcuts model; returns how many were inserted */ --static int --shortcuts_append_paths (GtkFileChooserDefault *impl, -- GSList *paths) --{ -- int start_row; -- int num_inserted; -- -- /* As there is no separator now, we want to start there. -- */ -- start_row = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR); -- num_inserted = 0; -- -- for (; paths; paths = paths->next) -- { -- GtkFilePath *path; -- GError *error; -- -- path = paths->data; -- error = NULL; -- -- if (impl->local_only && -- !gtk_file_system_path_is_local (impl->file_system, path)) -- continue; -- -- /* NULL GError, but we don't really want to show error boxes here */ -- if (shortcuts_insert_path (impl, start_row + num_inserted, FALSE, NULL, path, NULL, TRUE, NULL)) -- num_inserted++; -- } -- -- return num_inserted; --} -- --/* Returns the index for the corresponding item in the shortcuts bar */ --static int --shortcuts_get_index (GtkFileChooserDefault *impl, -- ShortcutsIndex where) --{ -- int n; -- -- n = 0; -- -- if (where == SHORTCUTS_HOME) -- goto out; -- -- n += impl->has_home ? 1 : 0; -- -- if (where == SHORTCUTS_DESKTOP) -- goto out; -- -- n += impl->has_desktop ? 1 : 0; -- -- if (where == SHORTCUTS_VOLUMES) -- goto out; -- -- n += impl->num_volumes; -- -- if (where == SHORTCUTS_SHORTCUTS) -- goto out; -- -- n += impl->num_shortcuts; -- -- if (where == SHORTCUTS_BOOKMARKS_SEPARATOR) -- goto out; -- -- /* If there are no bookmarks there won't be a separator */ -- n += (impl->num_bookmarks > 0) ? 1 : 0; -- -- if (where == SHORTCUTS_BOOKMARKS) -- goto out; -- -- n += impl->num_bookmarks; -- -- if (where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR) -- goto out; -- -- n += 1; -- -- if (where == SHORTCUTS_CURRENT_FOLDER) -- goto out; -- -- g_assert_not_reached (); -- -- out: -- -- return n; --} -- --/* Removes the specified number of rows from the shortcuts list */ --static void --shortcuts_remove_rows (GtkFileChooserDefault *impl, -- int start_row, -- int n_rows) --{ -- GtkTreePath *path; -- -- path = gtk_tree_path_new_from_indices (start_row, -1); -- -- for (; n_rows; n_rows--) -- { -- GtkTreeIter iter; -- -- if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path)) -- g_assert_not_reached (); -- -- shortcuts_free_row_data (impl, &iter); -- gtk_list_store_remove (impl->shortcuts_model, &iter); -- } -- -- gtk_tree_path_free (path); --} -- --/* Adds all the file system volumes to the shortcuts model */ --static void --shortcuts_add_volumes (GtkFileChooserDefault *impl) --{ -- int start_row; -- GSList *list, *l; -- int n; -- gboolean old_changing_folders; -- -- old_changing_folders = impl->changing_folder; -- impl->changing_folder = TRUE; -- -- start_row = shortcuts_get_index (impl, SHORTCUTS_VOLUMES); -- shortcuts_remove_rows (impl, start_row, impl->num_volumes); -- impl->num_volumes = 0; -- -- list = gtk_file_system_list_volumes (impl->file_system); -- -- n = 0; -- -- for (l = list; l; l = l->next) -- { -- GtkFileSystemVolume *volume; -- -- volume = l->data; -- -- if (impl->local_only) -- { -- GtkFilePath *base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); -- gboolean is_local = gtk_file_system_path_is_local (impl->file_system, base_path); -- gtk_file_path_free (base_path); -- -- if (!is_local) -- { -- gtk_file_system_volume_free (impl->file_system, volume); -- continue; -- } -- } -- -- if (shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, NULL)) -- n++; -- else -- gtk_file_system_volume_free (impl->file_system, volume); -- } -- -- impl->num_volumes = n; -- g_slist_free (list); -- -- if (impl->shortcuts_filter_model) -- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model)); -- -- impl->changing_folder = old_changing_folders; --} -- --/* Inserts a separator node in the shortcuts list */ --static void --shortcuts_insert_separator (GtkFileChooserDefault *impl, -- ShortcutsIndex where) --{ -- GtkTreeIter iter; -- -- g_assert (where == SHORTCUTS_BOOKMARKS_SEPARATOR || where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR); -- -- gtk_list_store_insert (impl->shortcuts_model, &iter, -- shortcuts_get_index (impl, where)); -- gtk_list_store_set (impl->shortcuts_model, &iter, -- SHORTCUTS_COL_PIXBUF, NULL, -- SHORTCUTS_COL_PIXBUF_VISIBLE, FALSE, -- SHORTCUTS_COL_NAME, NULL, -- SHORTCUTS_COL_DATA, NULL, -- -1); --} -- --/* Updates the list of bookmarks */ --static void --shortcuts_add_bookmarks (GtkFileChooserDefault *impl) --{ -- GSList *bookmarks; -- gboolean old_changing_folders; -- GtkTreeIter iter; -- GtkFilePath *list_selected = NULL; -- GtkFilePath *combo_selected = NULL; -- gboolean is_volume; -- gpointer col_data; -- -- old_changing_folders = impl->changing_folder; -- impl->changing_folder = TRUE; -- -- if (shortcuts_get_selected (impl, &iter)) -- { -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), -- &iter, -- SHORTCUTS_COL_DATA, &col_data, -- SHORTCUTS_COL_IS_VOLUME, &is_volume, -- -1); -- -- if (col_data && !is_volume) -- list_selected = gtk_file_path_copy (col_data); -- } -- -- if (impl->save_folder_combo && -- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (impl->save_folder_combo), -- &iter)) -- { -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), -- &iter, -- SHORTCUTS_COL_DATA, &col_data, -- SHORTCUTS_COL_IS_VOLUME, &is_volume, -- -1); -- -- if (col_data && !is_volume) -- combo_selected = gtk_file_path_copy (col_data); -- } -- -- if (impl->num_bookmarks > 0) -- shortcuts_remove_rows (impl, -- shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR), -- impl->num_bookmarks + 1); -- -- bookmarks = gtk_file_system_list_bookmarks (impl->file_system); -- impl->num_bookmarks = shortcuts_append_paths (impl, bookmarks); -- gtk_file_paths_free (bookmarks); -- -- if (impl->num_bookmarks > 0) -- shortcuts_insert_separator (impl, SHORTCUTS_BOOKMARKS_SEPARATOR); -- -- if (impl->shortcuts_filter_model) -- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model)); -- -- if (list_selected) -- { -- shortcuts_find_folder (impl, list_selected); -- gtk_file_path_free (list_selected); -- } -- -- if (combo_selected) -- { -- gint pos; -- -- pos = shortcut_find_position (impl, combo_selected); -- if (pos != -1) -- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), -- pos); -- gtk_file_path_free (combo_selected); -- } -- -- impl->changing_folder = old_changing_folders; --} -- --/* Appends a separator and a row to the shortcuts list for the current folder */ --static void --shortcuts_add_current_folder (GtkFileChooserDefault *impl) --{ -- int pos; -- gboolean success; -- -- g_assert (!impl->shortcuts_current_folder_active); -- -- success = TRUE; -- -- g_assert (impl->current_folder != NULL); -- -- pos = shortcut_find_position (impl, impl->current_folder); -- if (pos == -1) -- { -- GtkFileSystemVolume *volume; -- GtkFilePath *base_path; -- -- /* Separator */ -- -- shortcuts_insert_separator (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); -- -- /* Item */ -- -- pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER); -- -- volume = gtk_file_system_get_volume_for_path (impl->file_system, impl->current_folder); -- if (volume) -- base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); -- else -- base_path = NULL; -- -- if (base_path && -- strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0) -- { -- success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL); -- if (success) -- volume = NULL; -- } -- else -- success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL); -- -- if (volume) -- gtk_file_system_volume_free (impl->file_system, volume); -- -- if (base_path) -- gtk_file_path_free (base_path); -- -- if (!success) -- shortcuts_remove_rows (impl, pos - 1, 1); /* remove the separator */ -- -- impl->shortcuts_current_folder_active = success; -- } -- -- if (success) -- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos); --} -- --/* Updates the current folder row in the shortcuts model */ --static void --shortcuts_update_current_folder (GtkFileChooserDefault *impl) --{ -- int pos; -- -- pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); -- -- if (impl->shortcuts_current_folder_active) -- { -- shortcuts_remove_rows (impl, pos, 2); -- impl->shortcuts_current_folder_active = FALSE; -- } -- -- shortcuts_add_current_folder (impl); --} -- --/* Filter function used for the shortcuts filter model */ --static gboolean --shortcuts_filter_cb (GtkTreeModel *model, -- GtkTreeIter *iter, -- gpointer data) --{ -- GtkFileChooserDefault *impl; -- GtkTreePath *path; -- int pos; -- -- impl = GTK_FILE_CHOOSER_DEFAULT (data); -- -- path = gtk_tree_model_get_path (model, iter); -- if (!path) -- return FALSE; -- -- pos = *gtk_tree_path_get_indices (path); -- gtk_tree_path_free (path); -- -- return (pos < shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR)); --} -- --/* Creates the list model for shortcuts */ --static void --shortcuts_model_create (GtkFileChooserDefault *impl) --{ -- /* Keep this order in sync with the SHORCUTS_COL_* enum values */ -- impl->shortcuts_model = gtk_list_store_new (SHORTCUTS_COL_NUM_COLUMNS, -- GDK_TYPE_PIXBUF, /* pixbuf */ -- G_TYPE_STRING, /* name */ -- G_TYPE_POINTER, /* path or volume */ -- G_TYPE_BOOLEAN, /* is the previous column a volume? */ -- G_TYPE_BOOLEAN, /* removable */ -- G_TYPE_BOOLEAN); /* pixbuf cell visibility */ -- -- if (impl->file_system) -- { -- shortcuts_append_home (impl); -- shortcuts_append_desktop (impl); -- shortcuts_add_volumes (impl); -- shortcuts_add_bookmarks (impl); -- } -- -- impl->shortcuts_filter_model = shortcuts_model_filter_new (impl, -- GTK_TREE_MODEL (impl->shortcuts_model), -- NULL); -- -- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model), -- shortcuts_filter_cb, -- impl, -- NULL); --} - - /* Callback used when the "New Folder" button is clicked */ - static void -@@ -1793,7 +932,11 @@ edited_idle_cb (GtkFileChooserDefault *i - if (file_path) - { - error = NULL; -+#ifdef GTK26 - if (gtk_file_system_create_folder (impl->file_system, file_path, &error)) -+#else -+ if (gtk_file_system_create_folder (impl->file_system, file_path, NULL, NULL)) -+#endif - change_folder_and_display_error (impl, file_path); - else - error_creating_folder_dialog (impl, file_path, error); -@@ -1864,245 +1007,12 @@ static GtkWidget * - filter_create (GtkFileChooserDefault *impl) - { - impl->filter_combo = gtk_combo_box_new_text (); -- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE); -- - g_signal_connect (impl->filter_combo, "changed", - G_CALLBACK (filter_combo_changed), impl); - - return impl->filter_combo; - } - --static GtkWidget * --button_new (GtkFileChooserDefault *impl, -- const char *text, -- const char *stock_id, -- gboolean sensitive, -- gboolean show, -- GCallback callback) --{ -- GtkWidget *button; -- GtkWidget *hbox; -- GtkWidget *widget; -- GtkWidget *align; -- -- button = gtk_button_new (); -- hbox = gtk_hbox_new (FALSE, 2); -- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); -- -- gtk_container_add (GTK_CONTAINER (button), align); -- gtk_container_add (GTK_CONTAINER (align), hbox); -- widget = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); -- -- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); -- -- widget = gtk_label_new_with_mnemonic (text); -- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), GTK_WIDGET (button)); -- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); -- -- gtk_widget_set_sensitive (button, sensitive); -- g_signal_connect (button, "clicked", callback, impl); -- -- gtk_widget_show_all (align); -- -- if (show) -- gtk_widget_show (button); -- -- return button; --} -- --/* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */ --static int --shortcut_find_position (GtkFileChooserDefault *impl, -- const GtkFilePath *path) --{ -- GtkTreeIter iter; -- int i; -- int current_folder_separator_idx; -- -- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) -- return -1; -- -- current_folder_separator_idx = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); -- -- for (i = 0; i < current_folder_separator_idx; i++) -- { -- gpointer col_data; -- gboolean is_volume; -- -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, -- SHORTCUTS_COL_DATA, &col_data, -- SHORTCUTS_COL_IS_VOLUME, &is_volume, -- -1); -- -- if (col_data) -- { -- if (is_volume) -- { -- GtkFileSystemVolume *volume; -- GtkFilePath *base_path; -- gboolean exists; -- -- volume = col_data; -- base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); -- -- exists = strcmp (gtk_file_path_get_string (path), -- gtk_file_path_get_string (base_path)) == 0; -- g_free (base_path); -- -- if (exists) -- return i; -- } -- else -- { -- GtkFilePath *model_path; -- -- model_path = col_data; -- -- if (model_path && gtk_file_path_compare (model_path, path) == 0) -- return i; -- } -- } -- -- gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter); -- } -- -- return -1; --} -- --/* Tries to add a bookmark from a path name */ --static gboolean --shortcuts_add_bookmark_from_path (GtkFileChooserDefault *impl, -- const GtkFilePath *path, -- int pos) --{ -- GError *error; -- -- if (shortcut_find_position (impl, path) != -1) -- return FALSE; -- -- /* FIXME: this check really belongs in gtk_file_system_insert_bookmark. */ -- error = NULL; -- if (!check_is_folder (impl->file_system, path, &error)) -- { -- error_adding_bookmark_dialog (impl, path, error); -- return FALSE; -- } -- -- error = NULL; -- if (!gtk_file_system_insert_bookmark (impl->file_system, path, pos, &error)) -- { -- error_adding_bookmark_dialog (impl, path, error); -- return FALSE; -- } -- -- return TRUE; --} -- --static void --add_bookmark_foreach_cb (GtkTreeModel *model, -- GtkTreePath *path, -- GtkTreeIter *iter, -- gpointer data) --{ -- GtkFileChooserDefault *impl; -- GtkFileSystemModel *fs_model; -- GtkTreeIter child_iter; -- const GtkFilePath *file_path; -- -- impl = (GtkFileChooserDefault *) data; -- -- fs_model = impl->browse_files_model; -- gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, iter); -- -- file_path = _gtk_file_system_model_get_path (fs_model, &child_iter); -- shortcuts_add_bookmark_from_path (impl, file_path, -1); --} -- --/* Adds a bookmark from the currently selected item in the file list */ --static void --bookmarks_add_selected_folder (GtkFileChooserDefault *impl) --{ -- GtkTreeSelection *selection; -- -- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); -- -- if (gtk_tree_selection_count_selected_rows (selection) == 0) -- shortcuts_add_bookmark_from_path (impl, impl->current_folder, -1); -- else -- gtk_tree_selection_selected_foreach (selection, -- add_bookmark_foreach_cb, -- impl); --} -- --/* Callback used when the "Add bookmark" button is clicked */ --static void --add_bookmark_button_clicked_cb (GtkButton *button, -- GtkFileChooserDefault *impl) --{ -- bookmarks_add_selected_folder (impl); --} -- --/* Returns TRUE plus an iter in the shortcuts_model if a row is selected; -- * returns FALSE if no shortcut is selected. -- */ --static gboolean --shortcuts_get_selected (GtkFileChooserDefault *impl, -- GtkTreeIter *iter) --{ -- GtkTreeSelection *selection; -- GtkTreeIter parent_iter; -- -- if (!impl->browse_shortcuts_tree_view) -- return FALSE; -- -- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); -- -- if (!gtk_tree_selection_get_selected (selection, NULL, &parent_iter)) -- return FALSE; -- -- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model), -- iter, -- &parent_iter); -- return TRUE; --} -- --/* Removes the selected bookmarks */ --static void --remove_selected_bookmarks (GtkFileChooserDefault *impl) --{ -- GtkTreeIter iter; -- gpointer col_data; -- GtkFilePath *path; -- gboolean removable; -- GError *error; -- -- if (!shortcuts_get_selected (impl, &iter)) -- return; -- -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, -- SHORTCUTS_COL_DATA, &col_data, -- SHORTCUTS_COL_REMOVABLE, &removable, -- -1); -- g_assert (col_data != NULL); -- -- if (!removable) -- return; -- -- path = col_data; -- -- error = NULL; -- if (!gtk_file_system_remove_bookmark (impl->file_system, path, &error)) -- error_removing_bookmark_dialog (impl, path, error); --} -- --/* Callback used when the "Remove bookmark" button is clicked */ --static void --remove_bookmark_button_clicked_cb (GtkButton *button, -- GtkFileChooserDefault *impl) --{ -- remove_selected_bookmarks (impl); --} -- - struct selection_check_closure { - GtkFileChooserDefault *impl; - int num_selected; -@@ -2171,864 +1081,13 @@ struct get_selected_path_closure { - const GtkFilePath *path; - }; - --static void --get_selected_path_foreach_cb (GtkTreeModel *model, -- GtkTreePath *path, -- GtkTreeIter *iter, -- gpointer data) --{ -- struct get_selected_path_closure *closure; -- GtkTreeIter child_iter; -- -- closure = data; -- -- gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter); -- closure->path = _gtk_file_system_model_get_path (closure->impl->browse_files_model, &child_iter); --} -- - /* Returns a selected path from the file list */ --static const GtkFilePath * --get_selected_path (GtkFileChooserDefault *impl) --{ -- struct get_selected_path_closure closure; -- GtkTreeSelection *selection; -- -- closure.impl = impl; -- closure.path = NULL; -- -- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); -- gtk_tree_selection_selected_foreach (selection, -- get_selected_path_foreach_cb, -- &closure); -- -- return closure.path; --} - - typedef struct { - GtkFileChooserDefault *impl; - gchar *tip; - } UpdateTooltipData; - --static void --update_tooltip (GtkTreeModel *model, -- GtkTreePath *path, -- GtkTreeIter *iter, -- gpointer data) --{ -- UpdateTooltipData *udata = data; -- GtkTreeIter child_iter; -- const GtkFileInfo *info; -- -- if (udata->tip == NULL) -- { -- gtk_tree_model_sort_convert_iter_to_child_iter (udata->impl->sort_model, -- &child_iter, -- iter); -- -- info = _gtk_file_system_model_get_info (udata->impl->browse_files_model, &child_iter); -- udata->tip = g_strdup_printf (_("Add the folder '%s' to the bookmarks"), -- gtk_file_info_get_display_name (info)); -- } --} -- -- --/* Sensitize the "add bookmark" button if all the selected items are folders, or -- * if there are no selected items *and* the current folder is not in the -- * bookmarks list. De-sensitize the button otherwise. -- */ --static void --bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl) --{ -- gint num_selected; -- gboolean all_folders; -- gboolean active; -- gchar *tip; -- -- selection_check (impl, &num_selected, NULL, &all_folders); -- -- if (num_selected == 0) -- active = (impl->current_folder != NULL) && (shortcut_find_position (impl, impl->current_folder) == -1); -- else if (num_selected == 1) -- { -- const GtkFilePath *path; -- -- path = get_selected_path (impl); -- active = all_folders && (shortcut_find_position (impl, path) == -1); -- } -- else -- active = all_folders; -- -- gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, active); -- -- if (impl->browse_files_popup_menu_add_shortcut_item) -- gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item, -- (num_selected == 0) ? FALSE : active); -- -- if (active) -- { -- if (num_selected == 0) -- tip = g_strdup_printf (_("Add the current folder to the bookmarks")); -- else if (num_selected > 1) -- tip = g_strdup_printf (_("Add the selected folders to the bookmarks")); -- else -- { -- GtkTreeSelection *selection; -- UpdateTooltipData data; -- -- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); -- data.impl = impl; -- data.tip = NULL; -- gtk_tree_selection_selected_foreach (selection, update_tooltip, &data); -- tip = data.tip; -- -- } -- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button, tip, NULL); -- g_free (tip); -- } --} -- --/* Sets the sensitivity of the "remove bookmark" button depending on whether a -- * bookmark row is selected in the shortcuts tree. -- */ --static void --bookmarks_check_remove_sensitivity (GtkFileChooserDefault *impl) --{ -- GtkTreeIter iter; -- gboolean removable = FALSE; -- gchar *name = NULL; -- -- if (shortcuts_get_selected (impl, &iter)) -- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, -- SHORTCUTS_COL_REMOVABLE, &removable, -- SHORTCUTS_COL_NAME, &name, -- -1); -- -- gtk_widget_set_sensitive (impl->browse_shortcuts_remove_button, removable); -- -- if (removable) -- { -- gchar *tip; -- -- tip = g_strdup_printf (_("Remove the bookmark '%s'"), name); -- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button, -- tip, NULL); -- g_free (tip); -- } -- -- g_free (name); --} -- --/* GtkWidget::drag-begin handler for the shortcuts list. */ --static void --shortcuts_drag_begin_cb (GtkWidget *widget, -- GdkDragContext *context, -- GtkFileChooserDefault *impl) --{ --#if 0 -- impl->shortcuts_drag_context = g_object_ref (context); --#endif --} -- --#if 0 --/* Removes the idle handler for outside drags */ --static void --shortcuts_cancel_drag_outside_idle (GtkFileChooserDefault *impl) --{ -- if (!impl->shortcuts_drag_outside_idle) -- return; -- -- g_source_destroy (impl->shortcuts_drag_outside_idle); -- impl->shortcuts_drag_outside_idle = NULL; --} --#endif -- --/* GtkWidget::drag-end handler for the shortcuts list. */ --static void --shortcuts_drag_end_cb (GtkWidget *widget, -- GdkDragContext *context, -- GtkFileChooserDefault *impl) --{ --#if 0 -- g_object_unref (impl->shortcuts_drag_context); -- -- shortcuts_cancel_drag_outside_idle (impl); -- -- if (!impl->shortcuts_drag_outside) -- return; -- -- gtk_button_clicked (GTK_BUTTON (impl->browse_shortcuts_remove_button)); -- -- impl->shortcuts_drag_outside = FALSE; --#endif --} -- --/* GtkWidget::drag-data-delete handler for the shortcuts list. */ --static void --shortcuts_drag_data_delete_cb (GtkWidget *widget, -- GdkDragContext *context, -- GtkFileChooserDefault *impl) --{ -- g_signal_stop_emission_by_name (widget, "drag-data-delete"); --} -- --#if 0 --/* Creates a suitable drag cursor to indicate that the selected bookmark will be -- * deleted or not. -- */ --static void --shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl, -- gboolean delete) --{ -- GtkTreeView *tree_view; -- GtkTreeIter iter; -- GtkTreePath *path; -- GdkPixmap *row_pixmap; -- GdkBitmap *mask; -- int row_pixmap_y; -- int cell_y; -- -- tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view); -- -- /* Find the selected path and get its drag pixmap */ -- -- if (!shortcuts_get_selected (impl, &iter)) -- g_assert_not_reached (); -- -- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter); -- -- row_pixmap = gtk_tree_view_create_row_drag_icon (tree_view, path); -- gtk_tree_path_free (path); -- -- mask = NULL; -- row_pixmap_y = 0; -- -- if (delete) -- { -- GdkPixbuf *pixbuf; -- -- pixbuf = gtk_widget_render_icon (impl->browse_shortcuts_tree_view, -- GTK_STOCK_DELETE, -- GTK_ICON_SIZE_DND, -- NULL); -- if (pixbuf) -- { -- GdkPixmap *composite; -- int row_pixmap_width, row_pixmap_height; -- int pixbuf_width, pixbuf_height; -- int composite_width, composite_height; -- int pixbuf_x, pixbuf_y; -- GdkGC *gc, *mask_gc; -- GdkColor color; -- GdkBitmap *pixbuf_mask; -- -- /* Create pixmap and mask for composite image */ -- -- gdk_drawable_get_size (row_pixmap, &row_pixmap_width, &row_pixmap_height); -- pixbuf_width = gdk_pixbuf_get_width (pixbuf); -- pixbuf_height = gdk_pixbuf_get_height (pixbuf); -- -- composite_width = MAX (row_pixmap_width, pixbuf_width); -- composite_height = MAX (row_pixmap_height, pixbuf_height); -- -- row_pixmap_y = (composite_height - row_pixmap_height) / 2; -- -- if (gtk_widget_get_direction (impl->browse_shortcuts_tree_view) == GTK_TEXT_DIR_RTL) -- pixbuf_x = 0; -- else -- pixbuf_x = composite_width - pixbuf_width; -- -- pixbuf_y = (composite_height - pixbuf_height) / 2; -- -- composite = gdk_pixmap_new (row_pixmap, composite_width, composite_height, -1); -- gc = gdk_gc_new (composite); -- -- mask = gdk_pixmap_new (row_pixmap, composite_width, composite_height, 1); -- mask_gc = gdk_gc_new (mask); -- color.pixel = 0; -- gdk_gc_set_foreground (mask_gc, &color); -- gdk_draw_rectangle (mask, mask_gc, TRUE, 0, 0, composite_width, composite_height); -- -- color.red = 0xffff; -- color.green = 0xffff; -- color.blue = 0xffff; -- gdk_gc_set_rgb_fg_color (gc, &color); -- gdk_draw_rectangle (composite, gc, TRUE, 0, 0, composite_width, composite_height); -- -- /* Composite the row pixmap and the pixbuf */ -- -- gdk_pixbuf_render_pixmap_and_mask_for_colormap -- (pixbuf, -- gtk_widget_get_colormap (impl->browse_shortcuts_tree_view), -- NULL, &pixbuf_mask, 128); -- gdk_draw_drawable (mask, mask_gc, pixbuf_mask, -- 0, 0, -- pixbuf_x, pixbuf_y, -- pixbuf_width, pixbuf_height); -- g_object_unref (pixbuf_mask); -- -- gdk_draw_drawable (composite, gc, row_pixmap, -- 0, 0, -- 0, row_pixmap_y, -- row_pixmap_width, row_pixmap_height); -- color.pixel = 1; -- gdk_gc_set_foreground (mask_gc, &color); -- gdk_draw_rectangle (mask, mask_gc, TRUE, 0, row_pixmap_y, row_pixmap_width, row_pixmap_height); -- -- gdk_draw_pixbuf (composite, gc, pixbuf, -- 0, 0, -- pixbuf_x, pixbuf_y, -- pixbuf_width, pixbuf_height, -- GDK_RGB_DITHER_MAX, -- 0, 0); -- -- g_object_unref (pixbuf); -- g_object_unref (row_pixmap); -- -- row_pixmap = composite; -- } -- } -- -- /* The hotspot offsets here are copied from gtk_tree_view_drag_begin(), ugh */ -- -- gtk_tree_view_get_path_at_pos (tree_view, -- tree_view->priv->press_start_x, -- tree_view->priv->press_start_y, -- NULL, -- NULL, -- NULL, -- &cell_y); -- -- gtk_drag_set_icon_pixmap (impl->shortcuts_drag_context, -- gdk_drawable_get_colormap (row_pixmap), -- row_pixmap, -- mask, -- tree_view->priv->press_start_x + 1, -- row_pixmap_y + cell_y + 1); -- -- g_object_unref (row_pixmap); -- if (mask) -- g_object_unref (mask); --} -- --/* We set the delete cursor and the shortcuts_drag_outside flag in an idle -- * handler so that we can tell apart the drag_leave event that comes right -- * before a drag_drop, from a normal drag_leave. We don't want to set the -- * cursor nor the flag in the latter case. -- */ --static gboolean --shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl) --{ -- GDK_THREADS_ENTER (); -- -- shortcuts_drag_set_delete_cursor (impl, TRUE); -- impl->shortcuts_drag_outside = TRUE; -- -- shortcuts_cancel_drag_outside_idle (impl); -- -- GDK_THREADS_LEAVE (); -- -- return FALSE; --} --#endif -- --/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the -- * drop position. -- */ --static void --shortcuts_drag_leave_cb (GtkWidget *widget, --