mirror of https://github.com/GNOME/gimp.git
made gimp_display_shell_update_icon() public, removed the update_icon
2002-02-17 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplayshell.[ch]: made gimp_display_shell_update_icon() public, removed the update_icon signal handler and idle function. * app/display/gimpdisplayshell-handlers.c: added the update_icon stuff here so it get's properly dis- and reconnected.
This commit is contained in:
parent
2ccbf2a43d
commit
91ada34484
|
@ -1,3 +1,12 @@
|
|||
2002-02-17 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: made
|
||||
gimp_display_shell_update_icon() public, removed the update_icon
|
||||
signal handler and idle function.
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c: added the update_icon
|
||||
stuff here so it get's properly dis- and reconnected.
|
||||
|
||||
2002-02-17 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Fixed #34633 (wheel mouse zooming leaves straigth-line helpline on
|
||||
|
|
|
@ -106,11 +106,6 @@ static void gimp_display_shell_format_title (GimpDisplayShell *gdisp,
|
|||
gint title_len,
|
||||
const gchar *format);
|
||||
|
||||
static void gimp_display_shell_update_icon (GimpDisplayShell *gdisp);
|
||||
static gboolean gimp_display_shell_update_icon_invoker (gpointer data);
|
||||
static void gimp_display_shell_update_icon_scheduler (GimpImage *gimage,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
||||
const gchar *image_name);
|
||||
static void gimp_display_shell_close_warning_callback (GtkWidget *widget,
|
||||
|
@ -333,12 +328,6 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
shell->render_gc = NULL;
|
||||
}
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
shell->icon_idle_id = 0;
|
||||
}
|
||||
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
g_object_unref (G_OBJECT (shell->padding_gc));
|
||||
|
@ -670,13 +659,6 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
|||
|
||||
gimp_help_set_help_data (nav_ebox, NULL, "#nav_window_button");
|
||||
|
||||
/* Icon stuff */
|
||||
g_signal_connect (G_OBJECT (gdisp->gimage), "invalidate_preview",
|
||||
G_CALLBACK (gimp_display_shell_update_icon_scheduler),
|
||||
shell);
|
||||
|
||||
gimp_display_shell_update_icon_scheduler (gdisp->gimage, shell);
|
||||
|
||||
/* create the contents of the status area *********************************/
|
||||
|
||||
/* the statusbar */
|
||||
|
@ -1491,6 +1473,37 @@ gimp_display_shell_update_title (GimpDisplayShell *shell)
|
|||
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), "title", title);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width, height;
|
||||
gdouble factor;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
factor = ((gdouble) gimp_image_get_height (shell->gdisp->gimage) /
|
||||
(gdouble) gimp_image_get_width (shell->gdisp->gimage));
|
||||
|
||||
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_new_preview_pixbuf (GIMP_VIEWABLE (shell->gdisp->gimage),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
|
@ -1999,75 +2012,6 @@ gimp_display_shell_draw_cursor (GimpDisplayShell *shell)
|
|||
x+1, y - 7, x+1, y + 7);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width, height;
|
||||
gdouble factor;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
factor = ((gdouble) gimp_image_get_height (shell->gdisp->gimage) /
|
||||
(gdouble) gimp_image_get_width (shell->gdisp->gimage));
|
||||
|
||||
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_new_preview_pixbuf (GIMP_VIEWABLE (shell->gdisp->gimage),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
/* Just a dumb invoker for gdisplay_update_icon ()
|
||||
*/
|
||||
static gboolean
|
||||
gimp_display_shell_update_icon_invoker (gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
shell->icon_idle_id = 0;
|
||||
|
||||
gimp_display_shell_update_icon (shell);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* This function marks the icon as invalid and sets up the infrastructure
|
||||
* to check every 8 seconds if an update is necessary.
|
||||
*/
|
||||
static void
|
||||
gimp_display_shell_update_icon_scheduler (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
}
|
||||
|
||||
shell->icon_idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_display_shell_update_icon_invoker,
|
||||
shell,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gint print (gchar *buf,
|
||||
gint len,
|
||||
gint start,
|
||||
|
|
|
@ -116,7 +116,7 @@ struct _GimpDisplayShellClass
|
|||
|
||||
GType gimp_display_shell_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp);
|
||||
GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp);
|
||||
|
||||
void gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
gboolean kill_it);
|
||||
|
@ -180,6 +180,7 @@ void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
|||
gint x,
|
||||
gint y);
|
||||
void gimp_display_shell_update_title (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
|
|
|
@ -59,6 +59,10 @@ static void gimp_display_shell_qmask_changed_handler (GimpImage *g
|
|||
static void gimp_display_shell_update_guide_handler (GimpImage *gimage,
|
||||
GimpGuide *guide,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_invalidate_preview_handler (GimpImage *gimage,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
static gboolean gimp_display_shell_idle_update_icon (gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -104,6 +108,11 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
g_signal_connect (G_OBJECT (gimage), "update_guide",
|
||||
G_CALLBACK (gimp_display_shell_update_guide_handler),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (gimage), "invalidate_preview",
|
||||
G_CALLBACK (gimp_display_shell_invalidate_preview_handler),
|
||||
shell);
|
||||
|
||||
gimp_display_shell_invalidate_preview_handler (gimage, shell);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,6 +126,15 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
|||
|
||||
gimage = shell->gdisp->gimage;
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
shell->icon_idle_id = 0;
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage),
|
||||
gimp_display_shell_invalidate_preview_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage),
|
||||
gimp_display_shell_update_guide_handler,
|
||||
shell);
|
||||
|
@ -238,3 +256,32 @@ gimp_display_shell_update_guide_handler (GimpImage *gimage,
|
|||
{
|
||||
gimp_display_shell_expose_guide (shell, guide);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_invalidate_preview_handler (GimpImage *gimage,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
}
|
||||
|
||||
shell->icon_idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_display_shell_idle_update_icon,
|
||||
shell,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_shell_idle_update_icon (gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
shell->icon_idle_id = 0;
|
||||
|
||||
gimp_display_shell_update_icon (shell);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -106,11 +106,6 @@ static void gimp_display_shell_format_title (GimpDisplayShell *gdisp,
|
|||
gint title_len,
|
||||
const gchar *format);
|
||||
|
||||
static void gimp_display_shell_update_icon (GimpDisplayShell *gdisp);
|
||||
static gboolean gimp_display_shell_update_icon_invoker (gpointer data);
|
||||
static void gimp_display_shell_update_icon_scheduler (GimpImage *gimage,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
|
||||
const gchar *image_name);
|
||||
static void gimp_display_shell_close_warning_callback (GtkWidget *widget,
|
||||
|
@ -333,12 +328,6 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
shell->render_gc = NULL;
|
||||
}
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
shell->icon_idle_id = 0;
|
||||
}
|
||||
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
g_object_unref (G_OBJECT (shell->padding_gc));
|
||||
|
@ -670,13 +659,6 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
|||
|
||||
gimp_help_set_help_data (nav_ebox, NULL, "#nav_window_button");
|
||||
|
||||
/* Icon stuff */
|
||||
g_signal_connect (G_OBJECT (gdisp->gimage), "invalidate_preview",
|
||||
G_CALLBACK (gimp_display_shell_update_icon_scheduler),
|
||||
shell);
|
||||
|
||||
gimp_display_shell_update_icon_scheduler (gdisp->gimage, shell);
|
||||
|
||||
/* create the contents of the status area *********************************/
|
||||
|
||||
/* the statusbar */
|
||||
|
@ -1491,6 +1473,37 @@ gimp_display_shell_update_title (GimpDisplayShell *shell)
|
|||
gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), "title", title);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width, height;
|
||||
gdouble factor;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
factor = ((gdouble) gimp_image_get_height (shell->gdisp->gimage) /
|
||||
(gdouble) gimp_image_get_width (shell->gdisp->gimage));
|
||||
|
||||
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_new_preview_pixbuf (GIMP_VIEWABLE (shell->gdisp->gimage),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
|
@ -1999,75 +2012,6 @@ gimp_display_shell_draw_cursor (GimpDisplayShell *shell)
|
|||
x+1, y - 7, x+1, y + 7);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width, height;
|
||||
gdouble factor;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
factor = ((gdouble) gimp_image_get_height (shell->gdisp->gimage) /
|
||||
(gdouble) gimp_image_get_width (shell->gdisp->gimage));
|
||||
|
||||
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_new_preview_pixbuf (GIMP_VIEWABLE (shell->gdisp->gimage),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
/* Just a dumb invoker for gdisplay_update_icon ()
|
||||
*/
|
||||
static gboolean
|
||||
gimp_display_shell_update_icon_invoker (gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
shell->icon_idle_id = 0;
|
||||
|
||||
gimp_display_shell_update_icon (shell);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* This function marks the icon as invalid and sets up the infrastructure
|
||||
* to check every 8 seconds if an update is necessary.
|
||||
*/
|
||||
static void
|
||||
gimp_display_shell_update_icon_scheduler (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
}
|
||||
|
||||
shell->icon_idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_display_shell_update_icon_invoker,
|
||||
shell,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gint print (gchar *buf,
|
||||
gint len,
|
||||
gint start,
|
||||
|
|
|
@ -116,7 +116,7 @@ struct _GimpDisplayShellClass
|
|||
|
||||
GType gimp_display_shell_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp);
|
||||
GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp);
|
||||
|
||||
void gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
gboolean kill_it);
|
||||
|
@ -180,6 +180,7 @@ void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
|||
gint x,
|
||||
gint y);
|
||||
void gimp_display_shell_update_title (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
|
|
Loading…
Reference in New Issue