Commit fdf24546 authored by Martin Nordholts's avatar Martin Nordholts

app: Add gimp_image_window_new/destroy()

Add gimp_image_window_new/destroy() so we have a central place where
the Gimp::image_windows list is managed.
parent 19baff1a
......@@ -431,18 +431,10 @@ gimp_display_new (Gimp *gimp,
if (! window)
{
window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
"gimp", gimp,
"menu-factory", menu_factory,
"display-factory", display_factory,
/* The window position will be overridden by the
* dialog factory, it is only really used on first
* startup.
*/
display->image ? NULL : "window-position",
GTK_WIN_POS_CENTER,
NULL);
gimp->image_windows = g_list_prepend (gimp->image_windows, window);
window = gimp_image_window_new (gimp,
display->image,
menu_factory,
display_factory);
}
/* create the shell for the image */
......@@ -520,9 +512,7 @@ gimp_display_delete (GimpDisplay *display)
}
else
{
Gimp *gimp = display->gimp;
gimp->image_windows = g_list_remove (gimp->image_windows, window);
gtk_widget_destroy (GTK_WIDGET (window));
gimp_image_window_destroy (window);
}
}
else
......
......@@ -111,7 +111,7 @@ static void gimp_image_window_get_property (GObject *obj
GValue *value,
GParamSpec *pspec);
static void gimp_image_window_destroy (GtkObject *object);
static void gimp_image_window_real_destroy (GtkObject *object);
static gboolean gimp_image_window_delete_event (GtkWidget *widget,
GdkEventAny *event);
......@@ -181,7 +181,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
object_class->set_property = gimp_image_window_set_property;
object_class->get_property = gimp_image_window_get_property;
gtk_object_class->destroy = gimp_image_window_destroy;
gtk_object_class->destroy = gimp_image_window_real_destroy;
widget_class->delete_event = gimp_image_window_delete_event;
widget_class->configure_event = gimp_image_window_configure_event;
......@@ -412,7 +412,7 @@ gimp_image_window_get_property (GObject *object,
}
static void
gimp_image_window_destroy (GtkObject *object)
gimp_image_window_real_destroy (GtkObject *object)
{
GimpImageWindow *window = GIMP_IMAGE_WINDOW (object);
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
......@@ -591,6 +591,51 @@ gimp_image_window_style_set (GtkWidget *widget,
/* public functions */
GimpImageWindow *
gimp_image_window_new (Gimp *gimp,
GimpImage *image,
GimpMenuFactory *menu_factory,
GimpDialogFactory *display_factory)
{
GimpImageWindow *window;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (image) || image == NULL, NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (display_factory), NULL);
window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
"gimp", gimp,
"menu-factory", menu_factory,
"display-factory", display_factory,
/* The window position will be overridden by the
* dialog factory, it is only really used on first
* startup.
*/
image ? NULL : "window-position",
GTK_WIN_POS_CENTER,
NULL);
gimp->image_windows = g_list_prepend (gimp->image_windows, window);
return window;
}
void
gimp_image_window_destroy (GimpImageWindow *window)
{
GimpImageWindowPrivate *private;
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
private->gimp->image_windows = g_list_remove (private->gimp->image_windows,
window);
gtk_widget_destroy (GTK_WIDGET (window));
}
GimpUIManager *
gimp_image_window_get_ui_manager (GimpImageWindow *window)
{
......
......@@ -45,6 +45,12 @@ struct _GimpImageWindowClass
GType gimp_image_window_get_type (void) G_GNUC_CONST;
GimpImageWindow * gimp_image_window_new (Gimp *gimp,
GimpImage *image,
GimpMenuFactory *menu_factory,
GimpDialogFactory *display_factory);
void gimp_image_window_destroy (GimpImageWindow *window);
GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window);
GimpDockColumns * gimp_image_window_get_left_docks (GimpImageWindow *window);
GimpDockColumns * gimp_image_window_get_right_docks (GimpImageWindow *window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment