[nautilus] window-slot: allow overriding the creation of views
- From: Carlos Soriano SĂĄnchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window-slot: allow overriding the creation of views
- Date: Thu, 14 Apr 2016 08:47:12 +0000 (UTC)
commit 733b5371e6c2cccfa64ebb96335633fed7490aef
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Mar 22 13:38:54 2016 +0100
window-slot: allow overriding the creation of views
We would want in subclasses of nautilus window slot to have a way to
create custom views, like for instance, the desktop.
To allow it, make a vfunc for the creation of views that subclasses can
override.
https://bugzilla.gnome.org/show_bug.cgi?id=712620
src/nautilus-window-slot.c | 16 +++++++++-------
src/nautilus-window-slot.h | 7 +++++++
2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index ea09cc5..ee58c72 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -149,6 +149,13 @@ static NautilusView*
nautilus_window_slot_get_view_for_location (NautilusWindowSlot *self,
GFile *location)
{
+ return NAUTILUS_WINDOW_SLOT_CLASS (G_OBJECT_GET_CLASS (self))->get_view_for_location (self,
location);
+}
+
+static NautilusView*
+real_get_view_for_location (NautilusWindowSlot *self,
+ GFile *location)
+{
NautilusWindowSlotPrivate *priv;
NautilusWindow *window;
@@ -160,13 +167,7 @@ nautilus_window_slot_get_view_for_location (NautilusWindowSlot *self,
file = nautilus_file_get (location);
view = NULL;
- /* FIXME bugzilla.gnome.org 41243:
- * We should use inheritance instead of these special cases
- * for the desktop window.
- */
- if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- view = NAUTILUS_VIEW (nautilus_files_view_new (NAUTILUS_VIEW_DESKTOP_ID, self));
- } else if (nautilus_file_is_other_locations (file)) {
+ if (nautilus_file_is_other_locations (file)) {
view = NAUTILUS_VIEW (nautilus_places_view_new ());
/* Save the current view, so we can go back after places view */
@@ -2437,6 +2438,7 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
klass->active = real_active;
klass->inactive = real_inactive;
+ klass->get_view_for_location = real_get_view_for_location;
oclass->dispose = nautilus_window_slot_dispose;
oclass->constructed = nautilus_window_slot_constructed;
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 49b9749..9345f87 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -48,6 +48,13 @@ struct _NautilusWindowSlotClass {
/* wrapped NautilusWindowInfo signals, for overloading */
void (* active) (NautilusWindowSlot *slot);
void (* inactive) (NautilusWindowSlot *slot);
+
+ /* Use this in case the subclassed slot has some special views differents
+ * that the ones supported here. You can return your nautilus view
+ * subclass in this function.
+ */
+ NautilusView* (* get_view_for_location) (NautilusWindowSlot *slot,
+ GFile *location);
};
NautilusWindowSlot * nautilus_window_slot_new (NautilusWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]