[nautilus/wip/csoriano/flow: 30/55] file: allow overriding rename handling
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/flow: 30/55] file: allow overriding rename handling
- Date: Thu, 7 Apr 2016 20:53:52 +0000 (UTC)
commit b35be44900c9cd1cce4ab6d545c9503302e2345d
Author: Carlos Soriano <csoriano gnome org>
Date: Wed Mar 30 11:01:55 2016 +0200
file: allow overriding rename handling
We will need it for using inheritance instead of special casing.
libnautilus-private/nautilus-file.c | 28 ++++++++++++++++++++++++----
libnautilus-private/nautilus-file.h | 7 +++++++
2 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index d11f4b2..c22bcc1 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1490,6 +1490,12 @@ can_rename_desktop_file (NautilusFile *file)
gboolean
nautilus_file_can_rename (NautilusFile *file)
{
+ return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->can_rename (file);
+}
+
+static gboolean
+real_can_rename (NautilusFile *file)
+{
gboolean can_rename;
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
@@ -1793,10 +1799,22 @@ name_is (NautilusFile *file, const char *new_name)
}
void
-nautilus_file_rename (NautilusFile *file,
- const char *new_name,
- NautilusFileOperationCallback callback,
- gpointer callback_data)
+nautilus_file_rename (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data)
+{
+ NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->rename (file,
+ new_name,
+ callback,
+ callback_data);
+}
+
+static void
+real_rename (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data)
{
NautilusFileOperation *op;
char *uri;
@@ -8031,6 +8049,8 @@ nautilus_file_class_init (NautilusFileClass *class)
class->set_metadata = real_set_metadata;
class->set_metadata_as_list = real_set_metadata_as_list;
+ class->can_rename = real_can_rename;
+ class->rename = real_rename;
signals[CHANGED] =
g_signal_new ("changed",
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 1f77534..790d67b 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -560,6 +560,13 @@ typedef struct {
gpointer callback_data);
void (* poll_for_media) (NautilusFile *file);
+
+ gboolean (* can_rename) (NautilusFile *file);
+
+ void (* rename) (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
} NautilusFileClass;
#endif /* NAUTILUS_FILE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]