[maemo-commits] [maemo-commits] r8796 - projects/haf/branches/hildon-fm/1.x/hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Dec 18 13:37:55 EET 2006
- Previous message: [maemo-commits] r8795 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r8797 - projects/haf/branches/hildon-fm/1.x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll
Date: 2006-12-18 13:37:54 +0200 (Mon, 18 Dec 2006)
New Revision: 8796
Modified:
projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-chooser-dialog.c
Log:
* hildon-fm/hildon-file-chooser-dialog.c (set_stub_and_ext): Be
'smarter' about recognizing Rename dialogs in order to get the
is_folder attribute more right (N49932).
Modified: projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-chooser-dialog.c
===================================================================
--- projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-chooser-dialog.c 2006-12-18 11:03:48 UTC (rev 8795)
+++ projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-chooser-dialog.c 2006-12-18 11:37:54 UTC (rev 8796)
@@ -470,58 +470,81 @@
g_free (priv->stub_name);
priv->stub_name = g_strdup (name);
- /* Determine whether we are talking about a folder here. If
- action is CREATE_FOLDER, we need to ask our GtkFilesystem
- whether NAME refers to a folder, since the CREATE_FOLDER action
- is also used for the "Rename <object>" dialog...
+ /* XXX - Determine whether we are talking about a folder here. If
+ action is CREATE_FOLDER, the dialog might actually be used
+ for the "Rename <object>" dialog. We distinguish between
+ these two cases by looking at the "show-location" property,
+ which is false for Rename dialogs. But a Rename dialog
+ might still be used for a folder, of course, so we really
+ have to ask the filesystem.
- The following is about the right amount of code one should have
- to write for figuring out whether a file is a directory, I'd say.
+ The following is about the right amount of code one should
+ have to write for figuring out whether a file is a
+ directory, I'd say.
*/
if (priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
- is_folder = TRUE;
+ if (priv->should_show_location)
+ {
+ /* A "Create Folder" dialog.
+ */
+ is_folder = TRUE;
+ }
+ else
+ {
+ /* A "Rename" dialog. Let's see whether we are renaming a
+ folder.
+ */
- if (priv->model)
- {
- GtkFileSystem *filesystem =
- _hildon_file_system_model_get_file_system (priv->model);
- if (filesystem)
+ is_folder = FALSE;
+
+ if (priv->model)
{
- GtkFilePath *cur_folder_path;
- cur_folder_path =
- hildon_file_selection_get_current_folder (priv->filetree);
- if (cur_folder_path)
+ GtkFileSystem *filesystem =
+ _hildon_file_system_model_get_file_system (priv->model);
+ if (filesystem)
{
- GtkFileFolder *cur_folder =
- gtk_file_system_get_folder (filesystem, cur_folder_path,
- 0, NULL);
- if (cur_folder)
+ GtkFilePath *cur_folder_path;
+ cur_folder_path =
+ hildon_file_selection_get_current_folder (priv->filetree);
+ if (cur_folder_path)
{
- GtkFilePath *path =
- gtk_file_system_make_path (filesystem,
- cur_folder_path,
- name, NULL);
- if (path)
+ GtkFileFolder *cur_folder =
+ gtk_file_system_get_folder (filesystem,
+ cur_folder_path,
+ 0, NULL);
+ if (cur_folder)
{
- GtkFileInfo *info =
- gtk_file_folder_get_info (cur_folder, path, NULL);
- if (info)
+ GtkFilePath *path =
+ gtk_file_system_make_path (filesystem,
+ cur_folder_path,
+ name, NULL);
+ if (path)
{
- is_folder = gtk_file_info_get_is_folder (info);
- gtk_file_info_free (info);
+ GtkFileInfo *info =
+ gtk_file_folder_get_info (cur_folder, path,
+ NULL);
+ if (info)
+ {
+ is_folder = gtk_file_info_get_is_folder (info);
+ gtk_file_info_free (info);
+ }
+ gtk_file_path_free (path);
}
- gtk_file_path_free (path);
+ g_object_unref (cur_folder);
}
- g_object_unref (cur_folder);
+ gtk_file_path_free (cur_folder_path);
}
- gtk_file_path_free (cur_folder_path);
}
}
}
}
else
- is_folder = FALSE;
+ {
+ /* Other actions are never about folders.
+ */
+ is_folder = FALSE;
+ }
dot = _hildon_file_system_search_extension (priv->stub_name,
FALSE, is_folder);
- Previous message: [maemo-commits] r8795 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r8797 - projects/haf/branches/hildon-fm/1.x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
