diff options
author | Ross Burton <ross@openedhand.com> | 2008-06-16 10:14:57 +0000 |
---|---|---|
committer | Ross Burton <ross@openedhand.com> | 2008-06-16 10:14:57 +0000 |
commit | 0d007363d7ddebcd173cbc76d4fa6f03daa006ac (patch) | |
tree | fb6868cbe015cdad05e3c10daa0cc17098ad1667 /meta/packages | |
parent | 0a2c4cd9bdf972ce959d68150c175dfddf34eef2 (diff) | |
download | poky-0d007363d7ddebcd173cbc76d4fa6f03daa006ac.tar.gz |
gtk+: remove 2.6.10
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4660 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages')
17 files changed, 0 insertions, 5659 deletions
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 @@ | |||
1 | --- gtk+-2.4.1/docs/tutorial/Makefile.am~ 2003-05-06 22:54:20.000000000 +0100 | ||
2 | +++ gtk+-2.4.1/docs/tutorial/Makefile.am 2004-05-08 12:31:41.000000000 +0100 | ||
3 | @@ -52,21 +52,5 @@ | ||
4 | |||
5 | dist-hook: html | ||
6 | cp -Rp $(srcdir)/html $(distdir) | ||
7 | -else | ||
8 | -html: | ||
9 | - echo "***" | ||
10 | - echo "*** Warning: Tutorial not built" | ||
11 | - echo "***" | ||
12 | - | ||
13 | -pdf: | ||
14 | - echo "***" | ||
15 | - echo "*** Warning: Tutorial not built" | ||
16 | - echo "***" | ||
17 | - | ||
18 | -dist-hook: | ||
19 | - echo "***" | ||
20 | - echo "*** Warning: Tutorial not built" | ||
21 | - echo "*** DISTRIBUTION IS INCOMPLETE" | ||
22 | - echo "***" | ||
23 | endif | ||
24 | |||
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 @@ | |||
1 | Index: gtk/gtkcombobox.c | ||
2 | =================================================================== | ||
3 | RCS file: /cvs/gnome/gtk+/gtk/gtkcombobox.c,v | ||
4 | retrieving revision 1.185 | ||
5 | diff -u -p -r1.185 gtkcombobox.c | ||
6 | --- gtk/gtkcombobox.c 12 Oct 2006 13:48:07 -0000 1.185 | ||
7 | +++ gtk/gtkcombobox.c 1 Nov 2006 19:01:09 -0000 | ||
8 | @@ -756,6 +756,25 @@ gtk_combo_box_class_init (GtkComboBoxCla | ||
9 | FALSE, | ||
10 | GTK_PARAM_READABLE)); | ||
11 | |||
12 | + /** | ||
13 | + * GtkComboBox:arrow-size: | ||
14 | + * | ||
15 | + * Sets the minimum size of the arrow in the combo box. Note | ||
16 | + * that the arrow size is coupled to the font size, so in case | ||
17 | + * a larger font is used, the arrow will be larger than set | ||
18 | + * by arrow size. | ||
19 | + * | ||
20 | + * Since: 2.12 | ||
21 | + */ | ||
22 | + gtk_widget_class_install_style_property (widget_class, | ||
23 | + g_param_spec_int ("arrow-size", | ||
24 | + P_("Arrow Size"), | ||
25 | + P_("The minimum size of the arrow in the combo box"), | ||
26 | + 0, | ||
27 | + G_MAXINT, | ||
28 | + 15, | ||
29 | + G_PARAM_READABLE)); | ||
30 | + | ||
31 | g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate)); | ||
32 | } | ||
33 | |||
34 | @@ -1897,7 +1916,12 @@ gtk_combo_box_size_request (GtkWidget | ||
35 | { | ||
36 | gint width, height; | ||
37 | gint focus_width, focus_pad; | ||
38 | + gint font_size; | ||
39 | + gint arrow_size; | ||
40 | GtkRequisition bin_req; | ||
41 | + PangoContext *context; | ||
42 | + PangoFontMetrics *metrics; | ||
43 | + PangoFontDescription *font_desc; | ||
44 | |||
45 | GtkComboBox *combo_box = GTK_COMBO_BOX (widget); | ||
46 | |||
47 | @@ -1910,7 +1934,20 @@ gtk_combo_box_size_request (GtkWidget | ||
48 | gtk_widget_style_get (GTK_WIDGET (widget), | ||
49 | "focus-line-width", &focus_width, | ||
50 | "focus-padding", &focus_pad, | ||
51 | + "arrow-size", &arrow_size, | ||
52 | NULL); | ||
53 | + | ||
54 | + font_desc = GTK_BIN (widget)->child->style->font_desc; | ||
55 | + context = gtk_widget_get_pango_context (widget); | ||
56 | + metrics = pango_context_get_metrics (context, font_desc, | ||
57 | + pango_context_get_language (context)); | ||
58 | + font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + | ||
59 | + pango_font_metrics_get_descent (metrics)); | ||
60 | + pango_font_metrics_unref (metrics); | ||
61 | + | ||
62 | + arrow_size = MAX (arrow_size, font_size); | ||
63 | + | ||
64 | + gtk_widget_set_size_request (combo_box->priv->arrow, arrow_size, arrow_size); | ||
65 | |||
66 | if (!combo_box->priv->tree_view) | ||
67 | { | ||
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 @@ | |||
1 | --- gtk+-2.4.3/gtk/gtktooltips.c.old 2004-07-04 18:52:04.000000000 +0100 | ||
2 | +++ gtk+-2.4.3/gtk/gtktooltips.c 2004-07-04 18:52:08.000000000 +0100 | ||
3 | @@ -118,7 +118,7 @@ | ||
4 | tooltips->tips_data_list = NULL; | ||
5 | |||
6 | tooltips->delay = DEFAULT_DELAY; | ||
7 | - tooltips->enabled = TRUE; | ||
8 | + tooltips->enabled = FALSE; | ||
9 | tooltips->timer_tag = 0; | ||
10 | tooltips->use_sticky_delay = FALSE; | ||
11 | 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 @@ | |||
1 | --- | ||
2 | gtk/gtkfilechooserdefault.c | 3689 ++++---------------------------------------- | ||
3 | 1 file changed, 415 insertions(+), 3274 deletions(-) | ||
4 | |||
5 | Index: gtk+-2.6.10/gtk/gtkfilechooserdefault.c | ||
6 | =================================================================== | ||
7 | --- gtk+-2.6.10.orig/gtk/gtkfilechooserdefault.c 2007-06-08 09:29:24.000000000 +0100 | ||
8 | +++ gtk+-2.6.10/gtk/gtkfilechooserdefault.c 2007-06-08 11:08:41.000000000 +0100 | ||
9 | @@ -31,7 +31,6 @@ | ||
10 | #include "gtkcombobox.h" | ||
11 | #include "gtkentry.h" | ||
12 | #include "gtkeventbox.h" | ||
13 | -#include "gtkexpander.h" | ||
14 | #include "gtkfilechooserdefault.h" | ||
15 | #include "gtkfilechooserembed.h" | ||
16 | #include "gtkfilechooserentry.h" | ||
17 | @@ -50,7 +49,6 @@ | ||
18 | #include "gtkmarshalers.h" | ||
19 | #include "gtkmenuitem.h" | ||
20 | #include "gtkmessagedialog.h" | ||
21 | -#include "gtkpathbar.h" | ||
22 | #include "gtkprivate.h" | ||
23 | #include "gtkscrolledwindow.h" | ||
24 | #include "gtkseparatormenuitem.h" | ||
25 | @@ -79,18 +77,23 @@ | ||
26 | #include <string.h> | ||
27 | #include <time.h> | ||
28 | |||
29 | +#define DEFAULT_SPACING 5 | ||
30 | + | ||
31 | +#define GTK26 | ||
32 | typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass; | ||
33 | |||
34 | #define GTK_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass)) | ||
35 | #define GTK_IS_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT)) | ||
36 | #define GTK_FILE_CHOOSER_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass)) | ||
37 | |||
38 | +#ifdef GTK26 | ||
39 | typedef enum { | ||
40 | LOAD_EMPTY, /* There is no model */ | ||
41 | LOAD_PRELOAD, /* Model is loading and a timer is running; model isn't inserted into the tree yet */ | ||
42 | LOAD_LOADING, /* Timeout expired, model is inserted into the tree, but not fully loaded yet */ | ||
43 | LOAD_FINISHED /* Model is fully loaded and inserted into the tree */ | ||
44 | } LoadState; | ||
45 | +#endif | ||
46 | |||
47 | #define MAX_LOADING_TIME 500 | ||
48 | |||
49 | @@ -109,63 +112,38 @@ struct _GtkFileChooserDefault | ||
50 | |||
51 | /* Save mode widgets */ | ||
52 | GtkWidget *save_widgets; | ||
53 | - | ||
54 | GtkWidget *save_file_name_entry; | ||
55 | - GtkWidget *save_folder_label; | ||
56 | - GtkWidget *save_folder_combo; | ||
57 | - GtkWidget *save_expander; | ||
58 | |||
59 | /* The file browsing widgets */ | ||
60 | GtkWidget *browse_widgets; | ||
61 | - GtkWidget *browse_shortcuts_tree_view; | ||
62 | - GtkWidget *browse_shortcuts_add_button; | ||
63 | - GtkWidget *browse_shortcuts_remove_button; | ||
64 | GtkWidget *browse_files_tree_view; | ||
65 | - GtkWidget *browse_files_popup_menu; | ||
66 | - GtkWidget *browse_files_popup_menu_add_shortcut_item; | ||
67 | - GtkWidget *browse_files_popup_menu_hidden_files_item; | ||
68 | GtkWidget *browse_new_folder_button; | ||
69 | - GtkWidget *browse_path_bar; | ||
70 | - | ||
71 | + GtkWidget *bar; | ||
72 | + GtkWidget * up_button; | ||
73 | + | ||
74 | GtkFileSystemModel *browse_files_model; | ||
75 | |||
76 | - GtkWidget *filter_combo_hbox; | ||
77 | GtkWidget *filter_combo; | ||
78 | - GtkWidget *preview_box; | ||
79 | - GtkWidget *preview_label; | ||
80 | - GtkWidget *preview_widget; | ||
81 | - GtkWidget *extra_align; | ||
82 | - GtkWidget *extra_widget; | ||
83 | - | ||
84 | - GtkListStore *shortcuts_model; | ||
85 | - GtkTreeModel *shortcuts_filter_model; | ||
86 | - | ||
87 | + | ||
88 | GtkTreeModelSort *sort_model; | ||
89 | |||
90 | LoadState load_state; | ||
91 | guint load_timeout_id; | ||
92 | |||
93 | GSList *pending_select_paths; | ||
94 | - | ||
95 | + GSList * path_history; | ||
96 | + | ||
97 | GtkFileFilter *current_filter; | ||
98 | GSList *filters; | ||
99 | |||
100 | GtkTooltips *tooltips; | ||
101 | |||
102 | - gboolean has_home; | ||
103 | - gboolean has_desktop; | ||
104 | - | ||
105 | int num_volumes; | ||
106 | - int num_shortcuts; | ||
107 | - int num_bookmarks; | ||
108 | |||
109 | gulong volumes_changed_id; | ||
110 | - gulong bookmarks_changed_id; | ||
111 | |||
112 | GtkFilePath *current_volume_path; | ||
113 | GtkFilePath *current_folder; | ||
114 | - GtkFilePath *preview_path; | ||
115 | - char *preview_display_name; | ||
116 | |||
117 | GtkTreeViewColumn *list_name_column; | ||
118 | GtkCellRenderer *list_name_renderer; | ||
119 | @@ -179,25 +157,15 @@ struct _GtkFileChooserDefault | ||
120 | gulong toplevel_set_focus_id; | ||
121 | GtkWidget *toplevel_last_focus_widget; | ||
122 | |||
123 | -#if 0 | ||
124 | - GdkDragContext *shortcuts_drag_context; | ||
125 | - GSource *shortcuts_drag_outside_idle; | ||
126 | -#endif | ||
127 | - | ||
128 | + gchar * root_folder; | ||
129 | + | ||
130 | /* Flags */ | ||
131 | |||
132 | guint local_only : 1; | ||
133 | - guint preview_widget_active : 1; | ||
134 | - guint use_preview_label : 1; | ||
135 | guint select_multiple : 1; | ||
136 | guint show_hidden : 1; | ||
137 | guint list_sort_ascending : 1; | ||
138 | guint changing_folder : 1; | ||
139 | - guint shortcuts_current_folder_active : 1; | ||
140 | - | ||
141 | -#if 0 | ||
142 | - guint shortcuts_drag_outside : 1; | ||
143 | -#endif | ||
144 | }; | ||
145 | |||
146 | /* Signal IDs */ | ||
147 | @@ -211,17 +179,6 @@ enum { | ||
148 | |||
149 | static guint signals[LAST_SIGNAL] = { 0 }; | ||
150 | |||
151 | -/* Column numbers for the shortcuts tree. Keep these in sync with shortcuts_model_create() */ | ||
152 | -enum { | ||
153 | - SHORTCUTS_COL_PIXBUF, | ||
154 | - SHORTCUTS_COL_NAME, | ||
155 | - SHORTCUTS_COL_DATA, | ||
156 | - SHORTCUTS_COL_IS_VOLUME, | ||
157 | - SHORTCUTS_COL_REMOVABLE, | ||
158 | - SHORTCUTS_COL_PIXBUF_VISIBLE, | ||
159 | - SHORTCUTS_COL_NUM_COLUMNS | ||
160 | -}; | ||
161 | - | ||
162 | /* Column numbers for the file list */ | ||
163 | enum { | ||
164 | FILE_LIST_COL_NAME, | ||
165 | @@ -236,23 +193,6 @@ enum { | ||
166 | TEXT_URI_LIST | ||
167 | }; | ||
168 | |||
169 | -/* Target types for dragging from the shortcuts list */ | ||
170 | -static const GtkTargetEntry shortcuts_source_targets[] = { | ||
171 | - { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW } | ||
172 | -}; | ||
173 | - | ||
174 | -static const int num_shortcuts_source_targets = (sizeof (shortcuts_source_targets) | ||
175 | - / sizeof (shortcuts_source_targets[0])); | ||
176 | - | ||
177 | -/* Target types for dropping into the shortcuts list */ | ||
178 | -static const GtkTargetEntry shortcuts_dest_targets[] = { | ||
179 | - { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW }, | ||
180 | - { "text/uri-list", 0, TEXT_URI_LIST } | ||
181 | -}; | ||
182 | - | ||
183 | -static const int num_shortcuts_dest_targets = (sizeof (shortcuts_dest_targets) | ||
184 | - / sizeof (shortcuts_dest_targets[0])); | ||
185 | - | ||
186 | /* Target types for DnD from the file list */ | ||
187 | static const GtkTargetEntry file_list_source_targets[] = { | ||
188 | { "text/uri-list", 0, TEXT_URI_LIST } | ||
189 | @@ -270,22 +210,10 @@ static const int num_file_list_dest_targ | ||
190 | / sizeof (file_list_dest_targets[0])); | ||
191 | |||
192 | |||
193 | -/* Interesting places in the shortcuts bar */ | ||
194 | -typedef enum { | ||
195 | - SHORTCUTS_HOME, | ||
196 | - SHORTCUTS_DESKTOP, | ||
197 | - SHORTCUTS_VOLUMES, | ||
198 | - SHORTCUTS_SHORTCUTS, | ||
199 | - SHORTCUTS_BOOKMARKS_SEPARATOR, | ||
200 | - SHORTCUTS_BOOKMARKS, | ||
201 | - SHORTCUTS_CURRENT_FOLDER_SEPARATOR, | ||
202 | - SHORTCUTS_CURRENT_FOLDER | ||
203 | -} ShortcutsIndex; | ||
204 | - | ||
205 | /* Icon size for if we can't get it from the theme */ | ||
206 | #define FALLBACK_ICON_SIZE 16 | ||
207 | |||
208 | -#define PREVIEW_HBOX_SPACING 12 | ||
209 | +#define LIST_HBOX_SPACING DEFAULT_SPACING | ||
210 | #define NUM_LINES 40 | ||
211 | #define NUM_CHARS 60 | ||
212 | |||
213 | @@ -348,7 +276,6 @@ static gboolean gtk_file_chooser_d | ||
214 | const GtkFilePath *path, | ||
215 | GError **error); | ||
216 | static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser); | ||
217 | - | ||
218 | static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, | ||
219 | gint *default_width, | ||
220 | gint *default_height); | ||
221 | @@ -365,37 +292,11 @@ static void down_folder_handler (GtkF | ||
222 | static void home_folder_handler (GtkFileChooserDefault *impl); | ||
223 | static void update_appearance (GtkFileChooserDefault *impl); | ||
224 | |||
225 | -static void set_current_filter (GtkFileChooserDefault *impl, | ||
226 | - GtkFileFilter *filter); | ||
227 | -static void check_preview_change (GtkFileChooserDefault *impl); | ||
228 | - | ||
229 | static void filter_combo_changed (GtkComboBox *combo_box, | ||
230 | GtkFileChooserDefault *impl); | ||
231 | -static void shortcuts_row_activated_cb (GtkTreeView *tree_view, | ||
232 | - GtkTreePath *path, | ||
233 | - GtkTreeViewColumn *column, | ||
234 | - GtkFileChooserDefault *impl); | ||
235 | - | ||
236 | -static gboolean shortcuts_key_press_event_cb (GtkWidget *widget, | ||
237 | - GdkEventKey *event, | ||
238 | - GtkFileChooserDefault *impl); | ||
239 | - | ||
240 | -static gboolean shortcuts_select_func (GtkTreeSelection *selection, | ||
241 | - GtkTreeModel *model, | ||
242 | - GtkTreePath *path, | ||
243 | - gboolean path_currently_selected, | ||
244 | - gpointer data); | ||
245 | -static gboolean shortcuts_get_selected (GtkFileChooserDefault *impl, | ||
246 | - GtkTreeIter *iter); | ||
247 | -static void shortcuts_activate_iter (GtkFileChooserDefault *impl, | ||
248 | - GtkTreeIter *iter); | ||
249 | -static int shortcuts_get_index (GtkFileChooserDefault *impl, | ||
250 | - ShortcutsIndex where); | ||
251 | -static int shortcut_find_position (GtkFileChooserDefault *impl, | ||
252 | - const GtkFilePath *path); | ||
253 | - | ||
254 | -static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl); | ||
255 | |||
256 | +static void set_current_filter (GtkFileChooserDefault *impl, | ||
257 | + GtkFileFilter *filter); | ||
258 | static gboolean list_select_func (GtkTreeSelection *selection, | ||
259 | GtkTreeModel *model, | ||
260 | GtkTreePath *path, | ||
261 | @@ -414,16 +315,6 @@ static void select_func (GtkFileSystemMo | ||
262 | GtkTreeIter *iter, | ||
263 | gpointer user_data); | ||
264 | |||
265 | -static void path_bar_clicked (GtkPathBar *path_bar, | ||
266 | - GtkFilePath *file_path, | ||
267 | - gboolean child_is_hidden, | ||
268 | - GtkFileChooserDefault *impl); | ||
269 | - | ||
270 | -static void add_bookmark_button_clicked_cb (GtkButton *button, | ||
271 | - GtkFileChooserDefault *impl); | ||
272 | -static void remove_bookmark_button_clicked_cb (GtkButton *button, | ||
273 | - GtkFileChooserDefault *impl); | ||
274 | - | ||
275 | static void list_icon_data_func (GtkTreeViewColumn *tree_column, | ||
276 | GtkCellRenderer *cell, | ||
277 | GtkTreeModel *tree_model, | ||
278 | @@ -455,36 +346,6 @@ static void browse_files_center_selected | ||
279 | |||
280 | static GObjectClass *parent_class; | ||
281 | |||
282 | - | ||
283 | - | ||
284 | -/* Drag and drop interface declarations */ | ||
285 | - | ||
286 | -typedef struct { | ||
287 | - GtkTreeModelFilter parent; | ||
288 | - | ||
289 | - GtkFileChooserDefault *impl; | ||
290 | -} ShortcutsModelFilter; | ||
291 | - | ||
292 | -typedef struct { | ||
293 | - GtkTreeModelFilterClass parent_class; | ||
294 | -} ShortcutsModelFilterClass; | ||
295 | - | ||
296 | -#define SHORTCUTS_MODEL_FILTER_TYPE (_shortcuts_model_filter_get_type ()) | ||
297 | -#define SHORTCUTS_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHORTCUTS_MODEL_FILTER_TYPE, ShortcutsModelFilter)) | ||
298 | - | ||
299 | -static void shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface); | ||
300 | - | ||
301 | -G_DEFINE_TYPE_WITH_CODE (ShortcutsModelFilter, | ||
302 | - _shortcuts_model_filter, | ||
303 | - GTK_TYPE_TREE_MODEL_FILTER, | ||
304 | - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, | ||
305 | - shortcuts_model_filter_drag_source_iface_init)); | ||
306 | - | ||
307 | -static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl, | ||
308 | - GtkTreeModel *child_model, | ||
309 | - GtkTreePath *root); | ||
310 | - | ||
311 | - | ||
312 | |||
313 | GType | ||
314 | _gtk_file_chooser_default_get_type (void) | ||
315 | @@ -534,6 +395,11 @@ _gtk_file_chooser_default_get_type (void | ||
316 | return file_chooser_default_type; | ||
317 | } | ||
318 | |||
319 | +enum | ||
320 | +{ | ||
321 | + GTK_FILE_CHOOSER_PROP_ROOT_FOLDER = GTK_FILE_CHOOSER_PROP_LAST + 1, | ||
322 | +}; | ||
323 | + | ||
324 | static void | ||
325 | gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) | ||
326 | { | ||
327 | @@ -631,6 +497,14 @@ gtk_file_chooser_default_class_init (Gtk | ||
328 | "home-folder", | ||
329 | 0); | ||
330 | |||
331 | + g_object_class_install_property (gobject_class, | ||
332 | + GTK_FILE_CHOOSER_PROP_ROOT_FOLDER, | ||
333 | + g_param_spec_string ("root-folder", | ||
334 | + P_("File System Root"), | ||
335 | + P_("Root folder for the file system below which the user should not be able to switch"), | ||
336 | + NULL, | ||
337 | + G_PARAM_WRITABLE)); | ||
338 | + | ||
339 | _gtk_file_chooser_install_properties (gobject_class); | ||
340 | |||
341 | gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend", | ||
342 | @@ -648,7 +522,6 @@ gtk_file_chooser_default_iface_init (Gtk | ||
343 | iface->select_all = gtk_file_chooser_default_select_all; | ||
344 | iface->unselect_all = gtk_file_chooser_default_unselect_all; | ||
345 | iface->get_paths = gtk_file_chooser_default_get_paths; | ||
346 | - iface->get_preview_path = gtk_file_chooser_default_get_preview_path; | ||
347 | iface->get_file_system = gtk_file_chooser_default_get_file_system; | ||
348 | iface->set_current_folder = gtk_file_chooser_default_set_current_folder; | ||
349 | iface->get_current_folder = gtk_file_chooser_default_get_current_folder; | ||
350 | @@ -656,9 +529,12 @@ gtk_file_chooser_default_iface_init (Gtk | ||
351 | iface->add_filter = gtk_file_chooser_default_add_filter; | ||
352 | iface->remove_filter = gtk_file_chooser_default_remove_filter; | ||
353 | iface->list_filters = gtk_file_chooser_default_list_filters; | ||
354 | + | ||
355 | + /* these are only stubs */ | ||
356 | + iface->get_preview_path = gtk_file_chooser_default_get_preview_path; | ||
357 | iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder; | ||
358 | iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder; | ||
359 | - iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders; | ||
360 | + | ||
361 | } | ||
362 | |||
363 | static void | ||
364 | @@ -673,71 +549,22 @@ static void | ||
365 | gtk_file_chooser_default_init (GtkFileChooserDefault *impl) | ||
366 | { | ||
367 | impl->local_only = TRUE; | ||
368 | - impl->preview_widget_active = TRUE; | ||
369 | - impl->use_preview_label = TRUE; | ||
370 | impl->select_multiple = FALSE; | ||
371 | impl->show_hidden = FALSE; | ||
372 | impl->icon_size = FALLBACK_ICON_SIZE; | ||
373 | impl->load_state = LOAD_EMPTY; | ||
374 | impl->pending_select_paths = NULL; | ||
375 | - | ||
376 | + impl->path_history = NULL; | ||
377 | + | ||
378 | gtk_widget_set_redraw_on_allocate (GTK_WIDGET (impl), TRUE); | ||
379 | - gtk_box_set_spacing (GTK_BOX (impl), 12); | ||
380 | + gtk_box_set_spacing (GTK_BOX (impl), DEFAULT_SPACING); | ||
381 | |||
382 | impl->tooltips = gtk_tooltips_new (); | ||
383 | g_object_ref (impl->tooltips); | ||
384 | gtk_object_sink (GTK_OBJECT (impl->tooltips)); | ||
385 | -} | ||
386 | - | ||
387 | -/* Frees the data columns for the specified iter in the shortcuts model*/ | ||
388 | -static void | ||
389 | -shortcuts_free_row_data (GtkFileChooserDefault *impl, | ||
390 | - GtkTreeIter *iter) | ||
391 | -{ | ||
392 | - gpointer col_data; | ||
393 | - gboolean is_volume; | ||
394 | - | ||
395 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter, | ||
396 | - SHORTCUTS_COL_DATA, &col_data, | ||
397 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
398 | - -1); | ||
399 | - if (!col_data) | ||
400 | - return; | ||
401 | - | ||
402 | - if (is_volume) | ||
403 | - { | ||
404 | - GtkFileSystemVolume *volume; | ||
405 | - | ||
406 | - volume = col_data; | ||
407 | - gtk_file_system_volume_free (impl->file_system, volume); | ||
408 | - } | ||
409 | - else | ||
410 | - { | ||
411 | - GtkFilePath *path; | ||
412 | - | ||
413 | - path = col_data; | ||
414 | - gtk_file_path_free (path); | ||
415 | - } | ||
416 | -} | ||
417 | - | ||
418 | -/* Frees all the data columns in the shortcuts model */ | ||
419 | -static void | ||
420 | -shortcuts_free (GtkFileChooserDefault *impl) | ||
421 | -{ | ||
422 | - GtkTreeIter iter; | ||
423 | |||
424 | - if (!impl->shortcuts_model) | ||
425 | - return; | ||
426 | - | ||
427 | - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) | ||
428 | - do | ||
429 | - { | ||
430 | - shortcuts_free_row_data (impl, &iter); | ||
431 | - } | ||
432 | - while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)); | ||
433 | - | ||
434 | - g_object_unref (impl->shortcuts_model); | ||
435 | - impl->shortcuts_model = NULL; | ||
436 | + if (!impl->root_folder) | ||
437 | + impl->root_folder = g_strdup ("/"); | ||
438 | } | ||
439 | |||
440 | static void | ||
441 | @@ -757,6 +584,7 @@ pending_select_paths_free (GtkFileChoose | ||
442 | impl->pending_select_paths = NULL; | ||
443 | } | ||
444 | |||
445 | + | ||
446 | static void | ||
447 | pending_select_paths_add (GtkFileChooserDefault *impl, | ||
448 | const GtkFilePath *path) | ||
449 | @@ -796,20 +624,30 @@ pending_select_paths_store_selection (Gt | ||
450 | } | ||
451 | |||
452 | static void | ||
453 | -gtk_file_chooser_default_finalize (GObject *object) | ||
454 | +path_history_free (GtkFileChooserDefault *impl) | ||
455 | { | ||
456 | - GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object); | ||
457 | GSList *l; | ||
458 | |||
459 | - if (impl->shortcuts_filter_model) | ||
460 | - g_object_unref (impl->shortcuts_filter_model); | ||
461 | + for (l = impl->path_history; l; l = l->next) | ||
462 | + { | ||
463 | + GtkFilePath *path; | ||
464 | |||
465 | - shortcuts_free (impl); | ||
466 | + path = l->data; | ||
467 | + gtk_file_path_free (path); | ||
468 | + } | ||
469 | + | ||
470 | + g_slist_free (impl->path_history); | ||
471 | + impl->path_history = NULL; | ||
472 | +} | ||
473 | + | ||
474 | +static void | ||
475 | +gtk_file_chooser_default_finalize (GObject *object) | ||
476 | +{ | ||
477 | + GSList *l; | ||
478 | + GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object); | ||
479 | |||
480 | g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id); | ||
481 | impl->volumes_changed_id = 0; | ||
482 | - g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id); | ||
483 | - impl->bookmarks_changed_id = 0; | ||
484 | g_object_unref (impl->file_system); | ||
485 | |||
486 | for (l = impl->filters; l; l = l->next) | ||
487 | @@ -830,11 +668,9 @@ gtk_file_chooser_default_finalize (GObje | ||
488 | if (impl->current_folder) | ||
489 | gtk_file_path_free (impl->current_folder); | ||
490 | |||
491 | - if (impl->preview_path) | ||
492 | - gtk_file_path_free (impl->preview_path); | ||
493 | - | ||
494 | pending_select_paths_free (impl); | ||
495 | - | ||
496 | + path_history_free (impl); | ||
497 | + | ||
498 | load_remove_timer (impl); | ||
499 | |||
500 | /* Free all the Models we have */ | ||
501 | @@ -844,12 +680,12 @@ gtk_file_chooser_default_finalize (GObje | ||
502 | if (impl->sort_model) | ||
503 | g_object_unref (impl->sort_model); | ||
504 | |||
505 | - g_free (impl->preview_display_name); | ||
506 | - | ||
507 | g_free (impl->edited_new_text); | ||
508 | |||
509 | g_object_unref (impl->tooltips); | ||
510 | |||
511 | + g_free (impl->root_folder); | ||
512 | + | ||
513 | G_OBJECT_CLASS (parent_class)->finalize (object); | ||
514 | } | ||
515 | |||
516 | @@ -930,28 +766,6 @@ error_getting_info_dialog (GtkFileChoose | ||
517 | path, error); | ||
518 | } | ||
519 | |||
520 | -/* Shows an error dialog about not being able to add a bookmark */ | ||
521 | -static void | ||
522 | -error_adding_bookmark_dialog (GtkFileChooserDefault *impl, | ||
523 | - const GtkFilePath *path, | ||
524 | - GError *error) | ||
525 | -{ | ||
526 | - error_dialog (impl, | ||
527 | - _("Could not add a bookmark"), | ||
528 | - path, error); | ||
529 | -} | ||
530 | - | ||
531 | -/* Shows an error dialog about not being able to remove a bookmark */ | ||
532 | -static void | ||
533 | -error_removing_bookmark_dialog (GtkFileChooserDefault *impl, | ||
534 | - const GtkFilePath *path, | ||
535 | - GError *error) | ||
536 | -{ | ||
537 | - error_dialog (impl, | ||
538 | - _("Could not remove bookmark"), | ||
539 | - path, error); | ||
540 | -} | ||
541 | - | ||
542 | /* Shows an error dialog about not being able to create a folder */ | ||
543 | static void | ||
544 | error_creating_folder_dialog (GtkFileChooserDefault *impl, | ||
545 | @@ -963,21 +777,6 @@ error_creating_folder_dialog (GtkFileCho | ||
546 | path, error); | ||
547 | } | ||
548 | |||
549 | -/* Shows an error about not being able to create a folder because a file with | ||
550 | - * the same name is already there. | ||
551 | - */ | ||
552 | -static void | ||
553 | -error_creating_folder_over_existing_file_dialog (GtkFileChooserDefault *impl, | ||
554 | - const GtkFilePath *path, | ||
555 | - GError *error) | ||
556 | -{ | ||
557 | - error_dialog (impl, | ||
558 | - _("The folder could not be created, as a file with the same name " | ||
559 | - "already exists. Try using a different name for the folder, " | ||
560 | - "or rename the file first."), | ||
561 | - path, error); | ||
562 | -} | ||
563 | - | ||
564 | /* Shows an error dialog about not being able to create a filename */ | ||
565 | static void | ||
566 | error_building_filename_dialog (GtkFileChooserDefault *impl, | ||
567 | @@ -1007,6 +806,7 @@ change_folder_and_display_error (GtkFile | ||
568 | GError *error; | ||
569 | gboolean result; | ||
570 | GtkFilePath *path_copy; | ||
571 | + gchar * file_name; | ||
572 | |||
573 | /* We copy the path because of this case: | ||
574 | * | ||
575 | @@ -1019,6 +819,29 @@ change_folder_and_display_error (GtkFile | ||
576 | |||
577 | path_copy = gtk_file_path_copy (path); | ||
578 | |||
579 | + file_name = gtk_file_system_path_to_filename (impl->file_system, path_copy); | ||
580 | + | ||
581 | + /* refuse to change below the root */ | ||
582 | + if (file_name && impl->root_folder && | ||
583 | + strcmp (file_name, impl->root_folder) && | ||
584 | + !strncmp (file_name, impl->root_folder, strlen (file_name))) | ||
585 | + { | ||
586 | + | ||
587 | + gtk_file_path_free (path_copy); | ||
588 | + g_free (file_name); | ||
589 | + return 0; | ||
590 | + } | ||
591 | + else if (file_name && impl->root_folder && | ||
592 | + !strcmp (file_name, impl->root_folder)) | ||
593 | + { | ||
594 | + gtk_widget_set_sensitive (impl->up_button, FALSE); | ||
595 | + } | ||
596 | + else | ||
597 | + { | ||
598 | + gtk_widget_set_sensitive (impl->up_button, TRUE); | ||
599 | + } | ||
600 | + | ||
601 | + | ||
602 | error = NULL; | ||
603 | result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, &error); | ||
604 | |||
605 | @@ -1026,189 +849,11 @@ change_folder_and_display_error (GtkFile | ||
606 | error_changing_folder_dialog (impl, path_copy, error); | ||
607 | |||
608 | gtk_file_path_free (path_copy); | ||
609 | - | ||
610 | + g_free (file_name); | ||
611 | + | ||
612 | return result; | ||
613 | } | ||
614 | |||
615 | -static void | ||
616 | -update_preview_widget_visibility (GtkFileChooserDefault *impl) | ||
617 | -{ | ||
618 | - if (impl->use_preview_label) | ||
619 | - { | ||
620 | - if (!impl->preview_label) | ||
621 | - { | ||
622 | - impl->preview_label = gtk_label_new (impl->preview_display_name); | ||
623 | - gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_label, FALSE, FALSE, 0); | ||
624 | - gtk_box_reorder_child (GTK_BOX (impl->preview_box), impl->preview_label, 0); | ||
625 | - gtk_label_set_ellipsize (GTK_LABEL (impl->preview_label), PANGO_ELLIPSIZE_MIDDLE); | ||
626 | - gtk_widget_show (impl->preview_label); | ||
627 | - } | ||
628 | - } | ||
629 | - else | ||
630 | - { | ||
631 | - if (impl->preview_label) | ||
632 | - { | ||
633 | - gtk_widget_destroy (impl->preview_label); | ||
634 | - impl->preview_label = NULL; | ||
635 | - } | ||
636 | - } | ||
637 | - | ||
638 | - if (impl->preview_widget_active && impl->preview_widget) | ||
639 | - gtk_widget_show (impl->preview_box); | ||
640 | - else | ||
641 | - gtk_widget_hide (impl->preview_box); | ||
642 | - | ||
643 | - g_signal_emit_by_name (impl, "default-size-changed"); | ||
644 | -} | ||
645 | - | ||
646 | -static void | ||
647 | -set_preview_widget (GtkFileChooserDefault *impl, | ||
648 | - GtkWidget *preview_widget) | ||
649 | -{ | ||
650 | - if (preview_widget == impl->preview_widget) | ||
651 | - return; | ||
652 | - | ||
653 | - if (impl->preview_widget) | ||
654 | - gtk_container_remove (GTK_CONTAINER (impl->preview_box), | ||
655 | - impl->preview_widget); | ||
656 | - | ||
657 | - impl->preview_widget = preview_widget; | ||
658 | - if (impl->preview_widget) | ||
659 | - { | ||
660 | - gtk_widget_show (impl->preview_widget); | ||
661 | - gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_widget, TRUE, TRUE, 0); | ||
662 | - gtk_box_reorder_child (GTK_BOX (impl->preview_box), | ||
663 | - impl->preview_widget, | ||
664 | - (impl->use_preview_label && impl->preview_label) ? 1 : 0); | ||
665 | - } | ||
666 | - | ||
667 | - update_preview_widget_visibility (impl); | ||
668 | -} | ||
669 | - | ||
670 | -/* Re-reads all the icons for the shortcuts, used when the theme changes */ | ||
671 | -static void | ||
672 | -shortcuts_reload_icons (GtkFileChooserDefault *impl) | ||
673 | -{ | ||
674 | - GtkTreeIter iter; | ||
675 | - | ||
676 | - if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) | ||
677 | - return; | ||
678 | - | ||
679 | - do { | ||
680 | - gpointer data; | ||
681 | - gboolean is_volume; | ||
682 | - gboolean pixbuf_visible; | ||
683 | - GdkPixbuf *pixbuf; | ||
684 | - | ||
685 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
686 | - SHORTCUTS_COL_DATA, &data, | ||
687 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
688 | - SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible, | ||
689 | - -1); | ||
690 | - | ||
691 | - if (pixbuf_visible && data) | ||
692 | - { | ||
693 | - if (is_volume) | ||
694 | - { | ||
695 | - GtkFileSystemVolume *volume; | ||
696 | - | ||
697 | - volume = data; | ||
698 | - pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl), | ||
699 | - impl->icon_size, NULL); | ||
700 | - } | ||
701 | - else | ||
702 | - { | ||
703 | - const GtkFilePath *path; | ||
704 | - | ||
705 | - path = data; | ||
706 | - pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), | ||
707 | - impl->icon_size, NULL); | ||
708 | - } | ||
709 | - | ||
710 | - gtk_list_store_set (impl->shortcuts_model, &iter, | ||
711 | - SHORTCUTS_COL_PIXBUF, pixbuf, | ||
712 | - -1); | ||
713 | - if (pixbuf) | ||
714 | - g_object_unref (pixbuf); | ||
715 | - } | ||
716 | - } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter)); | ||
717 | -} | ||
718 | - | ||
719 | -static void | ||
720 | -shortcuts_find_folder (GtkFileChooserDefault *impl, | ||
721 | - GtkFilePath *folder) | ||
722 | -{ | ||
723 | - GtkTreeSelection *selection; | ||
724 | - int pos; | ||
725 | - GtkTreePath *path; | ||
726 | - | ||
727 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); | ||
728 | - | ||
729 | - g_assert (folder != NULL); | ||
730 | - pos = shortcut_find_position (impl, folder); | ||
731 | - if (pos == -1) | ||
732 | - { | ||
733 | - gtk_tree_selection_unselect_all (selection); | ||
734 | - return; | ||
735 | - } | ||
736 | - | ||
737 | - path = gtk_tree_path_new_from_indices (pos, -1); | ||
738 | - gtk_tree_selection_select_path (selection, path); | ||
739 | - gtk_tree_path_free (path); | ||
740 | -} | ||
741 | - | ||
742 | -/* If a shortcut corresponds to the current folder, selects it */ | ||
743 | -static void | ||
744 | -shortcuts_find_current_folder (GtkFileChooserDefault *impl) | ||
745 | -{ | ||
746 | - shortcuts_find_folder (impl, impl->current_folder); | ||
747 | -} | ||
748 | - | ||
749 | -/* Convenience function to get the display name and icon info for a path */ | ||
750 | -static GtkFileInfo * | ||
751 | -get_file_info (GtkFileSystem *file_system, | ||
752 | - const GtkFilePath *path, | ||
753 | - gboolean name_only, | ||
754 | - GError **error) | ||
755 | -{ | ||
756 | - GtkFilePath *parent_path; | ||
757 | - GtkFileFolder *parent_folder; | ||
758 | - GtkFileInfo *info; | ||
759 | - GError *tmp = NULL; | ||
760 | - | ||
761 | - parent_path = NULL; | ||
762 | - info = NULL; | ||
763 | - | ||
764 | - if (!gtk_file_system_get_parent (file_system, path, &parent_path, &tmp)) | ||
765 | - goto out; | ||
766 | - | ||
767 | - parent_folder = gtk_file_system_get_folder (file_system, parent_path ? parent_path : path, | ||
768 | - GTK_FILE_INFO_DISPLAY_NAME | ||
769 | - | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER), | ||
770 | - &tmp); | ||
771 | - if (!parent_folder) | ||
772 | - goto out; | ||
773 | - | ||
774 | - info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, &tmp); | ||
775 | - g_object_unref (parent_folder); | ||
776 | - | ||
777 | - out: | ||
778 | - if (parent_path) | ||
779 | - gtk_file_path_free (parent_path); | ||
780 | - | ||
781 | - if (tmp) | ||
782 | - { | ||
783 | - g_set_error (error, | ||
784 | - GTK_FILE_CHOOSER_ERROR, | ||
785 | - GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, | ||
786 | - _("Could not get information about '%s': %s"), | ||
787 | - gtk_file_path_get_string (path), | ||
788 | - tmp->message); | ||
789 | - g_error_free (tmp); | ||
790 | - } | ||
791 | - | ||
792 | - return info; | ||
793 | -} | ||
794 | |||
795 | /* Returns whether a path is a folder */ | ||
796 | static gboolean | ||
797 | @@ -1217,8 +862,11 @@ check_is_folder (GtkFileSystem *fil | ||
798 | GError **error) | ||
799 | { | ||
800 | GtkFileFolder *folder; | ||
801 | - | ||
802 | +#ifdef GTK26 | ||
803 | folder = gtk_file_system_get_folder (file_system, path, 0, error); | ||
804 | +#else | ||
805 | + folder = gtk_file_system_get_folder (file_system, path, 0, NULL, NULL); | ||
806 | +#endif | ||
807 | if (!folder) | ||
808 | return FALSE; | ||
809 | |||
810 | @@ -1226,515 +874,6 @@ check_is_folder (GtkFileSystem *fil | ||
811 | return TRUE; | ||
812 | } | ||
813 | |||
814 | -/* Inserts a path in the shortcuts tree, making a copy of it; alternatively, | ||
815 | - * inserts a volume. A position of -1 indicates the end of the tree. | ||
816 | - */ | ||
817 | -static gboolean | ||
818 | -shortcuts_insert_path (GtkFileChooserDefault *impl, | ||
819 | - int pos, | ||
820 | - gboolean is_volume, | ||
821 | - GtkFileSystemVolume *volume, | ||
822 | - const GtkFilePath *path, | ||
823 | - const char *label, | ||
824 | - gboolean removable, | ||
825 | - GError **error) | ||
826 | -{ | ||
827 | - char *label_copy; | ||
828 | - GdkPixbuf *pixbuf; | ||
829 | - gpointer data; | ||
830 | - GtkTreeIter iter; | ||
831 | - | ||
832 | - if (is_volume) | ||
833 | - { | ||
834 | - data = volume; | ||
835 | - label_copy = gtk_file_system_volume_get_display_name (impl->file_system, volume); | ||
836 | - pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl), | ||
837 | - impl->icon_size, NULL); | ||
838 | - } | ||
839 | - else | ||
840 | - { | ||
841 | - if (!check_is_folder (impl->file_system, path, error)) | ||
842 | - return FALSE; | ||
843 | - | ||
844 | - if (label) | ||
845 | - label_copy = g_strdup (label); | ||
846 | - else | ||
847 | - { | ||
848 | - GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error); | ||
849 | - | ||
850 | - if (!info) | ||
851 | - return FALSE; | ||
852 | - | ||
853 | - label_copy = g_strdup (gtk_file_info_get_display_name (info)); | ||
854 | - gtk_file_info_free (info); | ||
855 | - } | ||
856 | - | ||
857 | - data = gtk_file_path_copy (path); | ||
858 | - pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), | ||
859 | - impl->icon_size, NULL); | ||
860 | - } | ||
861 | - | ||
862 | - if (pos == -1) | ||
863 | - gtk_list_store_append (impl->shortcuts_model, &iter); | ||
864 | - else | ||
865 | - gtk_list_store_insert (impl->shortcuts_model, &iter, pos); | ||
866 | - | ||
867 | - gtk_list_store_set (impl->shortcuts_model, &iter, | ||
868 | - SHORTCUTS_COL_PIXBUF, pixbuf, | ||
869 | - SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE, | ||
870 | - SHORTCUTS_COL_NAME, label_copy, | ||
871 | - SHORTCUTS_COL_DATA, data, | ||
872 | - SHORTCUTS_COL_IS_VOLUME, is_volume, | ||
873 | - SHORTCUTS_COL_REMOVABLE, removable, | ||
874 | - -1); | ||
875 | - | ||
876 | - g_free (label_copy); | ||
877 | - | ||
878 | - if (pixbuf) | ||
879 | - g_object_unref (pixbuf); | ||
880 | - | ||
881 | - return TRUE; | ||
882 | -} | ||
883 | - | ||
884 | -/* Appends an item for the user's home directory to the shortcuts model */ | ||
885 | -static void | ||
886 | -shortcuts_append_home (GtkFileChooserDefault *impl) | ||
887 | -{ | ||
888 | - const char *home; | ||
889 | - GtkFilePath *home_path; | ||
890 | - GError *error; | ||
891 | - | ||
892 | - home = g_get_home_dir (); | ||
893 | - if (home == NULL) | ||
894 | - return; | ||
895 | - | ||
896 | - home_path = gtk_file_system_filename_to_path (impl->file_system, home); | ||
897 | - | ||
898 | - error = NULL; | ||
899 | - impl->has_home = shortcuts_insert_path (impl, -1, FALSE, NULL, home_path, _("Home"), FALSE, &error); | ||
900 | - if (!impl->has_home) | ||
901 | - error_getting_info_dialog (impl, home_path, error); | ||
902 | - | ||
903 | - gtk_file_path_free (home_path); | ||
904 | -} | ||
905 | - | ||
906 | -/* Appends the ~/Desktop directory to the shortcuts model */ | ||
907 | -static void | ||
908 | -shortcuts_append_desktop (GtkFileChooserDefault *impl) | ||
909 | -{ | ||
910 | - char *name; | ||
911 | - GtkFilePath *path; | ||
912 | - | ||
913 | -#ifdef G_OS_WIN32 | ||
914 | - name = _gtk_file_system_win32_get_desktop (); | ||
915 | -#else | ||
916 | - const char *home = g_get_home_dir (); | ||
917 | - if (home == NULL) | ||
918 | - return; | ||
919 | - | ||
920 | - name = g_build_filename (home, "Desktop", NULL); | ||
921 | -#endif | ||
922 | - | ||
923 | - path = gtk_file_system_filename_to_path (impl->file_system, name); | ||
924 | - g_free (name); | ||
925 | - | ||
926 | - impl->has_desktop = shortcuts_insert_path (impl, -1, FALSE, NULL, path, _("Desktop"), FALSE, NULL); | ||
927 | - /* We do not actually pop up an error dialog if there is no desktop directory | ||
928 | - * because some people may really not want to have one. | ||
929 | - */ | ||
930 | - | ||
931 | - gtk_file_path_free (path); | ||
932 | -} | ||
933 | - | ||
934 | -/* Appends a list of GtkFilePath to the shortcuts model; returns how many were inserted */ | ||
935 | -static int | ||
936 | -shortcuts_append_paths (GtkFileChooserDefault *impl, | ||
937 | - GSList *paths) | ||
938 | -{ | ||
939 | - int start_row; | ||
940 | - int num_inserted; | ||
941 | - | ||
942 | - /* As there is no separator now, we want to start there. | ||
943 | - */ | ||
944 | - start_row = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR); | ||
945 | - num_inserted = 0; | ||
946 | - | ||
947 | - for (; paths; paths = paths->next) | ||
948 | - { | ||
949 | - GtkFilePath *path; | ||
950 | - GError *error; | ||
951 | - | ||
952 | - path = paths->data; | ||
953 | - error = NULL; | ||
954 | - | ||
955 | - if (impl->local_only && | ||
956 | - !gtk_file_system_path_is_local (impl->file_system, path)) | ||
957 | - continue; | ||
958 | - | ||
959 | - /* NULL GError, but we don't really want to show error boxes here */ | ||
960 | - if (shortcuts_insert_path (impl, start_row + num_inserted, FALSE, NULL, path, NULL, TRUE, NULL)) | ||
961 | - num_inserted++; | ||
962 | - } | ||
963 | - | ||
964 | - return num_inserted; | ||
965 | -} | ||
966 | - | ||
967 | -/* Returns the index for the corresponding item in the shortcuts bar */ | ||
968 | -static int | ||
969 | -shortcuts_get_index (GtkFileChooserDefault *impl, | ||
970 | - ShortcutsIndex where) | ||
971 | -{ | ||
972 | - int n; | ||
973 | - | ||
974 | - n = 0; | ||
975 | - | ||
976 | - if (where == SHORTCUTS_HOME) | ||
977 | - goto out; | ||
978 | - | ||
979 | - n += impl->has_home ? 1 : 0; | ||
980 | - | ||
981 | - if (where == SHORTCUTS_DESKTOP) | ||
982 | - goto out; | ||
983 | - | ||
984 | - n += impl->has_desktop ? 1 : 0; | ||
985 | - | ||
986 | - if (where == SHORTCUTS_VOLUMES) | ||
987 | - goto out; | ||
988 | - | ||
989 | - n += impl->num_volumes; | ||
990 | - | ||
991 | - if (where == SHORTCUTS_SHORTCUTS) | ||
992 | - goto out; | ||
993 | - | ||
994 | - n += impl->num_shortcuts; | ||
995 | - | ||
996 | - if (where == SHORTCUTS_BOOKMARKS_SEPARATOR) | ||
997 | - goto out; | ||
998 | - | ||
999 | - /* If there are no bookmarks there won't be a separator */ | ||
1000 | - n += (impl->num_bookmarks > 0) ? 1 : 0; | ||
1001 | - | ||
1002 | - if (where == SHORTCUTS_BOOKMARKS) | ||
1003 | - goto out; | ||
1004 | - | ||
1005 | - n += impl->num_bookmarks; | ||
1006 | - | ||
1007 | - if (where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR) | ||
1008 | - goto out; | ||
1009 | - | ||
1010 | - n += 1; | ||
1011 | - | ||
1012 | - if (where == SHORTCUTS_CURRENT_FOLDER) | ||
1013 | - goto out; | ||
1014 | - | ||
1015 | - g_assert_not_reached (); | ||
1016 | - | ||
1017 | - out: | ||
1018 | - | ||
1019 | - return n; | ||
1020 | -} | ||
1021 | - | ||
1022 | -/* Removes the specified number of rows from the shortcuts list */ | ||
1023 | -static void | ||
1024 | -shortcuts_remove_rows (GtkFileChooserDefault *impl, | ||
1025 | - int start_row, | ||
1026 | - int n_rows) | ||
1027 | -{ | ||
1028 | - GtkTreePath *path; | ||
1029 | - | ||
1030 | - path = gtk_tree_path_new_from_indices (start_row, -1); | ||
1031 | - | ||
1032 | - for (; n_rows; n_rows--) | ||
1033 | - { | ||
1034 | - GtkTreeIter iter; | ||
1035 | - | ||
1036 | - if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path)) | ||
1037 | - g_assert_not_reached (); | ||
1038 | - | ||
1039 | - shortcuts_free_row_data (impl, &iter); | ||
1040 | - gtk_list_store_remove (impl->shortcuts_model, &iter); | ||
1041 | - } | ||
1042 | - | ||
1043 | - gtk_tree_path_free (path); | ||
1044 | -} | ||
1045 | - | ||
1046 | -/* Adds all the file system volumes to the shortcuts model */ | ||
1047 | -static void | ||
1048 | -shortcuts_add_volumes (GtkFileChooserDefault *impl) | ||
1049 | -{ | ||
1050 | - int start_row; | ||
1051 | - GSList *list, *l; | ||
1052 | - int n; | ||
1053 | - gboolean old_changing_folders; | ||
1054 | - | ||
1055 | - old_changing_folders = impl->changing_folder; | ||
1056 | - impl->changing_folder = TRUE; | ||
1057 | - | ||
1058 | - start_row = shortcuts_get_index (impl, SHORTCUTS_VOLUMES); | ||
1059 | - shortcuts_remove_rows (impl, start_row, impl->num_volumes); | ||
1060 | - impl->num_volumes = 0; | ||
1061 | - | ||
1062 | - list = gtk_file_system_list_volumes (impl->file_system); | ||
1063 | - | ||
1064 | - n = 0; | ||
1065 | - | ||
1066 | - for (l = list; l; l = l->next) | ||
1067 | - { | ||
1068 | - GtkFileSystemVolume *volume; | ||
1069 | - | ||
1070 | - volume = l->data; | ||
1071 | - | ||
1072 | - if (impl->local_only) | ||
1073 | - { | ||
1074 | - GtkFilePath *base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); | ||
1075 | - gboolean is_local = gtk_file_system_path_is_local (impl->file_system, base_path); | ||
1076 | - gtk_file_path_free (base_path); | ||
1077 | - | ||
1078 | - if (!is_local) | ||
1079 | - { | ||
1080 | - gtk_file_system_volume_free (impl->file_system, volume); | ||
1081 | - continue; | ||
1082 | - } | ||
1083 | - } | ||
1084 | - | ||
1085 | - if (shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, NULL)) | ||
1086 | - n++; | ||
1087 | - else | ||
1088 | - gtk_file_system_volume_free (impl->file_system, volume); | ||
1089 | - } | ||
1090 | - | ||
1091 | - impl->num_volumes = n; | ||
1092 | - g_slist_free (list); | ||
1093 | - | ||
1094 | - if (impl->shortcuts_filter_model) | ||
1095 | - gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model)); | ||
1096 | - | ||
1097 | - impl->changing_folder = old_changing_folders; | ||
1098 | -} | ||
1099 | - | ||
1100 | -/* Inserts a separator node in the shortcuts list */ | ||
1101 | -static void | ||
1102 | -shortcuts_insert_separator (GtkFileChooserDefault *impl, | ||
1103 | - ShortcutsIndex where) | ||
1104 | -{ | ||
1105 | - GtkTreeIter iter; | ||
1106 | - | ||
1107 | - g_assert (where == SHORTCUTS_BOOKMARKS_SEPARATOR || where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR); | ||
1108 | - | ||
1109 | - gtk_list_store_insert (impl->shortcuts_model, &iter, | ||
1110 | - shortcuts_get_index (impl, where)); | ||
1111 | - gtk_list_store_set (impl->shortcuts_model, &iter, | ||
1112 | - SHORTCUTS_COL_PIXBUF, NULL, | ||
1113 | - SHORTCUTS_COL_PIXBUF_VISIBLE, FALSE, | ||
1114 | - SHORTCUTS_COL_NAME, NULL, | ||
1115 | - SHORTCUTS_COL_DATA, NULL, | ||
1116 | - -1); | ||
1117 | -} | ||
1118 | - | ||
1119 | -/* Updates the list of bookmarks */ | ||
1120 | -static void | ||
1121 | -shortcuts_add_bookmarks (GtkFileChooserDefault *impl) | ||
1122 | -{ | ||
1123 | - GSList *bookmarks; | ||
1124 | - gboolean old_changing_folders; | ||
1125 | - GtkTreeIter iter; | ||
1126 | - GtkFilePath *list_selected = NULL; | ||
1127 | - GtkFilePath *combo_selected = NULL; | ||
1128 | - gboolean is_volume; | ||
1129 | - gpointer col_data; | ||
1130 | - | ||
1131 | - old_changing_folders = impl->changing_folder; | ||
1132 | - impl->changing_folder = TRUE; | ||
1133 | - | ||
1134 | - if (shortcuts_get_selected (impl, &iter)) | ||
1135 | - { | ||
1136 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), | ||
1137 | - &iter, | ||
1138 | - SHORTCUTS_COL_DATA, &col_data, | ||
1139 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
1140 | - -1); | ||
1141 | - | ||
1142 | - if (col_data && !is_volume) | ||
1143 | - list_selected = gtk_file_path_copy (col_data); | ||
1144 | - } | ||
1145 | - | ||
1146 | - if (impl->save_folder_combo && | ||
1147 | - gtk_combo_box_get_active_iter (GTK_COMBO_BOX (impl->save_folder_combo), | ||
1148 | - &iter)) | ||
1149 | - { | ||
1150 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), | ||
1151 | - &iter, | ||
1152 | - SHORTCUTS_COL_DATA, &col_data, | ||
1153 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
1154 | - -1); | ||
1155 | - | ||
1156 | - if (col_data && !is_volume) | ||
1157 | - combo_selected = gtk_file_path_copy (col_data); | ||
1158 | - } | ||
1159 | - | ||
1160 | - if (impl->num_bookmarks > 0) | ||
1161 | - shortcuts_remove_rows (impl, | ||
1162 | - shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR), | ||
1163 | - impl->num_bookmarks + 1); | ||
1164 | - | ||
1165 | - bookmarks = gtk_file_system_list_bookmarks (impl->file_system); | ||
1166 | - impl->num_bookmarks = shortcuts_append_paths (impl, bookmarks); | ||
1167 | - gtk_file_paths_free (bookmarks); | ||
1168 | - | ||
1169 | - if (impl->num_bookmarks > 0) | ||
1170 | - shortcuts_insert_separator (impl, SHORTCUTS_BOOKMARKS_SEPARATOR); | ||
1171 | - | ||
1172 | - if (impl->shortcuts_filter_model) | ||
1173 | - gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model)); | ||
1174 | - | ||
1175 | - if (list_selected) | ||
1176 | - { | ||
1177 | - shortcuts_find_folder (impl, list_selected); | ||
1178 | - gtk_file_path_free (list_selected); | ||
1179 | - } | ||
1180 | - | ||
1181 | - if (combo_selected) | ||
1182 | - { | ||
1183 | - gint pos; | ||
1184 | - | ||
1185 | - pos = shortcut_find_position (impl, combo_selected); | ||
1186 | - if (pos != -1) | ||
1187 | - gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), | ||
1188 | - pos); | ||
1189 | - gtk_file_path_free (combo_selected); | ||
1190 | - } | ||
1191 | - | ||
1192 | - impl->changing_folder = old_changing_folders; | ||
1193 | -} | ||
1194 | - | ||
1195 | -/* Appends a separator and a row to the shortcuts list for the current folder */ | ||
1196 | -static void | ||
1197 | -shortcuts_add_current_folder (GtkFileChooserDefault *impl) | ||
1198 | -{ | ||
1199 | - int pos; | ||
1200 | - gboolean success; | ||
1201 | - | ||
1202 | - g_assert (!impl->shortcuts_current_folder_active); | ||
1203 | - | ||
1204 | - success = TRUE; | ||
1205 | - | ||
1206 | - g_assert (impl->current_folder != NULL); | ||
1207 | - | ||
1208 | - pos = shortcut_find_position (impl, impl->current_folder); | ||
1209 | - if (pos == -1) | ||
1210 | - { | ||
1211 | - GtkFileSystemVolume *volume; | ||
1212 | - GtkFilePath *base_path; | ||
1213 | - | ||
1214 | - /* Separator */ | ||
1215 | - | ||
1216 | - shortcuts_insert_separator (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); | ||
1217 | - | ||
1218 | - /* Item */ | ||
1219 | - | ||
1220 | - pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER); | ||
1221 | - | ||
1222 | - volume = gtk_file_system_get_volume_for_path (impl->file_system, impl->current_folder); | ||
1223 | - if (volume) | ||
1224 | - base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); | ||
1225 | - else | ||
1226 | - base_path = NULL; | ||
1227 | - | ||
1228 | - if (base_path && | ||
1229 | - strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0) | ||
1230 | - { | ||
1231 | - success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL); | ||
1232 | - if (success) | ||
1233 | - volume = NULL; | ||
1234 | - } | ||
1235 | - else | ||
1236 | - success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL); | ||
1237 | - | ||
1238 | - if (volume) | ||
1239 | - gtk_file_system_volume_free (impl->file_system, volume); | ||
1240 | - | ||
1241 | - if (base_path) | ||
1242 | - gtk_file_path_free (base_path); | ||
1243 | - | ||
1244 | - if (!success) | ||
1245 | - shortcuts_remove_rows (impl, pos - 1, 1); /* remove the separator */ | ||
1246 | - | ||
1247 | - impl->shortcuts_current_folder_active = success; | ||
1248 | - } | ||
1249 | - | ||
1250 | - if (success) | ||
1251 | - gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos); | ||
1252 | -} | ||
1253 | - | ||
1254 | -/* Updates the current folder row in the shortcuts model */ | ||
1255 | -static void | ||
1256 | -shortcuts_update_current_folder (GtkFileChooserDefault *impl) | ||
1257 | -{ | ||
1258 | - int pos; | ||
1259 | - | ||
1260 | - pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); | ||
1261 | - | ||
1262 | - if (impl->shortcuts_current_folder_active) | ||
1263 | - { | ||
1264 | - shortcuts_remove_rows (impl, pos, 2); | ||
1265 | - impl->shortcuts_current_folder_active = FALSE; | ||
1266 | - } | ||
1267 | - | ||
1268 | - shortcuts_add_current_folder (impl); | ||
1269 | -} | ||
1270 | - | ||
1271 | -/* Filter function used for the shortcuts filter model */ | ||
1272 | -static gboolean | ||
1273 | -shortcuts_filter_cb (GtkTreeModel *model, | ||
1274 | - GtkTreeIter *iter, | ||
1275 | - gpointer data) | ||
1276 | -{ | ||
1277 | - GtkFileChooserDefault *impl; | ||
1278 | - GtkTreePath *path; | ||
1279 | - int pos; | ||
1280 | - | ||
1281 | - impl = GTK_FILE_CHOOSER_DEFAULT (data); | ||
1282 | - | ||
1283 | - path = gtk_tree_model_get_path (model, iter); | ||
1284 | - if (!path) | ||
1285 | - return FALSE; | ||
1286 | - | ||
1287 | - pos = *gtk_tree_path_get_indices (path); | ||
1288 | - gtk_tree_path_free (path); | ||
1289 | - | ||
1290 | - return (pos < shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR)); | ||
1291 | -} | ||
1292 | - | ||
1293 | -/* Creates the list model for shortcuts */ | ||
1294 | -static void | ||
1295 | -shortcuts_model_create (GtkFileChooserDefault *impl) | ||
1296 | -{ | ||
1297 | - /* Keep this order in sync with the SHORCUTS_COL_* enum values */ | ||
1298 | - impl->shortcuts_model = gtk_list_store_new (SHORTCUTS_COL_NUM_COLUMNS, | ||
1299 | - GDK_TYPE_PIXBUF, /* pixbuf */ | ||
1300 | - G_TYPE_STRING, /* name */ | ||
1301 | - G_TYPE_POINTER, /* path or volume */ | ||
1302 | - G_TYPE_BOOLEAN, /* is the previous column a volume? */ | ||
1303 | - G_TYPE_BOOLEAN, /* removable */ | ||
1304 | - G_TYPE_BOOLEAN); /* pixbuf cell visibility */ | ||
1305 | - | ||
1306 | - if (impl->file_system) | ||
1307 | - { | ||
1308 | - shortcuts_append_home (impl); | ||
1309 | - shortcuts_append_desktop (impl); | ||
1310 | - shortcuts_add_volumes (impl); | ||
1311 | - shortcuts_add_bookmarks (impl); | ||
1312 | - } | ||
1313 | - | ||
1314 | - impl->shortcuts_filter_model = shortcuts_model_filter_new (impl, | ||
1315 | - GTK_TREE_MODEL (impl->shortcuts_model), | ||
1316 | - NULL); | ||
1317 | - | ||
1318 | - gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model), | ||
1319 | - shortcuts_filter_cb, | ||
1320 | - impl, | ||
1321 | - NULL); | ||
1322 | -} | ||
1323 | |||
1324 | /* Callback used when the "New Folder" button is clicked */ | ||
1325 | static void | ||
1326 | @@ -1793,7 +932,11 @@ edited_idle_cb (GtkFileChooserDefault *i | ||
1327 | if (file_path) | ||
1328 | { | ||
1329 | error = NULL; | ||
1330 | +#ifdef GTK26 | ||
1331 | if (gtk_file_system_create_folder (impl->file_system, file_path, &error)) | ||
1332 | +#else | ||
1333 | + if (gtk_file_system_create_folder (impl->file_system, file_path, NULL, NULL)) | ||
1334 | +#endif | ||
1335 | change_folder_and_display_error (impl, file_path); | ||
1336 | else | ||
1337 | error_creating_folder_dialog (impl, file_path, error); | ||
1338 | @@ -1864,245 +1007,12 @@ static GtkWidget * | ||
1339 | filter_create (GtkFileChooserDefault *impl) | ||
1340 | { | ||
1341 | impl->filter_combo = gtk_combo_box_new_text (); | ||
1342 | - gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE); | ||
1343 | - | ||
1344 | g_signal_connect (impl->filter_combo, "changed", | ||
1345 | G_CALLBACK (filter_combo_changed), impl); | ||
1346 | |||
1347 | return impl->filter_combo; | ||
1348 | } | ||
1349 | |||
1350 | -static GtkWidget * | ||
1351 | -button_new (GtkFileChooserDefault *impl, | ||
1352 | - const char *text, | ||
1353 | - const char *stock_id, | ||
1354 | - gboolean sensitive, | ||
1355 | - gboolean show, | ||
1356 | - GCallback callback) | ||
1357 | -{ | ||
1358 | - GtkWidget *button; | ||
1359 | - GtkWidget *hbox; | ||
1360 | - GtkWidget *widget; | ||
1361 | - GtkWidget *align; | ||
1362 | - | ||
1363 | - button = gtk_button_new (); | ||
1364 | - hbox = gtk_hbox_new (FALSE, 2); | ||
1365 | - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); | ||
1366 | - | ||
1367 | - gtk_container_add (GTK_CONTAINER (button), align); | ||
1368 | - gtk_container_add (GTK_CONTAINER (align), hbox); | ||
1369 | - widget = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); | ||
1370 | - | ||
1371 | - gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); | ||
1372 | - | ||
1373 | - widget = gtk_label_new_with_mnemonic (text); | ||
1374 | - gtk_label_set_mnemonic_widget (GTK_LABEL (widget), GTK_WIDGET (button)); | ||
1375 | - gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); | ||
1376 | - | ||
1377 | - gtk_widget_set_sensitive (button, sensitive); | ||
1378 | - g_signal_connect (button, "clicked", callback, impl); | ||
1379 | - | ||
1380 | - gtk_widget_show_all (align); | ||
1381 | - | ||
1382 | - if (show) | ||
1383 | - gtk_widget_show (button); | ||
1384 | - | ||
1385 | - return button; | ||
1386 | -} | ||
1387 | - | ||
1388 | -/* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */ | ||
1389 | -static int | ||
1390 | -shortcut_find_position (GtkFileChooserDefault *impl, | ||
1391 | - const GtkFilePath *path) | ||
1392 | -{ | ||
1393 | - GtkTreeIter iter; | ||
1394 | - int i; | ||
1395 | - int current_folder_separator_idx; | ||
1396 | - | ||
1397 | - if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) | ||
1398 | - return -1; | ||
1399 | - | ||
1400 | - current_folder_separator_idx = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR); | ||
1401 | - | ||
1402 | - for (i = 0; i < current_folder_separator_idx; i++) | ||
1403 | - { | ||
1404 | - gpointer col_data; | ||
1405 | - gboolean is_volume; | ||
1406 | - | ||
1407 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
1408 | - SHORTCUTS_COL_DATA, &col_data, | ||
1409 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
1410 | - -1); | ||
1411 | - | ||
1412 | - if (col_data) | ||
1413 | - { | ||
1414 | - if (is_volume) | ||
1415 | - { | ||
1416 | - GtkFileSystemVolume *volume; | ||
1417 | - GtkFilePath *base_path; | ||
1418 | - gboolean exists; | ||
1419 | - | ||
1420 | - volume = col_data; | ||
1421 | - base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); | ||
1422 | - | ||
1423 | - exists = strcmp (gtk_file_path_get_string (path), | ||
1424 | - gtk_file_path_get_string (base_path)) == 0; | ||
1425 | - g_free (base_path); | ||
1426 | - | ||
1427 | - if (exists) | ||
1428 | - return i; | ||
1429 | - } | ||
1430 | - else | ||
1431 | - { | ||
1432 | - GtkFilePath *model_path; | ||
1433 | - | ||
1434 | - model_path = col_data; | ||
1435 | - | ||
1436 | - if (model_path && gtk_file_path_compare (model_path, path) == 0) | ||
1437 | - return i; | ||
1438 | - } | ||
1439 | - } | ||
1440 | - | ||
1441 | - gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter); | ||
1442 | - } | ||
1443 | - | ||
1444 | - return -1; | ||
1445 | -} | ||
1446 | - | ||
1447 | -/* Tries to add a bookmark from a path name */ | ||
1448 | -static gboolean | ||
1449 | -shortcuts_add_bookmark_from_path (GtkFileChooserDefault *impl, | ||
1450 | - const GtkFilePath *path, | ||
1451 | - int pos) | ||
1452 | -{ | ||
1453 | - GError *error; | ||
1454 | - | ||
1455 | - if (shortcut_find_position (impl, path) != -1) | ||
1456 | - return FALSE; | ||
1457 | - | ||
1458 | - /* FIXME: this check really belongs in gtk_file_system_insert_bookmark. */ | ||
1459 | - error = NULL; | ||
1460 | - if (!check_is_folder (impl->file_system, path, &error)) | ||
1461 | - { | ||
1462 | - error_adding_bookmark_dialog (impl, path, error); | ||
1463 | - return FALSE; | ||
1464 | - } | ||
1465 | - | ||
1466 | - error = NULL; | ||
1467 | - if (!gtk_file_system_insert_bookmark (impl->file_system, path, pos, &error)) | ||
1468 | - { | ||
1469 | - error_adding_bookmark_dialog (impl, path, error); | ||
1470 | - return FALSE; | ||
1471 | - } | ||
1472 | - | ||
1473 | - return TRUE; | ||
1474 | -} | ||
1475 | - | ||
1476 | -static void | ||
1477 | -add_bookmark_foreach_cb (GtkTreeModel *model, | ||
1478 | - GtkTreePath *path, | ||
1479 | - GtkTreeIter *iter, | ||
1480 | - gpointer data) | ||
1481 | -{ | ||
1482 | - GtkFileChooserDefault *impl; | ||
1483 | - GtkFileSystemModel *fs_model; | ||
1484 | - GtkTreeIter child_iter; | ||
1485 | - const GtkFilePath *file_path; | ||
1486 | - | ||
1487 | - impl = (GtkFileChooserDefault *) data; | ||
1488 | - | ||
1489 | - fs_model = impl->browse_files_model; | ||
1490 | - gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, iter); | ||
1491 | - | ||
1492 | - file_path = _gtk_file_system_model_get_path (fs_model, &child_iter); | ||
1493 | - shortcuts_add_bookmark_from_path (impl, file_path, -1); | ||
1494 | -} | ||
1495 | - | ||
1496 | -/* Adds a bookmark from the currently selected item in the file list */ | ||
1497 | -static void | ||
1498 | -bookmarks_add_selected_folder (GtkFileChooserDefault *impl) | ||
1499 | -{ | ||
1500 | - GtkTreeSelection *selection; | ||
1501 | - | ||
1502 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
1503 | - | ||
1504 | - if (gtk_tree_selection_count_selected_rows (selection) == 0) | ||
1505 | - shortcuts_add_bookmark_from_path (impl, impl->current_folder, -1); | ||
1506 | - else | ||
1507 | - gtk_tree_selection_selected_foreach (selection, | ||
1508 | - add_bookmark_foreach_cb, | ||
1509 | - impl); | ||
1510 | -} | ||
1511 | - | ||
1512 | -/* Callback used when the "Add bookmark" button is clicked */ | ||
1513 | -static void | ||
1514 | -add_bookmark_button_clicked_cb (GtkButton *button, | ||
1515 | - GtkFileChooserDefault *impl) | ||
1516 | -{ | ||
1517 | - bookmarks_add_selected_folder (impl); | ||
1518 | -} | ||
1519 | - | ||
1520 | -/* Returns TRUE plus an iter in the shortcuts_model if a row is selected; | ||
1521 | - * returns FALSE if no shortcut is selected. | ||
1522 | - */ | ||
1523 | -static gboolean | ||
1524 | -shortcuts_get_selected (GtkFileChooserDefault *impl, | ||
1525 | - GtkTreeIter *iter) | ||
1526 | -{ | ||
1527 | - GtkTreeSelection *selection; | ||
1528 | - GtkTreeIter parent_iter; | ||
1529 | - | ||
1530 | - if (!impl->browse_shortcuts_tree_view) | ||
1531 | - return FALSE; | ||
1532 | - | ||
1533 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); | ||
1534 | - | ||
1535 | - if (!gtk_tree_selection_get_selected (selection, NULL, &parent_iter)) | ||
1536 | - return FALSE; | ||
1537 | - | ||
1538 | - gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model), | ||
1539 | - iter, | ||
1540 | - &parent_iter); | ||
1541 | - return TRUE; | ||
1542 | -} | ||
1543 | - | ||
1544 | -/* Removes the selected bookmarks */ | ||
1545 | -static void | ||
1546 | -remove_selected_bookmarks (GtkFileChooserDefault *impl) | ||
1547 | -{ | ||
1548 | - GtkTreeIter iter; | ||
1549 | - gpointer col_data; | ||
1550 | - GtkFilePath *path; | ||
1551 | - gboolean removable; | ||
1552 | - GError *error; | ||
1553 | - | ||
1554 | - if (!shortcuts_get_selected (impl, &iter)) | ||
1555 | - return; | ||
1556 | - | ||
1557 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
1558 | - SHORTCUTS_COL_DATA, &col_data, | ||
1559 | - SHORTCUTS_COL_REMOVABLE, &removable, | ||
1560 | - -1); | ||
1561 | - g_assert (col_data != NULL); | ||
1562 | - | ||
1563 | - if (!removable) | ||
1564 | - return; | ||
1565 | - | ||
1566 | - path = col_data; | ||
1567 | - | ||
1568 | - error = NULL; | ||
1569 | - if (!gtk_file_system_remove_bookmark (impl->file_system, path, &error)) | ||
1570 | - error_removing_bookmark_dialog (impl, path, error); | ||
1571 | -} | ||
1572 | - | ||
1573 | -/* Callback used when the "Remove bookmark" button is clicked */ | ||
1574 | -static void | ||
1575 | -remove_bookmark_button_clicked_cb (GtkButton *button, | ||
1576 | - GtkFileChooserDefault *impl) | ||
1577 | -{ | ||
1578 | - remove_selected_bookmarks (impl); | ||
1579 | -} | ||
1580 | - | ||
1581 | struct selection_check_closure { | ||
1582 | GtkFileChooserDefault *impl; | ||
1583 | int num_selected; | ||
1584 | @@ -2171,864 +1081,13 @@ struct get_selected_path_closure { | ||
1585 | const GtkFilePath *path; | ||
1586 | }; | ||
1587 | |||
1588 | -static void | ||
1589 | -get_selected_path_foreach_cb (GtkTreeModel *model, | ||
1590 | - GtkTreePath *path, | ||
1591 | - GtkTreeIter *iter, | ||
1592 | - gpointer data) | ||
1593 | -{ | ||
1594 | - struct get_selected_path_closure *closure; | ||
1595 | - GtkTreeIter child_iter; | ||
1596 | - | ||
1597 | - closure = data; | ||
1598 | - | ||
1599 | - gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter); | ||
1600 | - closure->path = _gtk_file_system_model_get_path (closure->impl->browse_files_model, &child_iter); | ||
1601 | -} | ||
1602 | - | ||
1603 | /* Returns a selected path from the file list */ | ||
1604 | -static const GtkFilePath * | ||
1605 | -get_selected_path (GtkFileChooserDefault *impl) | ||
1606 | -{ | ||
1607 | - struct get_selected_path_closure closure; | ||
1608 | - GtkTreeSelection *selection; | ||
1609 | - | ||
1610 | - closure.impl = impl; | ||
1611 | - closure.path = NULL; | ||
1612 | - | ||
1613 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
1614 | - gtk_tree_selection_selected_foreach (selection, | ||
1615 | - get_selected_path_foreach_cb, | ||
1616 | - &closure); | ||
1617 | - | ||
1618 | - return closure.path; | ||
1619 | -} | ||
1620 | |||
1621 | typedef struct { | ||
1622 | GtkFileChooserDefault *impl; | ||
1623 | gchar *tip; | ||
1624 | } UpdateTooltipData; | ||
1625 | |||
1626 | -static void | ||
1627 | -update_tooltip (GtkTreeModel *model, | ||
1628 | - GtkTreePath *path, | ||
1629 | - GtkTreeIter *iter, | ||
1630 | - gpointer data) | ||
1631 | -{ | ||
1632 | - UpdateTooltipData *udata = data; | ||
1633 | - GtkTreeIter child_iter; | ||
1634 | - const GtkFileInfo *info; | ||
1635 | - | ||
1636 | - if (udata->tip == NULL) | ||
1637 | - { | ||
1638 | - gtk_tree_model_sort_convert_iter_to_child_iter (udata->impl->sort_model, | ||
1639 | - &child_iter, | ||
1640 | - iter); | ||
1641 | - | ||
1642 | - info = _gtk_file_system_model_get_info (udata->impl->browse_files_model, &child_iter); | ||
1643 | - udata->tip = g_strdup_printf (_("Add the folder '%s' to the bookmarks"), | ||
1644 | - gtk_file_info_get_display_name (info)); | ||
1645 | - } | ||
1646 | -} | ||
1647 | - | ||
1648 | - | ||
1649 | -/* Sensitize the "add bookmark" button if all the selected items are folders, or | ||
1650 | - * if there are no selected items *and* the current folder is not in the | ||
1651 | - * bookmarks list. De-sensitize the button otherwise. | ||
1652 | - */ | ||
1653 | -static void | ||
1654 | -bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl) | ||
1655 | -{ | ||
1656 | - gint num_selected; | ||
1657 | - gboolean all_folders; | ||
1658 | - gboolean active; | ||
1659 | - gchar *tip; | ||
1660 | - | ||
1661 | - selection_check (impl, &num_selected, NULL, &all_folders); | ||
1662 | - | ||
1663 | - if (num_selected == 0) | ||
1664 | - active = (impl->current_folder != NULL) && (shortcut_find_position (impl, impl->current_folder) == -1); | ||
1665 | - else if (num_selected == 1) | ||
1666 | - { | ||
1667 | - const GtkFilePath *path; | ||
1668 | - | ||
1669 | - path = get_selected_path (impl); | ||
1670 | - active = all_folders && (shortcut_find_position (impl, path) == -1); | ||
1671 | - } | ||
1672 | - else | ||
1673 | - active = all_folders; | ||
1674 | - | ||
1675 | - gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, active); | ||
1676 | - | ||
1677 | - if (impl->browse_files_popup_menu_add_shortcut_item) | ||
1678 | - gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item, | ||
1679 | - (num_selected == 0) ? FALSE : active); | ||
1680 | - | ||
1681 | - if (active) | ||
1682 | - { | ||
1683 | - if (num_selected == 0) | ||
1684 | - tip = g_strdup_printf (_("Add the current folder to the bookmarks")); | ||
1685 | - else if (num_selected > 1) | ||
1686 | - tip = g_strdup_printf (_("Add the selected folders to the bookmarks")); | ||
1687 | - else | ||
1688 | - { | ||
1689 | - GtkTreeSelection *selection; | ||
1690 | - UpdateTooltipData data; | ||
1691 | - | ||
1692 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
1693 | - data.impl = impl; | ||
1694 | - data.tip = NULL; | ||
1695 | - gtk_tree_selection_selected_foreach (selection, update_tooltip, &data); | ||
1696 | - tip = data.tip; | ||
1697 | - | ||
1698 | - } | ||
1699 | - gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button, tip, NULL); | ||
1700 | - g_free (tip); | ||
1701 | - } | ||
1702 | -} | ||
1703 | - | ||
1704 | -/* Sets the sensitivity of the "remove bookmark" button depending on whether a | ||
1705 | - * bookmark row is selected in the shortcuts tree. | ||
1706 | - */ | ||
1707 | -static void | ||
1708 | -bookmarks_check_remove_sensitivity (GtkFileChooserDefault *impl) | ||
1709 | -{ | ||
1710 | - GtkTreeIter iter; | ||
1711 | - gboolean removable = FALSE; | ||
1712 | - gchar *name = NULL; | ||
1713 | - | ||
1714 | - if (shortcuts_get_selected (impl, &iter)) | ||
1715 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
1716 | - SHORTCUTS_COL_REMOVABLE, &removable, | ||
1717 | - SHORTCUTS_COL_NAME, &name, | ||
1718 | - -1); | ||
1719 | - | ||
1720 | - gtk_widget_set_sensitive (impl->browse_shortcuts_remove_button, removable); | ||
1721 | - | ||
1722 | - if (removable) | ||
1723 | - { | ||
1724 | - gchar *tip; | ||
1725 | - | ||
1726 | - tip = g_strdup_printf (_("Remove the bookmark '%s'"), name); | ||
1727 | - gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button, | ||
1728 | - tip, NULL); | ||
1729 | - g_free (tip); | ||
1730 | - } | ||
1731 | - | ||
1732 | - g_free (name); | ||
1733 | -} | ||
1734 | - | ||
1735 | -/* GtkWidget::drag-begin handler for the shortcuts list. */ | ||
1736 | -static void | ||
1737 | -shortcuts_drag_begin_cb (GtkWidget *widget, | ||
1738 | - GdkDragContext *context, | ||
1739 | - GtkFileChooserDefault *impl) | ||
1740 | -{ | ||
1741 | -#if 0 | ||
1742 | - impl->shortcuts_drag_context = g_object_ref (context); | ||
1743 | -#endif | ||
1744 | -} | ||
1745 | - | ||
1746 | -#if 0 | ||
1747 | -/* Removes the idle handler for outside drags */ | ||
1748 | -static void | ||
1749 | -shortcuts_cancel_drag_outside_idle (GtkFileChooserDefault *impl) | ||
1750 | -{ | ||
1751 | - if (!impl->shortcuts_drag_outside_idle) | ||
1752 | - return; | ||
1753 | - | ||
1754 | - g_source_destroy (impl->shortcuts_drag_outside_idle); | ||
1755 | - impl->shortcuts_drag_outside_idle = NULL; | ||
1756 | -} | ||
1757 | -#endif | ||
1758 | - | ||
1759 | -/* GtkWidget::drag-end handler for the shortcuts list. */ | ||
1760 | -static void | ||
1761 | -shortcuts_drag_end_cb (GtkWidget *widget, | ||
1762 | - GdkDragContext *context, | ||
1763 | - GtkFileChooserDefault *impl) | ||
1764 | -{ | ||
1765 | -#if 0 | ||
1766 | - g_object_unref (impl->shortcuts_drag_context); | ||
1767 | - | ||
1768 | - shortcuts_cancel_drag_outside_idle (impl); | ||
1769 | - | ||
1770 | - if (!impl->shortcuts_drag_outside) | ||
1771 | - return; | ||
1772 | - | ||
1773 | - gtk_button_clicked (GTK_BUTTON (impl->browse_shortcuts_remove_button)); | ||
1774 | - | ||
1775 | - impl->shortcuts_drag_outside = FALSE; | ||
1776 | -#endif | ||
1777 | -} | ||
1778 | - | ||
1779 | -/* GtkWidget::drag-data-delete handler for the shortcuts list. */ | ||
1780 | -static void | ||
1781 | -shortcuts_drag_data_delete_cb (GtkWidget *widget, | ||
1782 | - GdkDragContext *context, | ||
1783 | - GtkFileChooserDefault *impl) | ||
1784 | -{ | ||
1785 | - g_signal_stop_emission_by_name (widget, "drag-data-delete"); | ||
1786 | -} | ||
1787 | - | ||
1788 | -#if 0 | ||
1789 | -/* Creates a suitable drag cursor to indicate that the selected bookmark will be | ||
1790 | - * deleted or not. | ||
1791 | - */ | ||
1792 | -static void | ||
1793 | -shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl, | ||
1794 | - gboolean delete) | ||
1795 | -{ | ||
1796 | - GtkTreeView *tree_view; | ||
1797 | - GtkTreeIter iter; | ||
1798 | - GtkTreePath *path; | ||
1799 | - GdkPixmap *row_pixmap; | ||
1800 | - GdkBitmap *mask; | ||
1801 | - int row_pixmap_y; | ||
1802 | - int cell_y; | ||
1803 | - | ||
1804 | - tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view); | ||
1805 | - | ||
1806 | - /* Find the selected path and get its drag pixmap */ | ||
1807 | - | ||
1808 | - if (!shortcuts_get_selected (impl, &iter)) | ||
1809 | - g_assert_not_reached (); | ||
1810 | - | ||
1811 | - path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter); | ||
1812 | - | ||
1813 | - row_pixmap = gtk_tree_view_create_row_drag_icon (tree_view, path); | ||
1814 | - gtk_tree_path_free (path); | ||
1815 | - | ||
1816 | - mask = NULL; | ||
1817 | - row_pixmap_y = 0; | ||
1818 | - | ||
1819 | - if (delete) | ||
1820 | - { | ||
1821 | - GdkPixbuf *pixbuf; | ||
1822 | - | ||
1823 | - pixbuf = gtk_widget_render_icon (impl->browse_shortcuts_tree_view, | ||
1824 | - GTK_STOCK_DELETE, | ||
1825 | - GTK_ICON_SIZE_DND, | ||
1826 | - NULL); | ||
1827 | - if (pixbuf) | ||
1828 | - { | ||
1829 | - GdkPixmap *composite; | ||
1830 | - int row_pixmap_width, row_pixmap_height; | ||
1831 | - int pixbuf_width, pixbuf_height; | ||
1832 | - int composite_width, composite_height; | ||
1833 | - int pixbuf_x, pixbuf_y; | ||
1834 | - GdkGC *gc, *mask_gc; | ||
1835 | - GdkColor color; | ||
1836 | - GdkBitmap *pixbuf_mask; | ||
1837 | - | ||
1838 | - /* Create pixmap and mask for composite image */ | ||
1839 | - | ||
1840 | - gdk_drawable_get_size (row_pixmap, &row_pixmap_width, &row_pixmap_height); | ||
1841 | - pixbuf_width = gdk_pixbuf_get_width (pixbuf); | ||
1842 | - pixbuf_height = gdk_pixbuf_get_height (pixbuf); | ||
1843 | - | ||
1844 | - composite_width = MAX (row_pixmap_width, pixbuf_width); | ||
1845 | - composite_height = MAX (row_pixmap_height, pixbuf_height); | ||
1846 | - | ||
1847 | - row_pixmap_y = (composite_height - row_pixmap_height) / 2; | ||
1848 | - | ||
1849 | - if (gtk_widget_get_direction (impl->browse_shortcuts_tree_view) == GTK_TEXT_DIR_RTL) | ||
1850 | - pixbuf_x = 0; | ||
1851 | - else | ||
1852 | - pixbuf_x = composite_width - pixbuf_width; | ||
1853 | - | ||
1854 | - pixbuf_y = (composite_height - pixbuf_height) / 2; | ||
1855 | - | ||
1856 | - composite = gdk_pixmap_new (row_pixmap, composite_width, composite_height, -1); | ||
1857 | - gc = gdk_gc_new (composite); | ||
1858 | - | ||
1859 | - mask = gdk_pixmap_new (row_pixmap, composite_width, composite_height, 1); | ||
1860 | - mask_gc = gdk_gc_new (mask); | ||
1861 | - color.pixel = 0; | ||
1862 | - gdk_gc_set_foreground (mask_gc, &color); | ||
1863 | - gdk_draw_rectangle (mask, mask_gc, TRUE, 0, 0, composite_width, composite_height); | ||
1864 | - | ||
1865 | - color.red = 0xffff; | ||
1866 | - color.green = 0xffff; | ||
1867 | - color.blue = 0xffff; | ||
1868 | - gdk_gc_set_rgb_fg_color (gc, &color); | ||
1869 | - gdk_draw_rectangle (composite, gc, TRUE, 0, 0, composite_width, composite_height); | ||
1870 | - | ||
1871 | - /* Composite the row pixmap and the pixbuf */ | ||
1872 | - | ||
1873 | - gdk_pixbuf_render_pixmap_and_mask_for_colormap | ||
1874 | - (pixbuf, | ||
1875 | - gtk_widget_get_colormap (impl->browse_shortcuts_tree_view), | ||
1876 | - NULL, &pixbuf_mask, 128); | ||
1877 | - gdk_draw_drawable (mask, mask_gc, pixbuf_mask, | ||
1878 | - 0, 0, | ||
1879 | - pixbuf_x, pixbuf_y, | ||
1880 | - pixbuf_width, pixbuf_height); | ||
1881 | - g_object_unref (pixbuf_mask); | ||
1882 | - | ||
1883 | - gdk_draw_drawable (composite, gc, row_pixmap, | ||
1884 | - 0, 0, | ||
1885 | - 0, row_pixmap_y, | ||
1886 | - row_pixmap_width, row_pixmap_height); | ||
1887 | - color.pixel = 1; | ||
1888 | - gdk_gc_set_foreground (mask_gc, &color); | ||
1889 | - gdk_draw_rectangle (mask, mask_gc, TRUE, 0, row_pixmap_y, row_pixmap_width, row_pixmap_height); | ||
1890 | - | ||
1891 | - gdk_draw_pixbuf (composite, gc, pixbuf, | ||
1892 | - 0, 0, | ||
1893 | - pixbuf_x, pixbuf_y, | ||
1894 | - pixbuf_width, pixbuf_height, | ||
1895 | - GDK_RGB_DITHER_MAX, | ||
1896 | - 0, 0); | ||
1897 | - | ||
1898 | - g_object_unref (pixbuf); | ||
1899 | - g_object_unref (row_pixmap); | ||
1900 | - | ||
1901 | - row_pixmap = composite; | ||
1902 | - } | ||
1903 | - } | ||
1904 | - | ||
1905 | - /* The hotspot offsets here are copied from gtk_tree_view_drag_begin(), ugh */ | ||
1906 | - | ||
1907 | - gtk_tree_view_get_path_at_pos (tree_view, | ||
1908 | - tree_view->priv->press_start_x, | ||
1909 | - tree_view->priv->press_start_y, | ||
1910 | - NULL, | ||
1911 | - NULL, | ||
1912 | - NULL, | ||
1913 | - &cell_y); | ||
1914 | - | ||
1915 | - gtk_drag_set_icon_pixmap (impl->shortcuts_drag_context, | ||
1916 | - gdk_drawable_get_colormap (row_pixmap), | ||
1917 | - row_pixmap, | ||
1918 | - mask, | ||
1919 | - tree_view->priv->press_start_x + 1, | ||
1920 | - row_pixmap_y + cell_y + 1); | ||
1921 | - | ||
1922 | - g_object_unref (row_pixmap); | ||
1923 | - if (mask) | ||
1924 | - g_object_unref (mask); | ||
1925 | -} | ||
1926 | - | ||
1927 | -/* We set the delete cursor and the shortcuts_drag_outside flag in an idle | ||
1928 | - * handler so that we can tell apart the drag_leave event that comes right | ||
1929 | - * before a drag_drop, from a normal drag_leave. We don't want to set the | ||
1930 | - * cursor nor the flag in the latter case. | ||
1931 | - */ | ||
1932 | -static gboolean | ||
1933 | -shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl) | ||
1934 | -{ | ||
1935 | - GDK_THREADS_ENTER (); | ||
1936 | - | ||
1937 | - shortcuts_drag_set_delete_cursor (impl, TRUE); | ||
1938 | - impl->shortcuts_drag_outside = TRUE; | ||
1939 | - | ||
1940 | - shortcuts_cancel_drag_outside_idle (impl); | ||
1941 | - | ||
1942 | - GDK_THREADS_LEAVE (); | ||
1943 | - | ||
1944 | - return FALSE; | ||
1945 | -} | ||
1946 | -#endif | ||
1947 | - | ||
1948 | -/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the | ||
1949 | - * drop position. | ||
1950 | - */ | ||
1951 | -static void | ||
1952 | -shortcuts_drag_leave_cb (GtkWidget *widget, | ||
1953 | - GdkDragContext *context, | ||
1954 | - guint time_, | ||
1955 | - GtkFileChooserDefault *impl) | ||
1956 | -{ | ||
1957 | -#if 0 | ||
1958 | - if (gtk_drag_get_source_widget (context) == widget && !impl->shortcuts_drag_outside_idle) | ||
1959 | - { | ||
1960 | - impl->shortcuts_drag_outside_idle = g_idle_source_new (); | ||
1961 | - g_source_set_closure (impl->shortcuts_drag_outside_idle, | ||
1962 | - g_cclosure_new_object (G_CALLBACK (shortcuts_drag_outside_idle_cb), | ||
1963 | - G_OBJECT (impl))); | ||
1964 | - g_source_attach (impl->shortcuts_drag_outside_idle, NULL); | ||
1965 | - } | ||
1966 | -#endif | ||
1967 | - | ||
1968 | - gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), | ||
1969 | - NULL, | ||
1970 | - GTK_TREE_VIEW_DROP_BEFORE); | ||
1971 | - | ||
1972 | - g_signal_stop_emission_by_name (widget, "drag-leave"); | ||
1973 | -} | ||
1974 | - | ||
1975 | -/* Computes the appropriate row and position for dropping */ | ||
1976 | -static void | ||
1977 | -shortcuts_compute_drop_position (GtkFileChooserDefault *impl, | ||
1978 | - int x, | ||
1979 | - int y, | ||
1980 | - GtkTreePath **path, | ||
1981 | - GtkTreeViewDropPosition *pos) | ||
1982 | -{ | ||
1983 | - GtkTreeView *tree_view; | ||
1984 | - GtkTreeViewColumn *column; | ||
1985 | - int cell_y; | ||
1986 | - GdkRectangle cell; | ||
1987 | - int row; | ||
1988 | - int bookmarks_index; | ||
1989 | - | ||
1990 | - tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view); | ||
1991 | - | ||
1992 | - bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS); | ||
1993 | - | ||
1994 | - if (!gtk_tree_view_get_path_at_pos (tree_view, | ||
1995 | - x, | ||
1996 | - y - TREE_VIEW_HEADER_HEIGHT (tree_view), | ||
1997 | - path, | ||
1998 | - &column, | ||
1999 | - NULL, | ||
2000 | - &cell_y)) | ||
2001 | - { | ||
2002 | - row = bookmarks_index + impl->num_bookmarks - 1; | ||
2003 | - *path = gtk_tree_path_new_from_indices (row, -1); | ||
2004 | - *pos = GTK_TREE_VIEW_DROP_AFTER; | ||
2005 | - return; | ||
2006 | - } | ||
2007 | - | ||
2008 | - row = *gtk_tree_path_get_indices (*path); | ||
2009 | - gtk_tree_view_get_background_area (tree_view, *path, column, &cell); | ||
2010 | - gtk_tree_path_free (*path); | ||
2011 | - | ||
2012 | - if (row < bookmarks_index) | ||
2013 | - { | ||
2014 | - row = bookmarks_index; | ||
2015 | - *pos = GTK_TREE_VIEW_DROP_BEFORE; | ||
2016 | - } | ||
2017 | - else if (row > bookmarks_index + impl->num_bookmarks - 1) | ||
2018 | - { | ||
2019 | - row = bookmarks_index + impl->num_bookmarks - 1; | ||
2020 | - *pos = GTK_TREE_VIEW_DROP_AFTER; | ||
2021 | - } | ||
2022 | - else | ||
2023 | - { | ||
2024 | - if (cell_y < cell.height / 2) | ||
2025 | - *pos = GTK_TREE_VIEW_DROP_BEFORE; | ||
2026 | - else | ||
2027 | - *pos = GTK_TREE_VIEW_DROP_AFTER; | ||
2028 | - } | ||
2029 | - | ||
2030 | - *path = gtk_tree_path_new_from_indices (row, -1); | ||
2031 | -} | ||
2032 | - | ||
2033 | -/* GtkWidget::drag-motion handler for the shortcuts list. We basically | ||
2034 | - * implement the destination side of DnD by hand, due to limitations in | ||
2035 | - * GtkTreeView's DnD API. | ||
2036 | - */ | ||
2037 | -static gboolean | ||
2038 | -shortcuts_drag_motion_cb (GtkWidget *widget, | ||
2039 | - GdkDragContext *context, | ||
2040 | - gint x, | ||
2041 | - gint y, | ||
2042 | - guint time_, | ||
2043 | - GtkFileChooserDefault *impl) | ||
2044 | -{ | ||
2045 | - GtkTreePath *path; | ||
2046 | - GtkTreeViewDropPosition pos; | ||
2047 | - GdkDragAction action; | ||
2048 | - | ||
2049 | -#if 0 | ||
2050 | - if (gtk_drag_get_source_widget (context) == widget) | ||
2051 | - { | ||
2052 | - shortcuts_cancel_drag_outside_idle (impl); | ||
2053 | - | ||
2054 | - if (impl->shortcuts_drag_outside) | ||
2055 | - { | ||
2056 | - shortcuts_drag_set_delete_cursor (impl, FALSE); | ||
2057 | - impl->shortcuts_drag_outside = FALSE; | ||
2058 | - } | ||
2059 | - } | ||
2060 | -#endif | ||
2061 | - | ||
2062 | - if (context->suggested_action == GDK_ACTION_COPY || (context->actions & GDK_ACTION_COPY) != 0) | ||
2063 | - action = GDK_ACTION_COPY; | ||
2064 | - else if (context->suggested_action == GDK_ACTION_MOVE || (context->actions & GDK_ACTION_MOVE) != 0) | ||
2065 | - action = GDK_ACTION_MOVE; | ||
2066 | - else | ||
2067 | - { | ||
2068 | - action = 0; | ||
2069 | - goto out; | ||
2070 | - } | ||
2071 | - | ||
2072 | - shortcuts_compute_drop_position (impl, x, y, &path, &pos); | ||
2073 | - gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), path, pos); | ||
2074 | - gtk_tree_path_free (path); | ||
2075 | - | ||
2076 | - out: | ||
2077 | - | ||
2078 | - g_signal_stop_emission_by_name (widget, "drag-motion"); | ||
2079 | - | ||
2080 | - if (action != 0) | ||
2081 | - { | ||
2082 | - gdk_drag_status (context, action, time_); | ||
2083 | - return TRUE; | ||
2084 | - } | ||
2085 | - else | ||
2086 | - return FALSE; | ||
2087 | -} | ||
2088 | - | ||
2089 | -/* GtkWidget::drag-drop handler for the shortcuts list. */ | ||
2090 | -static gboolean | ||
2091 | -shortcuts_drag_drop_cb (GtkWidget *widget, | ||
2092 | - GdkDragContext *context, | ||
2093 | - gint x, | ||
2094 | - gint y, | ||
2095 | - guint time_, | ||
2096 | - GtkFileChooserDefault *impl) | ||
2097 | -{ | ||
2098 | -#if 0 | ||
2099 | - shortcuts_cancel_drag_outside_idle (impl); | ||
2100 | -#endif | ||
2101 | - | ||
2102 | - g_signal_stop_emission_by_name (widget, "drag-drop"); | ||
2103 | - return TRUE; | ||
2104 | -} | ||
2105 | - | ||
2106 | -/* Parses a "text/uri-list" string and inserts its URIs as bookmarks */ | ||
2107 | -static void | ||
2108 | -shortcuts_drop_uris (GtkFileChooserDefault *impl, | ||
2109 | - const char *data, | ||
2110 | - int position) | ||
2111 | -{ | ||
2112 | - gchar **uris; | ||
2113 | - gint i; | ||
2114 | - | ||
2115 | - uris = g_uri_list_extract_uris (data); | ||
2116 | - | ||
2117 | - for (i = 0; uris[i]; i++) | ||
2118 | - { | ||
2119 | - char *uri; | ||
2120 | - GtkFilePath *path; | ||
2121 | - | ||
2122 | - uri = uris[i]; | ||
2123 | - path = gtk_file_system_uri_to_path (impl->file_system, uri); | ||
2124 | - | ||
2125 | - if (path) | ||
2126 | - { | ||
2127 | - if (shortcuts_add_bookmark_from_path (impl, path, position)) | ||
2128 | - position++; | ||
2129 | - | ||
2130 | - gtk_file_path_free (path); | ||
2131 | - } | ||
2132 | - else | ||
2133 | - { | ||
2134 | - GError *error; | ||
2135 | - | ||
2136 | - g_set_error (&error, | ||
2137 | - GTK_FILE_CHOOSER_ERROR, | ||
2138 | - GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, | ||
2139 | - _("Could not add a bookmark for '%s' " | ||
2140 | - "because it is an invalid path name."), | ||
2141 | - uri); | ||
2142 | - error_adding_bookmark_dialog (impl, path, error); | ||
2143 | - } | ||
2144 | - } | ||
2145 | - | ||
2146 | - g_strfreev (uris); | ||
2147 | -} | ||
2148 | - | ||
2149 | -/* Reorders the selected bookmark to the specified position */ | ||
2150 | -static void | ||
2151 | -shortcuts_reorder (GtkFileChooserDefault *impl, | ||
2152 | - int new_position) | ||
2153 | -{ | ||
2154 | - GtkTreeIter iter; | ||
2155 | - gpointer col_data; | ||
2156 | - gboolean is_volume; | ||
2157 | - GtkTreePath *path; | ||
2158 | - int old_position; | ||
2159 | - int bookmarks_index; | ||
2160 | - const GtkFilePath *file_path; | ||
2161 | - GtkFilePath *file_path_copy; | ||
2162 | - GError *error; | ||
2163 | - | ||
2164 | - /* Get the selected path */ | ||
2165 | - | ||
2166 | - if (!shortcuts_get_selected (impl, &iter)) | ||
2167 | - g_assert_not_reached (); | ||
2168 | - | ||
2169 | - path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter); | ||
2170 | - old_position = *gtk_tree_path_get_indices (path); | ||
2171 | - gtk_tree_path_free (path); | ||
2172 | - | ||
2173 | - bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS); | ||
2174 | - old_position -= bookmarks_index; | ||
2175 | - g_assert (old_position >= 0 && old_position < impl->num_bookmarks); | ||
2176 | - | ||
2177 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
2178 | - SHORTCUTS_COL_DATA, &col_data, | ||
2179 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
2180 | - -1); | ||
2181 | - g_assert (col_data != NULL); | ||
2182 | - g_assert (!is_volume); | ||
2183 | - | ||
2184 | - file_path = col_data; | ||
2185 | - file_path_copy = gtk_file_path_copy (file_path); /* removal below will free file_path, so we need a copy */ | ||
2186 | - | ||
2187 | - /* Remove the path from the old position and insert it in the new one */ | ||
2188 | - | ||
2189 | - if (new_position > old_position) | ||
2190 | - new_position--; | ||
2191 | - | ||
2192 | - if (old_position == new_position) | ||
2193 | - goto out; | ||
2194 | - | ||
2195 | - error = NULL; | ||
2196 | - if (gtk_file_system_remove_bookmark (impl->file_system, file_path_copy, &error)) | ||
2197 | - shortcuts_add_bookmark_from_path (impl, file_path_copy, new_position); | ||
2198 | - else | ||
2199 | - error_adding_bookmark_dialog (impl, file_path_copy, error); | ||
2200 | - | ||
2201 | - out: | ||
2202 | - | ||
2203 | - gtk_file_path_free (file_path_copy); | ||
2204 | -} | ||
2205 | - | ||
2206 | -/* Callback used when we get the drag data for the bookmarks list. We add the | ||
2207 | - * received URIs as bookmarks if they are folders. | ||
2208 | - */ | ||
2209 | -static void | ||
2210 | -shortcuts_drag_data_received_cb (GtkWidget *widget, | ||
2211 | - GdkDragContext *context, | ||
2212 | - gint x, | ||
2213 | - gint y, | ||
2214 | - GtkSelectionData *selection_data, | ||
2215 | - guint info, | ||
2216 | - guint time_, | ||
2217 | - gpointer data) | ||
2218 | -{ | ||
2219 | - GtkFileChooserDefault *impl; | ||
2220 | - GtkTreePath *tree_path; | ||
2221 | - GtkTreeViewDropPosition tree_pos; | ||
2222 | - int position; | ||
2223 | - int bookmarks_index; | ||
2224 | - | ||
2225 | - impl = GTK_FILE_CHOOSER_DEFAULT (data); | ||
2226 | - | ||
2227 | - /* Compute position */ | ||
2228 | - | ||
2229 | - bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS); | ||
2230 | - | ||
2231 | - shortcuts_compute_drop_position (impl, x, y, &tree_path, &tree_pos); | ||
2232 | - position = *gtk_tree_path_get_indices (tree_path); | ||
2233 | - gtk_tree_path_free (tree_path); | ||
2234 | - | ||
2235 | - if (tree_pos == GTK_TREE_VIEW_DROP_AFTER) | ||
2236 | - position++; | ||
2237 | - | ||
2238 | - g_assert (position >= bookmarks_index); | ||
2239 | - position -= bookmarks_index; | ||
2240 | - | ||
2241 | - if (selection_data->target == gdk_atom_intern ("text/uri-list", FALSE)) | ||
2242 | - shortcuts_drop_uris (impl, selection_data->data, position); | ||
2243 | - else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE)) | ||
2244 | - shortcuts_reorder (impl, position); | ||
2245 | - | ||
2246 | - g_signal_stop_emission_by_name (widget, "drag-data-received"); | ||
2247 | -} | ||
2248 | - | ||
2249 | -/* Callback used when the selection in the shortcuts tree changes */ | ||
2250 | -static void | ||
2251 | -shortcuts_selection_changed_cb (GtkTreeSelection *selection, | ||
2252 | - GtkFileChooserDefault *impl) | ||
2253 | -{ | ||
2254 | - bookmarks_check_remove_sensitivity (impl); | ||
2255 | -} | ||
2256 | - | ||
2257 | -static gboolean | ||
2258 | -shortcuts_row_separator_func (GtkTreeModel *model, | ||
2259 | - GtkTreeIter *iter, | ||
2260 | - gpointer data) | ||
2261 | -{ | ||
2262 | - gint column = GPOINTER_TO_INT (data); | ||
2263 | - gchar *text; | ||
2264 | - | ||
2265 | - gtk_tree_model_get (model, iter, column, &text, -1); | ||
2266 | - | ||
2267 | - if (!text) | ||
2268 | - return TRUE; | ||
2269 | - | ||
2270 | - g_free (text); | ||
2271 | - | ||
2272 | - return FALSE; | ||
2273 | -} | ||
2274 | - | ||
2275 | -/* Since GtkTreeView has a keybinding attached to '/', we need to catch | ||
2276 | - * keypresses before the TreeView gets them. | ||
2277 | - */ | ||
2278 | -static gboolean | ||
2279 | -tree_view_keybinding_cb (GtkWidget *tree_view, | ||
2280 | - GdkEventKey *event, | ||
2281 | - GtkFileChooserDefault *impl) | ||
2282 | -{ | ||
2283 | - if (event->keyval == GDK_slash && | ||
2284 | - ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) | ||
2285 | - { | ||
2286 | - location_popup_handler (impl, "/"); | ||
2287 | - return TRUE; | ||
2288 | - } | ||
2289 | - | ||
2290 | - return FALSE; | ||
2291 | -} | ||
2292 | - | ||
2293 | - | ||
2294 | -/* Creates the widgets for the shortcuts and bookmarks tree */ | ||
2295 | -static GtkWidget * | ||
2296 | -shortcuts_list_create (GtkFileChooserDefault *impl) | ||
2297 | -{ | ||
2298 | - GtkWidget *swin; | ||
2299 | - GtkTreeSelection *selection; | ||
2300 | - GtkTreeViewColumn *column; | ||
2301 | - GtkCellRenderer *renderer; | ||
2302 | - | ||
2303 | - /* Scrolled window */ | ||
2304 | - | ||
2305 | - swin = gtk_scrolled_window_new (NULL, NULL); | ||
2306 | - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), | ||
2307 | - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | ||
2308 | - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), | ||
2309 | - GTK_SHADOW_IN); | ||
2310 | - gtk_widget_show (swin); | ||
2311 | - | ||
2312 | - /* Tree */ | ||
2313 | - | ||
2314 | - impl->browse_shortcuts_tree_view = gtk_tree_view_new (); | ||
2315 | - g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event", | ||
2316 | - G_CALLBACK (tree_view_keybinding_cb), impl); | ||
2317 | - atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts")); | ||
2318 | - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE); | ||
2319 | - | ||
2320 | - gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model); | ||
2321 | - | ||
2322 | - gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), | ||
2323 | - GDK_BUTTON1_MASK, | ||
2324 | - shortcuts_source_targets, | ||
2325 | - num_shortcuts_source_targets, | ||
2326 | - GDK_ACTION_MOVE); | ||
2327 | - | ||
2328 | - gtk_drag_dest_set (impl->browse_shortcuts_tree_view, | ||
2329 | - GTK_DEST_DEFAULT_ALL, | ||
2330 | - shortcuts_dest_targets, | ||
2331 | - num_shortcuts_dest_targets, | ||
2332 | - GDK_ACTION_COPY | GDK_ACTION_MOVE); | ||
2333 | - | ||
2334 | - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); | ||
2335 | - gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); | ||
2336 | - gtk_tree_selection_set_select_function (selection, | ||
2337 | - shortcuts_select_func, | ||
2338 | - impl, NULL); | ||
2339 | - | ||
2340 | - g_signal_connect (selection, "changed", | ||
2341 | - G_CALLBACK (shortcuts_selection_changed_cb), impl); | ||
2342 | - | ||
2343 | - g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated", | ||
2344 | - G_CALLBACK (shortcuts_row_activated_cb), impl); | ||
2345 | - | ||
2346 | - g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event", | ||
2347 | - G_CALLBACK (shortcuts_key_press_event_cb), impl); | ||
2348 | - | ||
2349 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin", | ||
2350 | - G_CALLBACK (shortcuts_drag_begin_cb), impl); | ||
2351 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end", | ||
2352 | - G_CALLBACK (shortcuts_drag_end_cb), impl); | ||
2353 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-delete", | ||
2354 | - G_CALLBACK (shortcuts_drag_data_delete_cb), impl); | ||
2355 | - | ||
2356 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-leave", | ||
2357 | - G_CALLBACK (shortcuts_drag_leave_cb), impl); | ||
2358 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-motion", | ||
2359 | - G_CALLBACK (shortcuts_drag_motion_cb), impl); | ||
2360 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-drop", | ||
2361 | - G_CALLBACK (shortcuts_drag_drop_cb), impl); | ||
2362 | - g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received", | ||
2363 | - G_CALLBACK (shortcuts_drag_data_received_cb), impl); | ||
2364 | - | ||
2365 | - gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view); | ||
2366 | - gtk_widget_show (impl->browse_shortcuts_tree_view); | ||
2367 | - | ||
2368 | - /* Column */ | ||
2369 | - | ||
2370 | - column = gtk_tree_view_column_new (); | ||
2371 | - gtk_tree_view_column_set_title (column, _("Folder")); | ||
2372 | - | ||
2373 | - renderer = gtk_cell_renderer_pixbuf_new (); | ||
2374 | - gtk_tree_view_column_pack_start (column, renderer, FALSE); | ||
2375 | - gtk_tree_view_column_set_attributes (column, renderer, | ||
2376 | - "pixbuf", SHORTCUTS_COL_PIXBUF, | ||
2377 | - "visible", SHORTCUTS_COL_PIXBUF_VISIBLE, | ||
2378 | - NULL); | ||
2379 | - | ||
2380 | - renderer = gtk_cell_renderer_text_new (); | ||
2381 | - gtk_tree_view_column_pack_start (column, renderer, TRUE); | ||
2382 | - gtk_tree_view_column_set_attributes (column, renderer, | ||
2383 | - "text", SHORTCUTS_COL_NAME, | ||
2384 | - NULL); | ||
2385 | - | ||
2386 | - gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), | ||
2387 | - shortcuts_row_separator_func, | ||
2388 | - GINT_TO_POINTER (SHORTCUTS_COL_NAME), | ||
2389 | - NULL); | ||
2390 | - | ||
2391 | - gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column); | ||
2392 | - | ||
2393 | - return swin; | ||
2394 | -} | ||
2395 | - | ||
2396 | -/* Creates the widgets for the shortcuts/bookmarks pane */ | ||
2397 | -static GtkWidget * | ||
2398 | -shortcuts_pane_create (GtkFileChooserDefault *impl, | ||
2399 | - GtkSizeGroup *size_group) | ||
2400 | -{ | ||
2401 | - GtkWidget *vbox; | ||
2402 | - GtkWidget *hbox; | ||
2403 | - GtkWidget *widget; | ||
2404 | - | ||
2405 | - vbox = gtk_vbox_new (FALSE, 6); | ||
2406 | - gtk_widget_show (vbox); | ||
2407 | - | ||
2408 | - /* Shortcuts tree */ | ||
2409 | - | ||
2410 | - widget = shortcuts_list_create (impl); | ||
2411 | - gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0); | ||
2412 | - | ||
2413 | - /* Box for buttons */ | ||
2414 | - | ||
2415 | - hbox = gtk_hbox_new (TRUE, 6); | ||
2416 | - gtk_size_group_add_widget (size_group, hbox); | ||
2417 | - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); | ||
2418 | - gtk_widget_show (hbox); | ||
2419 | - | ||
2420 | - /* Add bookmark button */ | ||
2421 | - | ||
2422 | - impl->browse_shortcuts_add_button = button_new (impl, | ||
2423 | - _("_Add"), | ||
2424 | - GTK_STOCK_ADD, | ||
2425 | - FALSE, | ||
2426 | - TRUE, | ||
2427 | - G_CALLBACK (add_bookmark_button_clicked_cb)); | ||
2428 | - gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_add_button, TRUE, TRUE, 0); | ||
2429 | - gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button, | ||
2430 | - _("Add the selected folder to the bookmarks"), NULL); | ||
2431 | - | ||
2432 | - /* Remove bookmark button */ | ||
2433 | - | ||
2434 | - impl->browse_shortcuts_remove_button = button_new (impl, | ||
2435 | - _("_Remove"), | ||
2436 | - GTK_STOCK_REMOVE, | ||
2437 | - FALSE, | ||
2438 | - TRUE, | ||
2439 | - G_CALLBACK (remove_bookmark_button_clicked_cb)); | ||
2440 | - gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0); | ||
2441 | - gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button, | ||
2442 | - _("Remove the selected bookmark"), NULL); | ||
2443 | - | ||
2444 | - return vbox; | ||
2445 | -} | ||
2446 | |||
2447 | /* Handles key press events on the file list, so that we can trap Enter to | ||
2448 | * activate the default button on our own. Also, checks to see if '/' has been | ||
2449 | @@ -3040,14 +1099,11 @@ trap_activate_cb (GtkWidget *widget, | ||
2450 | gpointer data) | ||
2451 | { | ||
2452 | GtkFileChooserDefault *impl; | ||
2453 | - int modifiers; | ||
2454 | |||
2455 | impl = (GtkFileChooserDefault *) data; | ||
2456 | - | ||
2457 | - modifiers = gtk_accelerator_get_default_mod_mask (); | ||
2458 | |||
2459 | if (event->keyval == GDK_slash && | ||
2460 | - ! (event->state & (~GDK_SHIFT_MASK & modifiers))) | ||
2461 | + ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) | ||
2462 | { | ||
2463 | location_popup_handler (impl, "/"); | ||
2464 | return TRUE; | ||
2465 | @@ -3057,7 +1113,6 @@ trap_activate_cb (GtkWidget *widget, | ||
2466 | || event->keyval == GDK_ISO_Enter | ||
2467 | || event->keyval == GDK_KP_Enter | ||
2468 | || event->keyval == GDK_space) | ||
2469 | - && ((event->state && modifiers) == 0) | ||
2470 | && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || | ||
2471 | impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) | ||
2472 | { | ||
2473 | @@ -3077,37 +1132,7 @@ trap_activate_cb (GtkWidget *widget, | ||
2474 | return FALSE; | ||
2475 | } | ||
2476 | |||
2477 | -/* Callback used when the file list's popup menu is detached */ | ||
2478 | -static void | ||
2479 | -popup_menu_detach_cb (GtkWidget *attach_widget, | ||
2480 | - GtkMenu *menu) | ||
2481 | -{ | ||
2482 | - GtkFileChooserDefault *impl; | ||
2483 | - | ||
2484 | - impl = g_object_get_data (G_OBJECT (attach_widget), "GtkFileChooserDefault"); | ||
2485 | - g_assert (GTK_IS_FILE_CHOOSER_DEFAULT (impl)); | ||
2486 | - | ||
2487 | - impl->browse_files_popup_menu = NULL; | ||
2488 | - impl->browse_files_popup_menu_add_shortcut_item = NULL; | ||
2489 | - impl->browse_files_popup_menu_hidden_files_item = NULL; | ||
2490 | -} | ||
2491 | - | ||
2492 | -/* Callback used when the "Add to Shortcuts" menu item is activated */ | ||
2493 | -static void | ||
2494 | -add_to_shortcuts_cb (GtkMenuItem *item, | ||
2495 | - GtkFileChooserDefault *impl) | ||
2496 | -{ | ||
2497 | - bookmarks_add_selected_folder (impl); | ||
2498 | -} | ||
2499 | - | ||
2500 | -/* Callback used when the "Open Location" menu item is activated */ | ||
2501 | -static void | ||
2502 | -open_location_cb (GtkMenuItem *item, | ||
2503 | - GtkFileChooserDefault *impl) | ||
2504 | -{ | ||
2505 | - location_popup_handler (impl, ""); | ||
2506 | -} | ||
2507 | - | ||
2508 | +#if 0 | ||
2509 | /* Callback used when the "Show Hidden Files" menu item is toggled */ | ||
2510 | static void | ||
2511 | show_hidden_toggled_cb (GtkCheckMenuItem *item, | ||
2512 | @@ -3238,145 +1263,7 @@ file_list_drag_motion_cb (GtkWidget | ||
2513 | g_signal_stop_emission_by_name (widget, "drag-motion"); | ||
2514 | return TRUE; | ||
2515 | } | ||
2516 | - | ||
2517 | -/* Constructs the popup menu for the file list if needed */ | ||
2518 | -static void | ||
2519 | -file_list_build_popup_menu (GtkFileChooserDefault *impl) | ||
2520 | -{ | ||
2521 | - GtkWidget *item; | ||
2522 | - | ||
2523 | - if (impl->browse_files_popup_menu) | ||
2524 | - return; | ||
2525 | - | ||
2526 | - impl->browse_files_popup_menu = gtk_menu_new (); | ||
2527 | - gtk_menu_attach_to_widget (GTK_MENU (impl->browse_files_popup_menu), | ||
2528 | - impl->browse_files_tree_view, | ||
2529 | - popup_menu_detach_cb); | ||
2530 | - | ||
2531 | - item = gtk_image_menu_item_new_with_mnemonic (_("_Add to Shortcuts")); | ||
2532 | - impl->browse_files_popup_menu_add_shortcut_item = item; | ||
2533 | - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), | ||
2534 | - gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU)); | ||
2535 | - gtk_widget_set_sensitive (item, FALSE); | ||
2536 | - g_signal_connect (item, "activate", | ||
2537 | - G_CALLBACK (add_to_shortcuts_cb), impl); | ||
2538 | - gtk_widget_show (item); | ||
2539 | - gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item); | ||
2540 | - | ||
2541 | - item = gtk_image_menu_item_new_with_mnemonic (_("Open _Location")); | ||
2542 | - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), | ||
2543 | - gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU)); | ||
2544 | - g_signal_connect (item, "activate", | ||
2545 | - G_CALLBACK (open_location_cb), impl); | ||
2546 | - gtk_widget_show (item); | ||
2547 | - gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item); | ||
2548 | - | ||
2549 | - item = gtk_separator_menu_item_new (); | ||
2550 | - gtk_widget_show (item); | ||
2551 | - gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item); | ||
2552 | - | ||
2553 | - item = gtk_check_menu_item_new_with_mnemonic (_("Show _Hidden Files")); | ||
2554 | - impl->browse_files_popup_menu_hidden_files_item = item; | ||
2555 | - g_signal_connect (item, "toggled", | ||
2556 | - G_CALLBACK (show_hidden_toggled_cb), impl); | ||
2557 | - gtk_widget_show (item); | ||
2558 | - gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item); | ||
2559 | -} | ||
2560 | - | ||
2561 | -/* Updates the popup menu for the file list, creating it if necessary */ | ||
2562 | -static void | ||
2563 | -file_list_update_popup_menu (GtkFileChooserDefault *impl) | ||
2564 | -{ | ||
2565 | - file_list_build_popup_menu (impl); | ||
2566 | - | ||
2567 | - /* The sensitivity of the Add to Shortcuts item is set in | ||
2568 | - * bookmarks_check_add_sensitivity() | ||
2569 | - */ | ||
2570 | - | ||
2571 | - g_signal_handlers_block_by_func (impl->browse_files_popup_menu_hidden_files_item, | ||
2572 | - G_CALLBACK (show_hidden_toggled_cb), impl); | ||
2573 | - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->browse_files_popup_menu_hidden_files_item), | ||
2574 | - impl->show_hidden); | ||
2575 | - g_signal_handlers_unblock_by_func (impl->browse_files_popup_menu_hidden_files_item, | ||
2576 | - G_CALLBACK (show_hidden_toggled_cb), impl); | ||
2577 | -} | ||
2578 | - | ||
2579 | -static void | ||
2580 | -popup_position_func (GtkMenu *menu, | ||
2581 | - gint *x, | ||
2582 | - gint *y, | ||
2583 | - gboolean *push_in, | ||
2584 | - gpointer user_data) | ||
2585 | -{ | ||
2586 | - GtkWidget *widget = GTK_WIDGET (user_data); | ||
2587 | - GdkScreen *screen = gtk_widget_get_screen (widget); | ||
2588 | - GtkRequisition req; | ||
2589 | - gint monitor_num; | ||
2590 | - GdkRectangle monitor; | ||
2591 | - | ||
2592 | - g_return_if_fail (GTK_WIDGET_REALIZED (widget)); | ||
2593 | - | ||
2594 | - gdk_window_get_origin (widget->window, x, y); | ||
2595 | - | ||
2596 | - gtk_widget_size_request (GTK_WIDGET (menu), &req); | ||
2597 | - | ||
2598 | - *x += (widget->allocation.width - req.width) / 2; | ||
2599 | - *y += (widget->allocation.height - req.height) / 2; | ||
2600 | - | ||
2601 | - monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); | ||
2602 | - gtk_menu_set_monitor (menu, monitor_num); | ||
2603 | - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); | ||
2604 | - | ||
2605 | - *x = CLAMP (*x, monitor.x, monitor.x + MAX (0, monitor.width - req.width)); | ||
2606 | - *y = CLAMP (*y, monitor.y, monitor.y + MAX (0, monitor.height - req.height)); | ||
2607 | - | ||
2608 | - *push_in = FALSE; | ||
2609 | -} | ||
2610 | - | ||
2611 | -static void | ||
2612 | -file_list_popup_menu (GtkFileChooserDefault *impl, | ||
2613 | - GdkEventButton *event) | ||
2614 | -{ | ||
2615 | - file_list_update_popup_menu (impl); | ||
2616 | - if (event) | ||
2617 | - gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu), | ||
2618 | - NULL, NULL, NULL, NULL, | ||
2619 | - event->button, event->time); | ||
2620 | - else | ||
2621 | - { | ||
2622 | - gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu), | ||
2623 | - NULL, NULL, | ||
2624 | - popup_position_func, impl->browse_files_tree_view, | ||
2625 | - 0, GDK_CURRENT_TIME); | ||
2626 | - gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->browse_files_popup_menu), | ||
2627 | - FALSE); | ||
2628 | - } | ||
2629 | - | ||
2630 | -} | ||
2631 | - | ||
2632 | -/* Callback used for the GtkWidget::popup-menu signal of the file list */ | ||
2633 | -static gboolean | ||
2634 | -list_popup_menu_cb (GtkWidget *widget, | ||
2635 | - GtkFileChooserDefault *impl) | ||
2636 | -{ | ||
2637 | - file_list_popup_menu (impl, NULL); | ||
2638 | - return TRUE; | ||
2639 | -} | ||
2640 | - | ||
2641 | -/* Callback used when a button is pressed on the file list. We trap button 3 to | ||
2642 | - * bring up a popup menu. | ||
2643 | - */ | ||
2644 | -static gboolean | ||
2645 | -list_button_press_event_cb (GtkWidget *widget, | ||
2646 | - GdkEventButton *event, | ||
2647 | - GtkFileChooserDefault *impl) | ||
2648 | -{ | ||
2649 | - if (event->button != 3) | ||
2650 | - return FALSE; | ||
2651 | - | ||
2652 | - file_list_popup_menu (impl, event); | ||
2653 | - return TRUE; | ||
2654 | -} | ||
2655 | +#endif | ||
2656 | |||
2657 | /* Creates the widgets for the file list */ | ||
2658 | static GtkWidget * | ||
2659 | @@ -3414,17 +1301,6 @@ create_file_list (GtkFileChooserDefault | ||
2660 | G_CALLBACK (list_row_activated), impl); | ||
2661 | g_signal_connect (impl->browse_files_tree_view, "key-press-event", | ||
2662 | G_CALLBACK (trap_activate_cb), impl); | ||
2663 | - g_signal_connect (impl->browse_files_tree_view, "popup-menu", | ||
2664 | - G_CALLBACK (list_popup_menu_cb), impl); | ||
2665 | - g_signal_connect (impl->browse_files_tree_view, "button-press-event", | ||
2666 | - G_CALLBACK (list_button_press_event_cb), impl); | ||
2667 | - | ||
2668 | - g_signal_connect (impl->browse_files_tree_view, "drag-data-received", | ||
2669 | - G_CALLBACK (file_list_drag_data_received_cb), impl); | ||
2670 | - g_signal_connect (impl->browse_files_tree_view, "drag-drop", | ||
2671 | - G_CALLBACK (file_list_drag_drop_cb), impl); | ||
2672 | - g_signal_connect (impl->browse_files_tree_view, "drag-motion", | ||
2673 | - G_CALLBACK (file_list_drag_motion_cb), impl); | ||
2674 | |||
2675 | selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
2676 | gtk_tree_selection_set_select_function (selection, | ||
2677 | @@ -3495,70 +1371,163 @@ create_file_list (GtkFileChooserDefault | ||
2678 | return swin; | ||
2679 | } | ||
2680 | |||
2681 | -static GtkWidget * | ||
2682 | -create_path_bar (GtkFileChooserDefault *impl) | ||
2683 | +static void | ||
2684 | +up_button_clicked_cb (GtkButton *button, gpointer data) | ||
2685 | { | ||
2686 | - GtkWidget *path_bar; | ||
2687 | - | ||
2688 | - path_bar = g_object_new (GTK_TYPE_PATH_BAR, NULL); | ||
2689 | - _gtk_path_bar_set_file_system (GTK_PATH_BAR (path_bar), impl->file_system); | ||
2690 | - | ||
2691 | - return path_bar; | ||
2692 | + GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (data); | ||
2693 | + up_folder_handler (impl); | ||
2694 | } | ||
2695 | |||
2696 | static void | ||
2697 | -set_filter_tooltip (GtkWidget *widget, | ||
2698 | - gpointer data) | ||
2699 | +volume_button_clicked_cb (GtkButton *button, gpointer data) | ||
2700 | { | ||
2701 | - GtkTooltips *tooltips = (GtkTooltips *)data; | ||
2702 | - | ||
2703 | - if (GTK_IS_BUTTON (widget)) | ||
2704 | - gtk_tooltips_set_tip (tooltips, widget, | ||
2705 | - _("Select which types of files are shown"), | ||
2706 | - NULL); | ||
2707 | + GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (data); | ||
2708 | + GtkFilePath * path = g_object_get_data (G_OBJECT (button), "file-path"); | ||
2709 | + | ||
2710 | + change_folder_and_display_error (impl, path); | ||
2711 | } | ||
2712 | |||
2713 | -static void | ||
2714 | -realize_filter_combo (GtkWidget *combo, | ||
2715 | - gpointer data) | ||
2716 | +static GtkWidget * | ||
2717 | +create_bar (GtkFileChooserDefault *impl) | ||
2718 | { | ||
2719 | - GtkFileChooserDefault *impl = (GtkFileChooserDefault *)data; | ||
2720 | + GSList *list, *l; | ||
2721 | + int n; | ||
2722 | + GtkWidget *bar = gtk_hbox_new (FALSE, DEFAULT_SPACING); | ||
2723 | + GtkWidget *img; | ||
2724 | |||
2725 | - gtk_container_forall (GTK_CONTAINER (combo), | ||
2726 | - set_filter_tooltip, | ||
2727 | - impl->tooltips); | ||
2728 | + /* first the Up button */ | ||
2729 | + img = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON); | ||
2730 | + gtk_widget_show (img); | ||
2731 | + | ||
2732 | + impl->up_button = gtk_button_new (); | ||
2733 | + gtk_container_add (GTK_CONTAINER (impl->up_button), img); | ||
2734 | + gtk_widget_show (impl->up_button); | ||
2735 | + gtk_widget_set_sensitive (impl->up_button, FALSE); | ||
2736 | + gtk_button_set_focus_on_click (GTK_BUTTON (impl->up_button), FALSE); | ||
2737 | + | ||
2738 | + g_signal_connect (impl->up_button, "clicked", | ||
2739 | + G_CALLBACK (up_button_clicked_cb), impl); | ||
2740 | + gtk_box_pack_start (GTK_BOX(bar), impl->up_button, FALSE, FALSE, 0); | ||
2741 | + | ||
2742 | + impl->num_volumes = 0; | ||
2743 | + list = gtk_file_system_list_volumes (impl->file_system); | ||
2744 | + | ||
2745 | + n = 0; | ||
2746 | + | ||
2747 | + for (l = list; l; l = l->next, n++) | ||
2748 | + { | ||
2749 | + GtkFileSystemVolume *volume; | ||
2750 | + GdkPixbuf *pixbuf; | ||
2751 | + GtkWidget *button; | ||
2752 | + GtkWidget *image; | ||
2753 | + GtkFilePath *base_path; | ||
2754 | + gchar * file_name = NULL; | ||
2755 | + | ||
2756 | + volume = l->data; | ||
2757 | + base_path = | ||
2758 | + gtk_file_system_volume_get_base_path (impl->file_system, volume); | ||
2759 | + | ||
2760 | + if (impl->local_only) | ||
2761 | + { | ||
2762 | + gboolean is_local = | ||
2763 | + gtk_file_system_path_is_local (impl->file_system, base_path); | ||
2764 | + | ||
2765 | + if (!is_local) | ||
2766 | + { | ||
2767 | + gtk_file_path_free (base_path); | ||
2768 | + gtk_file_system_volume_free (impl->file_system, volume); | ||
2769 | + continue; | ||
2770 | + } | ||
2771 | + } | ||
2772 | + | ||
2773 | +#if 0 | ||
2774 | + label_copy = | ||
2775 | + gtk_file_system_volume_get_display_name (impl->file_system, volume); | ||
2776 | +#endif | ||
2777 | + pixbuf = | ||
2778 | + gtk_file_system_volume_render_icon (impl->file_system, volume, | ||
2779 | + GTK_WIDGET (impl), | ||
2780 | + impl->icon_size, NULL); | ||
2781 | + | ||
2782 | + button = gtk_button_new (); | ||
2783 | + image = gtk_image_new_from_pixbuf (pixbuf); | ||
2784 | + g_object_unref (G_OBJECT (pixbuf)); | ||
2785 | + gtk_container_add (GTK_CONTAINER (button), image); | ||
2786 | + gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE); | ||
2787 | + | ||
2788 | + file_name = | ||
2789 | + gtk_file_system_path_to_filename (impl->file_system, base_path); | ||
2790 | + | ||
2791 | + if (file_name && impl->root_folder && | ||
2792 | + strcmp (file_name, impl->root_folder) && | ||
2793 | + !strncmp (file_name, impl->root_folder, strlen (file_name))) | ||
2794 | + { | ||
2795 | + /* The base path is below the root folder; we replace it with | ||
2796 | + * the root folder | ||
2797 | + */ | ||
2798 | + gtk_file_path_free (base_path); | ||
2799 | + base_path = gtk_file_system_filename_to_path (impl->file_system, | ||
2800 | + impl->root_folder); | ||
2801 | + } | ||
2802 | + | ||
2803 | + g_free (file_name); | ||
2804 | + | ||
2805 | + gtk_widget_show_all (button); | ||
2806 | + | ||
2807 | + g_object_set_data (G_OBJECT (button), "file-path", base_path); | ||
2808 | + | ||
2809 | + g_signal_connect (button, "clicked", | ||
2810 | + G_CALLBACK (volume_button_clicked_cb), impl); | ||
2811 | + | ||
2812 | + gtk_box_pack_start (GTK_BOX(bar), button, FALSE, FALSE, 0); | ||
2813 | + } | ||
2814 | + | ||
2815 | + impl->num_volumes = n; | ||
2816 | + g_slist_free (list); | ||
2817 | + | ||
2818 | + gtk_widget_show (bar); | ||
2819 | + | ||
2820 | + return bar; | ||
2821 | } | ||
2822 | |||
2823 | /* Creates the widgets for the files/folders pane */ | ||
2824 | static GtkWidget * | ||
2825 | -file_pane_create (GtkFileChooserDefault *impl, | ||
2826 | - GtkSizeGroup *size_group) | ||
2827 | +file_pane_create (GtkFileChooserDefault *impl) | ||
2828 | { | ||
2829 | GtkWidget *vbox; | ||
2830 | GtkWidget *hbox; | ||
2831 | GtkWidget *widget; | ||
2832 | - | ||
2833 | - vbox = gtk_vbox_new (FALSE, 6); | ||
2834 | + vbox = gtk_vbox_new (FALSE, DEFAULT_SPACING); | ||
2835 | gtk_widget_show (vbox); | ||
2836 | |||
2837 | - /* The path bar and 'Create Folder' button */ | ||
2838 | - hbox = gtk_hbox_new (FALSE, 12); | ||
2839 | + /* The volume bar and 'Create Folder' button */ | ||
2840 | + hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING); | ||
2841 | gtk_widget_show (hbox); | ||
2842 | - impl->browse_path_bar = create_path_bar (impl); | ||
2843 | - g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl); | ||
2844 | - gtk_widget_show_all (impl->browse_path_bar); | ||
2845 | - gtk_box_pack_start (GTK_BOX (hbox), impl->browse_path_bar, TRUE, TRUE, 0); | ||
2846 | + impl->bar = create_bar (impl); | ||
2847 | + gtk_widget_show_all (impl->bar); | ||
2848 | + gtk_box_pack_start (GTK_BOX (hbox), impl->bar, TRUE, TRUE, 0); | ||
2849 | |||
2850 | /* Create Folder */ | ||
2851 | - impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder")); | ||
2852 | + widget = gtk_image_new_from_icon_name ("folder-new", GTK_ICON_SIZE_BUTTON); | ||
2853 | + gtk_widget_show (widget); | ||
2854 | + impl->browse_new_folder_button = gtk_button_new (); | ||
2855 | + gtk_container_add (GTK_CONTAINER (impl->browse_new_folder_button), widget); | ||
2856 | + gtk_button_set_focus_on_click (GTK_BUTTON (impl->browse_new_folder_button), | ||
2857 | + FALSE); | ||
2858 | + | ||
2859 | g_signal_connect (impl->browse_new_folder_button, "clicked", | ||
2860 | G_CALLBACK (new_folder_button_clicked), impl); | ||
2861 | gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0); | ||
2862 | + | ||
2863 | + widget = filter_create (impl); | ||
2864 | + gtk_widget_hide (widget); | ||
2865 | + gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 0); | ||
2866 | + | ||
2867 | gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); | ||
2868 | |||
2869 | - /* Box for lists and preview */ | ||
2870 | + /* Box for lists */ | ||
2871 | |||
2872 | - hbox = gtk_hbox_new (FALSE, PREVIEW_HBOX_SPACING); | ||
2873 | + hbox = gtk_hbox_new (FALSE, LIST_HBOX_SPACING); | ||
2874 | gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); | ||
2875 | gtk_widget_show (hbox); | ||
2876 | |||
2877 | @@ -3567,157 +1536,37 @@ file_pane_create (GtkFileChooserDefault | ||
2878 | widget = create_file_list (impl); | ||
2879 | gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); | ||
2880 | |||
2881 | - /* Preview */ | ||
2882 | - | ||
2883 | - impl->preview_box = gtk_vbox_new (FALSE, 12); | ||
2884 | - gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0); | ||
2885 | - /* Don't show preview box initially */ | ||
2886 | - | ||
2887 | - /* Filter combo */ | ||
2888 | - | ||
2889 | - impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12); | ||
2890 | - | ||
2891 | - widget = filter_create (impl); | ||
2892 | - | ||
2893 | - g_signal_connect (widget, "realize", | ||
2894 | - G_CALLBACK (realize_filter_combo), impl); | ||
2895 | - | ||
2896 | - gtk_widget_show (widget); | ||
2897 | - gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0); | ||
2898 | - | ||
2899 | - gtk_size_group_add_widget (size_group, impl->filter_combo_hbox); | ||
2900 | - gtk_box_pack_end (GTK_BOX (vbox), impl->filter_combo_hbox, FALSE, FALSE, 0); | ||
2901 | - | ||
2902 | return vbox; | ||
2903 | } | ||
2904 | -/* Callback used when the "Browse for more folders" expander is toggled */ | ||
2905 | -static void | ||
2906 | -expander_changed_cb (GtkExpander *expander, | ||
2907 | - GParamSpec *pspec, | ||
2908 | - GtkFileChooserDefault *impl) | ||
2909 | -{ | ||
2910 | - update_appearance (impl); | ||
2911 | -} | ||
2912 | - | ||
2913 | -/* Callback used when the selection changes in the save folder combo box */ | ||
2914 | -static void | ||
2915 | -save_folder_combo_changed_cb (GtkComboBox *combo, | ||
2916 | - GtkFileChooserDefault *impl) | ||
2917 | -{ | ||
2918 | - GtkTreeIter iter; | ||
2919 | - | ||
2920 | - if (impl->changing_folder) | ||
2921 | - return; | ||
2922 | - | ||
2923 | - if (gtk_combo_box_get_active_iter (combo, &iter)) | ||
2924 | - shortcuts_activate_iter (impl, &iter); | ||
2925 | -} | ||
2926 | - | ||
2927 | -/* Creates the combo box with the save folders */ | ||
2928 | -static GtkWidget * | ||
2929 | -save_folder_combo_create (GtkFileChooserDefault *impl) | ||
2930 | -{ | ||
2931 | - GtkWidget *combo; | ||
2932 | - GtkCellRenderer *cell; | ||
2933 | - | ||
2934 | - combo = g_object_new (GTK_TYPE_COMBO_BOX, | ||
2935 | - "model", impl->shortcuts_model, | ||
2936 | - "focus-on-click", FALSE, | ||
2937 | - NULL); | ||
2938 | - gtk_widget_show (combo); | ||
2939 | - | ||
2940 | - cell = gtk_cell_renderer_pixbuf_new (); | ||
2941 | - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE); | ||
2942 | - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, | ||
2943 | - "pixbuf", SHORTCUTS_COL_PIXBUF, | ||
2944 | - "visible", SHORTCUTS_COL_PIXBUF_VISIBLE, | ||
2945 | - "sensitive", SHORTCUTS_COL_PIXBUF_VISIBLE, | ||
2946 | - NULL); | ||
2947 | - | ||
2948 | - cell = gtk_cell_renderer_text_new (); | ||
2949 | - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); | ||
2950 | - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, | ||
2951 | - "text", SHORTCUTS_COL_NAME, | ||
2952 | - "sensitive", SHORTCUTS_COL_PIXBUF_VISIBLE, | ||
2953 | - NULL); | ||
2954 | - | ||
2955 | - gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo), | ||
2956 | - shortcuts_row_separator_func, | ||
2957 | - GINT_TO_POINTER (SHORTCUTS_COL_NAME), | ||
2958 | - NULL); | ||
2959 | - | ||
2960 | - g_signal_connect (combo, "changed", | ||
2961 | - G_CALLBACK (save_folder_combo_changed_cb), impl); | ||
2962 | - | ||
2963 | - return combo; | ||
2964 | -} | ||
2965 | |||
2966 | /* Creates the widgets specific to Save mode */ | ||
2967 | static GtkWidget * | ||
2968 | save_widgets_create (GtkFileChooserDefault *impl) | ||
2969 | { | ||
2970 | GtkWidget *vbox; | ||
2971 | - GtkWidget *table; | ||
2972 | + GtkWidget *hbox; | ||
2973 | GtkWidget *widget; | ||
2974 | - GtkWidget *alignment; | ||
2975 | - | ||
2976 | - vbox = gtk_vbox_new (FALSE, 12); | ||
2977 | |||
2978 | - table = gtk_table_new (2, 2, FALSE); | ||
2979 | - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); | ||
2980 | - gtk_widget_show (table); | ||
2981 | - gtk_table_set_row_spacings (GTK_TABLE (table), 12); | ||
2982 | - gtk_table_set_col_spacings (GTK_TABLE (table), 12); | ||
2983 | - | ||
2984 | - /* Name entry */ | ||
2985 | - | ||
2986 | - widget = gtk_label_new_with_mnemonic (_("_Name:")); | ||
2987 | + vbox = gtk_vbox_new (FALSE, 0); | ||
2988 | + hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING); | ||
2989 | + | ||
2990 | + widget = gtk_label_new (_("Name:")); | ||
2991 | gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); | ||
2992 | - gtk_table_attach (GTK_TABLE (table), widget, | ||
2993 | - 0, 1, 0, 1, | ||
2994 | - GTK_FILL, GTK_FILL, | ||
2995 | - 0, 0); | ||
2996 | + gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); | ||
2997 | gtk_widget_show (widget); | ||
2998 | |||
2999 | impl->save_file_name_entry = _gtk_file_chooser_entry_new (TRUE); | ||
3000 | _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), | ||
3001 | impl->file_system); | ||
3002 | - gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45); | ||
3003 | +/* gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45); */ | ||
3004 | gtk_entry_set_activates_default (GTK_ENTRY (impl->save_file_name_entry), TRUE); | ||
3005 | - gtk_table_attach (GTK_TABLE (table), impl->save_file_name_entry, | ||
3006 | - 1, 2, 0, 1, | ||
3007 | - GTK_EXPAND | GTK_FILL, 0, | ||
3008 | - 0, 0); | ||
3009 | + gtk_box_pack_start (GTK_BOX (hbox), impl->save_file_name_entry, | ||
3010 | + TRUE, TRUE, 0); | ||
3011 | gtk_widget_show (impl->save_file_name_entry); | ||
3012 | - gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->save_file_name_entry); | ||
3013 | - | ||
3014 | - /* Folder combo */ | ||
3015 | - impl->save_folder_label = gtk_label_new (NULL); | ||
3016 | - gtk_misc_set_alignment (GTK_MISC (impl->save_folder_label), 0.0, 0.5); | ||
3017 | - gtk_table_attach (GTK_TABLE (table), impl->save_folder_label, | ||
3018 | - 0, 1, 1, 2, | ||
3019 | - GTK_FILL, GTK_FILL, | ||
3020 | - 0, 0); | ||
3021 | - gtk_widget_show (impl->save_folder_label); | ||
3022 | - | ||
3023 | - impl->save_folder_combo = save_folder_combo_create (impl); | ||
3024 | - gtk_table_attach (GTK_TABLE (table), impl->save_folder_combo, | ||
3025 | - 1, 2, 1, 2, | ||
3026 | - GTK_EXPAND | GTK_FILL, GTK_FILL, | ||
3027 | - 0, 0); | ||
3028 | - gtk_label_set_mnemonic_widget (GTK_LABEL (impl->save_folder_label), impl->save_folder_combo); | ||
3029 | - | ||
3030 | - /* Expander */ | ||
3031 | - alignment = gtk_alignment_new (0.0, 0.5, 1.0, 1.0); | ||
3032 | - gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); | ||
3033 | - | ||
3034 | - impl->save_expander = gtk_expander_new_with_mnemonic (_("_Browse for other folders")); | ||
3035 | - gtk_container_add (GTK_CONTAINER (alignment), impl->save_expander); | ||
3036 | - g_signal_connect (impl->save_expander, "notify::expanded", | ||
3037 | - G_CALLBACK (expander_changed_cb), | ||
3038 | - impl); | ||
3039 | - gtk_widget_show_all (alignment); | ||
3040 | |||
3041 | + gtk_widget_show (hbox); | ||
3042 | + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); | ||
3043 | + | ||
3044 | return vbox; | ||
3045 | } | ||
3046 | |||
3047 | @@ -3725,29 +1574,11 @@ save_widgets_create (GtkFileChooserDefau | ||
3048 | static GtkWidget * | ||
3049 | browse_widgets_create (GtkFileChooserDefault *impl) | ||
3050 | { | ||
3051 | - GtkWidget *vbox; | ||
3052 | - GtkWidget *hpaned; | ||
3053 | GtkWidget *widget; | ||
3054 | - GtkSizeGroup *size_group; | ||
3055 | - | ||
3056 | - /* size group is used by the [+][-] buttons and the filter combo */ | ||
3057 | - size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); | ||
3058 | - vbox = gtk_vbox_new (FALSE, 12); | ||
3059 | - | ||
3060 | - /* Paned widget */ | ||
3061 | - hpaned = gtk_hpaned_new (); | ||
3062 | - gtk_widget_show (hpaned); | ||
3063 | - gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */ | ||
3064 | - gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); | ||
3065 | - | ||
3066 | - widget = shortcuts_pane_create (impl, size_group); | ||
3067 | - gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE); | ||
3068 | - widget = file_pane_create (impl, size_group); | ||
3069 | - gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE); | ||
3070 | |||
3071 | - g_object_unref (size_group); | ||
3072 | + widget = file_pane_create (impl); | ||
3073 | |||
3074 | - return vbox; | ||
3075 | + return widget; | ||
3076 | } | ||
3077 | |||
3078 | static GObject* | ||
3079 | @@ -3767,56 +1598,20 @@ gtk_file_chooser_default_constructor (GT | ||
3080 | |||
3081 | gtk_widget_push_composite_child (); | ||
3082 | |||
3083 | - /* Shortcuts model */ | ||
3084 | - | ||
3085 | - shortcuts_model_create (impl); | ||
3086 | - | ||
3087 | - /* Widgets for Save mode */ | ||
3088 | - impl->save_widgets = save_widgets_create (impl); | ||
3089 | - gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0); | ||
3090 | - | ||
3091 | /* The browse widgets */ | ||
3092 | impl->browse_widgets = browse_widgets_create (impl); | ||
3093 | gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0); | ||
3094 | |||
3095 | - /* Alignment to hold extra widget */ | ||
3096 | - impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0); | ||
3097 | - gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0); | ||
3098 | - | ||
3099 | + /* Widgets for Save mode */ | ||
3100 | + impl->save_widgets = save_widgets_create (impl); | ||
3101 | + gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0); | ||
3102 | + | ||
3103 | gtk_widget_pop_composite_child (); | ||
3104 | update_appearance (impl); | ||
3105 | |||
3106 | return object; | ||
3107 | } | ||
3108 | |||
3109 | -/* Sets the extra_widget by packing it in the appropriate place */ | ||
3110 | -static void | ||
3111 | -set_extra_widget (GtkFileChooserDefault *impl, | ||
3112 | - GtkWidget *extra_widget) | ||
3113 | -{ | ||
3114 | - if (extra_widget) | ||
3115 | - { | ||
3116 | - g_object_ref (extra_widget); | ||
3117 | - /* FIXME: is this right ? */ | ||
3118 | - gtk_widget_show (extra_widget); | ||
3119 | - } | ||
3120 | - | ||
3121 | - if (impl->extra_widget) | ||
3122 | - { | ||
3123 | - gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget); | ||
3124 | - g_object_unref (impl->extra_widget); | ||
3125 | - } | ||
3126 | - | ||
3127 | - impl->extra_widget = extra_widget; | ||
3128 | - if (impl->extra_widget) | ||
3129 | - { | ||
3130 | - gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget); | ||
3131 | - gtk_widget_show (impl->extra_align); | ||
3132 | - } | ||
3133 | - else | ||
3134 | - gtk_widget_hide (impl->extra_align); | ||
3135 | -} | ||
3136 | - | ||
3137 | static void | ||
3138 | set_local_only (GtkFileChooserDefault *impl, | ||
3139 | gboolean local_only) | ||
3140 | @@ -3825,12 +1620,6 @@ set_local_only (GtkFileChooserDefault *i | ||
3141 | { | ||
3142 | impl->local_only = local_only; | ||
3143 | |||
3144 | - if (impl->shortcuts_model && impl->file_system) | ||
3145 | - { | ||
3146 | - shortcuts_add_volumes (impl); | ||
3147 | - shortcuts_add_bookmarks (impl); | ||
3148 | - } | ||
3149 | - | ||
3150 | if (local_only && | ||
3151 | !gtk_file_system_path_is_local (impl->file_system, impl->current_folder)) | ||
3152 | { | ||
3153 | @@ -3857,18 +1646,7 @@ static void | ||
3154 | volumes_changed_cb (GtkFileSystem *file_system, | ||
3155 | GtkFileChooserDefault *impl) | ||
3156 | { | ||
3157 | - shortcuts_add_volumes (impl); | ||
3158 | -} | ||
3159 | - | ||
3160 | -/* Callback used when the set of bookmarks changes in the file system */ | ||
3161 | -static void | ||
3162 | -bookmarks_changed_cb (GtkFileSystem *file_system, | ||
3163 | - GtkFileChooserDefault *impl) | ||
3164 | -{ | ||
3165 | - shortcuts_add_bookmarks (impl); | ||
3166 | - | ||
3167 | - bookmarks_check_add_sensitivity (impl); | ||
3168 | - bookmarks_check_remove_sensitivity (impl); | ||
3169 | + /* FIXME -- not needed */ | ||
3170 | } | ||
3171 | |||
3172 | /* Sets the file chooser to multiple selection mode */ | ||
3173 | @@ -3890,8 +1668,6 @@ set_select_multiple (GtkFileChooserDefau | ||
3174 | |||
3175 | impl->select_multiple = select_multiple; | ||
3176 | g_object_notify (G_OBJECT (impl), "select-multiple"); | ||
3177 | - | ||
3178 | - check_preview_change (impl); | ||
3179 | } | ||
3180 | |||
3181 | static void | ||
3182 | @@ -3902,8 +1678,6 @@ set_file_system_backend (GtkFileChooserD | ||
3183 | { | ||
3184 | g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id); | ||
3185 | impl->volumes_changed_id = 0; | ||
3186 | - g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id); | ||
3187 | - impl->bookmarks_changed_id = 0; | ||
3188 | g_object_unref (impl->file_system); | ||
3189 | } | ||
3190 | |||
3191 | @@ -3939,9 +1713,6 @@ set_file_system_backend (GtkFileChooserD | ||
3192 | impl->volumes_changed_id = g_signal_connect (impl->file_system, "volumes-changed", | ||
3193 | G_CALLBACK (volumes_changed_cb), | ||
3194 | impl); | ||
3195 | - impl->bookmarks_changed_id = g_signal_connect (impl->file_system, "bookmarks-changed", | ||
3196 | - G_CALLBACK (bookmarks_changed_cb), | ||
3197 | - impl); | ||
3198 | } | ||
3199 | } | ||
3200 | |||
3201 | @@ -3956,30 +1727,8 @@ update_appearance (GtkFileChooserDefault | ||
3202 | if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || | ||
3203 | impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3204 | { | ||
3205 | - const char *text; | ||
3206 | - | ||
3207 | gtk_widget_show (impl->save_widgets); | ||
3208 | - | ||
3209 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
3210 | - text = _("Save in _folder:"); | ||
3211 | - else | ||
3212 | - text = _("Create in _folder:"); | ||
3213 | - | ||
3214 | - gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->save_folder_label), text); | ||
3215 | - | ||
3216 | - if (gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander))) | ||
3217 | - { | ||
3218 | - gtk_widget_set_sensitive (impl->save_folder_label, FALSE); | ||
3219 | - gtk_widget_set_sensitive (impl->save_folder_combo, FALSE); | ||
3220 | - gtk_widget_show (impl->browse_widgets); | ||
3221 | - } | ||
3222 | - else | ||
3223 | - { | ||
3224 | - gtk_widget_set_sensitive (impl->save_folder_label, TRUE); | ||
3225 | - gtk_widget_set_sensitive (impl->save_folder_combo, TRUE); | ||
3226 | - gtk_widget_hide (impl->browse_widgets); | ||
3227 | - } | ||
3228 | - | ||
3229 | + gtk_widget_show (impl->browse_widgets); | ||
3230 | gtk_widget_show (impl->browse_new_folder_button); | ||
3231 | |||
3232 | if (impl->select_multiple) | ||
3233 | @@ -3993,6 +1742,7 @@ update_appearance (GtkFileChooserDefault | ||
3234 | impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) | ||
3235 | { | ||
3236 | gtk_widget_hide (impl->save_widgets); | ||
3237 | + gtk_widget_hide (impl->browse_new_folder_button); | ||
3238 | gtk_widget_show (impl->browse_widgets); | ||
3239 | } | ||
3240 | |||
3241 | @@ -4025,12 +1775,9 @@ gtk_file_chooser_default_set_property (G | ||
3242 | { | ||
3243 | gtk_file_chooser_default_unselect_all (GTK_FILE_CHOOSER (impl)); | ||
3244 | |||
3245 | - if ((action == GTK_FILE_CHOOSER_ACTION_SAVE || action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3246 | - && impl->select_multiple) | ||
3247 | + if (action == GTK_FILE_CHOOSER_ACTION_SAVE && impl->select_multiple) | ||
3248 | { | ||
3249 | - g_warning ("Tried to change the file chooser action to SAVE or CREATE_FOLDER, but " | ||
3250 | - "this is not allowed in multiple selection mode. Resetting the file chooser " | ||
3251 | - "to single selection mode."); | ||
3252 | + g_warning ("Multiple selection mode is not allowed in Save mode"); | ||
3253 | set_select_multiple (impl, FALSE, TRUE); | ||
3254 | } | ||
3255 | impl->action = action; | ||
3256 | @@ -4051,29 +1798,12 @@ gtk_file_chooser_default_set_property (G | ||
3257 | case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY: | ||
3258 | set_local_only (impl, g_value_get_boolean (value)); | ||
3259 | break; | ||
3260 | - case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: | ||
3261 | - set_preview_widget (impl, g_value_get_object (value)); | ||
3262 | - break; | ||
3263 | - case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: | ||
3264 | - impl->preview_widget_active = g_value_get_boolean (value); | ||
3265 | - update_preview_widget_visibility (impl); | ||
3266 | - break; | ||
3267 | - case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: | ||
3268 | - impl->use_preview_label = g_value_get_boolean (value); | ||
3269 | - update_preview_widget_visibility (impl); | ||
3270 | - break; | ||
3271 | - case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: | ||
3272 | - set_extra_widget (impl, g_value_get_object (value)); | ||
3273 | - break; | ||
3274 | case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: | ||
3275 | { | ||
3276 | gboolean select_multiple = g_value_get_boolean (value); | ||
3277 | - if ((impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3278 | - && select_multiple) | ||
3279 | + if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE && select_multiple) | ||
3280 | { | ||
3281 | - g_warning ("Tried to set the file chooser to multiple selection mode, but this is " | ||
3282 | - "not allowed in SAVE or CREATE_FOLDER modes. Ignoring the change and " | ||
3283 | - "leaving the file chooser in single selection mode."); | ||
3284 | + g_warning ("Multiple selection mode is not allowed in Save mode"); | ||
3285 | return; | ||
3286 | } | ||
3287 | |||
3288 | @@ -4092,6 +1822,19 @@ gtk_file_chooser_default_set_property (G | ||
3289 | } | ||
3290 | } | ||
3291 | break; | ||
3292 | + case GTK_FILE_CHOOSER_PROP_ROOT_FOLDER: | ||
3293 | + { | ||
3294 | + impl->root_folder = g_strdup (g_value_get_string (value)); | ||
3295 | + } | ||
3296 | + break; | ||
3297 | + | ||
3298 | + /* These are not supported */ | ||
3299 | + case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: | ||
3300 | + case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: | ||
3301 | + case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: | ||
3302 | + case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: | ||
3303 | + break; | ||
3304 | + | ||
3305 | default: | ||
3306 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
3307 | break; | ||
3308 | @@ -4117,24 +1860,30 @@ gtk_file_chooser_default_get_property (G | ||
3309 | case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY: | ||
3310 | g_value_set_boolean (value, impl->local_only); | ||
3311 | break; | ||
3312 | + case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: | ||
3313 | + g_value_set_boolean (value, impl->select_multiple); | ||
3314 | + break; | ||
3315 | + case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN: | ||
3316 | + g_value_set_boolean (value, impl->show_hidden); | ||
3317 | + break; | ||
3318 | + case GTK_FILE_CHOOSER_PROP_ROOT_FOLDER: | ||
3319 | + g_value_set_string (value, impl->root_folder); | ||
3320 | + break; | ||
3321 | + | ||
3322 | + /* These are not supported */ | ||
3323 | case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: | ||
3324 | - g_value_set_object (value, impl->preview_widget); | ||
3325 | + g_value_set_object (value, NULL); | ||
3326 | break; | ||
3327 | case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: | ||
3328 | - g_value_set_boolean (value, impl->preview_widget_active); | ||
3329 | + g_value_set_boolean (value, FALSE); | ||
3330 | break; | ||
3331 | case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: | ||
3332 | - g_value_set_boolean (value, impl->use_preview_label); | ||
3333 | + g_value_set_boolean (value, FALSE); | ||
3334 | break; | ||
3335 | case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: | ||
3336 | - g_value_set_object (value, impl->extra_widget); | ||
3337 | - break; | ||
3338 | - case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: | ||
3339 | - g_value_set_boolean (value, impl->select_multiple); | ||
3340 | - break; | ||
3341 | - case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN: | ||
3342 | - g_value_set_boolean (value, impl->show_hidden); | ||
3343 | + g_value_set_object (value, NULL); | ||
3344 | break; | ||
3345 | + | ||
3346 | default: | ||
3347 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
3348 | break; | ||
3349 | @@ -4162,12 +1911,6 @@ gtk_file_chooser_default_dispose (GObjec | ||
3350 | { | ||
3351 | GtkFileChooserDefault *impl = (GtkFileChooserDefault *) object; | ||
3352 | |||
3353 | - if (impl->extra_widget) | ||
3354 | - { | ||
3355 | - g_object_unref (impl->extra_widget); | ||
3356 | - impl->extra_widget = NULL; | ||
3357 | - } | ||
3358 | - | ||
3359 | remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl))); | ||
3360 | |||
3361 | G_OBJECT_CLASS (parent_class)->dispose (object); | ||
3362 | @@ -4180,12 +1923,7 @@ gtk_file_chooser_default_dispose (GObjec | ||
3363 | static void | ||
3364 | gtk_file_chooser_default_show_all (GtkWidget *widget) | ||
3365 | { | ||
3366 | - GtkFileChooserDefault *impl = (GtkFileChooserDefault *) widget; | ||
3367 | - | ||
3368 | gtk_widget_show (widget); | ||
3369 | - | ||
3370 | - if (impl->extra_widget) | ||
3371 | - gtk_widget_show_all (impl->extra_widget); | ||
3372 | } | ||
3373 | |||
3374 | /* Handler for GtkWindow::set-focus; this is where we save the last-focused | ||
3375 | @@ -4244,7 +1982,6 @@ change_icon_theme (GtkFileChooserDefault | ||
3376 | else | ||
3377 | impl->icon_size = FALLBACK_ICON_SIZE; | ||
3378 | |||
3379 | - shortcuts_reload_icons (impl); | ||
3380 | gtk_widget_queue_resize (impl->browse_files_tree_view); | ||
3381 | } | ||
3382 | |||
3383 | @@ -4380,8 +2117,6 @@ gtk_file_chooser_default_map (GtkWidget | ||
3384 | pending_select_paths_store_selection (impl); | ||
3385 | change_folder_and_display_error (impl, impl->current_folder); | ||
3386 | } | ||
3387 | - | ||
3388 | - bookmarks_changed_cb (impl->file_system, impl); | ||
3389 | } | ||
3390 | |||
3391 | static gboolean | ||
3392 | @@ -4668,18 +2403,21 @@ show_and_select_paths (GtkFileChooserDef | ||
3393 | GtkFileFolder *folder; | ||
3394 | gboolean success; | ||
3395 | gboolean have_hidden; | ||
3396 | - gboolean have_filtered; | ||
3397 | |||
3398 | if (!only_one_path && !paths) | ||
3399 | return TRUE; | ||
3400 | |||
3401 | +#ifdef GTK26 | ||
3402 | folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error); | ||
3403 | +#else | ||
3404 | + folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, NULL, NULL); | ||
3405 | +#endif | ||
3406 | + | ||
3407 | if (!folder) | ||
3408 | return FALSE; | ||
3409 | |||
3410 | success = FALSE; | ||
3411 | have_hidden = FALSE; | ||
3412 | - have_filtered = FALSE; | ||
3413 | |||
3414 | if (only_one_path) | ||
3415 | { | ||
3416 | @@ -4690,7 +2428,6 @@ show_and_select_paths (GtkFileChooserDef | ||
3417 | { | ||
3418 | success = TRUE; | ||
3419 | have_hidden = gtk_file_info_get_is_hidden (info); | ||
3420 | - have_filtered = get_is_file_filtered (impl, only_one_path, info); | ||
3421 | gtk_file_info_free (info); | ||
3422 | } | ||
3423 | } | ||
3424 | @@ -4712,12 +2449,9 @@ show_and_select_paths (GtkFileChooserDef | ||
3425 | if (!have_hidden) | ||
3426 | have_hidden = gtk_file_info_get_is_hidden (info); | ||
3427 | |||
3428 | - if (!have_filtered) | ||
3429 | - have_filtered = get_is_file_filtered (impl, path, info); | ||
3430 | - | ||
3431 | gtk_file_info_free (info); | ||
3432 | |||
3433 | - if (have_hidden && have_filtered) | ||
3434 | + if (have_hidden) | ||
3435 | break; /* we now have all the information we need */ | ||
3436 | } | ||
3437 | } | ||
3438 | @@ -4733,9 +2467,6 @@ show_and_select_paths (GtkFileChooserDef | ||
3439 | if (have_hidden) | ||
3440 | g_object_set (impl, "show-hidden", TRUE, NULL); | ||
3441 | |||
3442 | - if (have_filtered) | ||
3443 | - set_current_filter (impl, NULL); | ||
3444 | - | ||
3445 | if (only_one_path) | ||
3446 | _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl); | ||
3447 | else | ||
3448 | @@ -4778,13 +2509,11 @@ pending_select_paths_process (GtkFileCho | ||
3449 | * that case, the chooser's selection should be what the caller expects, | ||
3450 | * as the user can't see that something else got selected. See bug #165264. | ||
3451 | * | ||
3452 | - * Also, we don't select the first file if we are not in OPEN mode. Doing | ||
3453 | - * so would change the contents of the filename entry for SAVE or | ||
3454 | - * CREATE_FOLDER, which is undesired; in SELECT_FOLDER, we don't want to | ||
3455 | - * select a *different* folder from the one into which the user just | ||
3456 | - * navigated. | ||
3457 | + * Also, we don't select the first file if we are in SAVE or CREATE_FOLDER | ||
3458 | + * modes. Doing so would change the contents of the filename entry. | ||
3459 | */ | ||
3460 | - if (GTK_WIDGET_MAPPED (impl) && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN) | ||
3461 | + if (GTK_WIDGET_MAPPED (impl) | ||
3462 | + && !(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) | ||
3463 | browse_files_select_first_row (impl); | ||
3464 | } | ||
3465 | |||
3466 | @@ -4874,19 +2603,15 @@ update_chooser_entry (GtkFileChooserDefa | ||
3467 | const GtkFileInfo *info; | ||
3468 | GtkTreeIter iter; | ||
3469 | GtkTreeIter child_iter; | ||
3470 | - gboolean change_entry; | ||
3471 | |||
3472 | - if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) | ||
3473 | + if (impl->action != GTK_FILE_CHOOSER_ACTION_SAVE) | ||
3474 | return; | ||
3475 | |||
3476 | g_assert (!impl->select_multiple); | ||
3477 | selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
3478 | |||
3479 | if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) | ||
3480 | - { | ||
3481 | - _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), ""); | ||
3482 | - return; | ||
3483 | - } | ||
3484 | + return; | ||
3485 | |||
3486 | gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, | ||
3487 | &child_iter, | ||
3488 | @@ -4894,12 +2619,7 @@ update_chooser_entry (GtkFileChooserDefa | ||
3489 | |||
3490 | info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter); | ||
3491 | |||
3492 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
3493 | - change_entry = !gtk_file_info_get_is_folder (info); /* We don't want the name to change when clicking on a folder... */ | ||
3494 | - else | ||
3495 | - change_entry = TRUE; /* ... unless we are in CREATE_FOLDER mode */ | ||
3496 | - | ||
3497 | - if (change_entry) | ||
3498 | + if (!gtk_file_info_get_is_folder (info)) | ||
3499 | _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), | ||
3500 | gtk_file_info_get_display_name (info)); | ||
3501 | } | ||
3502 | @@ -4938,9 +2658,6 @@ gtk_file_chooser_default_update_current_ | ||
3503 | if (!check_is_folder (impl->file_system, path, error)) | ||
3504 | return FALSE; | ||
3505 | |||
3506 | - if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, keep_trail, error)) | ||
3507 | - return FALSE; | ||
3508 | - | ||
3509 | if (impl->current_folder != path) | ||
3510 | { | ||
3511 | if (impl->current_folder) | ||
3512 | @@ -4949,17 +2666,6 @@ gtk_file_chooser_default_update_current_ | ||
3513 | impl->current_folder = gtk_file_path_copy (path); | ||
3514 | } | ||
3515 | |||
3516 | - /* Update the widgets that may trigger a folder change themselves. */ | ||
3517 | - | ||
3518 | - if (!impl->changing_folder) | ||
3519 | - { | ||
3520 | - impl->changing_folder = TRUE; | ||
3521 | - | ||
3522 | - shortcuts_update_current_folder (impl); | ||
3523 | - | ||
3524 | - impl->changing_folder = FALSE; | ||
3525 | - } | ||
3526 | - | ||
3527 | /* Set the folder on the save entry */ | ||
3528 | |||
3529 | _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), | ||
3530 | @@ -4973,13 +2679,7 @@ gtk_file_chooser_default_update_current_ | ||
3531 | |||
3532 | /* Refresh controls */ | ||
3533 | |||
3534 | - shortcuts_find_current_folder (impl); | ||
3535 | - | ||
3536 | g_signal_emit_by_name (impl, "current-folder-changed", 0); | ||
3537 | - | ||
3538 | - check_preview_change (impl); | ||
3539 | - bookmarks_check_add_sensitivity (impl); | ||
3540 | - | ||
3541 | g_signal_emit_by_name (impl, "selection-changed", 0); | ||
3542 | |||
3543 | return result; | ||
3544 | @@ -5002,7 +2702,6 @@ gtk_file_chooser_default_set_current_nam | ||
3545 | g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE | ||
3546 | || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER); | ||
3547 | |||
3548 | - pending_select_paths_free (impl); | ||
3549 | _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name); | ||
3550 | } | ||
3551 | |||
3552 | @@ -5141,24 +2840,13 @@ gtk_file_chooser_default_unselect_all (G | ||
3553 | GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
3554 | |||
3555 | gtk_tree_selection_unselect_all (selection); | ||
3556 | - pending_select_paths_free (impl); | ||
3557 | } | ||
3558 | |||
3559 | -/* Checks whether the filename entry for the Save modes contains a well-formed filename. | ||
3560 | - * | ||
3561 | - * is_well_formed_ret - whether what the user typed passes gkt_file_system_make_path() | ||
3562 | - * | ||
3563 | - * is_empty_ret - whether the file entry is totally empty | ||
3564 | - * | ||
3565 | - * is_file_part_empty_ret - whether the file part is empty (will be if user types "foobar/", and | ||
3566 | - * the path will be "$cwd/foobar") | ||
3567 | - */ | ||
3568 | -static void | ||
3569 | +/* Checks whether the filename entry for the Save modes contains a valid filename */ | ||
3570 | +static GtkFilePath * | ||
3571 | check_save_entry (GtkFileChooserDefault *impl, | ||
3572 | - GtkFilePath **path_ret, | ||
3573 | - gboolean *is_well_formed_ret, | ||
3574 | - gboolean *is_empty_ret, | ||
3575 | - gboolean *is_file_part_empty_ret) | ||
3576 | + gboolean *is_valid, | ||
3577 | + gboolean *is_empty) | ||
3578 | { | ||
3579 | GtkFileChooserEntry *chooser_entry; | ||
3580 | const GtkFilePath *current_folder; | ||
3581 | @@ -5171,31 +2859,17 @@ check_save_entry (GtkFileChooserDefault | ||
3582 | |||
3583 | chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry); | ||
3584 | |||
3585 | - if (strlen (gtk_entry_get_text (GTK_ENTRY (chooser_entry))) == 0) | ||
3586 | - { | ||
3587 | - *path_ret = NULL; | ||
3588 | - *is_well_formed_ret = TRUE; | ||
3589 | - *is_empty_ret = TRUE; | ||
3590 | - *is_file_part_empty_ret = TRUE; | ||
3591 | - | ||
3592 | - return; | ||
3593 | - } | ||
3594 | - | ||
3595 | - *is_empty_ret = FALSE; | ||
3596 | - | ||
3597 | current_folder = _gtk_file_chooser_entry_get_current_folder (chooser_entry); | ||
3598 | file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry); | ||
3599 | |||
3600 | if (!file_part || file_part[0] == '\0') | ||
3601 | { | ||
3602 | - *path_ret = gtk_file_path_copy (current_folder); | ||
3603 | - *is_well_formed_ret = TRUE; | ||
3604 | - *is_file_part_empty_ret = TRUE; | ||
3605 | - | ||
3606 | - return; | ||
3607 | + *is_valid = FALSE; | ||
3608 | + *is_empty = TRUE; | ||
3609 | + return NULL; | ||
3610 | } | ||
3611 | |||
3612 | - *is_file_part_empty_ret = FALSE; | ||
3613 | + *is_empty = FALSE; | ||
3614 | |||
3615 | error = NULL; | ||
3616 | path = gtk_file_system_make_path (impl->file_system, current_folder, file_part, &error); | ||
3617 | @@ -5203,14 +2877,12 @@ check_save_entry (GtkFileChooserDefault | ||
3618 | if (!path) | ||
3619 | { | ||
3620 | error_building_filename_dialog (impl, current_folder, file_part, error); | ||
3621 | - *path_ret = NULL; | ||
3622 | - *is_well_formed_ret = FALSE; | ||
3623 | - | ||
3624 | - return; | ||
3625 | + *is_valid = FALSE; | ||
3626 | + return NULL; | ||
3627 | } | ||
3628 | |||
3629 | - *path_ret = path; | ||
3630 | - *is_well_formed_ret = TRUE; | ||
3631 | + *is_valid = TRUE; | ||
3632 | + return path; | ||
3633 | } | ||
3634 | |||
3635 | struct get_paths_closure { | ||
3636 | @@ -5256,21 +2928,11 @@ gtk_file_chooser_default_get_paths (GtkF | ||
3637 | if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE | ||
3638 | || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3639 | { | ||
3640 | - gboolean is_well_formed, is_empty, is_file_part_empty; | ||
3641 | - | ||
3642 | - check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty); | ||
3643 | + gboolean is_valid, is_empty; | ||
3644 | |||
3645 | - if (!is_well_formed) | ||
3646 | + info.path_from_entry = check_save_entry (impl, &is_valid, &is_empty); | ||
3647 | + if (!is_valid && !is_empty) | ||
3648 | return NULL; | ||
3649 | - | ||
3650 | - if (!is_empty) | ||
3651 | - { | ||
3652 | - if (is_file_part_empty && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
3653 | - { | ||
3654 | - gtk_file_path_free (info.path_from_entry); | ||
3655 | - return NULL; | ||
3656 | - } | ||
3657 | - } | ||
3658 | } | ||
3659 | |||
3660 | if (!info.path_from_entry || impl->select_multiple) | ||
3661 | @@ -5295,17 +2957,6 @@ gtk_file_chooser_default_get_paths (GtkF | ||
3662 | return g_slist_reverse (info.result); | ||
3663 | } | ||
3664 | |||
3665 | -static GtkFilePath * | ||
3666 | -gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser) | ||
3667 | -{ | ||
3668 | - GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); | ||
3669 | - | ||
3670 | - if (impl->preview_path) | ||
3671 | - return gtk_file_path_copy (impl->preview_path); | ||
3672 | - else | ||
3673 | - return NULL; | ||
3674 | -} | ||
3675 | - | ||
3676 | static GtkFileSystem * | ||
3677 | gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser) | ||
3678 | { | ||
3679 | @@ -5320,9 +2971,9 @@ show_filters (GtkFileChooserDefault *imp | ||
3680 | gboolean show) | ||
3681 | { | ||
3682 | if (show) | ||
3683 | - gtk_widget_show (impl->filter_combo_hbox); | ||
3684 | + gtk_widget_show (impl->filter_combo); | ||
3685 | else | ||
3686 | - gtk_widget_hide (impl->filter_combo_hbox); | ||
3687 | + gtk_widget_hide (impl->filter_combo); | ||
3688 | } | ||
3689 | |||
3690 | static void | ||
3691 | @@ -5332,6 +2983,8 @@ gtk_file_chooser_default_add_filter (Gtk | ||
3692 | GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); | ||
3693 | const gchar *name; | ||
3694 | |||
3695 | + g_debug ("adding filter"); | ||
3696 | + | ||
3697 | if (g_slist_find (impl->filters, filter)) | ||
3698 | { | ||
3699 | g_warning ("gtk_file_chooser_add_filter() called on filter already in list\n"); | ||
3700 | @@ -5400,140 +3053,6 @@ gtk_file_chooser_default_list_filters (G | ||
3701 | return g_slist_copy (impl->filters); | ||
3702 | } | ||
3703 | |||
3704 | -/* Returns the position in the shortcuts tree where the nth specified shortcut would appear */ | ||
3705 | -static int | ||
3706 | -shortcuts_get_pos_for_shortcut_folder (GtkFileChooserDefault *impl, | ||
3707 | - int pos) | ||
3708 | -{ | ||
3709 | - return pos + shortcuts_get_index (impl, SHORTCUTS_SHORTCUTS); | ||
3710 | -} | ||
3711 | - | ||
3712 | -static gboolean | ||
3713 | -gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser, | ||
3714 | - const GtkFilePath *path, | ||
3715 | - GError **error) | ||
3716 | -{ | ||
3717 | - GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); | ||
3718 | - gboolean result; | ||
3719 | - int pos; | ||
3720 | - | ||
3721 | - /* Test validity of path here. */ | ||
3722 | - if (!check_is_folder (impl->file_system, path, error)) | ||
3723 | - return FALSE; | ||
3724 | - | ||
3725 | - pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts); | ||
3726 | - | ||
3727 | - result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error); | ||
3728 | - | ||
3729 | - if (result) | ||
3730 | - impl->num_shortcuts++; | ||
3731 | - | ||
3732 | - if (impl->shortcuts_filter_model) | ||
3733 | - gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model)); | ||
3734 | - | ||
3735 | - return result; | ||
3736 | -} | ||
3737 | - | ||
3738 | -static gboolean | ||
3739 | -gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser, | ||
3740 | - const GtkFilePath *path, | ||
3741 | - GError **error) | ||
3742 | -{ | ||
3743 | - GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); | ||
3744 | - int pos; | ||
3745 | - GtkTreeIter iter; | ||
3746 | - char *uri; | ||
3747 | - int i; | ||
3748 | - | ||
3749 | - if (impl->num_shortcuts == 0) | ||
3750 | - goto out; | ||
3751 | - | ||
3752 | - pos = shortcuts_get_pos_for_shortcut_folder (impl, 0); | ||
3753 | - if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos)) | ||
3754 | - g_assert_not_reached (); | ||
3755 | - | ||
3756 | - for (i = 0; i < impl->num_shortcuts; i++) | ||
3757 | - { | ||
3758 | - gpointer col_data; | ||
3759 | - gboolean is_volume; | ||
3760 | - GtkFilePath *shortcut; | ||
3761 | - | ||
3762 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
3763 | - SHORTCUTS_COL_DATA, &col_data, | ||
3764 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
3765 | - -1); | ||
3766 | - g_assert (col_data != NULL); | ||
3767 | - g_assert (!is_volume); | ||
3768 | - | ||
3769 | - shortcut = col_data; | ||
3770 | - if (gtk_file_path_compare (shortcut, path) == 0) | ||
3771 | - { | ||
3772 | - shortcuts_remove_rows (impl, pos + i, 1); | ||
3773 | - impl->num_shortcuts--; | ||
3774 | - return TRUE; | ||
3775 | - } | ||
3776 | - | ||
3777 | - if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) | ||
3778 | - g_assert_not_reached (); | ||
3779 | - } | ||
3780 | - | ||
3781 | - out: | ||
3782 | - | ||
3783 | - uri = gtk_file_system_path_to_uri (impl->file_system, path); | ||
3784 | - g_set_error (error, | ||
3785 | - GTK_FILE_CHOOSER_ERROR, | ||
3786 | - GTK_FILE_CHOOSER_ERROR_NONEXISTENT, | ||
3787 | - _("Shortcut %s does not exist"), | ||
3788 | - uri); | ||
3789 | - g_free (uri); | ||
3790 | - | ||
3791 | - return FALSE; | ||
3792 | -} | ||
3793 | - | ||
3794 | -static GSList * | ||
3795 | -gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser) | ||
3796 | -{ | ||
3797 | - GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); | ||
3798 | - int pos; | ||
3799 | - GtkTreeIter iter; | ||
3800 | - int i; | ||
3801 | - GSList *list; | ||
3802 | - | ||
3803 | - if (impl->num_shortcuts == 0) | ||
3804 | - return NULL; | ||
3805 | - | ||
3806 | - pos = shortcuts_get_pos_for_shortcut_folder (impl, 0); | ||
3807 | - if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos)) | ||
3808 | - g_assert_not_reached (); | ||
3809 | - | ||
3810 | - list = NULL; | ||
3811 | - | ||
3812 | - for (i = 0; i < impl->num_shortcuts; i++) | ||
3813 | - { | ||
3814 | - gpointer col_data; | ||
3815 | - gboolean is_volume; | ||
3816 | - GtkFilePath *shortcut; | ||
3817 | - | ||
3818 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, | ||
3819 | - SHORTCUTS_COL_DATA, &col_data, | ||
3820 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
3821 | - -1); | ||
3822 | - g_assert (col_data != NULL); | ||
3823 | - g_assert (!is_volume); | ||
3824 | - | ||
3825 | - shortcut = col_data; | ||
3826 | - list = g_slist_prepend (list, gtk_file_path_copy (shortcut)); | ||
3827 | - | ||
3828 | - if (i != impl->num_shortcuts - 1) | ||
3829 | - { | ||
3830 | - if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) | ||
3831 | - g_assert_not_reached (); | ||
3832 | - } | ||
3833 | - } | ||
3834 | - | ||
3835 | - return g_slist_reverse (list); | ||
3836 | -} | ||
3837 | - | ||
3838 | /* Guesses a size based upon font sizes */ | ||
3839 | static void | ||
3840 | find_good_size_from_style (GtkWidget *widget, | ||
3841 | @@ -5544,7 +3063,6 @@ find_good_size_from_style (GtkWidget *wi | ||
3842 | gint default_width, default_height; | ||
3843 | int font_size; | ||
3844 | GtkRequisition req; | ||
3845 | - GtkRequisition preview_req; | ||
3846 | |||
3847 | g_assert (widget->style != NULL); | ||
3848 | impl = GTK_FILE_CHOOSER_DEFAULT (widget); | ||
3849 | @@ -5558,12 +3076,7 @@ find_good_size_from_style (GtkWidget *wi | ||
3850 | /* Use at least the requisition size not including the preview widget */ | ||
3851 | gtk_widget_size_request (widget, &req); | ||
3852 | |||
3853 | - if (impl->preview_widget_active && impl->preview_widget) | ||
3854 | - gtk_widget_size_request (impl->preview_box, &preview_req); | ||
3855 | - else | ||
3856 | - preview_req.width = 0; | ||
3857 | - | ||
3858 | - default_width = MAX (default_width, (req.width - (preview_req.width + PREVIEW_HBOX_SPACING))); | ||
3859 | + default_width = MAX (default_width, (req.width - (LIST_HBOX_SPACING))); | ||
3860 | default_height = MAX (default_height, req.height); | ||
3861 | |||
3862 | *width = default_width; | ||
3863 | @@ -5581,8 +3094,6 @@ gtk_file_chooser_default_get_default_siz | ||
3864 | |||
3865 | find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height); | ||
3866 | |||
3867 | - if (impl->preview_widget_active && impl->preview_widget) | ||
3868 | - *default_width += impl->preview_box->requisition.width + PREVIEW_HBOX_SPACING; | ||
3869 | } | ||
3870 | |||
3871 | static void | ||
3872 | @@ -5599,16 +3110,6 @@ gtk_file_chooser_default_get_resizable_h | ||
3873 | |||
3874 | *resize_horizontally = TRUE; | ||
3875 | *resize_vertically = TRUE; | ||
3876 | - | ||
3877 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || | ||
3878 | - impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3879 | - { | ||
3880 | - if (! gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander))) | ||
3881 | - { | ||
3882 | - *resize_horizontally = FALSE; | ||
3883 | - *resize_vertically = FALSE; | ||
3884 | - } | ||
3885 | - } | ||
3886 | } | ||
3887 | |||
3888 | struct switch_folder_closure { | ||
3889 | @@ -5675,84 +3176,49 @@ gtk_file_chooser_default_should_respond | ||
3890 | |||
3891 | if (current_focus == impl->browse_files_tree_view) | ||
3892 | { | ||
3893 | - /* The following array encodes what we do based on the impl->action and the | ||
3894 | - * number of files selected. | ||
3895 | - */ | ||
3896 | - typedef enum { | ||
3897 | - NOOP, /* Do nothing (don't respond) */ | ||
3898 | - RESPOND, /* Respond immediately */ | ||
3899 | - RESPOND_OR_SWITCH, /* Respond immediately if the selected item is a file; switch to it if it is a folder */ | ||
3900 | - ALL_FILES, /* Respond only if everything selected is a file */ | ||
3901 | - ALL_FOLDERS, /* Respond only if everything selected is a folder */ | ||
3902 | - SAVE_ENTRY, /* Go to the code for handling the save entry */ | ||
3903 | - NOT_REACHED /* Sanity check */ | ||
3904 | - } ActionToTake; | ||
3905 | - static const ActionToTake what_to_do[4][3] = { | ||
3906 | - /* 0 selected 1 selected many selected */ | ||
3907 | - /* ACTION_OPEN */ { NOOP, RESPOND_OR_SWITCH, ALL_FILES }, | ||
3908 | - /* ACTION_SAVE */ { SAVE_ENTRY, RESPOND_OR_SWITCH, NOT_REACHED }, | ||
3909 | - /* ACTION_SELECT_FOLDER */ { RESPOND, ALL_FOLDERS, ALL_FOLDERS }, | ||
3910 | - /* ACTION_CREATE_FOLDER */ { SAVE_ENTRY, ALL_FOLDERS, NOT_REACHED } | ||
3911 | - }; | ||
3912 | - | ||
3913 | int num_selected; | ||
3914 | gboolean all_files, all_folders; | ||
3915 | - int k; | ||
3916 | - ActionToTake action; | ||
3917 | |||
3918 | file_list: | ||
3919 | |||
3920 | - g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action <= GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER); | ||
3921 | - | ||
3922 | selection_check (impl, &num_selected, &all_files, &all_folders); | ||
3923 | |||
3924 | - if (num_selected > 2) | ||
3925 | - k = 2; | ||
3926 | - else | ||
3927 | - k = num_selected; | ||
3928 | - | ||
3929 | - action = what_to_do [impl->action] [k]; | ||
3930 | - | ||
3931 | - switch (action) | ||
3932 | + if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) | ||
3933 | { | ||
3934 | - case NOOP: | ||
3935 | - return FALSE; | ||
3936 | - | ||
3937 | - case RESPOND: | ||
3938 | - return TRUE; | ||
3939 | - | ||
3940 | - case RESPOND_OR_SWITCH: | ||
3941 | - g_assert (num_selected == 1); | ||
3942 | - | ||
3943 | - if (all_folders) | ||
3944 | + if (num_selected != 1) | ||
3945 | + return TRUE; /* zero means current folder; more than one means use the whole selection */ | ||
3946 | + else if (current_focus != impl->browse_files_tree_view) | ||
3947 | { | ||
3948 | - switch_to_selected_folder (impl); | ||
3949 | - return FALSE; | ||
3950 | + /* a single folder is selected and a button was clicked */ | ||
3951 | + switch_to_selected_folder (impl); | ||
3952 | + return TRUE; | ||
3953 | } | ||
3954 | - else | ||
3955 | - return TRUE; | ||
3956 | - | ||
3957 | - case ALL_FILES: | ||
3958 | - return all_files; | ||
3959 | - | ||
3960 | - case ALL_FOLDERS: | ||
3961 | - return all_folders; | ||
3962 | + } | ||
3963 | |||
3964 | - case SAVE_ENTRY: | ||
3965 | - goto save_entry; | ||
3966 | + if (num_selected == 0) | ||
3967 | + { | ||
3968 | + if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE | ||
3969 | + || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) | ||
3970 | + goto save_entry; /* it makes sense to use the typed name */ | ||
3971 | + else | ||
3972 | + return FALSE; | ||
3973 | + } | ||
3974 | |||
3975 | - default: | ||
3976 | - g_assert_not_reached (); | ||
3977 | + if (num_selected == 1 && all_folders) | ||
3978 | + { | ||
3979 | + switch_to_selected_folder (impl); | ||
3980 | + return FALSE; | ||
3981 | } | ||
3982 | + else | ||
3983 | + return all_files; | ||
3984 | } | ||
3985 | else if (current_focus == impl->save_file_name_entry) | ||
3986 | { | ||
3987 | GtkFilePath *path; | ||
3988 | - gboolean is_well_formed, is_empty, is_file_part_empty; | ||
3989 | + gboolean is_valid, is_empty; | ||
3990 | gboolean is_folder; | ||
3991 | gboolean retval; | ||
3992 | - GtkFileChooserEntry *entry; | ||
3993 | - GError *error; | ||
3994 | + GtkFileChooserEntry *entry; | ||
3995 | |||
3996 | save_entry: | ||
3997 | |||
3998 | @@ -5760,103 +3226,39 @@ gtk_file_chooser_default_should_respond | ||
3999 | || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER); | ||
4000 | |||
4001 | entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry); | ||
4002 | - check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty); | ||
4003 | + path = check_save_entry (impl, &is_valid, &is_empty); | ||
4004 | |||
4005 | - if (is_empty || !is_well_formed) | ||
4006 | + if (!is_empty && !is_valid) | ||
4007 | return FALSE; | ||
4008 | |||
4009 | - g_assert (path != NULL); | ||
4010 | - | ||
4011 | - error = NULL; | ||
4012 | - is_folder = check_is_folder (impl->file_system, path, &error); | ||
4013 | + if (is_empty) | ||
4014 | + path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry)); | ||
4015 | + | ||
4016 | + is_folder = check_is_folder (impl->file_system, path, NULL); | ||
4017 | if (is_folder) | ||
4018 | { | ||
4019 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
4020 | - { | ||
4021 | - _gtk_file_chooser_entry_set_file_part (entry, ""); | ||
4022 | - change_folder_and_display_error (impl, path); | ||
4023 | - retval = FALSE; | ||
4024 | - } | ||
4025 | - else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */ | ||
4026 | - { | ||
4027 | - /* The folder already exists, so we do not need to create it. | ||
4028 | - * Just respond to terminate the dialog. | ||
4029 | - */ | ||
4030 | - retval = TRUE; | ||
4031 | - } | ||
4032 | + _gtk_file_chooser_entry_set_file_part (entry, ""); | ||
4033 | + change_folder_and_display_error (impl, path); | ||
4034 | + retval = FALSE; | ||
4035 | } | ||
4036 | else | ||
4037 | { | ||
4038 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER | ||
4039 | - && g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER)) | ||
4040 | + /* check that everything up to the last component exists */ | ||
4041 | + gtk_file_path_free (path); | ||
4042 | + path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry)); | ||
4043 | + is_folder = check_is_folder (impl->file_system, path, NULL); | ||
4044 | + if (!is_folder) | ||
4045 | { | ||
4046 | - /* Oops, the user typed the name of an existing path which is not a folder */ | ||
4047 | - error_creating_folder_over_existing_file_dialog (impl, path, error); | ||
4048 | - error = NULL; /* as it will be freed below for the general case */ | ||
4049 | + change_folder_and_display_error (impl, path); | ||
4050 | retval = FALSE; | ||
4051 | } | ||
4052 | else | ||
4053 | - { | ||
4054 | - GtkFilePath *parent_path; | ||
4055 | - | ||
4056 | - /* check that everything up to the last component exists */ | ||
4057 | - | ||
4058 | - parent_path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry)); | ||
4059 | - is_folder = check_is_folder (impl->file_system, parent_path, NULL); | ||
4060 | - if (is_folder) | ||
4061 | - { | ||
4062 | - if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
4063 | - retval = TRUE; | ||
4064 | - else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */ | ||
4065 | - { | ||
4066 | - GError *create_error; | ||
4067 | - | ||
4068 | - create_error = NULL; | ||
4069 | - if (gtk_file_system_create_folder (impl->file_system, path, &create_error)) | ||
4070 | - retval = TRUE; | ||
4071 | - else | ||
4072 | - { | ||
4073 | - error_creating_folder_dialog (impl, path, create_error); | ||
4074 | - retval = FALSE; | ||
4075 | - } | ||
4076 | - } | ||
4077 | - } | ||
4078 | - else | ||
4079 | - { | ||
4080 | - /* This will display an error, which is what we want */ | ||
4081 | - change_folder_and_display_error (impl, parent_path); | ||
4082 | - retval = FALSE; | ||
4083 | - } | ||
4084 | - | ||
4085 | - gtk_file_path_free (parent_path); | ||
4086 | - } | ||
4087 | - | ||
4088 | - if (error != NULL) | ||
4089 | - g_error_free (error); | ||
4090 | + retval = TRUE; | ||
4091 | } | ||
4092 | |||
4093 | gtk_file_path_free (path); | ||
4094 | return retval; | ||
4095 | } | ||
4096 | - else if (impl->toplevel_last_focus_widget == impl->browse_shortcuts_tree_view) | ||
4097 | - { | ||
4098 | - /* The focus is on a dialog's action area button, *and* the widget that | ||
4099 | - * was focused immediately before it is the shortcuts list. Switch to the | ||
4100 | - * selected shortcut and tell the caller not to respond. | ||
4101 | - */ | ||
4102 | - GtkTreeIter iter; | ||
4103 | - | ||
4104 | - if (shortcuts_get_selected (impl, &iter)) | ||
4105 | - { | ||
4106 | - shortcuts_activate_iter (impl, &iter); | ||
4107 | - | ||
4108 | - gtk_widget_grab_focus (impl->browse_files_tree_view); | ||
4109 | - } | ||
4110 | - else | ||
4111 | - goto file_list; | ||
4112 | - | ||
4113 | - return FALSE; | ||
4114 | - } | ||
4115 | else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view) | ||
4116 | { | ||
4117 | /* The focus is on a dialog's action area button, *and* the widget that | ||
4118 | @@ -5944,199 +3346,6 @@ filter_combo_changed (GtkComboBox | ||
4119 | set_current_filter (impl, new_filter); | ||
4120 | } | ||
4121 | |||
4122 | -static void | ||
4123 | -check_preview_change (GtkFileChooserDefault *impl) | ||
4124 | -{ | ||
4125 | - GtkTreePath *cursor_path; | ||
4126 | - const GtkFilePath *new_path; | ||
4127 | - const GtkFileInfo *new_info; | ||
4128 | - | ||
4129 | - gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL); | ||
4130 | - if (cursor_path && impl->sort_model) | ||
4131 | - { | ||
4132 | - GtkTreeIter iter; | ||
4133 | - GtkTreeIter child_iter; | ||
4134 | - | ||
4135 | - gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path); | ||
4136 | - gtk_tree_path_free (cursor_path); | ||
4137 | - | ||
4138 | - gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter); | ||
4139 | - | ||
4140 | - new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter); | ||
4141 | - new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter); | ||
4142 | - } | ||
4143 | - else | ||
4144 | - { | ||
4145 | - new_path = NULL; | ||
4146 | - new_info = NULL; | ||
4147 | - } | ||
4148 | - | ||
4149 | - if (new_path != impl->preview_path && | ||
4150 | - !(new_path && impl->preview_path && | ||
4151 | - gtk_file_path_compare (new_path, impl->preview_path) == 0)) | ||
4152 | - { | ||
4153 | - if (impl->preview_path) | ||
4154 | - { | ||
4155 | - gtk_file_path_free (impl->preview_path); | ||
4156 | - g_free (impl->preview_display_name); | ||
4157 | - } | ||
4158 | - | ||
4159 | - if (new_path) | ||
4160 | - { | ||
4161 | - impl->preview_path = gtk_file_path_copy (new_path); | ||
4162 | - impl->preview_display_name = g_strdup (gtk_file_info_get_display_name (new_info)); | ||
4163 | - } | ||
4164 | - else | ||
4165 | - { | ||
4166 | - impl->preview_path = NULL; | ||
4167 | - impl->preview_display_name = NULL; | ||
4168 | - } | ||
4169 | - | ||
4170 | - if (impl->use_preview_label && impl->preview_label) | ||
4171 | - gtk_label_set_text (GTK_LABEL (impl->preview_label), impl->preview_display_name); | ||
4172 | - | ||
4173 | - g_signal_emit_by_name (impl, "update-preview"); | ||
4174 | - } | ||
4175 | -} | ||
4176 | - | ||
4177 | -/* Activates a volume by mounting it if necessary and then switching to its | ||
4178 | - * base path. | ||
4179 | - */ | ||
4180 | -static void | ||
4181 | -shortcuts_activate_volume (GtkFileChooserDefault *impl, | ||
4182 | - GtkFileSystemVolume *volume) | ||
4183 | -{ | ||
4184 | - GtkFilePath *path; | ||
4185 | - | ||
4186 | - /* We ref the file chooser since volume_mount() may run a main loop, and the | ||
4187 | - * user could close the file chooser window in the meantime. | ||
4188 | - */ | ||
4189 | - g_object_ref (impl); | ||
4190 | - | ||
4191 | - if (!gtk_file_system_volume_get_is_mounted (impl->file_system, volume)) | ||
4192 | - { | ||
4193 | - GError *error; | ||
4194 | - gboolean result; | ||
4195 | - | ||
4196 | - set_busy_cursor (impl, TRUE); | ||
4197 | - | ||
4198 | - error = NULL; | ||
4199 | - result = gtk_file_system_volume_mount (impl->file_system, volume, &error); | ||
4200 | - | ||
4201 | - if (!result) | ||
4202 | - { | ||
4203 | - char *msg; | ||
4204 | - | ||
4205 | - msg = g_strdup_printf (_("Could not mount %s"), | ||
4206 | - gtk_file_system_volume_get_display_name (impl->file_system, volume)); | ||
4207 | - error_message (impl, msg, error->message); | ||
4208 | - g_free (msg); | ||
4209 | - g_error_free (error); | ||
4210 | - } | ||
4211 | - | ||
4212 | - set_busy_cursor (impl, FALSE); | ||
4213 | - | ||
4214 | - if (!result) | ||
4215 | - goto out; | ||
4216 | - } | ||
4217 | - | ||
4218 | - path = gtk_file_system_volume_get_base_path (impl->file_system, volume); | ||
4219 | - change_folder_and_display_error (impl, path); | ||
4220 | - gtk_file_path_free (path); | ||
4221 | - | ||
4222 | - out: | ||
4223 | - | ||
4224 | - g_object_unref (impl); | ||
4225 | -} | ||
4226 | - | ||
4227 | -/* Opens the folder or volume at the specified iter in the shortcuts model */ | ||
4228 | -static void | ||
4229 | -shortcuts_activate_iter (GtkFileChooserDefault *impl, | ||
4230 | - GtkTreeIter *iter) | ||
4231 | -{ | ||
4232 | - gpointer col_data; | ||
4233 | - gboolean is_volume; | ||
4234 | - | ||
4235 | - gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter, | ||
4236 | - SHORTCUTS_COL_DATA, &col_data, | ||
4237 | - SHORTCUTS_COL_IS_VOLUME, &is_volume, | ||
4238 | - -1); | ||
4239 | - | ||
4240 | - if (!col_data) | ||
4241 | - return; /* We are on a separator */ | ||
4242 | - | ||
4243 | - if (is_volume) | ||
4244 | - { | ||
4245 | - GtkFileSystemVolume *volume; | ||
4246 | - | ||
4247 | - volume = col_data; | ||
4248 | - | ||
4249 | - shortcuts_activate_volume (impl, volume); | ||
4250 | - } | ||
4251 | - else | ||
4252 | - { | ||
4253 | - const GtkFilePath *file_path; | ||
4254 | - | ||
4255 | - file_path = col_data; | ||
4256 | - change_folder_and_display_error (impl, file_path); | ||
4257 | - } | ||
4258 | -} | ||
4259 | - | ||
4260 | -/* Callback used when a row in the shortcuts list is activated */ | ||
4261 | -static void | ||
4262 | -shortcuts_row_activated_cb (GtkTreeView *tree_view, | ||
4263 | - GtkTreePath *path, | ||
4264 | - GtkTreeViewColumn *column, | ||
4265 | - GtkFileChooserDefault *impl) | ||
4266 | -{ | ||
4267 | - GtkTreeIter iter; | ||
4268 | - GtkTreeIter child_iter; | ||
4269 | - | ||
4270 | - if (!gtk_tree_model_get_iter (impl->shortcuts_filter_model, &iter, path)) | ||
4271 | - return; | ||
4272 | - | ||
4273 | - gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model), | ||
4274 | - &child_iter, | ||
4275 | - &iter); | ||
4276 | - shortcuts_activate_iter (impl, &child_iter); | ||
4277 | - | ||
4278 | - gtk_widget_grab_focus (impl->browse_files_tree_view); | ||
4279 | -} | ||
4280 | - | ||
4281 | -/* Handler for GtkWidget::key-press-event on the shortcuts list */ | ||
4282 | -static gboolean | ||
4283 | -shortcuts_key_press_event_cb (GtkWidget *widget, | ||
4284 | - GdkEventKey *event, | ||
4285 | - GtkFileChooserDefault *impl) | ||
4286 | -{ | ||
4287 | - guint modifiers; | ||
4288 | - | ||
4289 | - modifiers = gtk_accelerator_get_default_mod_mask (); | ||
4290 | - | ||
4291 | - if ((event->keyval == GDK_BackSpace | ||
4292 | - || event->keyval == GDK_Delete | ||
4293 | - || event->keyval == GDK_KP_Delete) | ||
4294 | - && (event->state & modifiers) == 0) | ||
4295 | - { | ||
4296 | - remove_selected_bookmarks (impl); | ||
4297 | - return TRUE; | ||
4298 | - } | ||
4299 | - | ||
4300 | - return FALSE; | ||
4301 | -} | ||
4302 | - | ||
4303 | -static gboolean | ||
4304 | -shortcuts_select_func (GtkTreeSelection *selection, | ||
4305 | - GtkTreeModel *model, | ||
4306 | - GtkTreePath *path, | ||
4307 | - gboolean path_currently_selected, | ||
4308 | - gpointer data) | ||
4309 | -{ | ||
4310 | - GtkFileChooserDefault *impl = data; | ||
4311 | - | ||
4312 | - return (*gtk_tree_path_get_indices (path) != shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR)); | ||
4313 | -} | ||
4314 | - | ||
4315 | static gboolean | ||
4316 | list_select_func (GtkTreeSelection *selection, | ||
4317 | GtkTreeModel *model, | ||
4318 | @@ -6180,7 +3389,7 @@ list_selection_changed (GtkTreeSelection | ||
4319 | g_assert (!impl->select_multiple); | ||
4320 | selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
4321 | if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) | ||
4322 | - goto out; /* normal processing */ | ||
4323 | + return; | ||
4324 | |||
4325 | gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, | ||
4326 | &child_iter, | ||
4327 | @@ -6191,11 +3400,7 @@ list_selection_changed (GtkTreeSelection | ||
4328 | return; /* We are on the editable row for New Folder */ | ||
4329 | } | ||
4330 | |||
4331 | - out: | ||
4332 | - | ||
4333 | update_chooser_entry (impl); | ||
4334 | - check_preview_change (impl); | ||
4335 | - bookmarks_check_add_sensitivity (impl); | ||
4336 | |||
4337 | g_signal_emit_by_name (impl, "selection-changed", 0); | ||
4338 | } | ||
4339 | @@ -6232,23 +3437,6 @@ list_row_activated (GtkTreeView | ||
4340 | g_signal_emit_by_name (impl, "file-activated"); | ||
4341 | } | ||
4342 | |||
4343 | -static void | ||
4344 | -path_bar_clicked (GtkPathBar *path_bar, | ||
4345 | - GtkFilePath *file_path, | ||
4346 | - gboolean child_is_hidden, | ||
4347 | - GtkFileChooserDefault *impl) | ||
4348 | -{ | ||
4349 | - if (!change_folder_and_display_error (impl, file_path)) | ||
4350 | - return; | ||
4351 | - | ||
4352 | - /* Say we have "/foo/bar/[.baz]" and the user clicks on "bar". We should then | ||
4353 | - * show hidden files so that ".baz" appears in the file list, as it will still | ||
4354 | - * be shown in the path bar: "/foo/[bar]/.baz" | ||
4355 | - */ | ||
4356 | - if (child_is_hidden) | ||
4357 | - g_object_set (impl, "show-hidden", TRUE, NULL); | ||
4358 | -} | ||
4359 | - | ||
4360 | static const GtkFileInfo * | ||
4361 | get_list_file_info (GtkFileChooserDefault *impl, | ||
4362 | GtkTreeIter *iter) | ||
4363 | @@ -6415,33 +3603,31 @@ list_mtime_data_func (GtkTreeViewColumn | ||
4364 | |||
4365 | time_mtime = gtk_file_info_get_modification_time (info); | ||
4366 | |||
4367 | - if (time_mtime == 0) | ||
4368 | - strcpy (buf, _("Unknown")); | ||
4369 | - else | ||
4370 | - { | ||
4371 | - g_date_set_time (&mtime, (GTime) time_mtime); | ||
4372 | +#ifdef GTK26 | ||
4373 | + g_date_set_time (&mtime, (GTime) time_mtime); | ||
4374 | +#else | ||
4375 | + g_date_set_time_t (&mtime, time_mtime); | ||
4376 | +#endif | ||
4377 | + time_now = (GTime ) time (NULL); | ||
4378 | + g_date_set_time (&now, (GTime) time_now); | ||
4379 | |||
4380 | - time_now = (GTime ) time (NULL); | ||
4381 | - g_date_set_time (&now, (GTime) time_now); | ||
4382 | + days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime); | ||
4383 | |||
4384 | - days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime); | ||
4385 | + if (days_diff == 0) | ||
4386 | + strcpy (buf, _("Today")); | ||
4387 | + else if (days_diff == 1) | ||
4388 | + strcpy (buf, _("Yesterday")); | ||
4389 | + else | ||
4390 | + { | ||
4391 | + char *format; | ||
4392 | |||
4393 | - if (days_diff == 0) | ||
4394 | - strcpy (buf, _("Today")); | ||
4395 | - else if (days_diff == 1) | ||
4396 | - strcpy (buf, _("Yesterday")); | ||
4397 | + if (days_diff > 1 && days_diff < 7) | ||
4398 | + format = "%A"; /* Days from last week */ | ||
4399 | else | ||
4400 | - { | ||
4401 | - char *format; | ||
4402 | - | ||
4403 | - if (days_diff > 1 && days_diff < 7) | ||
4404 | - format = "%A"; /* Days from last week */ | ||
4405 | - else | ||
4406 | - format = "%x"; /* Any other date */ | ||
4407 | + format = "%x"; /* Any other date */ | ||
4408 | |||
4409 | - if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0) | ||
4410 | - strcpy (buf, _("Unknown")); | ||
4411 | - } | ||
4412 | + if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0) | ||
4413 | + strcpy (buf, _("Unknown")); | ||
4414 | } | ||
4415 | |||
4416 | if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || | ||
4417 | @@ -6534,8 +3720,11 @@ update_from_entry (GtkFileChooserDefault | ||
4418 | */ | ||
4419 | |||
4420 | error = NULL; | ||
4421 | +#ifdef GTK26 | ||
4422 | folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, &error); | ||
4423 | - | ||
4424 | +#else | ||
4425 | + folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, NULL, NULL); | ||
4426 | +#endif | ||
4427 | if (!folder) | ||
4428 | { | ||
4429 | error_getting_info_dialog (impl, folder_path, error); | ||
4430 | @@ -6645,8 +3834,8 @@ location_popup_handler (GtkFileChooserDe | ||
4431 | accept_stock, GTK_RESPONSE_ACCEPT, | ||
4432 | NULL); | ||
4433 | gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1); | ||
4434 | - gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); | ||
4435 | - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); | ||
4436 | + gtk_container_set_border_width (GTK_CONTAINER (dialog), DEFAULT_SPACING); | ||
4437 | + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), DEFAULT_SPACING); | ||
4438 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); | ||
4439 | |||
4440 | gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), | ||
4441 | @@ -6654,17 +3843,16 @@ location_popup_handler (GtkFileChooserDe | ||
4442 | GTK_RESPONSE_CANCEL, | ||
4443 | -1); | ||
4444 | |||
4445 | - hbox = gtk_hbox_new (FALSE, 12); | ||
4446 | + hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING); | ||
4447 | gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); | ||
4448 | gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); | ||
4449 | |||
4450 | - label = gtk_label_new_with_mnemonic (_("_Location:")); | ||
4451 | + label = gtk_label_new (_("Location:")); | ||
4452 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); | ||
4453 | |||
4454 | entry = location_entry_create (impl, path); | ||
4455 | |||
4456 | gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); | ||
4457 | - gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); | ||
4458 | |||
4459 | /* Run */ | ||
4460 | |||
4461 | @@ -6713,115 +3901,68 @@ location_popup_handler (GtkFileChooserDe | ||
4462 | static void | ||
4463 | up_folder_handler (GtkFileChooserDefault *impl) | ||
4464 | { | ||
4465 | + GtkFilePath * parent; | ||
4466 | pending_select_paths_add (impl, impl->current_folder); | ||
4467 | - _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar)); | ||
4468 | + | ||
4469 | + if (gtk_file_system_get_parent (impl->file_system, impl->current_folder, | ||
4470 | + &parent, NULL) && parent) | ||
4471 | + { | ||
4472 | + impl->path_history = g_slist_prepend (impl->path_history, | ||
4473 | + gtk_file_path_copy (impl->current_folder)); | ||
4474 | + | ||
4475 | + change_folder_and_display_error (impl, parent); | ||
4476 | + gtk_file_path_free (parent); | ||
4477 | + } | ||
4478 | } | ||
4479 | |||
4480 | /* Handler for the "down-folder" keybinding signal */ | ||
4481 | static void | ||
4482 | down_folder_handler (GtkFileChooserDefault *impl) | ||
4483 | { | ||
4484 | - _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar)); | ||
4485 | + if (impl->path_history) | ||
4486 | + { | ||
4487 | + const GtkFilePath * path = impl->path_history->data; | ||
4488 | + | ||
4489 | + change_folder_and_display_error (impl, path); | ||
4490 | + impl->path_history = g_slist_remove (impl->path_history, path); | ||
4491 | + gtk_file_path_free (path); | ||
4492 | + } | ||
4493 | } | ||
4494 | |||
4495 | /* Handler for the "home-folder" keybinding signal */ | ||
4496 | static void | ||
4497 | home_folder_handler (GtkFileChooserDefault *impl) | ||
4498 | { | ||
4499 | - int pos; | ||
4500 | - GtkTreeIter iter; | ||
4501 | - | ||
4502 | - if (!impl->has_home) | ||
4503 | - return; /* Should we put up an error dialog? */ | ||
4504 | - | ||
4505 | - pos = shortcuts_get_index (impl, SHORTCUTS_HOME); | ||
4506 | - if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos)) | ||
4507 | - g_assert_not_reached (); | ||
4508 | - | ||
4509 | - shortcuts_activate_iter (impl, &iter); | ||
4510 | -} | ||
4511 | - | ||
4512 | - | ||
4513 | - | ||
4514 | -/* Drag and drop interfaces */ | ||
4515 | - | ||
4516 | -static void | ||
4517 | -_shortcuts_model_filter_class_init (ShortcutsModelFilterClass *class) | ||
4518 | -{ | ||
4519 | } | ||
4520 | |||
4521 | -static void | ||
4522 | -_shortcuts_model_filter_init (ShortcutsModelFilter *model) | ||
4523 | +static GtkFilePath * | ||
4524 | +gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser) | ||
4525 | { | ||
4526 | - model->impl = NULL; | ||
4527 | + return NULL; | ||
4528 | } | ||
4529 | |||
4530 | -/* GtkTreeDragSource::row_draggable implementation for the shortcuts filter model */ | ||
4531 | static gboolean | ||
4532 | -shortcuts_model_filter_row_draggable (GtkTreeDragSource *drag_source, | ||
4533 | - GtkTreePath *path) | ||
4534 | +gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser, | ||
4535 | + const GtkFilePath *path, | ||
4536 | + GError **error) | ||
4537 | { | ||
4538 | - ShortcutsModelFilter *model; | ||
4539 | - int pos; | ||
4540 | - int bookmarks_pos; | ||
4541 | - | ||
4542 | - model = SHORTCUTS_MODEL_FILTER (drag_source); | ||
4543 | - | ||
4544 | - pos = *gtk_tree_path_get_indices (path); | ||
4545 | - bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS); | ||
4546 | - | ||
4547 | - return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks); | ||
4548 | + return FALSE; | ||
4549 | } | ||
4550 | |||
4551 | -/* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */ | ||
4552 | static gboolean | ||
4553 | -shortcuts_model_filter_drag_data_get (GtkTreeDragSource *drag_source, | ||
4554 | - GtkTreePath *path, | ||
4555 | - GtkSelectionData *selection_data) | ||
4556 | -{ | ||
4557 | - ShortcutsModelFilter *model; | ||
4558 | - | ||
4559 | - model = SHORTCUTS_MODEL_FILTER (drag_source); | ||
4560 | - | ||
4561 | - /* FIXME */ | ||
4562 | - | ||
4563 | - return FALSE; | ||
4564 | -} | ||
4565 | - | ||
4566 | -/* Fill the GtkTreeDragSourceIface vtable */ | ||
4567 | -static void | ||
4568 | -shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface) | ||
4569 | +gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser, | ||
4570 | + const GtkFilePath *path, | ||
4571 | + GError **error) | ||
4572 | { | ||
4573 | - iface->row_draggable = shortcuts_model_filter_row_draggable; | ||
4574 | - iface->drag_data_get = shortcuts_model_filter_drag_data_get; | ||
4575 | + return TRUE; | ||
4576 | } | ||
4577 | |||
4578 | -#if 0 | ||
4579 | -/* Fill the GtkTreeDragDestIface vtable */ | ||
4580 | -static void | ||
4581 | -shortcuts_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface) | ||
4582 | +static GSList * | ||
4583 | +gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser) | ||
4584 | { | ||
4585 | - iface->drag_data_received = shortcuts_model_filter_drag_data_received; | ||
4586 | - iface->row_drop_possible = shortcuts_model_filter_row_drop_possible; | ||
4587 | + return NULL; | ||
4588 | } | ||
4589 | -#endif | ||
4590 | - | ||
4591 | -static GtkTreeModel * | ||
4592 | -shortcuts_model_filter_new (GtkFileChooserDefault *impl, | ||
4593 | - GtkTreeModel *child_model, | ||
4594 | - GtkTreePath *root) | ||
4595 | -{ | ||
4596 | - ShortcutsModelFilter *model; | ||
4597 | - | ||
4598 | - model = g_object_new (SHORTCUTS_MODEL_FILTER_TYPE, | ||
4599 | - "child_model", child_model, | ||
4600 | - "virtual_root", root, | ||
4601 | - NULL); | ||
4602 | |||
4603 | - model->impl = impl; | ||
4604 | - | ||
4605 | - return GTK_TREE_MODEL (model); | ||
4606 | -} | ||
4607 | |||
4608 | #define __GTK_FILE_CHOOSER_DEFAULT_C__ | ||
4609 | #include "gtkaliasdef.c" | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/filechooser-respect-style.patch b/meta/packages/gtk+/gtk+-2.6.10/filechooser-respect-style.patch deleted file mode 100644 index 76c66a7d2a..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/filechooser-respect-style.patch +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | --- gtk+-2.6.8/gtk/gtkfilechooserdialog.c.orig 2007-02-09 12:18:25.000000000 +0000 | ||
2 | +++ gtk+-2.6.8/gtk/gtkfilechooserdialog.c 2007-02-09 12:18:25.000000000 +0000 | ||
3 | @@ -62,8 +62,6 @@ | ||
4 | |||
5 | static void gtk_file_chooser_dialog_map (GtkWidget *widget); | ||
6 | static void gtk_file_chooser_dialog_unmap (GtkWidget *widget); | ||
7 | -static void gtk_file_chooser_dialog_style_set (GtkWidget *widget, | ||
8 | - GtkStyle *previous_style); | ||
9 | |||
10 | static void response_cb (GtkDialog *dialog, | ||
11 | gint response_id); | ||
12 | @@ -122,7 +120,6 @@ | ||
13 | |||
14 | widget_class->map = gtk_file_chooser_dialog_map; | ||
15 | widget_class->unmap = gtk_file_chooser_dialog_unmap; | ||
16 | - widget_class->style_set = gtk_file_chooser_dialog_style_set; | ||
17 | |||
18 | _gtk_file_chooser_install_properties (gobject_class); | ||
19 | |||
20 | @@ -135,13 +132,19 @@ | ||
21 | GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog, | ||
22 | GTK_TYPE_FILE_CHOOSER_DIALOG, | ||
23 | GtkFileChooserDialogPrivate); | ||
24 | + | ||
25 | + GtkDialog *fc_dialog = GTK_DIALOG (dialog); | ||
26 | + | ||
27 | dialog->priv = priv; | ||
28 | dialog->priv->default_width = -1; | ||
29 | dialog->priv->default_height = -1; | ||
30 | dialog->priv->resize_horizontally = TRUE; | ||
31 | dialog->priv->resize_vertically = TRUE; | ||
32 | |||
33 | - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); | ||
34 | + gtk_dialog_set_has_separator (fc_dialog, FALSE); | ||
35 | + gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5); | ||
36 | + gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ | ||
37 | + gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5); | ||
38 | |||
39 | /* We do a signal connection here rather than overriding the method in | ||
40 | * class_init because GtkDialog::response is a RUN_LAST signal. We want *our* | ||
41 | @@ -394,6 +397,7 @@ | ||
42 | g_signal_connect (priv->widget, "default-size-changed", | ||
43 | G_CALLBACK (file_chooser_widget_default_size_changed), object); | ||
44 | |||
45 | + gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5); | ||
46 | gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0); | ||
47 | |||
48 | gtk_widget_show (priv->widget); | ||
49 | @@ -522,28 +526,6 @@ | ||
50 | gtk_widget_unmap (priv->widget); | ||
51 | } | ||
52 | |||
53 | -static void | ||
54 | -gtk_file_chooser_dialog_style_set (GtkWidget *widget, | ||
55 | - GtkStyle *previous_style) | ||
56 | -{ | ||
57 | - GtkDialog *dialog; | ||
58 | - | ||
59 | - if (GTK_WIDGET_CLASS (parent_class)->style_set) | ||
60 | - GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style); | ||
61 | - | ||
62 | - dialog = GTK_DIALOG (widget); | ||
63 | - | ||
64 | - /* Override the style properties with HIG-compliant spacings. Ugh. | ||
65 | - * http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs | ||
66 | - * http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing | ||
67 | - */ | ||
68 | - | ||
69 | - gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12); | ||
70 | - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 24); | ||
71 | - | ||
72 | - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0); | ||
73 | - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); | ||
74 | -} | ||
75 | |||
76 | /* GtkDialog::response handler */ | ||
77 | static void | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/filesystem-volumes.patch b/meta/packages/gtk+/gtk+-2.6.10/filesystem-volumes.patch deleted file mode 100644 index 4386d83ee9..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/filesystem-volumes.patch +++ /dev/null | |||
@@ -1,182 +0,0 @@ | |||
1 | --- gtk+-2.6.8/gtk/gtkfilesystemunix.c.orig 2007-02-08 12:01:19.000000000 +0000 | ||
2 | +++ gtk+-2.6.8/gtk/gtkfilesystemunix.c 2007-02-08 12:01:19.000000000 +0000 | ||
3 | @@ -33,6 +33,7 @@ | ||
4 | #include <errno.h> | ||
5 | #include <string.h> | ||
6 | #include <sys/stat.h> | ||
7 | +#include <sys/statvfs.h> | ||
8 | #include <sys/types.h> | ||
9 | #include <pwd.h> | ||
10 | #ifdef HAVE_UNISTD_H | ||
11 | @@ -358,7 +359,49 @@ | ||
12 | static GSList * | ||
13 | gtk_file_system_unix_list_volumes (GtkFileSystem *file_system) | ||
14 | { | ||
15 | - return g_slist_append (NULL, get_root_volume ()); | ||
16 | + struct statvfs stv; | ||
17 | + struct stat st; | ||
18 | + GSList * l = g_slist_append (NULL, get_root_volume ()); | ||
19 | + | ||
20 | + if (!statvfs ("/.", &stv)) | ||
21 | + { | ||
22 | + fsblkcnt_t root_blocks = stv.f_blocks; | ||
23 | + fsfilcnt_t root_files = stv.f_files; | ||
24 | + | ||
25 | + GDir * dir; | ||
26 | + if ((dir = g_dir_open ("/media", 0, NULL)) != NULL) | ||
27 | + { | ||
28 | + const gchar * name; | ||
29 | + while ((name = g_dir_read_name (dir)) != NULL) | ||
30 | + { | ||
31 | + gchar * abs_name = g_strconcat ("/media/", name, NULL); | ||
32 | + | ||
33 | + if (!stat (abs_name, &st) && S_ISDIR (st.st_mode)) | ||
34 | + { | ||
35 | + gchar * dot = g_strconcat (abs_name, "/.", NULL); | ||
36 | + if (!statvfs (dot, &stv) && | ||
37 | + (stv.f_blocks != root_blocks || | ||
38 | + stv.f_files != root_files)) | ||
39 | + { | ||
40 | + GtkFilePath * path = | ||
41 | + gtk_file_system_filename_to_path (file_system, | ||
42 | + abs_name); | ||
43 | + | ||
44 | + if (path) | ||
45 | + l = g_slist_append (l, path); | ||
46 | + } | ||
47 | + | ||
48 | + g_free (dot); | ||
49 | + } | ||
50 | + | ||
51 | + g_free (abs_name); | ||
52 | + } | ||
53 | + | ||
54 | + g_dir_close (dir); | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | + return l; | ||
59 | } | ||
60 | |||
61 | static GtkFileSystemVolume * | ||
62 | @@ -375,10 +418,15 @@ | ||
63 | |||
64 | len = strlen (filename); | ||
65 | |||
66 | - if (len > 1 && filename[len - 1] == '/') | ||
67 | - return g_strndup (filename, len - 1); | ||
68 | - else | ||
69 | - return g_memdup (filename, len + 1); | ||
70 | + if (len > 1) | ||
71 | + { | ||
72 | + gchar *c = g_utf8_prev_char (filename + len); | ||
73 | + | ||
74 | + if (c && *c == '/') | ||
75 | + return g_strndup (filename, len - 1); | ||
76 | + } | ||
77 | + | ||
78 | + return g_memdup (filename, len + 1); | ||
79 | } | ||
80 | |||
81 | static GtkFileFolder * | ||
82 | @@ -590,7 +638,7 @@ | ||
83 | gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system, | ||
84 | GtkFileSystemVolume *volume) | ||
85 | { | ||
86 | - return gtk_file_path_new_dup ("/"); | ||
87 | + return gtk_file_path_copy ((GtkFilePath*)volume); | ||
88 | } | ||
89 | |||
90 | static gboolean | ||
91 | @@ -616,7 +664,32 @@ | ||
92 | gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system, | ||
93 | GtkFileSystemVolume *volume) | ||
94 | { | ||
95 | - return g_strdup (_("Filesystem")); /* Same as Nautilus */ | ||
96 | + gchar * slash; | ||
97 | + gchar * path; | ||
98 | + gchar * c; | ||
99 | + | ||
100 | + g_return_val_if_fail (file_system && volume, NULL); | ||
101 | + | ||
102 | + path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume); | ||
103 | + | ||
104 | + g_return_val_if_fail (path && *path, NULL); | ||
105 | + | ||
106 | + if (path[0] == '/' && !path[1]) | ||
107 | + return g_strdup (_("Filesystem")); /* Same as Nautilus */ | ||
108 | + | ||
109 | + /* Now the media volumes */ | ||
110 | + /* strip trailing / if any */ | ||
111 | + c = g_utf8_prev_char (path + strlen(path)); | ||
112 | + | ||
113 | + if (*c == '/') | ||
114 | + *c = 0; | ||
115 | + | ||
116 | + slash = g_utf8_strrchr (path, -1, '/'); | ||
117 | + | ||
118 | + if (!slash) | ||
119 | + return g_strdup (path); | ||
120 | + | ||
121 | + return g_strdup (slash + 1); | ||
122 | } | ||
123 | |||
124 | static IconType | ||
125 | @@ -787,11 +860,54 @@ | ||
126 | GError **error) | ||
127 | { | ||
128 | GdkPixbuf *pixbuf; | ||
129 | + gchar * slash; | ||
130 | + gchar * path; | ||
131 | + gchar * c; | ||
132 | + const gchar * id = NULL; | ||
133 | + | ||
134 | + g_return_val_if_fail (file_system && volume, NULL); | ||
135 | + | ||
136 | + path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume); | ||
137 | |||
138 | - pixbuf = get_cached_icon (widget, "gnome-fs-blockdev", pixel_size); | ||
139 | - if (pixbuf) | ||
140 | - return pixbuf; | ||
141 | + g_return_val_if_fail (path && *path, NULL); | ||
142 | + | ||
143 | + if (path[0] == '/' && !path[1]) | ||
144 | + id = "gnome-fs-blockdev"; | ||
145 | + else | ||
146 | + { | ||
147 | + /* Now the media volumes */ | ||
148 | + /* strip trailing / if any */ | ||
149 | + c = g_utf8_prev_char (path + strlen(path)); | ||
150 | + | ||
151 | + if (*c == '/') | ||
152 | + *c = 0; | ||
153 | + | ||
154 | + slash = g_utf8_strrchr (path, -1, '/'); | ||
155 | |||
156 | + if (slash) | ||
157 | + { | ||
158 | + slash++; | ||
159 | + | ||
160 | + if (!strcmp (slash, "card")) | ||
161 | + id = "gnome-dev-media-sdmmc"; | ||
162 | + else if (!strcmp (slash, "cf")) | ||
163 | + id = "gnome-dev-media-cf"; | ||
164 | + else if (!strncmp (slash, "mmc", 3)) | ||
165 | + id = "gnome-dev-media-sdmmc"; | ||
166 | + else if (!strcmp (slash, "usbhdd")) | ||
167 | + id = "gnome-dev-removable-usb"; | ||
168 | + else | ||
169 | + id = "gnome-dev-removable"; | ||
170 | + } | ||
171 | + } | ||
172 | + | ||
173 | + if (id) | ||
174 | + { | ||
175 | + pixbuf = get_cached_icon (widget, id, pixel_size); | ||
176 | + if (pixbuf) | ||
177 | + return pixbuf; | ||
178 | + } | ||
179 | + | ||
180 | pixbuf = get_fallback_icon (widget, ICON_BLOCK_DEVICE, error); | ||
181 | g_assert (pixbuf != NULL); | ||
182 | |||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/gtk+-handhelds.patch b/meta/packages/gtk+/gtk+-2.6.10/gtk+-handhelds.patch deleted file mode 100644 index 20481f059b..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/gtk+-handhelds.patch +++ /dev/null | |||
@@ -1,236 +0,0 @@ | |||
1 | --- gtk+-2.4.1/gtk/gtkarrow.c 2004-03-13 09:51:13.000000000 +1100 | ||
2 | +++ gtk+-2.4.1/gtk/gtkarrow.c 2004-05-26 14:52:17.000000000 +1000 | ||
3 | @@ -29,7 +29,7 @@ | ||
4 | #include "gtkarrow.h" | ||
5 | #include "gtkintl.h" | ||
6 | |||
7 | -#define MIN_ARROW_SIZE 15 | ||
8 | +#define MIN_ARROW_SIZE 7 | ||
9 | |||
10 | enum { | ||
11 | PROP_0, | ||
12 | @@ -53,6 +53,8 @@ | ||
13 | guint prop_id, | ||
14 | GValue *value, | ||
15 | GParamSpec *pspec); | ||
16 | +static void gtk_arrow_size_request (GtkWidget *arrow, | ||
17 | + GtkRequisition *requisition); | ||
18 | |||
19 | GType | ||
20 | gtk_arrow_get_type (void) | ||
21 | @@ -111,6 +113,7 @@ | ||
22 | G_PARAM_READABLE | G_PARAM_WRITABLE)); | ||
23 | |||
24 | widget_class->expose_event = gtk_arrow_expose; | ||
25 | + widget_class->size_request = gtk_arrow_size_request; | ||
26 | } | ||
27 | |||
28 | static void | ||
29 | @@ -166,13 +169,18 @@ | ||
30 | } | ||
31 | |||
32 | static void | ||
33 | +gtk_arrow_size_request (GtkWidget *arrow, | ||
34 | + GtkRequisition *requisition) | ||
35 | +{ | ||
36 | + requisition->width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; | ||
37 | + requisition->height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; | ||
38 | +} | ||
39 | + | ||
40 | +static void | ||
41 | gtk_arrow_init (GtkArrow *arrow) | ||
42 | { | ||
43 | GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW); | ||
44 | |||
45 | - GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; | ||
46 | - GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; | ||
47 | - | ||
48 | arrow->arrow_type = GTK_ARROW_RIGHT; | ||
49 | arrow->shadow_type = GTK_SHADOW_OUT; | ||
50 | } | ||
51 | --- gtk+-2.4.1/gtk/gtkcalendar.c 2004-03-06 14:37:26.000000000 +1100 | ||
52 | +++ gtk+-2.4.1/gtk/gtkcalendar.c 2004-05-26 14:58:57.000000000 +1000 | ||
53 | @@ -340,6 +340,9 @@ | ||
54 | static void gtk_calendar_select_and_focus_day (GtkCalendar *calendar, | ||
55 | guint day); | ||
56 | |||
57 | +static void gtk_calendar_do_select_day (GtkCalendar *calendar, | ||
58 | + guint day); | ||
59 | + | ||
60 | static void gtk_calendar_paint_arrow (GtkWidget *widget, | ||
61 | guint arrow); | ||
62 | static void gtk_calendar_paint_day_num (GtkWidget *widget, | ||
63 | @@ -861,13 +864,13 @@ | ||
64 | if (month_len < calendar->selected_day) | ||
65 | { | ||
66 | calendar->selected_day = 0; | ||
67 | - gtk_calendar_select_day (calendar, month_len); | ||
68 | + gtk_calendar_do_select_day (calendar, month_len); | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | if (calendar->selected_day < 0) | ||
73 | calendar->selected_day = calendar->selected_day + 1 + month_length[leap (calendar->year)][calendar->month + 1]; | ||
74 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
75 | + gtk_calendar_do_select_day (calendar, calendar->selected_day); | ||
76 | } | ||
77 | |||
78 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
79 | @@ -908,10 +911,10 @@ | ||
80 | if (month_len < calendar->selected_day) | ||
81 | { | ||
82 | calendar->selected_day = 0; | ||
83 | - gtk_calendar_select_day (calendar, month_len); | ||
84 | + gtk_calendar_do_select_day (calendar, month_len); | ||
85 | } | ||
86 | else | ||
87 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
88 | + gtk_calendar_do_select_day (calendar, calendar->selected_day); | ||
89 | |||
90 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
91 | gtk_calendar_thaw (calendar); | ||
92 | @@ -939,10 +942,10 @@ | ||
93 | if (month_len < calendar->selected_day) | ||
94 | { | ||
95 | calendar->selected_day = 0; | ||
96 | - gtk_calendar_select_day (calendar, month_len); | ||
97 | + gtk_calendar_do_select_day (calendar, month_len); | ||
98 | } | ||
99 | else | ||
100 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
101 | + gtk_calendar_do_select_day (calendar, calendar->selected_day); | ||
102 | |||
103 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
104 | gtk_calendar_thaw (calendar); | ||
105 | @@ -974,10 +977,10 @@ | ||
106 | if (month_len < calendar->selected_day) | ||
107 | { | ||
108 | calendar->selected_day = 0; | ||
109 | - gtk_calendar_select_day (calendar, month_len); | ||
110 | + gtk_calendar_do_select_day (calendar, month_len); | ||
111 | } | ||
112 | else | ||
113 | - gtk_calendar_select_day (calendar, calendar->selected_day); | ||
114 | + gtk_calendar_do_select_day (calendar, calendar->selected_day); | ||
115 | |||
116 | gtk_widget_queue_draw (GTK_WIDGET (calendar)); | ||
117 | gtk_calendar_thaw (calendar); | ||
118 | @@ -2480,9 +2483,9 @@ | ||
119 | return TRUE; | ||
120 | } | ||
121 | |||
122 | -void | ||
123 | -gtk_calendar_select_day (GtkCalendar *calendar, | ||
124 | - guint day) | ||
125 | +static void | ||
126 | +gtk_calendar_do_select_day (GtkCalendar *calendar, | ||
127 | + guint day) | ||
128 | { | ||
129 | g_return_if_fail (GTK_IS_CALENDAR (calendar)); | ||
130 | g_return_if_fail (day <= 31); | ||
131 | @@ -2499,6 +2502,13 @@ | ||
132 | if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) | ||
133 | gtk_calendar_paint_day_num (GTK_WIDGET (calendar), selected_day); | ||
134 | } | ||
135 | +} | ||
136 | + | ||
137 | +void | ||
138 | +gtk_calendar_select_day (GtkCalendar *calendar, | ||
139 | + guint day) | ||
140 | +{ | ||
141 | + gtk_calendar_do_select_day (calendar, day); | ||
142 | |||
143 | calendar->selected_day = day; | ||
144 | |||
145 | --- gtk+-2.4.1/gtk/gtkentry.c 2004-04-22 08:08:08.000000000 +1000 | ||
146 | +++ gtk+-2.4.1/gtk/gtkentry.c 2004-05-26 14:52:17.000000000 +1000 | ||
147 | @@ -557,6 +557,15 @@ | ||
148 | 0.0, | ||
149 | G_PARAM_READABLE | G_PARAM_WRITABLE)); | ||
150 | |||
151 | + gtk_widget_class_install_style_property (widget_class, | ||
152 | + g_param_spec_int ("min_width", | ||
153 | + _("Minimum width"), | ||
154 | + _("Minimum width of the entry field"), | ||
155 | + 0, | ||
156 | + G_MAXINT, | ||
157 | + MIN_ENTRY_WIDTH, | ||
158 | + G_PARAM_READABLE)); | ||
159 | + | ||
160 | signals[POPULATE_POPUP] = | ||
161 | g_signal_new ("populate_popup", | ||
162 | G_OBJECT_CLASS_TYPE (gobject_class), | ||
163 | @@ -1124,7 +1133,7 @@ | ||
164 | { | ||
165 | GtkEntry *entry = GTK_ENTRY (widget); | ||
166 | PangoFontMetrics *metrics; | ||
167 | - gint xborder, yborder; | ||
168 | + gint xborder, yborder, min_width; | ||
169 | PangoContext *context; | ||
170 | |||
171 | gtk_widget_ensure_style (widget); | ||
172 | @@ -1140,9 +1149,11 @@ | ||
173 | |||
174 | xborder += INNER_BORDER; | ||
175 | yborder += INNER_BORDER; | ||
176 | - | ||
177 | + | ||
178 | + gtk_widget_style_get (widget, "min_width", &min_width, NULL); | ||
179 | + | ||
180 | if (entry->width_chars < 0) | ||
181 | - requisition->width = MIN_ENTRY_WIDTH + xborder * 2; | ||
182 | + requisition->width = min_width + xborder * 2; | ||
183 | else | ||
184 | { | ||
185 | gint char_width = pango_font_metrics_get_approximate_char_width (metrics); | ||
186 | --- gtk+-2.4.1/gtk/gtkrange.c 2004-03-06 14:38:08.000000000 +1100 | ||
187 | +++ gtk+-2.4.1/gtk/gtkrange.c 2004-05-26 14:52:17.000000000 +1000 | ||
188 | @@ -180,6 +180,7 @@ | ||
189 | static GtkWidgetClass *parent_class = NULL; | ||
190 | static guint signals[LAST_SIGNAL]; | ||
191 | |||
192 | +static GdkAtom recognize_protocols_atom, atom_atom; | ||
193 | |||
194 | GType | ||
195 | gtk_range_get_type (void) | ||
196 | @@ -220,6 +221,9 @@ | ||
197 | object_class = (GtkObjectClass*) class; | ||
198 | widget_class = (GtkWidgetClass*) class; | ||
199 | |||
200 | + recognize_protocols_atom = gdk_atom_intern ("RECOGNIZE_PROTOCOLS", FALSE); | ||
201 | + atom_atom = gdk_atom_intern ("ATOM", FALSE); | ||
202 | + | ||
203 | parent_class = g_type_class_peek_parent (class); | ||
204 | |||
205 | gobject_class->set_property = gtk_range_set_property; | ||
206 | @@ -815,6 +819,12 @@ | ||
207 | &attributes, attributes_mask); | ||
208 | gdk_window_set_user_data (range->event_window, range); | ||
209 | |||
210 | + gdk_property_change (range->event_window, | ||
211 | + recognize_protocols_atom, | ||
212 | + atom_atom, | ||
213 | + 32, GDK_PROP_MODE_REPLACE, | ||
214 | + NULL, 0); | ||
215 | + | ||
216 | widget->style = gtk_style_attach (widget->style, widget->window); | ||
217 | } | ||
218 | |||
219 | @@ -1186,7 +1196,7 @@ | ||
220 | |||
221 | /* ignore presses when we're already doing something else. */ | ||
222 | if (range->layout->grab_location != MOUSE_OUTSIDE) | ||
223 | - return FALSE; | ||
224 | + return TRUE; | ||
225 | |||
226 | range->layout->mouse_x = event->x; | ||
227 | range->layout->mouse_y = event->y; | ||
228 | @@ -1364,7 +1374,7 @@ | ||
229 | return TRUE; | ||
230 | } | ||
231 | |||
232 | - return FALSE; | ||
233 | + return TRUE; | ||
234 | } | ||
235 | |||
236 | /** | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/gtklabel-resize-patch b/meta/packages/gtk+/gtk+-2.6.10/gtklabel-resize-patch deleted file mode 100644 index df29656343..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/gtklabel-resize-patch +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | --- gtk+-2.4.3/gtk/gtklabel.c~ 2004-06-11 13:50:34.000000000 +0100 | ||
2 | +++ gtk+-2.4.3/gtk/gtklabel.c 2004-07-05 13:33:57.000000000 +0100 | ||
3 | @@ -1623,6 +1623,7 @@ | ||
4 | |||
5 | /* We have to clear the layout, fonts etc. may have changed */ | ||
6 | gtk_label_clear_layout (label); | ||
7 | + gtk_widget_queue_resize (GTK_WIDGET (label)); | ||
8 | } | ||
9 | |||
10 | static void | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/hardcoded_libtool.patch b/meta/packages/gtk+/gtk+-2.6.10/hardcoded_libtool.patch deleted file mode 100644 index b2afddcc61..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/hardcoded_libtool.patch +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | --- gtk+-2.6.0/configure.in.old 2005-01-01 16:23:45.000000000 +0000 | ||
2 | +++ gtk+-2.6.0/configure.in 2005-01-01 16:24:03.000000000 +0000 | ||
3 | @@ -360,7 +360,7 @@ | ||
4 | AC_MSG_CHECKING([Whether to write dependencies into .pc files]) | ||
5 | case $enable_explicit_deps in | ||
6 | auto) | ||
7 | - deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh` | ||
8 | + deplib_check_method=`($host_alias-libtool --config; echo eval echo \\$deplib_check_method) | sh` | ||
9 | if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then | ||
10 | enable_explicit_deps=yes | ||
11 | else | ||
12 | @@ -688,7 +688,7 @@ | ||
13 | dnl Now we check to see if our libtool supports shared lib deps | ||
14 | dnl (in a rather ugly way even) | ||
15 | if $dynworks; then | ||
16 | - pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config" | ||
17 | + pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} $host_alias-libtool --config" | ||
18 | pixbuf_deplibs_check=`$pixbuf_libtool_config | \ | ||
19 | grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \ | ||
20 | sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'` | ||
21 | @@ -1512,7 +1512,7 @@ | ||
22 | # | ||
23 | # We are using gmodule-no-export now, but I'm leaving the stripping | ||
24 | # code in place for now, since pango and atk still require gmodule. | ||
25 | -export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` | ||
26 | +export_dynamic=`($host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` | ||
27 | if test -n "$export_dynamic"; then | ||
28 | GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"` | ||
29 | GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"` | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/menu-deactivate.patch b/meta/packages/gtk+/gtk+-2.6.10/menu-deactivate.patch deleted file mode 100644 index 29e665fbf3..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/menu-deactivate.patch +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | --- gtk+-2.4.4/gtk/gtkmenushell.c.old Thu Aug 26 23:45:28 2004 | ||
2 | +++ gtk+-2.4.4/gtk/gtkmenushell.c Fri Aug 27 00:13:33 2004 | ||
3 | @@ -37,7 +37,7 @@ | ||
4 | #include "gtktearoffmenuitem.h" | ||
5 | #include "gtkwindow.h" | ||
6 | |||
7 | -#define MENU_SHELL_TIMEOUT 500 | ||
8 | +#define MENU_SHELL_TIMEOUT 2000 | ||
9 | |||
10 | enum { | ||
11 | DEACTIVATE, | ||
12 | @@ -156,6 +156,7 @@ | ||
13 | static GtkContainerClass *parent_class = NULL; | ||
14 | static guint menu_shell_signals[LAST_SIGNAL] = { 0 }; | ||
15 | |||
16 | +static int last_crossing_time; | ||
17 | |||
18 | GType | ||
19 | gtk_menu_shell_get_type (void) | ||
20 | @@ -418,6 +419,7 @@ | ||
21 | gtk_grab_add (GTK_WIDGET (menu_shell)); | ||
22 | menu_shell->have_grab = TRUE; | ||
23 | menu_shell->active = TRUE; | ||
24 | + last_crossing_time = 0; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | @@ -545,6 +547,13 @@ | ||
29 | menu_shell->activate_time = 0; | ||
30 | deactivate = FALSE; | ||
31 | } | ||
32 | + | ||
33 | + if (last_crossing_time != 0 | ||
34 | + && ((event->time - last_crossing_time) < 500)) | ||
35 | + { | ||
36 | + last_crossing_time = 0; | ||
37 | + deactivate = FALSE; | ||
38 | + } | ||
39 | |||
40 | if (deactivate) | ||
41 | { | ||
42 | @@ -597,6 +606,8 @@ | ||
43 | if (menu_shell->active) | ||
44 | { | ||
45 | menu_item = gtk_get_event_widget ((GdkEvent*) event); | ||
46 | + | ||
47 | + last_crossing_time = event->time; | ||
48 | |||
49 | if (!menu_item || | ||
50 | (GTK_IS_MENU_ITEM (menu_item) && | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/no-demos.patch b/meta/packages/gtk+/gtk+-2.6.10/no-demos.patch deleted file mode 100644 index 2f10a30dda..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/no-demos.patch +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | --- gtk+-2.4.1/Makefile.am~ 2004-01-17 22:15:56.000000000 +0000 | ||
2 | +++ gtk+-2.4.1/Makefile.am 2004-05-08 12:25:32.000000000 +0100 | ||
3 | @@ -1,6 +1,6 @@ | ||
4 | ## Makefile.am for GTK+ | ||
5 | |||
6 | -SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests contrib | ||
7 | +SRC_SUBDIRS = gdk-pixbuf gdk gtk modules tests contrib | ||
8 | SUBDIRS = po po-properties $(SRC_SUBDIRS) docs build m4macros | ||
9 | |||
10 | # require automake 1.4 | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/no-xwc.patch b/meta/packages/gtk+/gtk+-2.6.10/no-xwc.patch deleted file mode 100644 index affb4a303e..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/no-xwc.patch +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c | ||
2 | --- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2004-11-30 14:57:14 +00:00 | ||
3 | +++ gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2005-01-02 15:38:06 +00:00 | ||
4 | @@ -576,12 +576,14 @@ | ||
5 | GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2); | ||
6 | } | ||
7 | } | ||
8 | +#ifdef HAVE_XWC | ||
9 | else if (font->type == GDK_FONT_FONTSET) | ||
10 | { | ||
11 | XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font); | ||
12 | XmbDrawString (xdisplay, impl->xid, | ||
13 | fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length); | ||
14 | } | ||
15 | +#endif | ||
16 | else | ||
17 | g_error("undefined font type\n"); | ||
18 | } | ||
19 | @@ -613,6 +615,7 @@ | ||
20 | GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length); | ||
21 | g_free (text_8bit); | ||
22 | } | ||
23 | +#ifdef HAVE_XWC | ||
24 | else if (font->type == GDK_FONT_FONTSET) | ||
25 | { | ||
26 | if (sizeof(GdkWChar) == sizeof(wchar_t)) | ||
27 | @@ -633,6 +636,7 @@ | ||
28 | g_free (text_wchar); | ||
29 | } | ||
30 | } | ||
31 | +#endif | ||
32 | else | ||
33 | g_error("undefined font type\n"); | ||
34 | } | ||
35 | diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c gtk+-2.6.0/gdk/x11/gdkfont-x11.c | ||
36 | --- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2004-08-26 01:23:46 +01:00 | ||
37 | +++ gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2005-01-02 15:45:39 +00:00 | ||
38 | @@ -525,10 +525,12 @@ | ||
39 | width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2); | ||
40 | } | ||
41 | break; | ||
42 | +#ifdef HAVE_XWC | ||
43 | case GDK_FONT_FONTSET: | ||
44 | fontset = (XFontSet) private->xfont; | ||
45 | width = XmbTextEscapement (fontset, text, text_length); | ||
46 | break; | ||
47 | +#endif | ||
48 | default: | ||
49 | width = 0; | ||
50 | } | ||
51 | @@ -578,6 +580,7 @@ | ||
52 | width = 0; | ||
53 | } | ||
54 | break; | ||
55 | +#ifdef HAVE_XWC | ||
56 | case GDK_FONT_FONTSET: | ||
57 | if (sizeof(GdkWChar) == sizeof(wchar_t)) | ||
58 | { | ||
59 | @@ -595,6 +598,7 @@ | ||
60 | g_free (text_wchar); | ||
61 | } | ||
62 | break; | ||
63 | +#endif | ||
64 | default: | ||
65 | width = 0; | ||
66 | } | ||
67 | @@ -667,6 +671,7 @@ | ||
68 | if (descent) | ||
69 | *descent = overall.descent; | ||
70 | break; | ||
71 | +#ifdef HAVE_XWC | ||
72 | case GDK_FONT_FONTSET: | ||
73 | fontset = (XFontSet) private->xfont; | ||
74 | XmbTextExtents (fontset, text, text_length, &ink, &logical); | ||
75 | @@ -681,6 +686,7 @@ | ||
76 | if (descent) | ||
77 | *descent = ink.y + ink.height; | ||
78 | break; | ||
79 | +#endif | ||
80 | } | ||
81 | |||
82 | } | ||
83 | @@ -753,6 +759,7 @@ | ||
84 | *descent = overall.descent; | ||
85 | break; | ||
86 | } | ||
87 | +#ifdef HAVE_XWC | ||
88 | case GDK_FONT_FONTSET: | ||
89 | fontset = (XFontSet) private->xfont; | ||
90 | |||
91 | @@ -780,6 +787,7 @@ | ||
92 | if (descent) | ||
93 | *descent = ink.y + ink.height; | ||
94 | break; | ||
95 | +#endif | ||
96 | } | ||
97 | |||
98 | } | ||
99 | diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c gtk+-2.6.0/gdk/x11/gdkim-x11.c | ||
100 | --- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c 2004-11-17 00:55:10 +00:00 | ||
101 | +++ gtk+-2.6.0/gdk/x11/gdkim-x11.c 2005-01-02 15:42:04 +00:00 | ||
102 | @@ -48,6 +48,7 @@ | ||
103 | void | ||
104 | _gdk_x11_initialize_locale (void) | ||
105 | { | ||
106 | +#ifdef HAVE_XWC | ||
107 | wchar_t result; | ||
108 | gchar *current_locale; | ||
109 | static char *last_locale = NULL; | ||
110 | @@ -93,7 +94,8 @@ | ||
111 | GDK_NOTE (XIM, | ||
112 | g_message ("%s multi-byte string functions.", | ||
113 | gdk_use_mb ? "Using" : "Not using")); | ||
114 | - | ||
115 | +#endif | ||
116 | + | ||
117 | return; | ||
118 | } | ||
119 | |||
120 | @@ -136,6 +138,7 @@ | ||
121 | { | ||
122 | gchar *mbstr; | ||
123 | |||
124 | +#ifdef HAVE_XWC | ||
125 | if (gdk_use_mb) | ||
126 | { | ||
127 | GdkDisplay *display = find_a_display (); | ||
128 | @@ -178,6 +181,7 @@ | ||
129 | XFree (tpr.value); | ||
130 | } | ||
131 | else | ||
132 | +#endif | ||
133 | { | ||
134 | gint length = 0; | ||
135 | gint i; | ||
136 | @@ -210,6 +214,7 @@ | ||
137 | gint | ||
138 | gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) | ||
139 | { | ||
140 | +#ifdef HAVE_XWC | ||
141 | if (gdk_use_mb) | ||
142 | { | ||
143 | GdkDisplay *display = find_a_display (); | ||
144 | @@ -242,6 +247,7 @@ | ||
145 | return len_cpy; | ||
146 | } | ||
147 | else | ||
148 | +#endif | ||
149 | { | ||
150 | gint i; | ||
151 | |||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/range-no-redraw.patch b/meta/packages/gtk+/gtk+-2.6.10/range-no-redraw.patch deleted file mode 100644 index d168712282..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/range-no-redraw.patch +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | Index: gtk/gtkrange.c | ||
2 | =================================================================== | ||
3 | --- gtk/gtkrange.c (revision 18542) | ||
4 | +++ gtk/gtkrange.c (working copy) | ||
5 | @@ -1569,9 +1569,12 @@ | ||
6 | |||
7 | gtk_widget_queue_draw (GTK_WIDGET (range)); | ||
8 | /* This is so we don't lag the widget being scrolled. */ | ||
9 | +#if 0 | ||
10 | + /* Disable this, the scroll bar lags a bit but the end result is that | ||
11 | + scrolling treeviews is *a lot* smoother. See GNOME #460534. */ | ||
12 | if (GTK_WIDGET_REALIZED (range)) | ||
13 | gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE); | ||
14 | - | ||
15 | +#endif | ||
16 | /* Note that we don't round off to range->round_digits here. | ||
17 | * that's because it's really broken to change a value | ||
18 | * in response to a change signal on that value; round_digits | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/scroll-timings.patch b/meta/packages/gtk+/gtk+-2.6.10/scroll-timings.patch deleted file mode 100644 index a38b21dcc2..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/scroll-timings.patch +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | --- gtk+-2.4.4/gtk/gtkrange.c~ 2004-08-23 01:50:22.000000000 +0100 | ||
2 | +++ gtk+-2.4.4/gtk/gtkrange.c 2004-08-27 15:48:49.000000000 +0100 | ||
3 | @@ -35,9 +35,9 @@ | ||
4 | #include "gtkintl.h" | ||
5 | #include "gtkscrollbar.h" | ||
6 | |||
7 | -#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */ | ||
8 | -#define SCROLL_LATER_DELAY 100 /* ... it starts repeating at this rate */ | ||
9 | -#define UPDATE_DELAY 300 /* Delay for queued update */ | ||
10 | +#define SCROLL_INITIAL_DELAY 500 /* must hold button this long before ... */ | ||
11 | +#define SCROLL_LATER_DELAY 200 /* ... it starts repeating at this rate */ | ||
12 | +#define UPDATE_DELAY 1000 /* Delay for queued update */ | ||
13 | |||
14 | enum { | ||
15 | PROP_0, | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/smaller-filechooser.patch b/meta/packages/gtk+/gtk+-2.6.10/smaller-filechooser.patch deleted file mode 100644 index 3c6f7217e5..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/smaller-filechooser.patch +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | Index: gtkfilechooserdefault.c | ||
2 | =================================================================== | ||
3 | RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v | ||
4 | retrieving revision 1.240.2.25 | ||
5 | diff -u -p -r1.240.2.25 gtkfilechooserdefault.c | ||
6 | --- gtk+/gtk/gtkfilechooserdefault.c 7 Jul 2005 17:14:09 -0000 1.240.2.25 | ||
7 | +++ gtk+/gtk/gtkfilechooserdefault.c 27 Oct 2006 14:22:28 -0000 | ||
8 | @@ -3728,6 +3728,7 @@ browse_widgets_create (GtkFileChooserDef | ||
9 | GtkWidget *vbox; | ||
10 | GtkWidget *hpaned; | ||
11 | GtkWidget *widget; | ||
12 | + GtkWidget *shortcuts_pane; | ||
13 | GtkSizeGroup *size_group; | ||
14 | |||
15 | /* size group is used by the [+][-] buttons and the filter combo */ | ||
16 | @@ -3740,12 +3741,29 @@ browse_widgets_create (GtkFileChooserDef | ||
17 | gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */ | ||
18 | gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); | ||
19 | |||
20 | - widget = shortcuts_pane_create (impl, size_group); | ||
21 | - gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE); | ||
22 | + shortcuts_pane = shortcuts_pane_create (impl, size_group); | ||
23 | + gtk_paned_pack1 (GTK_PANED (hpaned), shortcuts_pane, FALSE, FALSE); | ||
24 | widget = file_pane_create (impl, size_group); | ||
25 | gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE); | ||
26 | |||
27 | g_object_unref (size_group); | ||
28 | + | ||
29 | + | ||
30 | + /* remove excess baggage from the filechooser for small displays */ | ||
31 | + | ||
32 | + /* get the columns in the tree view and remove the last column (should be Modified column) */ | ||
33 | + GList *column_list; | ||
34 | + column_list = gtk_tree_view_get_columns (GTK_TREE_VIEW (impl->browse_files_tree_view)); | ||
35 | + gtk_tree_view_remove_column (GTK_TREE_VIEW (impl->browse_files_tree_view), (g_list_last (column_list))->data); | ||
36 | + g_list_free (column_list); | ||
37 | + | ||
38 | + /* hide the tree view headers */ | ||
39 | + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_files_tree_view), FALSE); | ||
40 | + | ||
41 | + /* hide the shortcuts pane */ | ||
42 | + gtk_widget_hide (GTK_WIDGET (shortcuts_pane)); | ||
43 | + | ||
44 | + | ||
45 | |||
46 | return vbox; | ||
47 | } | ||
diff --git a/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff b/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff deleted file mode 100644 index ad3bc6e38c..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | Index: gtk/gtkcellrenderertoggle.c | ||
2 | =================================================================== | ||
3 | --- gtk/gtkcellrenderertoggle.c (revision 18542) | ||
4 | +++ gtk/gtkcellrenderertoggle.c (working copy) | ||
5 | @@ -80,6 +80,8 @@ | ||
6 | typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate; | ||
7 | struct _GtkCellRendererTogglePrivate | ||
8 | { | ||
9 | + gint indicator_size; | ||
10 | + GtkWidget *cached_widget; | ||
11 | guint inconsistent : 1; | ||
12 | }; | ||
13 | |||
14 | @@ -281,6 +283,27 @@ | ||
15 | } | ||
16 | |||
17 | static void | ||
18 | +on_widget_style_set (GtkWidget *widget, GtkStyle *previous, gpointer user_data) | ||
19 | +{ | ||
20 | + GtkCellRendererTogglePrivate *priv = user_data; | ||
21 | + PangoContext *context; | ||
22 | + PangoFontMetrics *metrics; | ||
23 | + int height; | ||
24 | + | ||
25 | + context = gtk_widget_get_pango_context (widget); | ||
26 | + metrics = pango_context_get_metrics (context, | ||
27 | + widget->style->font_desc, | ||
28 | + pango_context_get_language (context)); | ||
29 | + | ||
30 | + height = pango_font_metrics_get_ascent (metrics) + | ||
31 | + pango_font_metrics_get_descent (metrics); | ||
32 | + | ||
33 | + pango_font_metrics_unref (metrics); | ||
34 | + | ||
35 | + priv->indicator_size = PANGO_PIXELS (height * 0.85); | ||
36 | +} | ||
37 | + | ||
38 | +static void | ||
39 | gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell, | ||
40 | GtkWidget *widget, | ||
41 | GdkRectangle *cell_area, | ||
42 | @@ -291,10 +314,25 @@ | ||
43 | { | ||
44 | gint calc_width; | ||
45 | gint calc_height; | ||
46 | + GtkCellRendererTogglePrivate *priv; | ||
47 | |||
48 | - calc_width = (gint) cell->xpad * 2 + TOGGLE_WIDTH; | ||
49 | - calc_height = (gint) cell->ypad * 2 + TOGGLE_WIDTH; | ||
50 | + priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell); | ||
51 | |||
52 | + if (priv->cached_widget != widget) { | ||
53 | + if (priv->cached_widget) { | ||
54 | + g_object_remove_weak_pointer (widget, &priv->cached_widget); | ||
55 | + g_signal_handlers_disconnect_by_func (priv->cached_widget, on_widget_style_set, priv); | ||
56 | + } | ||
57 | + priv->cached_widget = widget; | ||
58 | + g_object_add_weak_pointer (widget, &priv->cached_widget); | ||
59 | + g_signal_connect (widget, "style-set", on_widget_style_set, priv); | ||
60 | + | ||
61 | + on_widget_style_set (widget, NULL, priv); | ||
62 | + } | ||
63 | + | ||
64 | + calc_width = (gint) cell->xpad * 2 + priv->indicator_size; | ||
65 | + calc_height = (gint) cell->ypad * 2 + priv->indicator_size; | ||
66 | + | ||
67 | if (width) | ||
68 | *width = calc_width; | ||
69 | |||
diff --git a/meta/packages/gtk+/gtk+_2.6.10.bb b/meta/packages/gtk+/gtk+_2.6.10.bb deleted file mode 100644 index 73e6fc3954..0000000000 --- a/meta/packages/gtk+/gtk+_2.6.10.bb +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | require gtk+.inc | ||
2 | |||
3 | PR = "r15" | ||
4 | |||
5 | SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ | ||
6 | file://no-demos.patch;patch=1 \ | ||
7 | file://no-xwc.patch;patch=1 \ | ||
8 | file://automake-lossage.patch;patch=1 \ | ||
9 | file://gtk+-handhelds.patch;patch=1 \ | ||
10 | file://hardcoded_libtool.patch;patch=1 \ | ||
11 | file://disable-tooltips.patch;patch=1 \ | ||
12 | file://gtklabel-resize-patch;patch=1 \ | ||
13 | file://menu-deactivate.patch;patch=1 \ | ||
14 | file://scroll-timings.patch;patch=1 \ | ||
15 | file://filesystem-volumes.patch;patch=1 \ | ||
16 | file://filechooser-respect-style.patch;patch=1 \ | ||
17 | file://filechooser-default.patch;patch=1 \ | ||
18 | file://toggle-font.diff;patch=1;pnum=0 \ | ||
19 | file://combo-arrow-size.patch;patch=1;pnum=0 \ | ||
20 | file://range-no-redraw.patch;patch=1;pnum=0 \ | ||
21 | " | ||
22 | |||
23 | EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest" | ||
24 | |||
25 | LIBV = "2.4.0" | ||
26 | LEAD_SONAME = "libgtk-x11*" | ||
27 | |||
28 | |||
29 | do_configure_prepend() { | ||
30 | for i in `find . -name "Makefile.am"` | ||
31 | do | ||
32 | sed -i -e s,-DG_DISABLE_DEPRECATED,-DSED_ROCKS_DUDES, $i | ||
33 | done | ||
34 | } | ||
35 | |||
36 | |||
37 | PACKAGES_DYNAMIC = "gdk-pixbuf-loader-* gtk-immodule-*" | ||
38 | |||
39 | python populate_packages_prepend () { | ||
40 | import os.path | ||
41 | |||
42 | prologue = bb.data.getVar("postinst_prologue", d, 1) | ||
43 | postinst_pixbufloader = bb.data.getVar("postinst_pixbufloader", d, 1) | ||
44 | |||
45 | gtk_libdir = bb.data.expand('${libdir}/gtk-2.0/${LIBV}', d) | ||
46 | loaders_root = os.path.join(gtk_libdir, 'loaders') | ||
47 | immodules_root = os.path.join(gtk_libdir, 'immodules') | ||
48 | |||
49 | do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s', postinst_pixbufloader) | ||
50 | do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules') | ||
51 | |||
52 | if (bb.data.getVar('DEBIAN_NAMES', d, 1)): | ||
53 | bb.data.setVar('PKG_${PN}', 'libgtk-2.0', d) | ||
54 | } | ||