file chooser: Cleanups
This commit is contained in:
@ -4189,19 +4189,15 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
|
||||
|
||||
static void
|
||||
stop_loading_and_clear_list_model (GtkFileChooserWidget *impl,
|
||||
gboolean remove_from_treeview)
|
||||
gboolean remove)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
load_remove_timer (impl, LOAD_EMPTY);
|
||||
|
||||
if (priv->browse_files_model)
|
||||
{
|
||||
g_object_unref (priv->browse_files_model);
|
||||
priv->browse_files_model = NULL;
|
||||
}
|
||||
g_set_object (&priv->browse_files_model, NULL);
|
||||
|
||||
if (remove_from_treeview)
|
||||
if (remove)
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
|
||||
}
|
||||
|
||||
@ -4221,6 +4217,18 @@ string_replace (const gchar *input,
|
||||
return output;
|
||||
}
|
||||
|
||||
static void
|
||||
replace_ratio (gchar **str)
|
||||
{
|
||||
if (g_get_charset (NULL))
|
||||
{
|
||||
gchar *ret;
|
||||
ret = string_replace (*str, ":", "\xE2\x80\x8E∶");
|
||||
g_free (*str);
|
||||
*str = ret;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
my_g_format_date_for_display (GtkFileChooserWidget *impl,
|
||||
glong secs)
|
||||
@ -4268,18 +4276,10 @@ my_g_format_date_for_display (GtkFileChooserWidget *impl,
|
||||
format = N_("%-e %b %Y");
|
||||
}
|
||||
|
||||
g_date_time_unref (now);
|
||||
|
||||
date_str = g_date_time_format (time, format);
|
||||
replace_ratio (&date_str);
|
||||
|
||||
if (g_get_charset (NULL))
|
||||
{
|
||||
gchar *ret;
|
||||
ret = string_replace (date_str, ":", "\xE2\x80\x8E∶");
|
||||
g_free (date_str);
|
||||
date_str = ret;
|
||||
}
|
||||
|
||||
g_date_time_unref (now);
|
||||
g_date_time_unref (time);
|
||||
|
||||
return date_str;
|
||||
@ -4306,14 +4306,7 @@ my_g_format_time_for_display (GtkFileChooserWidget *impl,
|
||||
format = _("%l:%M %p");
|
||||
|
||||
date_str = g_date_time_format (time, format);
|
||||
|
||||
if (g_get_charset (NULL))
|
||||
{
|
||||
gchar *ret;
|
||||
ret = string_replace (date_str, ":", "\xE2\x80\x8E∶");
|
||||
g_free (date_str);
|
||||
date_str = ret;
|
||||
}
|
||||
replace_ratio (&date_str);
|
||||
|
||||
g_date_time_unref (time);
|
||||
|
||||
@ -4321,7 +4314,9 @@ my_g_format_time_for_display (GtkFileChooserWidget *impl,
|
||||
}
|
||||
|
||||
static void
|
||||
copy_attribute (GFileInfo *to, GFileInfo *from, const char *attribute)
|
||||
copy_attribute (GFileInfo *to,
|
||||
GFileInfo *from,
|
||||
const gchar *attribute)
|
||||
{
|
||||
GFileAttributeType type;
|
||||
gpointer value;
|
||||
@ -4331,7 +4326,9 @@ copy_attribute (GFileInfo *to, GFileInfo *from, const char *attribute)
|
||||
}
|
||||
|
||||
static void
|
||||
file_system_model_got_thumbnail (GObject *object, GAsyncResult *res, gpointer data)
|
||||
file_system_model_got_thumbnail (GObject *object,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileSystemModel *model = data; /* might be unreffed if operation was cancelled */
|
||||
GFile *file = G_FILE (object);
|
||||
@ -4579,10 +4576,7 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
|
||||
if (priv->browse_files_model &&
|
||||
_gtk_file_system_model_get_directory (priv->browse_files_model) == priv->current_folder)
|
||||
{
|
||||
g_print ("avoid reloading\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
@ -4715,7 +4709,7 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
|
||||
{
|
||||
/* Don't change the name when clicking on a folder... */
|
||||
change_entry = (! _gtk_file_info_consider_as_directory (info));
|
||||
change_entry = !_gtk_file_info_consider_as_directory (info);
|
||||
}
|
||||
else
|
||||
change_entry = TRUE; /* ... unless we are in SELECT_FOLDER mode */
|
||||
@ -5170,19 +5164,19 @@ gtk_file_chooser_widget_unselect_file (GtkFileChooser *chooser,
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (priv->browse_files_tree_view);
|
||||
GtkTreeView *tree_view;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (!priv->browse_files_model)
|
||||
tree_view = GTK_TREE_VIEW (priv->browse_files_tree_view);
|
||||
model = gtk_tree_view_get_model (tree_view);
|
||||
if (!model)
|
||||
return;
|
||||
|
||||
if (!_gtk_file_system_model_get_iter_for_file (priv->browse_files_model,
|
||||
&iter,
|
||||
file))
|
||||
if (!_gtk_file_system_model_get_iter_for_file (GTK_FILE_SYSTEM_MODEL (model), &iter, file))
|
||||
return;
|
||||
|
||||
gtk_tree_selection_unselect_iter (gtk_tree_view_get_selection (tree_view),
|
||||
&iter);
|
||||
gtk_tree_selection_unselect_iter (gtk_tree_view_get_selection (tree_view), &iter);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -5246,14 +5240,14 @@ gtk_file_chooser_widget_unselect_all (GtkFileChooser *chooser)
|
||||
pending_select_files_free (impl);
|
||||
}
|
||||
|
||||
/* Checks whether the filename entry for the Save modes contains a well-formed filename.
|
||||
/* Checks whether the filename entry for Save modes contains a well-formed filename.
|
||||
*
|
||||
* is_well_formed_ret - whether what the user typed passes gkt_file_system_make_path()
|
||||
*
|
||||
* is_empty_ret - whether the file entry is totally empty
|
||||
*
|
||||
* is_file_part_empty_ret - whether the file part is empty (will be if user types "foobar/", and
|
||||
* the path will be “$cwd/foobar”)
|
||||
* is_file_part_empty_ret - whether the file part is empty (will be if user types
|
||||
* "foobar/", and the path will be “$cwd/foobar”)
|
||||
*/
|
||||
static void
|
||||
check_save_entry (GtkFileChooserWidget *impl,
|
||||
@ -5270,11 +5264,11 @@ check_save_entry (GtkFileChooserWidget *impl,
|
||||
GFile *file;
|
||||
GError *error;
|
||||
|
||||
g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
|
||||
|| ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||
&& priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
|
||||
g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER ||
|
||||
((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
|
||||
priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
|
||||
|
||||
chooser_entry = GTK_FILE_CHOOSER_ENTRY (priv->location_entry);
|
||||
|
||||
@ -5458,8 +5452,9 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
|
||||
out:
|
||||
|
||||
/* If there's no folder selected, and we're in SELECT_FOLDER mode, then we
|
||||
* fall back to the current directory */
|
||||
/* If there's no folder selected, and we're in SELECT_FOLDER mode,
|
||||
* then we fall back to the current directory
|
||||
*/
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
|
||||
info.result == NULL)
|
||||
{
|
||||
@ -5502,11 +5497,7 @@ show_filters (GtkFileChooserWidget *impl,
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
if (show)
|
||||
gtk_widget_show (priv->filter_combo_hbox);
|
||||
else
|
||||
gtk_widget_hide (priv->filter_combo_hbox);
|
||||
|
||||
gtk_widget_set_visible (priv->filter_combo_hbox, show);
|
||||
update_extra_and_filters (impl);
|
||||
}
|
||||
|
||||
@ -5834,8 +5825,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
|
||||
if (gtk_window_has_group (toplevel))
|
||||
gtk_window_group_add_window (gtk_window_get_group (toplevel),
|
||||
GTK_WINDOW (dialog));
|
||||
gtk_window_group_add_window (gtk_window_get_group (toplevel), GTK_WINDOW (dialog));
|
||||
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
@ -5850,8 +5840,8 @@ struct GetDisplayNameData
|
||||
gchar *file_part;
|
||||
};
|
||||
|
||||
/* Every time we request a response explicitly, we need to save the selection to the recently-used list,
|
||||
* as requesting a response means, “the dialog is confirmed”.
|
||||
/* Every time we request a response explicitly, we need to save the selection to
|
||||
* the recently-used list, as requesting a response means, “the dialog is confirmed”.
|
||||
*/
|
||||
static void
|
||||
request_response_and_add_to_recent_list (GtkFileChooserWidget *impl)
|
||||
@ -6030,7 +6020,9 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
/* The parent exists, but it's not a folder! Someone probably typed existing_file.txt/subfile.txt */
|
||||
/* The parent exists, but it's not a folder!
|
||||
* Someone probably typed existing_file.txt/subfile.txt
|
||||
*/
|
||||
error_with_file_under_nonfolder (impl, data->parent_file);
|
||||
}
|
||||
else
|
||||
@ -6140,7 +6132,8 @@ file_exists_get_info_cb (GCancellable *cancellable,
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if (needs_parent_check) {
|
||||
if (needs_parent_check)
|
||||
{
|
||||
/* check that everything up to the last path component exists (i.e. the parent) */
|
||||
|
||||
data->file_exists_and_is_not_folder = file_exists && !is_folder;
|
||||
@ -6348,20 +6341,20 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
|
||||
|
||||
save_entry:
|
||||
|
||||
g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
|
||||
|| ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||
&& priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
|
||||
g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER ||
|
||||
((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
|
||||
priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
|
||||
|
||||
entry = GTK_FILE_CHOOSER_ENTRY (priv->location_entry);
|
||||
check_save_entry (impl, &file, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder);
|
||||
|
||||
if (!is_well_formed)
|
||||
{
|
||||
if (!is_empty
|
||||
&& priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|
||||
&& priv->operation_mode == OPERATION_MODE_RECENT)
|
||||
if (!is_empty &&
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SAVE &&
|
||||
priv->operation_mode == OPERATION_MODE_RECENT)
|
||||
{
|
||||
/* FIXME: ERROR_NO_FOLDER */
|
||||
#if 0
|
||||
@ -6380,8 +6373,8 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
|
||||
|
||||
if (is_empty)
|
||||
{
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
|
||||
{
|
||||
/* FIXME: ERROR_NO_FILENAME */
|
||||
gtk_widget_grab_focus (priv->location_entry);
|
||||
@ -6467,8 +6460,8 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
|
||||
}
|
||||
else
|
||||
/* The focus is on a dialog's action area button or something else */
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|
||||
|| priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
|
||||
goto save_entry;
|
||||
else
|
||||
goto file_list;
|
||||
@ -6524,7 +6517,10 @@ search_selected_foreach_get_file_cb (GtkTreeModel *model,
|
||||
list = data;
|
||||
|
||||
gtk_tree_model_get (model, iter, MODEL_COL_FILE, &file, -1);
|
||||
*list = g_slist_prepend (*list, file); /* The file already has a new ref courtesy of gtk_tree_model_get(); this will be unreffed by the caller */
|
||||
/* The file already has a new ref courtesy of gtk_tree_model_get();
|
||||
* this will be unreffed by the caller
|
||||
*/
|
||||
*list = g_slist_prepend (*list, file);
|
||||
}
|
||||
|
||||
/* Constructs a list of the selected paths in search mode */
|
||||
@ -6629,9 +6625,7 @@ search_engine_error_cb (GtkSearchEngine *engine,
|
||||
const gchar *message,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (data);
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
|
||||
|
||||
search_stop_searching (impl, TRUE);
|
||||
error_message (impl, _("Could not send the search request"), message);
|
||||
@ -6640,19 +6634,16 @@ search_engine_error_cb (GtkSearchEngine *engine,
|
||||
/* Frees the data in the search_model */
|
||||
static void
|
||||
search_clear_model (GtkFileChooserWidget *impl,
|
||||
gboolean remove_from_treeview)
|
||||
gboolean remove)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
if (!priv->search_model)
|
||||
return;
|
||||
|
||||
if (remove_from_treeview &&
|
||||
1)//gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == GTK_TREE_MODEL (priv->search_model))
|
||||
{
|
||||
g_print ("clear model\n");
|
||||
if (remove &&
|
||||
gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == GTK_TREE_MODEL (priv->search_model))
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
|
||||
}
|
||||
|
||||
g_clear_object (&priv->search_model);
|
||||
}
|
||||
@ -6674,8 +6665,8 @@ search_stop_searching (GtkFileChooserWidget *impl,
|
||||
{
|
||||
_gtk_search_engine_stop (priv->search_engine);
|
||||
g_signal_handlers_disconnect_by_data (priv->search_engine, impl);
|
||||
g_object_unref (priv->search_engine);
|
||||
priv->search_engine = NULL;
|
||||
g_clear_object (&priv->search_engine);
|
||||
|
||||
set_busy_cursor (impl, FALSE);
|
||||
gtk_spinner_stop (GTK_SPINNER (priv->search_spinner));
|
||||
}
|
||||
@ -6706,10 +6697,6 @@ search_setup_model (GtkFileChooserWidget *impl)
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_ASCENDING);
|
||||
|
||||
/* EB: setting the model here will make the hits list update feel
|
||||
* more "alive" than setting the model at the end of the search
|
||||
* run
|
||||
*/
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view),
|
||||
GTK_TREE_MODEL (priv->search_model));
|
||||
|
||||
@ -6748,6 +6735,7 @@ search_start_query (GtkFileChooserWidget *impl,
|
||||
search_stop_searching (impl, FALSE);
|
||||
search_clear_model (impl, TRUE);
|
||||
search_setup_model (impl);
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
gtk_spinner_start (GTK_SPINNER (priv->search_spinner));
|
||||
priv->show_progress_timeout = g_timeout_add (1000, show_spinner, impl);
|
||||
@ -6809,15 +6797,9 @@ search_entry_activate_cb (GtkFileChooserWidget *impl)
|
||||
text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
|
||||
|
||||
/* reset any existing query object */
|
||||
if (priv->search_query)
|
||||
{
|
||||
g_object_unref (priv->search_query);
|
||||
priv->search_query = NULL;
|
||||
}
|
||||
|
||||
if (strlen (text) == 0)
|
||||
return;
|
||||
g_set_object (&priv->search_query, NULL);
|
||||
|
||||
if (text[0] != '\0')
|
||||
search_start_query (impl, text);
|
||||
}
|
||||
|
||||
@ -6839,13 +6821,13 @@ search_setup_widgets (GtkFileChooserWidget *impl)
|
||||
/* if there already is a query, restart it */
|
||||
if (priv->search_query)
|
||||
{
|
||||
gchar *query = gtk_query_get_text (priv->search_query);
|
||||
gchar *query;
|
||||
|
||||
query = gtk_query_get_text (priv->search_query);
|
||||
if (query)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->search_entry), query);
|
||||
search_start_query (impl, query);
|
||||
|
||||
g_free (query);
|
||||
}
|
||||
else
|
||||
@ -6854,8 +6836,6 @@ search_setup_widgets (GtkFileChooserWidget *impl)
|
||||
priv->search_query = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* FMQ: hide the filter combo? */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6865,18 +6845,17 @@ search_setup_widgets (GtkFileChooserWidget *impl)
|
||||
/* Frees the data in the recent_model */
|
||||
static void
|
||||
recent_clear_model (GtkFileChooserWidget *impl,
|
||||
gboolean remove_from_treeview)
|
||||
gboolean remove)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
if (!priv->recent_model)
|
||||
return;
|
||||
|
||||
if (remove_from_treeview)
|
||||
if (remove)
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
|
||||
|
||||
g_object_unref (priv->recent_model);
|
||||
priv->recent_model = NULL;
|
||||
g_set_object (&priv->recent_model, NULL);
|
||||
}
|
||||
|
||||
/* Stops any ongoing loading of the recent files list; does
|
||||
@ -6905,8 +6884,7 @@ recent_setup_model (GtkFileChooserWidget *impl)
|
||||
impl,
|
||||
MODEL_COLUMN_TYPES);
|
||||
|
||||
_gtk_file_system_model_set_filter (priv->recent_model,
|
||||
priv->current_filter);
|
||||
_gtk_file_system_model_set_filter (priv->recent_model, priv->current_filter);
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->recent_model),
|
||||
recent_sort_func,
|
||||
impl, NULL);
|
||||
@ -6946,14 +6924,17 @@ recent_idle_cleanup (gpointer data)
|
||||
g_free (load_data);
|
||||
}
|
||||
|
||||
/* Populates the file system model with the GtkRecentInfo* items in the provided list; frees the items */
|
||||
/* Populates the file system model with the GtkRecentInfo* items
|
||||
* in the provided list; frees the items
|
||||
*/
|
||||
static void
|
||||
populate_model_with_recent_items (GtkFileChooserWidget *impl, GList *items)
|
||||
populate_model_with_recent_items (GtkFileChooserWidget *impl,
|
||||
GList *items)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
gint limit;
|
||||
GList *l;
|
||||
int n;
|
||||
gint n;
|
||||
|
||||
limit = DEFAULT_RECENT_FILES_LIMIT;
|
||||
|
||||
@ -6979,7 +6960,8 @@ populate_model_with_recent_items (GtkFileChooserWidget *impl, GList *items)
|
||||
}
|
||||
|
||||
static void
|
||||
populate_model_with_folders (GtkFileChooserWidget *impl, GList *items)
|
||||
populate_model_with_folders (GtkFileChooserWidget *impl,
|
||||
GList *items)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
GList *folders;
|
||||
@ -6988,16 +6970,11 @@ populate_model_with_folders (GtkFileChooserWidget *impl, GList *items)
|
||||
folders = _gtk_file_chooser_extract_recent_folders (items);
|
||||
|
||||
for (l = folders; l; l = l->next)
|
||||
{
|
||||
GFile *folder = l->data;
|
||||
|
||||
_gtk_file_system_model_add_and_query_file (priv->recent_model,
|
||||
folder,
|
||||
G_FILE (l->data),
|
||||
MODEL_ATTRIBUTES);
|
||||
}
|
||||
|
||||
g_list_foreach (folders, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (folders);
|
||||
g_list_free_full (folders, g_object_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -7019,8 +6996,7 @@ recent_idle_load (gpointer data)
|
||||
else
|
||||
populate_model_with_folders (impl, load_data->items);
|
||||
|
||||
g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
|
||||
g_list_free (load_data->items);
|
||||
g_list_free_full (load_data->items, (GDestroyNotify) gtk_recent_info_unref);
|
||||
load_data->items = NULL;
|
||||
|
||||
return FALSE;
|
||||
@ -7133,9 +7109,11 @@ filter_combo_changed (GtkComboBox *combo_box,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
gint new_index = gtk_combo_box_get_active (combo_box);
|
||||
GtkFileFilter *new_filter = g_slist_nth_data (priv->filters, new_index);
|
||||
gint new_index;
|
||||
GtkFileFilter *new_filter;
|
||||
|
||||
new_index = gtk_combo_box_get_active (combo_box);
|
||||
new_filter = g_slist_nth_data (priv->filters, new_index);
|
||||
set_current_filter (impl, new_filter);
|
||||
}
|
||||
|
||||
@ -7478,13 +7456,12 @@ desktop_folder_handler (GtkFileChooserWidget *impl)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
name = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
|
||||
/* "To disable a directory, point it to the homedir."
|
||||
* See http://freedesktop.org/wiki/Software/xdg-user-dirs
|
||||
**/
|
||||
if (!g_strcmp0 (name, g_get_home_dir ())) {
|
||||
*/
|
||||
name = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
|
||||
if (!g_strcmp0 (name, g_get_home_dir ()))
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (impl), name);
|
||||
}
|
||||
@ -7535,9 +7512,7 @@ show_hidden_handler (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
g_object_set (impl,
|
||||
"show-hidden", !priv->show_hidden,
|
||||
NULL);
|
||||
g_object_set (impl, "show-hidden", !priv->show_hidden, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7564,7 +7539,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GtkBindingSet *binding_set;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
gobject_class->finalize = gtk_file_chooser_widget_finalize;
|
||||
gobject_class->constructed = gtk_file_chooser_widget_constructed;
|
||||
@ -7587,27 +7562,20 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::location-popup:
|
||||
* @widget: the object which received the signal.
|
||||
* @path: a string that gets put in the text entry for the file
|
||||
* name.
|
||||
* @widget: the object which received the signal
|
||||
* @path: a string that gets put in the text entry for the file name
|
||||
*
|
||||
* The ::location-popup signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::location-popup signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show a "Location"
|
||||
* prompt which the user can use to manually type the name of
|
||||
* the file he wishes to select.
|
||||
* This is used to make the file chooser show a "Location" prompt which
|
||||
* the user can use to manually type the name of the file he wishes to select.
|
||||
*
|
||||
* The default bindings for this signal are
|
||||
* `Control + L`
|
||||
* with a @path string of "" (the empty
|
||||
* string). It is also bound to `/` with a
|
||||
* @path string of "`/`"
|
||||
* (a slash): this lets you type `/` and
|
||||
* immediately type a path name. On Unix systems, this is bound to
|
||||
* `~` (tilde) with a @path string
|
||||
* of "~" itself for access to home directories.
|
||||
* The default bindings for this signal are `Control + L` with a @path string
|
||||
* of "" (the empty string). It is also bound to `/` with a @path string of
|
||||
* "`/`" (a slash): this lets you type `/` and immediately type a path name.
|
||||
* On Unix systems, this is bound to `~` (tilde) with a @path string of "~"
|
||||
* itself for access to home directories.
|
||||
*/
|
||||
signals[LOCATION_POPUP] =
|
||||
g_signal_new_class_handler (I_("location-popup"),
|
||||
@ -7620,14 +7588,13 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::location-popup-on-paste:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::location-popup-on-paste signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::location-popup-on-paste signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show a "Location"
|
||||
* prompt when the user pastes into a #GtkFileChooserWidget.
|
||||
* This is used to make the file chooser show a "Location" prompt when the user
|
||||
* pastes into a #GtkFileChooserWidget.
|
||||
*
|
||||
* The default binding for this signal is `Control + V`.
|
||||
*/
|
||||
@ -7642,15 +7609,13 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::location-toggle-popup:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::location-toggle-popup signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::location-toggle-popup signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to toggle the visibility of a "Location"
|
||||
* prompt which the user can use to manually type the name of
|
||||
* the file he wishes to select.
|
||||
* This is used to toggle the visibility of a "Location" prompt which the user
|
||||
* can use to manually type the name of the file he wishes to select.
|
||||
*
|
||||
* The default binding for this signal is `Control + L`.
|
||||
*/
|
||||
@ -7665,14 +7630,13 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::up-folder:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::up-folder signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::up-folder signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser go to the parent of
|
||||
* the current folder in the file hierarchy.
|
||||
* This is used to make the file chooser go to the parent of the current folder
|
||||
* in the file hierarchy.
|
||||
*
|
||||
* The default binding for this signal is `Alt + Up`.
|
||||
*/
|
||||
@ -7687,18 +7651,16 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::down-folder:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::down-folder signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::down-folder signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser go to a child of the
|
||||
* current folder in the file hierarchy. The subfolder that
|
||||
* will be used is displayed in the path bar widget of the file
|
||||
* chooser. For example, if the path bar is showing
|
||||
* "/foo/bar/baz", with bar currently displayed, then this will cause
|
||||
* the file chooser to switch to the "baz" subfolder.
|
||||
* This is used to make the file chooser go to a child of the current folder
|
||||
* in the file hierarchy. The subfolder that will be used is displayed in the
|
||||
* path bar widget of the file chooser. For example, if the path bar is showing
|
||||
* "/foo/bar/baz", with bar currently displayed, then this will cause the file
|
||||
* chooser to switch to the "baz" subfolder.
|
||||
*
|
||||
* The default binding for this signal is `Alt + Down`.
|
||||
*/
|
||||
@ -7713,10 +7675,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::home-folder:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::home-folder signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::home-folder signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show the user's home
|
||||
@ -7735,10 +7696,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::desktop-folder:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::desktop-folder signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::desktop-folder signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show the user's Desktop
|
||||
@ -7757,17 +7717,15 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::quick-bookmark:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
* @bookmark_index: the number of the bookmark to switch to
|
||||
*
|
||||
* The ::quick-bookmark signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::quick-bookmark signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser switch to the bookmark
|
||||
* specified in the @bookmark_index parameter.
|
||||
* For example, if you have three bookmarks, you can pass 0, 1, 2 to
|
||||
* this signal to switch to each of them, respectively.
|
||||
* This is used to make the file chooser switch to the bookmark specified
|
||||
* in the @bookmark_index parameter. For example, if you have three bookmarks,
|
||||
* you can pass 0, 1, 2 to this signal to switch to each of them, respectively.
|
||||
*
|
||||
* The default binding for this signal is `Alt + 1`, `Alt + 2`,
|
||||
* etc. until `Alt + 0`. Note that in the default binding, that
|
||||
@ -7786,10 +7744,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::show-hidden:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::show-hidden signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::show-hidden signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser display hidden files.
|
||||
@ -7807,10 +7764,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::search-shortcut:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::search-shortcut signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::search-shortcut signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show the search entry.
|
||||
@ -7828,10 +7784,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
|
||||
/**
|
||||
* GtkFileChooserWidget::recent-shortcut:
|
||||
* @widget: the object which received the signal.
|
||||
* @widget: the object which received the signal
|
||||
*
|
||||
* The ::recent-shortcut signal is a
|
||||
* [keybinding signal][GtkBindingSignal]
|
||||
* The ::recent-shortcut signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user asks for it.
|
||||
*
|
||||
* This is used to make the file chooser show the Recent location.
|
||||
@ -8137,4 +8092,3 @@ gtk_file_chooser_widget_new (GtkFileChooserAction action)
|
||||
"action", action,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user