X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-accounts-window.c;h=d083b0e8685d21caba468a68a12911131ed029c4;hp=8fd60267af38eba178c4a0d03cbda94b8c4c1bc6;hb=7d07f29b865a0c42691c73affa6ab618dad8b3b3;hpb=2acb02c4cf9b7c529abead2dfc70d3b7559931b1;ds=sidebyside diff --git a/src/hildon2/modest-accounts-window.c b/src/hildon2/modest-accounts-window.c index 8fd6026..d083b0e 100644 --- a/src/hildon2/modest-accounts-window.c +++ b/src/hildon2/modest-accounts-window.c @@ -59,7 +59,13 @@ static void on_account_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, ModestAccountsWindow *accounts_window); +static void on_progress_list_changed (ModestWindowMgr *mgr, + ModestAccountsWindow *self); static void setup_menu (ModestAccountsWindow *self); +static gboolean _modest_accounts_window_map_event (GtkWidget *widget, + GdkEvent *event, + gpointer userdata); +static void update_progress_hint (ModestAccountsWindow *self); typedef struct _ModestAccountsWindowPrivate ModestAccountsWindowPrivate; @@ -70,6 +76,7 @@ struct _ModestAccountsWindowPrivate { /* signals */ GSList *sighandlers; + gboolean progress_hint; }; #define MODEST_ACCOUNTS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ MODEST_TYPE_ACCOUNTS_WINDOW, \ @@ -129,6 +136,7 @@ modest_accounts_window_instance_init (ModestAccountsWindow *obj) priv->sighandlers = NULL; priv->account_view = NULL; + priv->progress_hint = FALSE; modest_window_mgr_register_help_id (modest_runtime_get_window_mgr(), GTK_WINDOW(obj), @@ -171,6 +179,12 @@ connect_signals (ModestAccountsWindow *self) G_OBJECT (priv->account_view), "row-activated", G_CALLBACK (on_account_activated), self); + priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers, + G_OBJECT (modest_runtime_get_window_mgr ()), + "progress-list-changed", + G_CALLBACK (on_progress_list_changed), self); + + /* window */ /* we don't register this in sighandlers, as it should be run after disconnecting all signals, @@ -227,6 +241,12 @@ modest_accounts_window_new (void) * so that the UI is not visible for non-menu D-Bus activation. */ + g_signal_connect (G_OBJECT (self), "map-event", + G_CALLBACK (_modest_accounts_window_map_event), + G_OBJECT (self)); + update_progress_hint (self); + + return MODEST_WINDOW(self); } @@ -298,3 +318,36 @@ on_account_activated (GtkTreeView *account_view, } +static gboolean +_modest_accounts_window_map_event (GtkWidget *widget, + GdkEvent *event, + gpointer userdata) +{ + ModestAccountsWindow *self = (ModestAccountsWindow *) userdata; + ModestAccountsWindowPrivate *priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (self); + + if (priv->progress_hint) { + hildon_gtk_window_set_progress_indicator (GTK_WINDOW (self), TRUE); + } + + return FALSE; +} + +static void +update_progress_hint (ModestAccountsWindow *self) +{ + ModestAccountsWindowPrivate *priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (self); + + priv->progress_hint = modest_window_mgr_has_progress_operation (modest_runtime_get_window_mgr ()); + + if (GTK_WIDGET_VISIBLE (self)) { + hildon_gtk_window_set_progress_indicator (GTK_WINDOW (self), priv->progress_hint?1:0); + } +} + +static void +on_progress_list_changed (ModestWindowMgr *mgr, + ModestAccountsWindow *self) +{ + update_progress_hint (self); +}