G_MODULE_EXPORT void statusbar_remove_all (GtkStatusbar *s) { gtk_statusbar_push (s, 0, "One"); gtk_statusbar_push (s, 0, "Two"); gtk_statusbar_remove_all (s, 0); }
gboolean tmr_statusbar_write (GtkWidget *widget, gpointer statbar) { gtk_statusbar_remove_all(_statbar, _contextid); gtk_statusbar_write(_statbar, _contextid, _msg); _tmrstatusbar = -1; return FALSE; }
static void gm_sb_push_message (GmStatusbar *sb, gboolean flash_message, gboolean info_message, const char *msg, va_list args) { static guint timer_source; gint id = 0; gint msg_id = 0; #if GTK_CHECK_VERSION (2, 21, 2) #else int len = 0; int i = 0; #endif g_return_if_fail (sb != NULL); if (info_message) id = gtk_statusbar_get_context_id (GTK_STATUSBAR (sb), "info"); else id = gtk_statusbar_get_context_id (GTK_STATUSBAR (sb), "statusbar"); #if GTK_CHECK_VERSION (2, 21, 2) gtk_statusbar_remove_all (GTK_STATUSBAR (sb), id); #else len = g_slist_length ((GSList *) (GTK_STATUSBAR (sb)->messages)); for (i = 0 ; i < len ; i++) gtk_statusbar_pop (GTK_STATUSBAR (sb), id); #endif if (msg) { char buffer [1025]; g_vsnprintf (buffer, 1024, msg, args); msg_id = gtk_statusbar_push (GTK_STATUSBAR (sb), id, buffer); if (flash_message) { if (timer_source != 0) { g_source_remove (timer_source); timer_source = 0; } callback_info* info = g_new0 (callback_info, 1); info->statusbar = GTK_STATUSBAR (sb); info->msg_id = msg_id; timer_source = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 15, gm_statusbar_clear_msg_cb, info, g_free); } } }
/* Helper function for uistatus() */ static gboolean realstatus(gpointer data) { GtkStatusbar* sb = GTK_STATUSBAR(gtk_builder_get_object(builder, "statusbar")); GtkSpinner* spinner = GTK_SPINNER(gtk_builder_get_object(builder, "busy_spinner")); struct statusupdate *update = (struct statusupdate*)data; if(G_UNLIKELY(!statusbar_context)) { statusbar_context = gtk_statusbar_get_context_id(sb, "useless"); } gtk_statusbar_remove_all(sb, statusbar_context); gtk_widget_set_visible(GTK_WIDGET(spinner), update->spin); g_object_set(G_OBJECT(spinner), "active", update->spin, NULL); if(update->text) { gtk_statusbar_push(sb, statusbar_context, update->text); g_free(update->text); } g_free(update); return FALSE; }
int gtk_statusbar_write (GtkStatusbar *statusbar, guint context_id, const gchar *text) { gtk_statusbar_remove_all(statusbar, context_id); return gtk_statusbar_push(statusbar, context_id, text); }
void cir_gtk_status_update(char *message) { gtk_statusbar_remove_all(GTK_STATUSBAR(statusbar), 0); gtk_statusbar_push(GTK_STATUSBAR(statusbar), 0, message); }