deal with NULL image and unset the icon.

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

	* app/display/gimpdisplayshell.c (gimp_display_shell_update_icon):
	deal with NULL image and unset the icon.

	* app/display/gimpdisplay.c (gimp_display_set_image): unset the
	icon when no image is set.

	* app/display/gimpdisplayshell-title.c
	(gimp_display_shell_format_title): use GIMP_NAME as the window
	title when no image is set. Append GIMP_ACRONYM otherwise.

svn path=/trunk/; revision=25115
This commit is contained in:
Sven Neumann 2008-03-19 09:11:04 +00:00 committed by Sven Neumann
parent bd636468e8
commit ebdd875ce7
4 changed files with 46 additions and 19 deletions

View file

@ -1,3 +1,15 @@
2008-03-19 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell.c (gimp_display_shell_update_icon):
deal with NULL image and unset the icon.
* app/display/gimpdisplay.c (gimp_display_set_image): unset the
icon when no image is set.
* app/display/gimpdisplayshell-title.c
(gimp_display_shell_format_title): use GIMP_NAME as the window
title when no image is set. Append GIMP_ACRONYM otherwise.
2008-03-18 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayoptions.[ch]: add new options object

View file

@ -490,6 +490,8 @@ gimp_display_set_image (GimpDisplay *display,
if (image)
gimp_display_shell_reconnect (GIMP_DISPLAY_SHELL (display->shell));
else
gimp_display_shell_update_icon (GIMP_DISPLAY_SHELL (display->shell));
}
void

View file

@ -42,6 +42,8 @@
#include "gimpdisplayshell-title.h"
#include "gimpstatusbar.h"
#include "about.h"
#include "gimp-intl.h"
@ -162,7 +164,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
if (! image)
{
print (title, title_len, i, _("GIMP - Drop Files"));
print (title, title_len, i, GIMP_NAME);
return;
}
@ -423,5 +425,8 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
format++;
}
title[MIN (i, title_len - 1)] = '\0';
if (i) /* U+2013 EN DASH */
i += g_strlcpy (title + i, " \342\200\223 ", title_len - i);
g_strlcpy (title + i, GIMP_ACRONYM, title_len - i);
}

View file

@ -1557,33 +1557,41 @@ void
gimp_display_shell_update_icon (GimpDisplayShell *shell)
{
GimpImage *image;
GdkPixbuf *pixbuf;
gint width, height;
gdouble factor;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
image = shell->display->image;
factor = ((gdouble) gimp_image_get_height (image) /
(gdouble) gimp_image_get_width (image));
if (factor >= 1)
if (image)
{
height = MAX (shell->icon_size, 1);
width = MAX (((gdouble) shell->icon_size) / factor, 1);
Gimp *gimp = shell->display->gimp;
GdkPixbuf *pixbuf;
gint width;
gint height;
gdouble factor = ((gdouble) gimp_image_get_height (image) /
(gdouble) gimp_image_get_width (image));
if (factor >= 1)
{
height = MAX (shell->icon_size, 1);
width = MAX (((gdouble) shell->icon_size) / factor, 1);
}
else
{
height = MAX (((gdouble) shell->icon_size) * factor, 1);
width = MAX (shell->icon_size, 1);
}
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image),
gimp_get_user_context (gimp),
width, height);
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
}
else
{
height = MAX (((gdouble) shell->icon_size) * factor, 1);
width = MAX (shell->icon_size, 1);
gtk_window_set_icon (GTK_WINDOW (shell), NULL);
}
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image),
gimp_get_user_context (shell->display->gimp),
width, height);
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
}
void