[nautilus/wip/csoriano/destktop-split2: 41/54] 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/destktop-split2: 41/54] directory: allow overriding the creation of files
- Date: Wed, 30 Mar 2016 14:06:14 +0000 (UTC)
commit 49e169e415d157171742e558ab07bfd48997a983
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 | 17 ++++++++++++++++-
libnautilus-private/nautilus-directory.h | 8 +++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 515d38b..97be864 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
nautilus-directory.c: Nautilus directory model.
@@ -66,6 +66,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);
@@ -112,6 +115,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;
@@ -548,6 +553,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 c04888e..f375f45 100644
--- a/libnautilus-private/nautilus-directory.h
+++ b/libnautilus-private/nautilus-directory.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
nautilus-directory.h: Nautilus directory model.
@@ -138,6 +138,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]