summaryrefslogtreecommitdiff
path: root/src/nautilus-places-view.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-11-14 14:48:30 +0100
committerCarlos Soriano <csoriano@gnome.org>2016-11-23 13:02:29 +0100
commit88cee3926a95150099f479cc16487ba01d6c8520 (patch)
tree9d54fb07fad793a75fb40558a256644c419634d1 /src/nautilus-places-view.c
parentd4323bd2be071b795552610245219a6a47cafb78 (diff)
downloadnautilus-88cee3926a95150099f479cc16487ba01d6c8520.tar.gz
view: make icon getter static
We were relying on the current view to return the icon to put in the toolbar, however that requires a view instance and also we cannot control really what icon we want to show in which circumstances. We want more control about that, so we need a single entry point where we can get the icon to show depending on the known view types we have. So this patch converts the view property to a static method. https://bugzilla.gnome.org/show_bug.cgi?id=771075
Diffstat (limited to 'src/nautilus-places-view.c')
-rw-r--r--src/nautilus-places-view.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index 151e424e4..981d2de15 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -26,7 +26,6 @@
typedef struct
{
GFile *location;
- GIcon *icon;
NautilusQuery *search_query;
NautilusToolbarMenuSections *toolbar_menu_sections;
@@ -47,7 +46,6 @@ G_DEFINE_TYPE_WITH_CODE (NautilusPlacesView, nautilus_places_view, GTK_TYPE_BOX,
enum
{
PROP_0,
- PROP_ICON,
PROP_LOCATION,
PROP_SEARCH_QUERY,
PROP_IS_LOADING,
@@ -142,7 +140,6 @@ nautilus_places_view_finalize (GObject *object)
NautilusPlacesView *self = (NautilusPlacesView *) object;
NautilusPlacesViewPrivate *priv = nautilus_places_view_get_instance_private (self);
- g_clear_object (&priv->icon);
g_clear_object (&priv->location);
g_clear_object (&priv->search_query);
@@ -161,12 +158,6 @@ nautilus_places_view_get_property (GObject *object,
switch (prop_id)
{
- case PROP_ICON:
- {
- g_value_set_object (value, nautilus_view_get_icon (view));
- }
- break;
-
case PROP_LOCATION:
{
g_value_set_object (value, nautilus_view_get_location (view));
@@ -211,16 +202,6 @@ nautilus_places_view_set_property (GObject *object,
}
}
-static GIcon *
-nautilus_places_view_get_icon (NautilusView *view)
-{
- NautilusPlacesViewPrivate *priv;
-
- priv = nautilus_places_view_get_instance_private (NAUTILUS_PLACES_VIEW (view));
-
- return priv->icon;
-}
-
static GFile *
nautilus_places_view_get_location (NautilusView *view)
{
@@ -334,10 +315,15 @@ nautilus_places_view_is_searching (NautilusView *view)
return priv->search_query != NULL;
}
+static guint
+nautilus_places_view_get_view_id (NautilusView *view)
+{
+ return NAUTILUS_VIEW_OTHER_LOCATIONS_ID;
+}
+
static void
nautilus_places_view_iface_init (NautilusViewInterface *iface)
{
- iface->get_icon = nautilus_places_view_get_icon;
iface->get_location = nautilus_places_view_get_location;
iface->set_location = nautilus_places_view_set_location;
iface->get_selection = nautilus_places_view_get_selection;
@@ -347,6 +333,7 @@ nautilus_places_view_iface_init (NautilusViewInterface *iface)
iface->get_toolbar_menu_sections = nautilus_places_view_get_toolbar_menu_sections;
iface->is_loading = nautilus_places_view_is_loading;
iface->is_searching = nautilus_places_view_is_searching;
+ iface->get_view_id = nautilus_places_view_get_view_id;
}
static void
@@ -358,7 +345,6 @@ nautilus_places_view_class_init (NautilusPlacesViewClass *klass)
object_class->get_property = nautilus_places_view_get_property;
object_class->set_property = nautilus_places_view_set_property;
- g_object_class_override_property (object_class, PROP_ICON, "icon");
g_object_class_override_property (object_class, PROP_IS_LOADING, "is-loading");
g_object_class_override_property (object_class, PROP_IS_SEARCHING, "is-searching");
g_object_class_override_property (object_class, PROP_LOCATION, "location");
@@ -372,9 +358,6 @@ nautilus_places_view_init (NautilusPlacesView *self)
priv = nautilus_places_view_get_instance_private (self);
- /* Icon */
- priv->icon = g_themed_icon_new_with_default_fallbacks ("view-list-symbolic");
-
/* Location */
priv->location = g_file_new_for_uri ("other-locations:///");