X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/5a9cffb11d58c725f425828c09c814d1139bbae1..754b2771ce0de9b290e798f12def2b13245c03fd:/src/background.c diff --git a/src/background.c b/src/background.c index 2cc3a178..f08e9bbe 100644 --- a/src/background.c +++ b/src/background.c @@ -22,7 +22,6 @@ #include #include -#include "vikstatus.h" #include "background.h" static GThreadPool *thread_pool = NULL; @@ -32,10 +31,13 @@ static GtkWidget *bgwindow = NULL; static GtkWidget *bgtreeview = NULL; static GtkListStore *bgstore = NULL; -static GSList *statusbars_to_update = NULL; +// Still only actually updating the statusbar though +static GSList *windows_to_update = NULL; static gint bgitemcount = 0; +#define VIK_BG_NUM_ARGS 7 + enum { TITLE_COLUMN = 0, @@ -44,18 +46,16 @@ enum N_COLUMNS, }; -void a_background_update_status ( VikStatusbar *vs, gchar *str ) +void a_background_update_status ( VikWindow *vw, gpointer data ) { - gdk_threads_enter (); - vik_statusbar_set_message ( vs, 1, str ); - gdk_threads_leave (); + static gchar buf[20]; + g_snprintf(buf, sizeof(buf), _("%d items"), bgitemcount); + vik_window_signal_statusbar_update ( vw, buf, VIK_STATUSBAR_ITEMS ); } static void background_thread_update () { - static gchar buf[20]; - g_snprintf(buf, sizeof(buf), _("%d items"), bgitemcount); - g_slist_foreach ( statusbars_to_update, (GFunc) a_background_update_status, buf ); + g_slist_foreach ( windows_to_update, (GFunc) a_background_update_status, NULL ); } int a_background_thread_progress ( gpointer callbackdata, gdouble fraction ) @@ -74,7 +74,7 @@ int a_background_thread_progress ( gpointer callbackdata, gdouble fraction ) return res; } -static void thread_die ( gpointer args[6] ) +static void thread_die ( gpointer args[VIK_BG_NUM_ARGS] ) { vik_thr_free_func userdata_free_func = args[3]; @@ -106,7 +106,7 @@ int a_background_testcancel ( gpointer callbackdata ) return 0; } -static void thread_helper ( gpointer args[6], gpointer user_data ) +static void thread_helper ( gpointer args[VIK_BG_NUM_ARGS], gpointer user_data ) { /* unpack args */ vik_thr_func func = args[1]; @@ -139,7 +139,7 @@ static void thread_helper ( gpointer args[6], gpointer user_data ) void a_background_thread ( GtkWindow *parent, const gchar *message, vik_thr_func func, gpointer userdata, vik_thr_free_func userdata_free_func, vik_thr_free_func userdata_cancel_cleanup_func, gint number_items ) { GtkTreeIter *piter = g_malloc ( sizeof ( GtkTreeIter ) ); - gpointer *args = g_malloc ( sizeof(gpointer) * 7 ); + gpointer *args = g_malloc ( sizeof(gpointer) * VIK_BG_NUM_ARGS ); g_debug(__FUNCTION__); @@ -287,13 +287,12 @@ void a_background_uninit() g_thread_pool_free ( thread_pool, TRUE, TRUE ); } -void a_background_add_status(VikStatusbar *vs) +void a_background_add_window (VikWindow *vw) { - statusbars_to_update = g_slist_prepend(statusbars_to_update,vs); + windows_to_update = g_slist_prepend(windows_to_update,vw); } -void a_background_remove_status(VikStatusbar *vs) +void a_background_remove_window (VikWindow *vw) { - statusbars_to_update = g_slist_remove(statusbars_to_update,vs); + windows_to_update = g_slist_remove(windows_to_update,vw); } -