/** * operation: The operation to process * message: The message that will be pushed to the status bar * fract: The fraction of the progress bar to fill * swidget: The SeahorseWidget to extract the gtk widgets from * * This gets called whenever an operation updates it's progress status thingy. * We update the appbar as appropriate. If operation != NULL then we only * display the latest operation in our special list * **/ static void operation_progress (SeahorseOperation *operation, const gchar *message, gdouble fract, SeahorseWidget *swidget) { GtkProgressBar *progress; GtkStatusbar *status; guint id; progress = GTK_PROGRESS_BAR (seahorse_widget_get_widget (swidget, "progress")); status = GTK_STATUSBAR (seahorse_widget_get_widget (swidget, "status")); if (!seahorse_operation_is_running (operation)) fract = 0.0; if (message != NULL && status) { g_return_if_fail (GTK_IS_STATUSBAR (status)); id = gtk_statusbar_get_context_id (status, "operation-progress"); gtk_statusbar_pop (status, id); if (message[0]) gtk_statusbar_push (status, id, message); } if(progress) { g_return_if_fail (GTK_IS_PROGRESS_BAR (progress)); if (fract >= 0.0) { stop_pulse (progress); gtk_progress_bar_set_fraction (progress, fract); } else { start_pulse (progress); } } }
static const gchar* gail_statusbar_get_name (AtkObject *obj) { const gchar* name; g_return_val_if_fail (GAIL_IS_STATUSBAR (obj), NULL); name = ATK_OBJECT_CLASS (gail_statusbar_parent_class)->get_name (obj); if (name != NULL) return name; else { /* * Get the text on the label */ GtkWidget *widget; GtkWidget *label; widget = GTK_ACCESSIBLE (obj)->widget; if (widget == NULL) /* * State is defunct */ return NULL; g_return_val_if_fail (GTK_IS_STATUSBAR (widget), NULL); label = get_label_from_statusbar (widget); if (GTK_IS_LABEL (label)) return gtk_label_get_label (GTK_LABEL (label)); else return NULL; } }
static void test_statusbar_basic (void) { GtkWidget *widget; widget = gtk_statusbar_new (); g_assert (GTK_IS_STATUSBAR (widget)); gtk_widget_destroy (widget); }
static void progress_update_display (TrackedTask *task) { GtkProgressBar *progress = NULL; GtkStatusbar *status = NULL; GtkLabel *label = NULL; GtkWidget *widget; TrackedPart *part; gdouble fraction; guint id; if (task->builder == NULL) return; /* Dig out our progress display stuff */ widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "progress-bar")); if (widget == NULL) g_warning ("cannot display progress because seahorse window has no progress widget"); else progress = GTK_PROGRESS_BAR (widget); widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "status")); if (GTK_IS_STATUSBAR (widget)) { status = GTK_STATUSBAR (widget); } else { widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "progress-details")); if (GTK_IS_LABEL (widget)) label = GTK_LABEL (widget); } /* The details is the first on a begun part */ part = tracked_part_find (task, find_part_begun_with_details, NULL); if (status) { id = gtk_statusbar_get_context_id (status, "operation-progress"); gtk_statusbar_pop (status, id); if (part != NULL) gtk_statusbar_push (status, id, part->details); } else if (label) { gtk_label_set_text (label, part ? part->details : ""); } /* If all parts are running simultaneously then indeterminate */ if (task->parts_prepped == 0 && task->parts_ended == 0) { fraction = -1; } else { fraction = (gdouble)task->parts_ended / (gdouble)task->parts->length; } if (progress) { if (fraction >= 0.0) { stop_pulse (progress); gtk_progress_bar_set_fraction (progress, fraction); } else { start_pulse (progress); } } }
/*---------------------------------------------------------------------------*/ static void menu_item_deselect_cb (GtkMenuItem *proxy, glWindow *window) { g_return_if_fail (window && GL_IS_WINDOW (window)); g_return_if_fail (window->status_bar && GTK_IS_STATUSBAR (window->status_bar)); gtk_statusbar_pop (GTK_STATUSBAR (window->status_bar), window->menu_tips_context_id); }
/** * Display a message in the status bar. * * \param message Message to display. */ void gsb_status_message ( gchar * message ) { if ( ! main_statusbar || ! GTK_IS_STATUSBAR ( main_statusbar ) ) return; gsb_status_clear (); message_id = gtk_statusbar_push ( GTK_STATUSBAR (main_statusbar), context_id, message ); /* force status message to be displayed NOW */ update_gui ( ); }
static void gwy_statusbar_update_markup(GtkStatusbar *statusbar, G_GNUC_UNUSED guint context_id, const gchar *text) { g_return_if_fail(GTK_IS_STATUSBAR(statusbar)); if (!text) text = ""; /* FIXME: this causes size allocation request */ gtk_label_set_markup(GTK_LABEL(statusbar->label), text); }
/** * Clear any message in the status bar. */ void gsb_status_clear ( ) { if ( ! main_statusbar || ! GTK_IS_STATUSBAR ( main_statusbar ) ) return; if ( message_id >= 0 ) { gtk_statusbar_remove ( GTK_STATUSBAR (main_statusbar), context_id, message_id ); message_id = -1; } /* force status message to be displayed NOW */ update_gui ( ); }
void fwitux_replies_window_set_statusbar_msg (const gchar *message) { FwituxRepliesWindowPriv *priv; priv = GET_PRIV (replies_window); /* Avoid some warnings */ if (!priv->statusbar || !GTK_IS_STATUSBAR (priv->statusbar)) return; /* conext ID will be always 1 */ gtk_statusbar_pop (GTK_STATUSBAR (priv->statusbar), 1); gtk_statusbar_push (GTK_STATUSBAR (priv->statusbar), 1, message); }
/*---------------------------------------------------------------------------*/ static void menu_item_select_cb (GtkMenuItem *proxy, glWindow *window) { GtkAction *action; char *message; g_return_if_fail (window && GL_IS_WINDOW (window)); g_return_if_fail (window->status_bar && GTK_IS_STATUSBAR (window->status_bar)); action = g_object_get_data (G_OBJECT (proxy), "gtk-action"); g_return_if_fail (action != NULL); g_object_get (G_OBJECT (action), "tooltip", &message, NULL); if (message) { gtk_statusbar_push (GTK_STATUSBAR (window->status_bar), window->menu_tips_context_id, message); g_free (message); } }
GtkWidget* qtcWindowGetStatusBar(GtkWidget *parent, int level) { if (level < 3 && GTK_IS_CONTAINER(parent) && canGetChildren(parent) /* && gtk_widget_get_realized(parent)*/) { GtkWidget *rv = NULL; GList *children = gtk_container_get_children(GTK_CONTAINER(parent)); for(GList *child = children;child && !rv;child = child->next) { GtkWidget *boxChild = (GtkWidget*)child->data; if (GTK_IS_STATUSBAR(boxChild)) { rv=GTK_WIDGET(boxChild); } else if (GTK_IS_CONTAINER(boxChild)) { rv=qtcWindowGetStatusBar(GTK_WIDGET(boxChild), level + 1); } } if (children) { g_list_free(children); } return rv; } return NULL; }