[nautilus/wip/csoriano/destktop-split2: 41/47] desktop-icon-file: override get_drop_target_uri
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/destktop-split2: 41/47] desktop-icon-file: override get_drop_target_uri
- Date: Wed, 30 Mar 2016 20:01:31 +0000 (UTC)
commit b4715aabe7d1dd6cbe946f127c50c7d9d6f71fce
Author: Carlos Soriano <csoriano gnome org>
Date: Wed Mar 30 14:57:50 2016 +0200
desktop-icon-file: override get_drop_target_uri
Now that we can do it in subclasses, use inheritance instead of special
casing in the parent.
libnautilus-private/nautilus-desktop-icon-file.c | 24 ++++++++++++++++++++++
libnautilus-private/nautilus-file.c | 19 +---------------
2 files changed, 26 insertions(+), 17 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-icon-file.c
b/libnautilus-private/nautilus-desktop-icon-file.c
index 94cbb64..bd1b31d 100644
--- a/libnautilus-private/nautilus-desktop-icon-file.c
+++ b/libnautilus-private/nautilus-desktop-icon-file.c
@@ -345,6 +345,29 @@ nautilus_desktop_icon_file_eject (NautilusFile *file,
}
}
+static char*
+real_get_drop_target_uri (NautilusFile *file)
+{
+ char *uri = NULL;
+ GFile *location;
+ NautilusDesktopLink *link;
+
+ g_return_val_if_fail (NAUTILUS_IS_DESKTOP_ICON_FILE (file), NULL);
+
+ link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
+
+ if (link != NULL) {
+ location = nautilus_desktop_link_get_activation_location (link);
+ g_object_unref (link);
+ if (location != NULL) {
+ uri = g_file_get_uri (location);
+ g_object_unref (location);
+ }
+ }
+
+ return uri;
+}
+
static void
real_rename (NautilusFile *file,
const char *new_name,
@@ -466,6 +489,7 @@ nautilus_desktop_icon_file_class_init (NautilusDesktopIconFileClass *klass)
file_class->eject = nautilus_desktop_icon_file_eject;
file_class->can_rename = real_can_rename;
file_class->rename = real_rename;
+ file_class->get_drop_target_uri = real_get_drop_target_uri;
g_type_class_add_private (object_class, sizeof(NautilusDesktopIconFileDetails));
}
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 10db30c..48aa94e 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -3858,26 +3858,11 @@ real_get_drop_target_uri (NautilusFile *file)
{
char *uri, *target_uri;
GFile *location;
- NautilusDesktopLink *link;
-
+
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
- link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
-
- if (link != NULL) {
- location = nautilus_desktop_link_get_activation_location (link);
- g_object_unref (link);
- if (location != NULL) {
- uri = g_file_get_uri (location);
- g_object_unref (location);
- return uri;
- }
- }
- }
-
uri = nautilus_file_get_uri (file);
-
+
/* Check for Nautilus link */
if (nautilus_file_is_nautilus_link (file)) {
location = nautilus_file_get_location (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]