Don't leave the user without progress bar just because the display's

2007-05-28  Michael Natterer  <mitch@gimp.org>

	Don't leave the user without progress bar just because the
	display's statusbar is invisible:

	* app/display/gimpstatusbar.[ch]: if the statusbar is invisible
	when a progress wants to be shown, temporarily show it, recording
	the fact in the new boolean "progress_shown" member. Added new API
	gimp_statusbar_get/set_visible() which is aware of the new
	temporary visibility state.

	* app/display/gimpdisplayshell-appearance.c
	(gimp_display_shell_set_show_statusbar)
	* app/display/gimpdisplayshell-progress.c
	(gimp_display_shell_progress_message): use the new API instead of
	showing/hiding the widget directly.


svn path=/trunk/; revision=22642
This commit is contained in:
Michael Natterer
2007-05-28 17:42:55 +00:00
committed by Michael Natterer
parent 53f70a7eea
commit 2fe95848c5
5 changed files with 70 additions and 5 deletions

View File

@ -1,3 +1,20 @@
2007-05-28 Michael Natterer <mitch@gimp.org>
Don't leave the user without progress bar just because the
display's statusbar is invisible:
* app/display/gimpstatusbar.[ch]: if the statusbar is invisible
when a progress wants to be shown, temporarily show it, recording
the fact in the new boolean "progress_shown" member. Added new API
gimp_statusbar_get/set_visible() which is aware of the new
temporary visibility state.
* app/display/gimpdisplayshell-appearance.c
(gimp_display_shell_set_show_statusbar)
* app/display/gimpdisplayshell-progress.c
(gimp_display_shell_progress_message): use the new API instead of
showing/hiding the widget directly.
2007-05-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpfgbgview.[ch]: derive from GtkWidget instead of

View File

@ -41,6 +41,7 @@
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-selection.h"
#include "gimpstatusbar.h"
#define GET_OPTIONS(shell) \
@ -234,10 +235,7 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
g_object_set (options, "show-statusbar", show, NULL);
if (show)
gtk_widget_show (shell->statusbar);
else
gtk_widget_hide (shell->statusbar);
gimp_statusbar_set_visible (GIMP_STATUSBAR (shell->statusbar), show);
SET_ACTIVE (shell->menubar_manager, "view-show-statusbar", show);

View File

@ -117,7 +117,7 @@ gimp_display_shell_progress_message (GimpProgress *progress,
case GIMP_MESSAGE_WARNING:
/* warning messages go to the statusbar, if it's visible */
if (! GTK_WIDGET_VISIBLE (shell->statusbar))
if (! gimp_statusbar_get_visible (GIMP_STATUSBAR (shell->statusbar)))
break;
/* else fallthrough */

View File

@ -163,6 +163,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
statusbar->length_format_str[0] = '\0';
statusbar->progress_active = FALSE;
statusbar->progress_shown = FALSE;
box->spacing = 2;
box->homogeneous = FALSE;
@ -281,6 +282,12 @@ gimp_statusbar_progress_start (GimpProgress *progress,
statusbar->progress_active = TRUE;
if (! GTK_WIDGET_VISIBLE (statusbar))
{
gtk_widget_show (GTK_WIDGET (statusbar));
statusbar->progress_shown = TRUE;
}
if (GTK_WIDGET_DRAWABLE (bar))
gdk_window_process_updates (bar->window, TRUE);
@ -299,6 +306,12 @@ gimp_statusbar_progress_end (GimpProgress *progress)
{
GtkWidget *bar = statusbar->progressbar;
if (statusbar->progress_shown)
{
gtk_widget_hide (GTK_WIDGET (statusbar));
statusbar->progress_shown = FALSE;
}
statusbar->progress_active = FALSE;
gimp_statusbar_pop (statusbar, "progress");
@ -477,6 +490,38 @@ gimp_statusbar_new (GimpDisplayShell *shell)
return GTK_WIDGET (statusbar);
}
gboolean
gimp_statusbar_get_visible (GimpStatusbar *statusbar)
{
g_return_val_if_fail (GIMP_IS_STATUSBAR (statusbar), FALSE);
if (statusbar->progress_shown)
return FALSE;
return GTK_WIDGET_VISIBLE (statusbar);
}
void
gimp_statusbar_set_visible (GimpStatusbar *statusbar,
gboolean visible)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
if (statusbar->progress_shown)
{
if (visible)
{
statusbar->progress_shown = FALSE;
return;
}
}
if (visible)
gtk_widget_show (GTK_WIDGET (statusbar));
else
gtk_widget_hide (GTK_WIDGET (statusbar));
}
void
gimp_statusbar_push (GimpStatusbar *statusbar,
const gchar *context,

View File

@ -61,6 +61,7 @@ struct _GimpStatusbar
GtkWidget *progressbar;
GtkWidget *cancel_button;
gboolean progress_active;
gboolean progress_shown;
};
struct _GimpStatusbarClass
@ -72,6 +73,10 @@ struct _GimpStatusbarClass
GType gimp_statusbar_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_statusbar_new (GimpDisplayShell *shell);
gboolean gimp_statusbar_get_visible (GimpStatusbar *statusbar);
void gimp_statusbar_set_visible (GimpStatusbar *statusbar,
gboolean visible);
void gimp_statusbar_push (GimpStatusbar *statusbar,
const gchar *context,
const gchar *format,