summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-08-19 14:46:34 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-08-20 11:58:09 +0200
commit2181b21d2a6b619847928e0aef272186f1d0b297 (patch)
tree82e4626fb0139bf83c4def61a00d71e97e6687f7
parent04a08d25c9f228e273ba62918ae37a6fe84cddfa (diff)
downloadgtk+-wip/csoriano/networks.tar.gz
gtkplacesview: add a loading propertywip/csoriano/networks
So clients of the view can know if the view is busy. https://bugzilla.gnome.org/show_bug.cgi?id=753786
-rw-r--r--gtk/gtkplacesview.c39
-rw-r--r--gtk/gtkplacesviewprivate.h3
2 files changed, 42 insertions, 0 deletions
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index e9e75bf3e9..f9b42d9a9b 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -85,6 +85,7 @@ struct _GtkPlacesViewPrivate
guint entry_pulse_timeout_id;
guint connecting_to_server : 1;
guint fetching_networks : 1;
+ guint loading : 1;
};
static void mount_volume (GtkPlacesView *view,
@@ -107,6 +108,7 @@ enum {
PROP_0,
PROP_LOCAL_ONLY,
PROP_OPEN_FLAGS,
+ PROP_LOADING,
LAST_PROP
};
@@ -411,6 +413,10 @@ gtk_places_view_get_property (GObject *object,
g_value_set_boolean (value, gtk_places_view_get_local_only (self));
break;
+ case PROP_LOADING:
+ g_value_set_boolean (value, gtk_places_view_get_loading (self));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -971,6 +977,9 @@ network_enumeration_next_files_finished (GObject *source_object,
/* avoid to update widgets if the operation was cancelled in finalize */
if (priv->listbox != NULL)
update_network_state (view);
+
+ priv->loading = FALSE;
+ g_object_notify_by_pspec (G_OBJECT (view), properties[PROP_LOADING]);
}
static void
@@ -1053,6 +1062,9 @@ update_places (GtkPlacesView *view)
priv->network_placeholder = NULL;
priv->network_header_spinner = NULL;
+ priv->loading = TRUE;
+ g_object_notify_by_pspec (G_OBJECT (view), properties[PROP_LOADING]);
+
/* Add "Computer" row */
file = g_file_new_for_path ("/");
icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk");
@@ -2164,6 +2176,13 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
FALSE,
G_PARAM_READWRITE);
+ properties[PROP_LOADING] =
+ g_param_spec_boolean ("loading",
+ P_("Loading"),
+ P_("Whether the view is loading locations"),
+ FALSE,
+ G_PARAM_READABLE);
+
properties[PROP_OPEN_FLAGS] =
g_param_spec_flags ("open-flags",
P_("Open Flags"),
@@ -2342,6 +2361,26 @@ gtk_places_view_set_search_query (GtkPlacesView *view,
}
/**
+ * gtk_places_view_get_loading:
+ * @view: a #GtkPlacesView
+ *
+ * Returns %TRUE if the view is loading locations.
+ *
+ * Since: 3.18
+ */
+gboolean
+gtk_places_view_get_loading (GtkPlacesView *view)
+{
+ GtkPlacesViewPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE);
+
+ priv = gtk_places_view_get_instance_private (view);
+
+ return priv->loading;
+}
+
+/**
* gtk_places_view_get_local_only:
* @view: a #GtkPlacesView
*
diff --git a/gtk/gtkplacesviewprivate.h b/gtk/gtkplacesviewprivate.h
index 17f55fd3a7..00eab93771 100644
--- a/gtk/gtkplacesviewprivate.h
+++ b/gtk/gtkplacesviewprivate.h
@@ -86,6 +86,9 @@ void gtk_places_view_set_local_only (GtkPlacesView
gboolean local_only);
GDK_AVAILABLE_IN_3_18
+gboolean gtk_places_view_get_loading (GtkPlacesView *view);
+
+GDK_AVAILABLE_IN_3_18
GtkWidget * gtk_places_view_new (void);
G_END_DECLS