mirror of https://github.com/GNOME/gimp.git
combined the two progress bars (when loading multiple thumbnails) into a
2007-05-16 Sven Neumann <sven@gimp.org> * app/widgets/gimpthumbbox.[ch]: combined the two progress bars (when loading multiple thumbnails) into a single one using a GimpSubProgress. svn path=/trunk/; revision=22503
This commit is contained in:
parent
a2621b55e0
commit
fbe369c85d
|
@ -1,3 +1,9 @@
|
|||
2007-05-16 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpthumbbox.[ch]: combined the two progress bars
|
||||
(when loading multiple thumbnails) into a single one using a
|
||||
GimpSubProgress.
|
||||
|
||||
2007-05-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/jpeg/jpeg-save.c
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
#include "core/gimpprogress.h"
|
||||
#include "core/gimpsubprogress.h"
|
||||
|
||||
#include "plug-in/gimppluginmanager.h"
|
||||
|
||||
|
@ -92,7 +93,8 @@ static void gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
|||
static void gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
|
||||
const gchar *uri,
|
||||
GimpThumbnailSize size,
|
||||
gboolean force);
|
||||
gboolean force,
|
||||
GimpProgress *progress);
|
||||
static gboolean gimp_thumb_box_auto_thumbnail (GimpThumbBox *box);
|
||||
|
||||
|
||||
|
@ -237,12 +239,7 @@ gimp_thumb_box_progress_set_value (GimpProgress *progress,
|
|||
{
|
||||
GimpThumbBox *box = GIMP_THUMB_BOX (progress);
|
||||
|
||||
if (box->progress_active)
|
||||
{
|
||||
GtkProgressBar *bar = GTK_PROGRESS_BAR (box->progress);
|
||||
|
||||
gtk_progress_bar_set_fraction (bar, percentage);
|
||||
}
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->progress), percentage);
|
||||
}
|
||||
|
||||
static gdouble
|
||||
|
@ -301,7 +298,6 @@ gimp_thumb_box_new (GimpContext *context)
|
|||
gchar *str;
|
||||
gint h, v;
|
||||
GtkRequisition info_requisition;
|
||||
GtkRequisition thumb_progress_requisition;
|
||||
GtkRequisition progress_requisition;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
@ -415,16 +411,9 @@ gimp_thumb_box_new (GimpContext *context)
|
|||
gtk_widget_set_no_show_all (box->progress, TRUE);
|
||||
/* don't gtk_widget_show (box->progress); */
|
||||
|
||||
box->thumb_progress = gtk_progress_bar_new ();
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), "Fog");
|
||||
gtk_box_pack_end (GTK_BOX (vbox2), box->thumb_progress, FALSE, FALSE, 0);
|
||||
gtk_widget_set_no_show_all (box->thumb_progress, TRUE);
|
||||
/* don't gtk_widget_show (box->thumb_progress); */
|
||||
|
||||
/* eek */
|
||||
gtk_widget_size_request (box->info, &info_requisition);
|
||||
gtk_widget_size_request (box->thumb_progress, &thumb_progress_requisition);
|
||||
gtk_widget_size_request (box->progress, &progress_requisition);
|
||||
gtk_widget_size_request (box->info, &info_requisition);
|
||||
gtk_widget_size_request (box->progress, &progress_requisition);
|
||||
|
||||
gtk_widget_set_size_request (box->info,
|
||||
progress_requisition.width,
|
||||
|
@ -432,10 +421,6 @@ gimp_thumb_box_new (GimpContext *context)
|
|||
gtk_widget_set_size_request (box->filename,
|
||||
progress_requisition.width, -1);
|
||||
|
||||
gtk_widget_set_size_request (box->thumb_progress, -1,
|
||||
thumb_progress_requisition.height);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), "");
|
||||
|
||||
gtk_widget_set_size_request (box->progress, -1,
|
||||
progress_requisition.height);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), "");
|
||||
|
@ -549,8 +534,9 @@ static void
|
|||
gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
||||
gboolean force)
|
||||
{
|
||||
Gimp *gimp = box->imagefile->gimp;
|
||||
GimpFileDialog *dialog = NULL;
|
||||
Gimp *gimp = box->imagefile->gimp;
|
||||
GimpProgress *progress = GIMP_PROGRESS (box);
|
||||
GimpFileDialog *dialog = NULL;
|
||||
GtkWidget *toplevel;
|
||||
GSList *list;
|
||||
gint n_uris;
|
||||
|
@ -584,44 +570,41 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
|||
{
|
||||
gchar *str;
|
||||
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), NULL);
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress),
|
||||
0.0);
|
||||
progress = gimp_sub_progress_new (progress);
|
||||
|
||||
gtk_widget_show (box->thumb_progress);
|
||||
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (progress), 0, n_uris);
|
||||
|
||||
for (list = box->uris->next, i = 1;
|
||||
list;
|
||||
list = g_slist_next (list), i++)
|
||||
{
|
||||
str = g_strdup_printf (_("Thumbnail %d of %d"), i, n_uris);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress),
|
||||
str);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), str);
|
||||
g_free (str);
|
||||
|
||||
gimp_progress_set_value (progress, 0.0);
|
||||
|
||||
while (g_main_context_pending (NULL))
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
||||
gimp_thumb_box_create_thumbnail (box,
|
||||
list->data,
|
||||
gimp->config->thumbnail_size,
|
||||
force);
|
||||
force,
|
||||
progress);
|
||||
|
||||
if (dialog && dialog->canceled)
|
||||
goto canceled;
|
||||
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress),
|
||||
(gdouble) i /
|
||||
(gdouble) n_uris);
|
||||
|
||||
while (g_main_context_pending (NULL))
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (progress), i, n_uris);
|
||||
}
|
||||
|
||||
str = g_strdup_printf (_("Thumbnail %d of %d"), n_uris, n_uris);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), str);
|
||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), str);
|
||||
g_free (str);
|
||||
|
||||
gimp_progress_set_value (progress, 0.0);
|
||||
|
||||
while (g_main_context_pending (NULL))
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
}
|
||||
|
@ -631,22 +614,16 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
|||
gimp_thumb_box_create_thumbnail (box,
|
||||
box->uris->data,
|
||||
gimp->config->thumbnail_size,
|
||||
force);
|
||||
force,
|
||||
progress);
|
||||
|
||||
if (n_uris > 1)
|
||||
{
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress),
|
||||
1.0);
|
||||
|
||||
while (g_main_context_pending (NULL))
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
}
|
||||
gimp_progress_set_value (progress, 1.0);
|
||||
}
|
||||
|
||||
canceled:
|
||||
|
||||
if (n_uris > 1)
|
||||
gtk_widget_hide (box->thumb_progress);
|
||||
g_object_unref (progress);
|
||||
|
||||
if (box->uris)
|
||||
{
|
||||
|
@ -666,7 +643,8 @@ static void
|
|||
gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
|
||||
const gchar *uri,
|
||||
GimpThumbnailSize size,
|
||||
gboolean force)
|
||||
gboolean force,
|
||||
GimpProgress *progress)
|
||||
{
|
||||
gchar *filename = file_utils_filename_from_uri (uri);
|
||||
GimpThumbnail *thumb;
|
||||
|
@ -695,7 +673,7 @@ gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
|
|||
! gimp_thumbnail_has_failed (thumb)))
|
||||
{
|
||||
gimp_imagefile_create_thumbnail (box->imagefile, box->context,
|
||||
GIMP_PROGRESS (box),
|
||||
progress,
|
||||
size,
|
||||
!force);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ struct _GimpThumbBox
|
|||
GtkWidget *preview;
|
||||
GtkWidget *filename;
|
||||
GtkWidget *info;
|
||||
GtkWidget *thumb_progress;
|
||||
|
||||
gboolean progress_active;
|
||||
GtkWidget *progress;
|
||||
|
|
Loading…
Reference in New Issue