aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-12 06:25:14 +0800
committerPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-12 06:28:21 +0800
commitba975704f0cfeae622fdd2967f36ebf2c39e29df (patch)
treefaf6a48c1801e53ac4da94d973cfa307d8111c8e
parent3974937e07af52950c8f8ae411069a04804f8ab3 (diff)
downloadgsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar.gz
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar.bz2
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar.lz
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar.xz
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.tar.zst
gsoc2013-empathy-ba975704f0cfeae622fdd2967f36ebf2c39e29df.zip
Add spinning throbber to EmpathyMapView
OSM servers can be slow at times, the user can now know that data is loading
-rw-r--r--src/empathy-map-view.c27
-rw-r--r--src/empathy-map-view.ui27
2 files changed, 54 insertions, 0 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 458c297be..05f5291d2 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -40,6 +40,7 @@
#include <libempathy-gtk/empathy-ui-utils.h>
#include "empathy-map-view.h"
+#include "ephy-spinner.h"
#define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
#include <libempathy/empathy-debug.h>
@@ -50,6 +51,7 @@ typedef struct {
GtkWidget *window;
GtkWidget *zoom_in;
GtkWidget *zoom_out;
+ GtkWidget *throbber;
ChamplainView *map_view;
ChamplainLayer *layer;
} EmpathyMapView;
@@ -68,6 +70,20 @@ static void map_view_contact_location_notify (GObject *gobject,
GParamSpec *arg1,
gpointer user_data);
+static void
+map_view_state_changed (ChamplainView *view,
+ GParamSpec *gobject,
+ EmpathyMapView *window)
+{
+ ChamplainState state;
+
+ g_object_get (G_OBJECT (view), "state", &state, NULL);
+ if (state == CHAMPLAIN_STATE_LOADING)
+ ephy_spinner_start (EPHY_SPINNER (window->throbber));
+ else
+ ephy_spinner_stop (EPHY_SPINNER (window->throbber));
+}
+
GtkWidget *
empathy_map_view_show (void)
{
@@ -75,6 +91,7 @@ empathy_map_view_show (void)
GtkBuilder *gui;
GtkWidget *sw;
GtkWidget *embed;
+ GtkWidget *throbber_holder;
gchar *filename;
GtkTreeModel *model;
EmpathyContactList *list_iface;
@@ -95,6 +112,7 @@ empathy_map_view_show (void)
"zoom_in", &window->zoom_in,
"zoom_out", &window->zoom_out,
"map_scrolledwindow", &sw,
+ "throbber", &throbber_holder,
NULL);
g_free (filename);
@@ -115,6 +133,12 @@ empathy_map_view_show (void)
empathy_contact_list_store_set_show_avatars (list_store, TRUE);
g_object_unref (list_iface);
+ window->throbber = ephy_spinner_new ();
+ ephy_spinner_set_size (EPHY_SPINNER (window->throbber),
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_widget_show (window->throbber);
+ gtk_container_add (GTK_CONTAINER (throbber_holder), window->throbber);
+
window->list_store = list_store;
/* Set up map view */
@@ -131,6 +155,9 @@ empathy_map_view_show (void)
window->layer = g_object_ref (champlain_layer_new ());
champlain_view_add_layer (window->map_view, window->layer);
+ g_signal_connect (window->map_view, "notify::state",
+ G_CALLBACK (map_view_state_changed), window);
+
/* Set up contact list. */
model = GTK_TREE_MODEL (window->list_store);
gtk_tree_model_foreach (model, map_view_contacts_foreach, window);
diff --git a/src/empathy-map-view.ui b/src/empathy-map-view.ui
index f1140399b..545136d4d 100644
--- a/src/empathy-map-view.ui
+++ b/src/empathy-map-view.ui
@@ -34,6 +34,33 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolItem" id="toolbutton1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="throbber">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>