Add "icon" property to GimpDisplayShell

Set it instead of setting the window icon and connect GimpImageWindow
to the notification.
This commit is contained in:
Michael Natterer 2009-09-24 09:09:35 +02:00
parent 660c333b55
commit 1bbcd8f7b5
4 changed files with 40 additions and 4 deletions

View File

@ -69,11 +69,11 @@ gimp_display_shell_icon_update (GimpDisplayShell *shell)
gimp_get_user_context (gimp),
width, height);
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
g_object_set (shell, "gimp-icon", pixbuf, NULL);
}
else
{
gtk_window_set_icon (GTK_WINDOW (shell), NULL);
g_object_set (shell, "gimp-icon", NULL, NULL);
}
}

View File

@ -86,7 +86,8 @@ enum
PROP_0,
PROP_UNIT,
PROP_TITLE,
PROP_STATUS
PROP_STATUS,
PROP_ICON
};
enum
@ -227,6 +228,12 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
NULL,
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ICON,
/* FIXME: "icon" later */
g_param_spec_object ("gimp-icon", NULL, NULL,
GDK_TYPE_PIXBUF,
GIMP_PARAM_READWRITE));
gtk_rc_parse_string (display_rc_style);
}
@ -419,6 +426,9 @@ gimp_display_shell_finalize (GObject *object)
if (shell->status)
g_free (shell->status);
if (shell->icon)
g_object_unref (shell->icon);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -443,6 +453,11 @@ gimp_display_shell_set_property (GObject *object,
g_free (shell->status);
shell->status = g_value_dup_string (value);
break;
case PROP_ICON:
if (shell->icon)
g_object_unref (shell->icon);
shell->icon = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -469,6 +484,9 @@ gimp_display_shell_get_property (GObject *object,
case PROP_STATUS:
g_value_set_string (value, shell->status);
break;
case PROP_ICON:
g_value_set_object (value, shell->icon);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View File

@ -147,12 +147,12 @@ struct _GimpDisplayShell
guchar *render_buf; /* buffer for rendering the image */
guint title_idle_id; /* title update idle ID */
gchar *title; /* current title */
gchar *status; /* current default statusbar content */
gint icon_size; /* size of the icon pixmap */
guint icon_idle_id; /* ID of the idle-function */
GdkPixbuf *icon; /* icon */
guint fill_idle_id; /* display_shell_fill() idle ID */

View File

@ -83,6 +83,9 @@ static void gimp_image_window_shell_title_notify (GimpDisplayShell *she
static void gimp_image_window_shell_status_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
static void gimp_image_window_shell_icon_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
G_DEFINE_TYPE (GimpImageWindow, gimp_image_window, GIMP_TYPE_WINDOW)
@ -384,6 +387,9 @@ gimp_image_window_set_active_display (GimpImageWindow *window,
g_signal_handlers_disconnect_by_func (active_shell,
gimp_image_window_shell_status_notify,
window);
g_signal_handlers_disconnect_by_func (active_shell,
gimp_image_window_shell_icon_notify,
window);
}
window->active_display = display;
@ -401,6 +407,10 @@ gimp_image_window_set_active_display (GimpImageWindow *window,
g_signal_connect (active_shell, "notify::status",
G_CALLBACK (gimp_image_window_shell_status_notify),
window);
/* FIXME: "icon" later */
g_signal_connect (active_shell, "notify::gimp-icon",
G_CALLBACK (gimp_image_window_shell_icon_notify),
window);
gimp_ui_manager_update (window->menubar_manager,
window->active_display);
@ -481,3 +491,11 @@ gimp_image_window_shell_status_notify (GimpDisplayShell *shell,
gimp_statusbar_replace (GIMP_STATUSBAR (window->statusbar), "title",
NULL, "%s", shell->status);
}
static void
gimp_image_window_shell_icon_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window)
{
gtk_window_set_icon (GTK_WINDOW (window), shell->icon);
}