[nautilus/wip/csoriano/desktop-split: 26/53] directory: allow overriding the creation of files
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/desktop-split: 26/53] directory: allow overriding the creation of files
- Date: Tue, 5 Apr 2016 13:30:12 +0000 (UTC)
commit f38910de24e0792d32d81c9dd862ef6230a7a39c
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Mar 29 21:47:11 2016 +0200
directory: allow overriding the creation of files
So subclasses like the desktop directory can do their own.
libnautilus-private/nautilus-directory.c | 15 +++++++++++++++
libnautilus-private/nautilus-directory.h | 6 ++++++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index a79fe30..06cb6a7 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -65,6 +65,9 @@ static GList * real_get_file_list (NautilusDirectory
static gboolean real_is_editable (NautilusDirectory *directory);
static void set_directory_location (NautilusDirectory *directory,
GFile *location);
+static NautilusFile * real_new_file_from_filename (NautilusDirectory *directory,
+ const char *filename,
+ gboolean self_owned);
G_DEFINE_TYPE (NautilusDirectory, nautilus_directory, G_TYPE_OBJECT);
@@ -111,6 +114,8 @@ nautilus_directory_class_init (NautilusDirectoryClass *klass)
object_class = G_OBJECT_CLASS (klass);
+ klass->new_file_from_filename = real_new_file_from_filename;
+
object_class->finalize = nautilus_directory_finalize;
object_class->set_property = nautilus_directory_set_property;
object_class->get_property = nautilus_directory_get_property;
@@ -547,6 +552,16 @@ nautilus_directory_new_file_from_filename (NautilusDirectory *directory,
const char *filename,
gboolean self_owned)
{
+ return NAUTILUS_DIRECTORY_CLASS (G_OBJECT_GET_CLASS (directory))->new_file_from_filename (directory,
+ filename,
+
self_owned);
+}
+
+static NautilusFile *
+real_new_file_from_filename (NautilusDirectory *directory,
+ const char *filename,
+ gboolean self_owned)
+{
NautilusFile *file;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
diff --git a/libnautilus-private/nautilus-directory.h b/libnautilus-private/nautilus-directory.h
index 46a253c..de3c0d9 100644
--- a/libnautilus-private/nautilus-directory.h
+++ b/libnautilus-private/nautilus-directory.h
@@ -137,6 +137,12 @@ typedef struct
* An example of this is the search directory.
*/
gboolean (* is_editable) (NautilusDirectory *directory);
+
+ /* Subclasses can use this to create custom files when asked by the user
+ * or the nautilus cache. */
+ NautilusFile * (* new_file_from_filename) (NautilusDirectory *directory,
+ const char *filename,
+ gboolean self_owned);
} NautilusDirectoryClass;
/* Basic GObject requirements. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]