[nautilus/wip/gbsneto/view-menu] window-slot: add an ::icon property
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gbsneto/view-menu] window-slot: add an ::icon property
- Date: Tue, 11 Aug 2015 17:54:58 +0000 (UTC)
commit e2f7b7c53e1e41f6cf6c3cde51529401c3be5848
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Aug 11 14:53:11 2015 -0300
window-slot: add an ::icon property
The icon property of NautilusWindowSlot is a wrapper
around the icon of the view. This is needed for us
to be able to isolate NautilusView from outside
access.
src/nautilus-window-slot.c | 25 +++++++++++++++++++++++++
src/nautilus-window-slot.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 766c6a5..43f5841 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -55,6 +55,7 @@ enum {
enum {
PROP_WINDOW = 1,
+ PROP_ICON,
NUM_PROPERTIES
};
@@ -527,6 +528,9 @@ nautilus_window_slot_get_property (GObject *object,
case PROP_WINDOW:
g_value_set_object (value, slot->details->window);
break;
+ case PROP_ICON:
+ g_value_set_object (value, nautilus_window_slot_get_icon (slot));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -2267,6 +2271,8 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *slot)
gtk_container_add (GTK_CONTAINER (slot), widget);
gtk_widget_set_vexpand (widget, TRUE);
gtk_widget_show (widget);
+
+ g_object_notify_by_pspec (G_OBJECT (slot), properties[PROP_ICON]);
}
}
@@ -2448,6 +2454,13 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
NAUTILUS_TYPE_WINDOW,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+ properties[PROP_ICON] =
+ g_param_spec_object ("icon",
+ "Icon that represents the slot",
+ "The icon that represents the slot",
+ G_TYPE_ICON,
+ G_PARAM_READABLE);
+
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (NautilusWindowSlotDetails));
}
@@ -2656,3 +2669,15 @@ nautilus_window_slot_new (NautilusWindow *window)
"window", window,
NULL);
}
+
+GIcon*
+nautilus_window_slot_get_icon (NautilusWindowSlot *slot)
+{
+ NautilusView *view;
+
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot), NULL);
+
+ view = nautilus_window_slot_get_current_view (slot);
+
+ return view ? nautilus_view_get_icon (view) : NULL;
+}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 97ff788..5b96570 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -127,4 +127,6 @@ void nautilus_window_slot_display_view_selection_failure (NautilusWindow *wind
GFile *location,
GError *error);
+GIcon* nautilus_window_slot_get_icon (NautilusWindowSlot *slot);
+
#endif /* NAUTILUS_WINDOW_SLOT_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]