Merge lp:~rodrigo-moya/libubuntuone/progress-bar into lp:libubuntuone

Proposed by Rodrigo Moya
Status: Merged
Approved by: Stuart Langridge
Approved revision: 76
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/libubuntuone/progress-bar
Merge into: lp:libubuntuone
Diff against target: 61 lines (+26/-0)
1 file modified
libubuntuone/u1-music-store.c (+26/-0)
To merge this branch: bzr merge lp:~rodrigo-moya/libubuntuone/progress-bar
Reviewer Review Type Date Requested Status
Stuart Langridge (community) Approve
Review via email: mp+22381@code.launchpad.net

Commit message

Add a progress bar to show loading progress

Description of the change

Add a progress bar to show loading progress

To post a comment you must log in.
Revision history for this message
Stuart Langridge (sil) wrote :

nice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntuone/u1-music-store.c'
2--- libubuntuone/u1-music-store.c 2010-03-29 15:55:05 +0000
3+++ libubuntuone/u1-music-store.c 2010-03-29 17:12:31 +0000
4@@ -54,6 +54,7 @@
5 GtkWidget *initial_web_viewer;
6 GtkWidget *web_viewer;
7 WebKitWebFrame *frame_to_use;
8+ GtkWidget *progress;
9
10 GdkCursor *busy_cursor;
11 GdkCursor *normal_cursor;
12@@ -757,6 +758,8 @@
13 g_free (tmp_url);
14
15 /* Signal users the URL finished loading */
16+ gtk_widget_hide (music_store->priv->progress);
17+
18 g_signal_emit (music_store, u1_music_store_signals[URL_LOADED_SIGNAL], 0,
19 (const gchar *) webkit_web_view_get_uri (WEBKIT_WEB_VIEW (music_store->priv->web_viewer)));
20 }
21@@ -822,6 +825,22 @@
22 }
23
24 static void
25+viewer_property_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
26+{
27+ U1MusicStore *music_store = U1_MUSIC_STORE (user_data);
28+
29+ if (g_strcmp0 (pspec->name, "progress") == 0) {
30+ gdouble progress = webkit_web_view_get_progress (WEBKIT_WEB_VIEW (music_store->priv->web_viewer));
31+
32+ if (progress > 0.0 && progress < 1.0) {
33+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (music_store->priv->progress), progress);
34+ gtk_widget_show (music_store->priv->progress);
35+ } else
36+ gtk_widget_hide (music_store->priv->progress);
37+ }
38+}
39+
40+static void
41 u1_music_store_init (U1MusicStore *music_store)
42 {
43 gchar *new_user_agent;
44@@ -896,10 +915,17 @@
45 gtk_widget_show (music_store->priv->initial_web_viewer);
46 gtk_container_add (GTK_CONTAINER (music_store->priv->scroll), music_store->priv->initial_web_viewer);
47
48+ /* Create a hidden progress bar */
49+ music_store->priv->progress = gtk_progress_bar_new ();
50+
51+ g_signal_connect (G_OBJECT (music_store->priv->web_viewer), "notify",
52+ G_CALLBACK (viewer_property_changed_cb), music_store);
53+
54 /* And load the real store in the background */
55 music_store->priv->idle_cb = g_idle_add ((GSourceFunc) load_real_store_cb, music_store);
56
57 gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->scroll, TRUE, TRUE, 3);
58+ gtk_box_pack_start (GTK_BOX (music_store), music_store->priv->progress, FALSE, FALSE, 3);
59 }
60
61 /**

Subscribers

People subscribed via source and target branches