[gthumb] progress dialog: set the task description as dialog title if the main window is hidden
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] progress dialog: set the task description as dialog title if the main window is hidden
- Date: Wed, 13 Jul 2011 08:11:44 +0000 (UTC)
commit d90edd8b8a56b0e0a5776d613c54cb038980a0c9
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Jul 13 10:10:12 2011 +0200
progress dialog: set the task description as dialog title if the main window is hidden
[bug #628769]
gthumb/gth-progress-dialog.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-progress-dialog.c b/gthumb/gth-progress-dialog.c
index de396d2..78a3186 100644
--- a/gthumb/gth-progress-dialog.c
+++ b/gthumb/gth-progress-dialog.c
@@ -418,6 +418,35 @@ task_dialog_cb (GthTask *task,
}
+static void
+main_dialog_task_progress_cb (GthTask *task,
+ const char *description,
+ const char *details,
+ gboolean pulse,
+ double fraction,
+ gpointer user_data)
+{
+ GthProgressDialog *self = user_data;
+ GString *title;
+
+ /* set the task description as dialog title if the main window is hidden */
+
+ if (description == NULL)
+ return;
+
+ if ((self->priv->parent != NULL) && gtk_widget_get_mapped (GTK_WIDGET (self->priv->parent)))
+ return;
+
+ title = g_string_new ("");
+ g_string_append (title, description);
+ g_string_append (title, " - ");
+ g_string_append (title, _("gThumb"));
+ gtk_window_set_title (GTK_WINDOW (self), title->str);
+
+ g_string_free (title, TRUE);
+}
+
+
void
gth_progress_dialog_add_task (GthProgressDialog *self,
GthTask *task)
@@ -428,13 +457,21 @@ gth_progress_dialog_add_task (GthProgressDialog *self,
"dialog",
G_CALLBACK (task_dialog_cb),
self);
+ g_signal_connect (task,
+ "progress",
+ G_CALLBACK (main_dialog_task_progress_cb),
+ self);
+
+ gtk_window_set_title (GTK_WINDOW (self), "");
child = gth_task_progress_new (task);
gtk_widget_show (child);
gtk_box_pack_start (GTK_BOX (self->priv->task_box), child, TRUE, TRUE, 0);
gth_task_exec (task, NULL);
- if (self->priv->show_event == 0)
+ if ((self->priv->parent == NULL) || ! gtk_widget_get_mapped (GTK_WIDGET (self->priv->parent)))
+ _show_dialog_cb (self);
+ else if (self->priv->show_event == 0)
self->priv->show_event = g_timeout_add (SHOW_DELAY, _show_dialog_cb, self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]