]> err.no Git - mapper/commitdiff
Add a progress bar to the toolbar.
authorKaj-Michael Lang <milang@onion.tal.org>
Tue, 19 Jun 2007 13:08:21 +0000 (16:08 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Tue, 19 Jun 2007 13:08:21 +0000 (16:08 +0300)
Use the progress bar from the hildon wrappers

src/hildon-wrappers.c
src/map.c
src/ui-common.c
src/ui-common.h

index eba28fdefe69ecec71e3a8e375a57f052e4a87d1..3d6c8fa9fff71e76258e607e2704010628c0d514 100644 (file)
@@ -8,7 +8,7 @@
 #include <gtk/gtk.h>
 #include "ui-common.h"
 
-static _sb_sid=0;
+static gint _sb_sid=0;
 
 GtkWidget *hildon_file_chooser_dialog_new(GtkWindow * parent,
                                          GtkFileChooserAction action)
@@ -51,9 +51,11 @@ void hildon_banner_show_information(GtkWidget *w, void *t, gchar *text)
        _sb_sid=g_timeout_add(6000, status_bar_clear, NULL);
 }
 
-GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar * bar,
+GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar *bar,
                                       const gchar * text)
 {
+       gtk_widget_show(_progress_item);
+       gtk_progress_bar_set_text(_progress_item, text);
        hildon_banner_show_information(_status_bar, NULL, text);
        return NULL;
 }
@@ -66,21 +68,29 @@ GtkWidget *hildon_note_new_confirmation(GtkWidget *widget, const gchar *text)
                                        GTK_BUTTONS_OK_CANCEL, text);
 }
 
-void hildon_banner_set_fraction(GtkWidget * widget, gfloat tmp)
+void hildon_banner_set_fraction(GtkWidget * widget, gdouble fraction)
 {
-
+       gtk_progress_bar_set_fraction(_progress_item, fraction);
+       if (fraction==1.0)
+               gtk_widget_hide(_progress_item);
+       else
+               gtk_widget_show(_progress_item);
+       g_printf("P: %f\n", fraction);
 }
 
-GtkWidget *hildon_banner_show_animation(GtkWidget * widget,
-                                       const gchar * animation_name,
-                                       const gchar * text)
+GtkWidget *hildon_banner_show_animation(GtkWidget *widget,
+                                       const gchar *animation_name,
+                                       const gchar *text)
 {
        hildon_banner_show_information(_status_bar, NULL, text);
+       gtk_widget_show(_progress_item);
+       gtk_progress_bar_pulse(_progress_item);
        return NULL;
 }
 
 void gtk_widget_tap_and_hold_setup(GtkWidget * a, GtkWidget * w, void *p, gint t)
 {
+
 }
 
 GtkWidget *hildon_number_editor_new(gint min, gint max)
index 79421899dfabce3f5e938653d3cb40170b35cb9d..7e4d3b70d253e464cc925cf87e4e4ae8a5c30643 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -51,6 +51,9 @@ static guint _id = 0;
 static gint _zoom_timeout_sid=0;
 static gint _map_mode=0;
 
+guint _num_downloads=0;
+guint _curr_download=0;
+
 void map_render_paths();
 void map_force_redraw();
 gboolean curl_download_timeout();
@@ -716,8 +719,7 @@ gboolean map_download_idle_refresh(ProgressUpdateInfo * pui)
                } else {
                        /* No more retries left - something must be wrong. */
                        MACRO_BANNER_SHOW_INFO(_window,
-                                              _
-                                              ("Error in download.  Check internet connection"
+                                              _("Error in download.  Check internet connection"
                                                " and/or Map Repository URL Format."));
                }
        }
@@ -731,8 +733,7 @@ gboolean map_download_idle_refresh(ProgressUpdateInfo * pui)
                _num_downloads = _curr_download = 0;
        } else
                hildon_banner_set_fraction(HILDON_BANNER(_download_banner),
-                                          _curr_download /
-                                          (double)_num_downloads);
+                                          _curr_download / (double)_num_downloads);
 
        vprintf("%s(): return\n", __PRETTY_FUNCTION__);
        return FALSE;
index 30d714ae9a470b6cf5d7ece82788cdf9b781fe89..b5d8b63a0327dc76de2bb39c7aa386beec51e4f8 100644 (file)
@@ -765,7 +765,10 @@ item = gtk_separator_tool_item_new();
 gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1);
 
 #ifndef WITH_HILDON
-
+item = gtk_tool_item_new();
+_progress_item=gtk_progress_bar_new();
+gtk_container_add(item, _progress_item);
+gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1);
 #endif
 }
 
index 99a91fa3ea7017039b9aaef28c0320bec47eb93a..9e1d059447a2b75e68c8170c1b8ece27c2dfdda3 100644 (file)
@@ -128,6 +128,7 @@ GtkWidget *_menu_poi_item;
 
 /* Toolbar items */
 GtkWidget *_toolbar_fullscreen_item;
+GtkWidget *_progress_item;
 
 /* Menu items for the "Auto-Center" submenu. */
 GtkWidget *_menu_ac_latlon_item;