コード例 #1
0
ファイル: nemo-progress-ui-handler.c プロジェクト: jensb/nemo
static void
progress_info_changed_cb (NemoProgressInfo *info,
			   NemoProgressUIHandler *self)
{	
	if (g_list_length(self->priv->infos) > 0) {
        NemoProgressInfo *first_info = (NemoProgressInfo *) g_list_first(self->priv->infos)->data;
        GList *l;
        double progress = 0.0;
        int i = 0;
        for (l = self->priv->infos; l != NULL; l = l->next) {
            progress = (progress + nemo_progress_info_get_progress (l->data)) / (double) ++i;
        }
        if (progress > 0) {
            int iprogress = progress * 100;
            gchar *str = g_strdup_printf (_("%d%% %s"), iprogress, nemo_progress_info_get_status(first_info));
            gtk_window_set_title (GTK_WINDOW (self->priv->progress_window), str);
            g_free (str);
            self->priv->active_percent = iprogress;
            progress_ui_handler_update_status_icon (self);
        }
        else {
            gtk_window_set_title (GTK_WINDOW (self->priv->progress_window), nemo_progress_info_get_status(first_info)); 
        }
    } 
}
コード例 #2
0
static void
handle_new_progress_info (NemoProgressUIHandler *self,
			  NemoProgressInfo *info)
{
	self->priv->infos = g_list_append (self->priv->infos, info);	
	
	g_signal_connect (info, "finished",
			  G_CALLBACK (progress_info_finished_cb), self);
			  
	g_signal_connect (info, "progress-changed",
			  G_CALLBACK (progress_info_changed_cb), self);

	self->priv->active_infos++;

	if (self->priv->active_infos == 1) {
		/* this is the only active operation, present the window */
		progress_ui_handler_add_to_window (self, info);
		gtk_window_present (GTK_WINDOW (self->priv->progress_window));
		gtk_window_set_title (GTK_WINDOW (self->priv->progress_window), nemo_progress_info_get_details(info));
		gtk_window_set_icon_name (GTK_WINDOW (self->priv->progress_window), "system-run");			     
	} else {
		progress_ui_handler_add_to_window (self, info);
		progress_ui_handler_update_status_icon (self);
	}
}
コード例 #3
0
static void
progress_ui_handler_update_notification_or_status (NautilusProgressUIHandler *self)
{
	if (self->priv->notification_supports_persistence) {
		progress_ui_handler_update_notification (self);
	} else {
		progress_ui_handler_update_status_icon (self);
	}
}
コード例 #4
0
static void
progress_ui_handler_update_notification_or_status (AthenaProgressUIHandler *self)
{
    if (server_has_persistence ()) {
        progress_ui_handler_update_notification (self);
    } else {
        progress_ui_handler_update_status_icon (self);
    }
}
コード例 #5
0
ファイル: nemo-progress-ui-handler.c プロジェクト: jensb/nemo
static gboolean
progress_window_delete_event (GtkWidget *widget,
			      GdkEvent *event,
			      NemoProgressUIHandler *self)
{
    gtk_widget_hide (widget);

    self->priv->should_show_status_icon = TRUE;
    progress_ui_handler_update_status_icon (self);

    return TRUE;
}
コード例 #6
0
static gboolean
progress_window_delete_event (GtkWidget *widget,
			      GdkEvent *event,
			      NautilusProgressUIHandler *self)
{
	gtk_widget_hide (widget);

	if (self->priv->notification_supports_persistence) {
		progress_ui_handler_update_notification (self);
	} else {
		progress_ui_handler_update_status_icon (self);
	}

	return TRUE;
}
コード例 #7
0
static gboolean
progress_window_delete_event (GtkWidget *widget,
                              GdkEvent *event,
                              AthenaProgressUIHandler *self)
{
    gtk_widget_hide (widget);

    if (server_has_persistence ()) {
        progress_ui_handler_update_notification (self);
    } else {
        progress_ui_handler_update_status_icon (self);
    }

    return TRUE;
}
コード例 #8
0
ファイル: nemo-progress-ui-handler.c プロジェクト: jensb/nemo
static void
progress_info_finished_cb (NemoProgressInfo *info,
			   NemoProgressUIHandler *self)
{
	self->priv->active_infos--;
	self->priv->infos = g_list_remove (self->priv->infos, info);

	if (self->priv->active_infos > 0) {
		if (!gtk_widget_get_visible (self->priv->progress_window)) {
			progress_ui_handler_update_status_icon (self);
		}
	} else {
		if (gtk_widget_get_visible (self->priv->progress_window)) {
			gtk_widget_hide (self->priv->progress_window);
		} else {
			progress_ui_handler_hide_status (self);
			progress_ui_handler_show_complete_notification (self);
		}
	}
}