static void update_operations (NautilusToolbar *self) { GList *progress_infos; GList *l; GtkWidget *progress; gboolean should_show_progress_button = FALSE; gtk_container_foreach (GTK_CONTAINER (self->priv->operations_container), (GtkCallback) gtk_widget_destroy, NULL); disconnect_progress_infos (self); progress_infos = get_filtered_progress_infos (self); for (l = progress_infos; l != NULL; l = l->next) { should_show_progress_button = should_show_progress_button || should_show_progress_info (l->data); g_signal_connect_swapped (l->data, "finished", G_CALLBACK (on_progress_info_finished), self); g_signal_connect_swapped (l->data, "cancelled", G_CALLBACK (on_progress_info_cancelled), self); g_signal_connect_swapped (l->data, "progress-changed", G_CALLBACK (on_progress_info_progress_changed), self); progress = nautilus_progress_info_widget_new (l->data); gtk_box_pack_start (GTK_BOX (self->priv->operations_container), progress, FALSE, FALSE, 0); } g_list_free (progress_infos); /* Either we are already showing the button, so keep showing it until the user * toggle it to hide the operations popover, or, if we want now to show it, * we have to have at least one operation that its total stimated time * is longer than OPERATION_MINIMUM_TIME seconds, or if we failed to get * a correct stimated time and it's around OPERATION_MINIMUM_TIME, * showing the button for just for a moment because now we realized the * estimated time is longer than a OPERATION_MINIMUM_TIME is odd, so show * it only if the remaining time is bigger than again OPERATION_MINIMUM_TIME. */ if (should_show_progress_button && !gtk_revealer_get_reveal_child (GTK_REVEALER (self->priv->operations_revealer))) { add_operations_button_attention_style (self); gtk_revealer_set_reveal_child (GTK_REVEALER (self->priv->operations_revealer), TRUE); gtk_widget_queue_draw (self->priv->operations_icon); } }
static void progress_ui_handler_add_to_window (NautilusProgressUIHandler *self, NautilusProgressInfo *info) { GtkWidget *progress; progress = nautilus_progress_info_widget_new (info); progress_ui_handler_ensure_window (self); gtk_box_pack_start (GTK_BOX (self->priv->window_vbox), progress, FALSE, FALSE, 6); gtk_widget_show (progress); }