[nautilus/wip/csoriano/destktop-split2: 44/54] file: allow overriding rename handling
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/destktop-split2: 44/54] file: allow overriding rename handling
- Date: Wed, 30 Mar 2016 14:06:29 +0000 (UTC)
commit 8376294809bd83aa362dd7fd0a9ad836d02d706c
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 | 30 +++++++++++++++++++++++++-----
libnautilus-private/nautilus-file.h | 7 +++++++
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 513533b..6736d37 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.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-file.c: Nautilus file model.
@@ -1491,6 +1491,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);
@@ -1794,10 +1800,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;
@@ -8032,6 +8050,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 363fbff..f6e9b8d 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -561,6 +561,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]