summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesystem.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2003-03-26 16:24:35 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-03-26 16:24:35 +0000
commit5ef90224aaa8a2054247e8031fcd93c52014f438 (patch)
tree63ae21e238b1fa92c050c364f10d5e262079c02f /gtk/gtkfilesystem.c
parentb33894c5a5265ec1e111e6d3483b027bd2b6173c (diff)
downloadgtk+-5ef90224aaa8a2054247e8031fcd93c52014f438.tar.gz
- Add GnomeVFS backend
- Add gtk_file_info_get_display_key() - Start switching from file_added => files_added - Switch over to Nautilus-like Loading.../Empty
Diffstat (limited to 'gtk/gtkfilesystem.c')
-rw-r--r--gtk/gtkfilesystem.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c
index 492895d004..0e588823ff 100644
--- a/gtk/gtkfilesystem.c
+++ b/gtk/gtkfilesystem.c
@@ -25,6 +25,7 @@ struct _GtkFileInfo
GtkFileTime modification_time;
gint64 size;
gchar *display_name;
+ gchar *display_key;
gchar *mime_type;
GdkPixbuf *icon;
guint is_folder : 1;
@@ -108,6 +109,33 @@ gtk_file_info_get_display_name (const GtkFileInfo *info)
return info->display_name;
}
+/**
+ * gtk_file_info_get_display_key:
+ * @info: a #GtkFileInfo
+ *
+ * Returns results of g_utf8_collate_key() on the display name
+ * for @info. This is useful when sorting a bunch of #GtkFileInfo
+ * structures since the collate key will be only computed once.
+ *
+ * Return value: The collate key for the display name, or %NULL
+ * if the display name hasn't been set.
+ **/
+G_CONST_RETURN gchar *
+gtk_file_info_get_display_key (const GtkFileInfo *info)
+{
+ g_return_val_if_fail (info != NULL, NULL);
+
+ if (!info->display_key && info->display_name)
+ {
+ /* Since info->display_key is only a cache, we cast off the const
+ */
+ ((GtkFileInfo *)info)->display_key = g_utf8_collate_key (info->display_name, -1);
+ }
+
+
+ return info->display_key;
+}
+
void
gtk_file_info_set_display_name (GtkFileInfo *info,
const gchar *display_name)
@@ -116,6 +144,11 @@ gtk_file_info_set_display_name (GtkFileInfo *info,
if (info->display_name)
g_free (info->display_name);
+ if (info->display_key)
+ {
+ g_free (info->display_key);
+ info->display_key = NULL;
+ }
info->display_name = g_strdup (display_name);
}
@@ -473,27 +506,30 @@ gtk_file_folder_base_init (gpointer g_class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_signal_new ("file_added",
+ g_signal_new ("files_added",
iface_type,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkFileFolderIface, file_added),
+ G_STRUCT_OFFSET (GtkFileFolderIface, files_added),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 0);
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
g_signal_new ("file_changed",
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, file_changed),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 0);
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
g_signal_new ("file_removed",
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, file_removed),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 0);
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
initialized = TRUE;
}