added gimp_statusbar_peek(), a method to access the contents of the

2008-03-25  Sven Neumann  <sven@gimp.org>

	* app/display/gimpstatusbar.[ch]: added gimp_statusbar_peek(), a
	method to access the contents of the statusbar.

	* app/display/gimpdisplayshell.c
	(gimp_display_shell_window_state_event): when the iconfied state
	changes, call gimp_display_shell_progress_window_state_changed().

	* app/display/gimpdisplayshell-progress.[ch]: when the image
	window is iconified, display the progress message in the window
	title so that it appears in the task bar.

	* app/menus/plug-in-menus.c: formatting.

svn path=/trunk/; revision=25224
This commit is contained in:
Sven Neumann
2008-03-25 14:07:10 +00:00
committed by Sven Neumann
parent 7de3392e26
commit f7a49c83e9
7 changed files with 108 additions and 4 deletions

View File

@ -1,3 +1,18 @@
2008-03-25 Sven Neumann <sven@gimp.org>
* app/display/gimpstatusbar.[ch]: added gimp_statusbar_peek(), a
method to access the contents of the statusbar.
* app/display/gimpdisplayshell.c
(gimp_display_shell_window_state_event): when the iconfied state
changes, call gimp_display_shell_progress_window_state_changed().
* app/display/gimpdisplayshell-progress.[ch]: when the image
window is iconified, display the progress message in the window
title so that it appears in the task bar.
* app/menus/plug-in-menus.c: formatting.
2008-03-25 Michael Natterer <mitch@gimp.org> 2008-03-25 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.[ch]: remove the window * app/display/gimpdisplayshell-callbacks.[ch]: remove the window

View File

@ -28,9 +28,18 @@
#include "gimpdisplayshell.h" #include "gimpdisplayshell.h"
#include "gimpdisplayshell-progress.h" #include "gimpdisplayshell-progress.h"
#include "gimpdisplayshell-title.h"
#include "gimpstatusbar.h" #include "gimpstatusbar.h"
/* Progress is shown in the status-bar. If the image window is iconified,
* the progress messages are also shown in the window title so that they
* appear in the task bar.
*/
static gboolean gimp_display_shell_is_iconified (GimpDisplayShell *shell);
static GimpProgress * static GimpProgress *
gimp_display_shell_progress_start (GimpProgress *progress, gimp_display_shell_progress_start (GimpProgress *progress,
const gchar *message, const gchar *message,
@ -38,8 +47,15 @@ gimp_display_shell_progress_start (GimpProgress *progress,
{ {
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
return gimp_progress_start (GIMP_PROGRESS (shell->statusbar), progress = gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
message, cancelable); message, cancelable);
if (progress && gimp_display_shell_is_iconified (shell))
{
gdk_window_set_title (GTK_WIDGET (shell)->window, message);
}
return progress;
} }
static void static void
@ -48,6 +64,9 @@ gimp_display_shell_progress_end (GimpProgress *progress)
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_end (GIMP_PROGRESS (shell->statusbar)); gimp_progress_end (GIMP_PROGRESS (shell->statusbar));
if (gimp_display_shell_is_iconified (shell))
gimp_display_shell_title_update (shell);
} }
static gboolean static gboolean
@ -65,6 +84,12 @@ gimp_display_shell_progress_set_text (GimpProgress *progress,
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message); gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message);
if (gimp_progress_is_active (GIMP_PROGRESS (shell->statusbar)) &&
gimp_display_shell_is_iconified (shell))
{
gdk_window_set_title (GTK_WIDGET (shell)->window, message);
}
} }
static void static void
@ -130,6 +155,16 @@ gimp_display_shell_progress_message (GimpProgress *progress,
return FALSE; return FALSE;
} }
static gboolean
gimp_display_shell_is_iconified (GimpDisplayShell *shell)
{
GtkWidget *widget = GTK_WIDGET (shell);
return (GTK_WIDGET_DRAWABLE (widget) &&
gdk_window_get_state (widget->window) == GDK_WINDOW_STATE_ICONIFIED);
}
void void
gimp_display_shell_progress_iface_init (GimpProgressInterface *iface) gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
{ {
@ -143,3 +178,23 @@ gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
iface->get_window = gimp_display_shell_progress_get_window; iface->get_window = gimp_display_shell_progress_get_window;
iface->message = gimp_display_shell_progress_message; iface->message = gimp_display_shell_progress_message;
} }
void
gimp_display_shell_progress_window_state_changed (GimpDisplayShell *shell)
{
if (! gimp_progress_is_active (GIMP_PROGRESS (shell)))
return;
if (gimp_display_shell_is_iconified (shell))
{
const gchar *msg = gimp_statusbar_peek (GIMP_STATUSBAR (shell->statusbar),
"progress");
if (msg)
{
gdk_window_set_title (GTK_WIDGET (shell)->window, msg);
return;
}
}
gimp_display_shell_title_update (shell);
}

View File

@ -24,5 +24,7 @@
void gimp_display_shell_progress_iface_init (GimpProgressInterface *iface); void gimp_display_shell_progress_iface_init (GimpProgressInterface *iface);
void gimp_display_shell_progress_window_state_changed (GimpDisplayShell *shell);
#endif /* __GIMP_DISPLAY_SHELL_PROGRESS_H__ */ #endif /* __GIMP_DISPLAY_SHELL_PROGRESS_H__ */

View File

@ -602,6 +602,11 @@ gimp_display_shell_window_state_event (GtkWidget *widget,
} }
} }
if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
{
gimp_display_shell_progress_window_state_changed (shell);
}
return FALSE; return FALSE;
} }

View File

@ -825,6 +825,31 @@ gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
gimp_statusbar_update (statusbar); gimp_statusbar_update (statusbar);
} }
const gchar *
gimp_statusbar_peek (GimpStatusbar *statusbar,
const gchar *context)
{
GSList *list;
guint context_id;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
context_id = gimp_statusbar_get_context_id (statusbar, context);
for (list = statusbar->messages; list; list = list->next)
{
GimpStatusbarMsg *msg = list->data;
if (msg->context_id == context_id)
{
return msg->text;
}
}
return NULL;
}
void void
gimp_statusbar_pop (GimpStatusbar *statusbar, gimp_statusbar_pop (GimpStatusbar *statusbar,
const gchar *context) const gchar *context)

View File

@ -109,6 +109,8 @@ void gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *format, const gchar *format,
va_list args); va_list args);
const gchar * gimp_statusbar_peek (GimpStatusbar *statusbar,
const gchar *context);
void gimp_statusbar_pop (GimpStatusbar *statusbar, void gimp_statusbar_pop (GimpStatusbar *statusbar,
const gchar *context); const gchar *context);