[gthumb] added G_USER_DIRECTORY_DOCUMENTS to sidebar - bug 654635
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] added G_USER_DIRECTORY_DOCUMENTS to sidebar - bug 654635
- Date: Thu, 14 Jul 2011 19:33:49 +0000 (UTC)
commit 14e0b0c89696bc8f35a4509fea91594f76bd714f
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date: Thu Jul 14 15:32:54 2011 -0400
added G_USER_DIRECTORY_DOCUMENTS to sidebar - bug 654635
gthumb/gth-file-source-vfs.c | 96 ++++++++++++++++++++++--------------------
1 files changed, 50 insertions(+), 46 deletions(-)
---
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index b968941..892df6e 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -60,70 +60,74 @@ static guint mount_removed_event_id = 0;
static GList *
-gth_file_source_vfs_get_entry_points (GthFileSource *file_source)
+gth_file_source_vfs_add_special_dir (GList *list,
+ GthFileSource *file_source,
+ GUserDirectory special_dir)
{
const gchar *path;
- GList *list;
- GFile *file;
- GFileInfo *info;
- GList *mounts;
- GList *scan;
-
- list = NULL;
- file = g_file_new_for_uri (get_home_uri ());
- info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
- g_file_info_set_display_name (info, _("Home Folder"));
- list = g_list_append (list, gth_file_data_new (file, info));
- g_object_unref (info);
- g_object_unref (file);
-
- path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+ path = g_get_user_special_dir (special_dir);
if (path != NULL) {
+ GFile *file;
file = g_file_new_for_path (path);
if (g_file_query_exists (file, NULL)) {
+ GFileInfo *info;
info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
list = g_list_append (list, gth_file_data_new (file, info));
g_object_unref (info);
}
- g_object_unref (file);
- }
- path = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
- if (path != NULL) {
- file = g_file_new_for_path (path);
- if (g_file_query_exists (file, NULL)) {
- info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
- list = g_list_append (list, gth_file_data_new (file, info));
- g_object_unref (info);
- }
g_object_unref (file);
}
- path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
- if (path != NULL) {
- file = g_file_new_for_path (path);
- if (g_file_query_exists (file, NULL)) {
- info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
- list = g_list_append (list, gth_file_data_new (file, info));
- g_object_unref (info);
- }
- g_object_unref (file);
- }
+ return list;
+}
+
+
+static GList *
+gth_file_source_vfs_add_uri (GList *list,
+ GthFileSource *file_source,
+ const char *uri,
+ char *display_name)
+{
+ GFile *file;
+ GFileInfo *info;
+
+ file = g_file_new_for_uri (uri);
+ info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
+ g_file_info_set_display_name (info, display_name);
+ list = g_list_append (list, gth_file_data_new (file, info));
+ g_object_unref (info);
+ g_object_unref (file);
+
+ return list;
+}
+
+
+static GList *
+gth_file_source_vfs_get_entry_points (GthFileSource *file_source)
+{
+ GList *list;
+ GList *mounts;
+ GList *scan;
+
+ list = NULL;
- file = g_file_new_for_uri ("file:///");
- info = gth_file_source_get_file_info (file_source, file, GFILE_BASIC_ATTRIBUTES ",access::*");
- g_file_info_set_display_name (info, _("File System"));
- list = g_list_append (list, gth_file_data_new (file, info));
- g_object_unref (info);
- g_object_unref (file);
+ list = gth_file_source_vfs_add_uri (list, file_source, get_home_uri (), _("Home Folder"));
+ list = gth_file_source_vfs_add_special_dir (list, file_source, G_USER_DIRECTORY_PICTURES);
+ list = gth_file_source_vfs_add_special_dir (list, file_source, G_USER_DIRECTORY_VIDEOS);
+ list = gth_file_source_vfs_add_special_dir (list, file_source, G_USER_DIRECTORY_DESKTOP);
+ list = gth_file_source_vfs_add_special_dir (list, file_source, G_USER_DIRECTORY_DOCUMENTS);
+ list = gth_file_source_vfs_add_uri (list, file_source, "file:///", _("File System"));
mounts = g_volume_monitor_get_mounts (g_volume_monitor_get ());
for (scan = mounts; scan; scan = scan->next) {
- GMount *mount = scan->data;
- GIcon *icon;
- char *name;
- GDrive *drive;
+ GMount *mount = scan->data;
+ GIcon *icon;
+ char *name;
+ GDrive *drive;
+ GFile *file;
+ GFileInfo *info;
if (g_mount_is_shadowed (mount))
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]