Example #1
0
/**
* 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);
        }
    }
}
Example #2
0
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);
		}
	}
}
Example #3
0
void ttl74123_device::b_w(UINT8 data)
{
	/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
	if (data && !m_b && !m_a && m_clear)
	{
		start_pulse();
	}

	m_b = data;
}
Example #4
0
void ttl74123_device::a_w(UINT8 data)
{
	/* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */
	if (!data && m_a && m_b && m_clear)
	{
		start_pulse();
	}

	m_a = data;
}
Example #5
0
void TTL74123_B_w(int which, int data)
{
	TTL74123_state *chip = &chips[which];

	/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
	if (data && !chip->B && !chip->A && chip->clear)
		start_pulse(chip);

	chip->B = data;
}
Example #6
0
void TTL74123_A_w(int which, int data)
{
	TTL74123_state *chip = &chips[which];

	/* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */
	if (!data && chip->A && chip->B && chip->clear)
		start_pulse(chip);

	chip->A = data;
}
Example #7
0
void ttl74123_device::clear_w(UINT8 data)
{
	/* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */
	if (data && !m_a && m_b && !m_clear)
	{
		start_pulse();
	}
	else if (!data)	 /* clear the output  */
	{
		timer_adjust_oneshot(m_timer, attotime_zero, 0);

		if (LOG) logerror("74123 #%s:  Cleared\n", tag() );
	}
	m_clear = data;
}
Example #8
0
/**
* operation: The SeahorseOperation to use
* message: An optional message to display
* fract: The fraction finished
* swidget: the SeahorseWidget to get the widgets from
*
* Progress window update. Similar to operation_progress
*
**/
static void
progress_operation_update (SeahorseOperation *operation, const gchar *message, 
                           gdouble fract, SeahorseWidget *swidget)
{
    GtkProgressBar *progress;
    GtkWidget *w;
    const gchar *t;
    
    w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "operation-details"));
    g_return_if_fail (w != NULL);
    
    t = seahorse_operation_get_message (operation);
    gtk_label_set_text (GTK_LABEL (w), t ? t : "");
    
    progress = GTK_PROGRESS_BAR (seahorse_widget_get_widget (swidget, "operation-bar"));
    g_return_if_fail (w != NULL);
    
    if (fract >= 0.0) {
        stop_pulse (progress);
        gtk_progress_bar_set_fraction (progress, fract);        
    } else { 
        start_pulse (progress);
    }
}