gimp r25461 - in trunk: . app/display app/gui
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25461 - in trunk: . app/display app/gui
- Date: Thu, 10 Apr 2008 20:24:06 +0100 (BST)
Author: neo
Date: Thu Apr 10 20:24:06 2008
New Revision: 25461
URL: http://svn.gnome.org/viewvc/gimp?rev=25461&view=rev
Log:
2008-04-10 Sven Neumann <sven gimp org>
* app/display/gimpstatusbar.[ch]
(gimp_statusbar_progress_message):
improved the check if the message can be shown in the statusbar.
Do not show messages that don't fit into the given space.
* app/gui/gui-message.c (gui_message_error_dialog): if there's
already an error dialog associated with a progress, then use it.
Modified:
trunk/ChangeLog
trunk/app/display/gimpstatusbar.c
trunk/app/display/gimpstatusbar.h
trunk/app/gui/gui-message.c
Modified: trunk/app/display/gimpstatusbar.c
==============================================================================
--- trunk/app/display/gimpstatusbar.c (original)
+++ trunk/app/display/gimpstatusbar.c Thu Apr 10 20:24:06 2008
@@ -262,8 +262,8 @@
g_hash_table_destroy (statusbar->context_ids);
statusbar->context_ids = NULL;
- g_free (statusbar->temp_spaces);
- statusbar->temp_spaces = NULL;
+ g_free (statusbar->icon_spaces);
+ statusbar->icon_spaces = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -483,17 +483,37 @@
const gchar *domain,
const gchar *message)
{
- GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
+ GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
+ PangoLayout *layout;
+ gboolean handle_msg = FALSE;
- /* we can handle only one-liners */
- if (strchr (message, '\n'))
- return FALSE;
+ /* we can only handle short one-liners */
+
+ layout = gtk_widget_create_pango_layout (GTK_STATUSBAR (statusbar)->label,
+ message);
+
+ if (pango_layout_get_line_count (layout) == 1)
+ {
+ gint width;
+
+ pango_layout_get_pixel_size (layout, &width, NULL);
+
+ width += statusbar->icon_width;
- gimp_statusbar_push_temp (statusbar,
- gimp_get_message_stock_id (severity),
- "%s", message);
+ if (width < GTK_STATUSBAR (statusbar)->label->allocation.width)
+ {
+ handle_msg = TRUE;
+ }
+ }
- return TRUE;
+ g_object_unref (layout);
+
+ if (handle_msg)
+ gimp_statusbar_push_temp (statusbar,
+ gimp_get_message_stock_id (severity),
+ "%s", message);
+
+ return handle_msg;
}
static void
@@ -538,7 +558,7 @@
if (text && statusbar->temp_timeout_id)
{
- gchar *temp = g_strconcat (statusbar->temp_spaces, text, NULL);
+ gchar *temp = g_strconcat (statusbar->icon_spaces, text, NULL);
gimp_statusbar_set_text (statusbar, temp);
g_free (temp);
@@ -1108,15 +1128,17 @@
{
n_spaces++;
- statusbar->temp_spaces = g_realloc (statusbar->temp_spaces, n_spaces + 1);
+ statusbar->icon_spaces = g_realloc (statusbar->icon_spaces, n_spaces + 1);
- memset (statusbar->temp_spaces, ' ', n_spaces);
- statusbar->temp_spaces[n_spaces] = '\0';
+ memset (statusbar->icon_spaces, ' ', n_spaces);
+ statusbar->icon_spaces[n_spaces] = '\0';
- pango_layout_set_text (layout, statusbar->temp_spaces, -1);
+ pango_layout_set_text (layout, statusbar->icon_spaces, -1);
pango_layout_get_pixel_size (layout, &layout_width, NULL);
}
+ statusbar->icon_width = layout_width;
+
g_object_unref (layout);
g_object_unref (pixbuf);
}
Modified: trunk/app/display/gimpstatusbar.h
==============================================================================
--- trunk/app/display/gimpstatusbar.h (original)
+++ trunk/app/display/gimpstatusbar.h Thu Apr 10 20:24:06 2008
@@ -48,7 +48,8 @@
guint temp_context_id;
guint temp_timeout_id;
- gchar *temp_spaces;
+ gint icon_width;
+ gchar *icon_spaces;
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
gchar length_format_str[CURSOR_FORMAT_LENGTH];
Modified: trunk/app/gui/gui-message.c
==============================================================================
--- trunk/app/gui/gui-message.c (original)
+++ trunk/app/gui/gui-message.c Thu Apr 10 20:24:06 2008
@@ -193,7 +193,11 @@
if (GIMP_IS_PROGRESS (handler))
{
- if (gimp_progress_message (GIMP_PROGRESS (handler), gimp,
+ /* If there's already an error dialog associated with this
+ * progress, then continue without trying gimp_progress_message().
+ */
+ if (! g_object_get_data (handler, "gimp-error-dialog") &&
+ gimp_progress_message (GIMP_PROGRESS (handler), gimp,
severity, domain, message))
{
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]