summaryrefslogtreecommitdiff
path: root/src/nautilus-window-slot.c
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2015-08-11 12:33:39 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2015-08-16 07:21:01 -0300
commitdd90a18a5c66b90323cfd779b329425fda7ffbeb (patch)
treee3616a617127795e50e210f5542bf60a8cfc207b /src/nautilus-window-slot.c
parentae96063471fd31f1c58818dfa4b0440ce8302f7e (diff)
downloadnautilus-dd90a18a5c66b90323cfd779b329425fda7ffbeb.tar.gz
view: handle view menuwip/gbsneto/view-menu
NautilusToolbar handles the view menu, requiring direct access to the underlying view inside the window slot. Since we're wiping out every access to the underlying view, we shouldn't access it from NautilusToolbar. To fix that, makes the view handle the view widget. Since we're making NautilusWindowSlot a wrapper, add the necessary properties for it to expose view data without exposing the view itself.
Diffstat (limited to 'src/nautilus-window-slot.c')
-rw-r--r--src/nautilus-window-slot.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 766c6a564..0c5e3934e 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -55,6 +55,8 @@ enum {
enum {
PROP_WINDOW = 1,
+ PROP_ICON,
+ PROP_VIEW_WIDGET,
NUM_PROPERTIES
};
@@ -527,6 +529,12 @@ 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;
+ case PROP_VIEW_WIDGET:
+ g_value_set_object (value, nautilus_window_slot_get_view_widget (slot));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -2267,6 +2275,9 @@ 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]);
+ g_object_notify_by_pspec (G_OBJECT (slot), properties[PROP_VIEW_WIDGET]);
}
}
@@ -2448,6 +2459,20 @@ 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);
+
+ properties[PROP_VIEW_WIDGET] =
+ g_param_spec_object ("view-widget",
+ "Widget for the view menu",
+ "The widget for the view's menu",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READABLE);
+
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (NautilusWindowSlotDetails));
}
@@ -2656,3 +2681,27 @@ 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;
+}
+
+GtkWidget*
+nautilus_window_slot_get_view_widget (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_view_widget (view) : NULL;
+}