#include <gmodule.h>
#include "gtkfilesystem.h"
#include "gtkicontheme.h"
-#include "gtkmain.h"
+#include "gtkmodules.h"
+#include "gtkintl.h"
+#include "gtkalias.h"
#include <string.h>
static GType our_type = 0;
if (our_type == 0)
- our_type = g_boxed_type_register_static ("GtkFileInfo",
+ our_type = g_boxed_type_register_static (I_("GtkFileInfo"),
(GBoxedCopyFunc) gtk_file_info_copy,
(GBoxedFreeFunc) gtk_file_info_free);
* 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.
+ * Returns for the collation key for 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.
{
/* 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);
+ ((GtkFileInfo *)info)->display_key = g_utf8_collate_key_for_filename (info->display_name, -1);
}
return info->display_key;
};
file_system_type = g_type_register_static (G_TYPE_INTERFACE,
- "GtkFileSystem",
+ I_("GtkFileSystem"),
&file_system_info, 0);
g_type_interface_add_prerequisite (file_system_type, G_TYPE_OBJECT);
{
GType iface_type = G_TYPE_FROM_INTERFACE (g_class);
- g_signal_new ("volumes-changed",
+ g_signal_new (I_("volumes-changed"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileSystemIface, volumes_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_signal_new ("bookmarks-changed",
+ g_signal_new (I_("bookmarks-changed"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileSystemIface, bookmarks_changed),
g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), FALSE);
g_return_val_if_fail (base_path != NULL, FALSE);
+ g_return_val_if_fail (str != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
result = GTK_FILE_SYSTEM_GET_IFACE (file_system)->parse (file_system, base_path, str,
&tmp_folder, &tmp_file_part,
error);
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->list_bookmarks (file_system);
}
+/**
+ * gtk_file_system_get_bookmark_label:
+ * @file_system: a #GtkFileSystem
+ * @path: path of the bookmark
+ *
+ * Gets the label to display for a bookmark, or %NULL.
+ *
+ * Returns: the label for the bookmark @path
+ *
+ * Since: 2.8
+ */
+gchar *
+gtk_file_system_get_bookmark_label (GtkFileSystem *file_system,
+ const GtkFilePath *path)
+{
+ GtkFileSystemIface *iface;
+
+ g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
+ g_return_val_if_fail (path != NULL, FALSE);
+
+ iface = GTK_FILE_SYSTEM_GET_IFACE (file_system);
+ if (iface->get_bookmark_label)
+ return iface->get_bookmark_label (file_system, path);
+
+ return NULL;
+}
+
+/**
+ * gtk_file_system_set_bookmark_label:
+ * @file_system: a #GtkFileSystem
+ * @path: path of the bookmark
+ * @label: the label for the bookmark, or %NULL to display
+ * the path itself
+ *
+ * Sets the label to display for a bookmark.
+ *
+ * Since: 2.8
+ */
+void
+gtk_file_system_set_bookmark_label (GtkFileSystem *file_system,
+ const GtkFilePath *path,
+ const gchar *label)
+{
+ GtkFileSystemIface *iface;
+
+ g_return_if_fail (GTK_IS_FILE_SYSTEM (file_system));
+ g_return_if_fail (path != NULL);
+
+ iface = GTK_FILE_SYSTEM_GET_IFACE (file_system);
+ if (iface->set_bookmark_label)
+ iface->set_bookmark_label (file_system, path, label);
+}
+
/*****************************************
* GtkFileFolder *
*****************************************/
};
file_folder_type = g_type_register_static (G_TYPE_INTERFACE,
- "GtkFileFolder",
+ I_("GtkFileFolder"),
&file_folder_info, 0);
g_type_interface_add_prerequisite (file_folder_type, G_TYPE_OBJECT);
{
GType iface_type = G_TYPE_FROM_INTERFACE (g_class);
- g_signal_new ("deleted",
+ g_signal_new (I_("deleted"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, deleted),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_signal_new ("files-added",
+ g_signal_new (I_("files-added"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, files_added),
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- g_signal_new ("files-changed",
+ g_signal_new (I_("files-changed"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, files_changed),
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- g_signal_new ("files-removed",
+ g_signal_new (I_("files-removed"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileFolderIface, files_removed),
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
+ g_signal_new (I_("finished-loading"),
+ iface_type,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkFileFolderIface, finished_loading),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
initialized = TRUE;
}
return GTK_FILE_FOLDER_GET_IFACE (folder)->get_info (folder, path, error);
}
+gboolean
+gtk_file_folder_is_finished_loading (GtkFileFolder *folder)
+{
+ GtkFileFolderIface *iface;
+
+ g_return_val_if_fail (GTK_IS_FILE_FOLDER (folder), TRUE);
+
+ iface = GTK_FILE_FOLDER_GET_IFACE (folder);
+ if (!iface->is_finished_loading)
+ return TRUE;
+ else
+ return iface->is_finished_loading (folder);
+}
+
/*****************************************
* GtkFilePath modules *
static gpointer
gtk_file_path_real_copy (gpointer boxed)
{
- return gtk_file_path_new_dup (gtk_file_path_get_string ((GtkFilePath *) boxed));
+ return gtk_file_path_copy ((GtkFilePath *) boxed);
}
static void
static GType our_type = 0;
if (our_type == 0)
- our_type = g_boxed_type_register_static ("GtkFilePath",
+ our_type = g_boxed_type_register_static (I_("GtkFilePath"),
(GBoxedCopyFunc) gtk_file_path_real_copy,
(GBoxedFreeFunc) gtk_file_path_real_free);
GTypeModuleClass parent_class;
};
-G_DEFINE_TYPE (GtkFileSystemModule, gtk_file_system_module, G_TYPE_TYPE_MODULE);
-#define GTK_TYPE_FILE_SYSTEM_MODULE (gtk_file_system_module_get_type ())
+G_DEFINE_TYPE (GtkFileSystemModule, _gtk_file_system_module, G_TYPE_TYPE_MODULE);
+#define GTK_TYPE_FILE_SYSTEM_MODULE (_gtk_file_system_module_get_type ())
#define GTK_FILE_SYSTEM_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), GTK_TYPE_FILE_SYSTEM_MODULE, GtkFileSystemModule))
g_free (module->path);
- G_OBJECT_CLASS (gtk_file_system_module_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_gtk_file_system_module_parent_class)->finalize (object);
}
static void
-gtk_file_system_module_class_init (GtkFileSystemModuleClass *class)
+_gtk_file_system_module_class_init (GtkFileSystemModuleClass *class)
{
GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
}
static void
-gtk_file_system_module_init (GtkFileSystemModule *fs_module)
+_gtk_file_system_module_init (GtkFileSystemModule *fs_module)
{
}
return fs;
}
-
+#define __GTK_FILE_SYSTEM_C__
+#include "gtkaliasdef.c"