Add gimp_image_window_add_display() and use it

This API is most likely not final, but enables adding the vbox of
shell widgets to the image window's vbox *after* the shell constructor
returns. Seems to work nicely :-)
This commit is contained in:
Michael Natterer 2009-09-25 18:35:58 +02:00
parent bcef4f275d
commit 5b5e4e039a
5 changed files with 36 additions and 4 deletions

View File

@ -385,6 +385,10 @@ gimp_display_new (Gimp *gimp,
menu_factory, popup_manager,
display_factory);
/* FIXME image window */
gimp_image_window_add_display (GIMP_IMAGE_WINDOW (display->shell),
display);
/* FIXME image window */
gimp_image_window_set_active_display (GIMP_IMAGE_WINDOW (display->shell),
display);

View File

@ -771,7 +771,6 @@ gimp_display_shell_new (GimpDisplay *display,
GimpDisplayShell *shell;
GimpDisplayOptions *options;
GimpColorDisplayStack *filter;
GtkWidget *disp_vbox;
GtkWidget *upper_hbox;
GtkWidget *right_vbox;
GtkWidget *lower_hbox;
@ -911,14 +910,17 @@ gimp_display_shell_new (GimpDisplay *display,
}
/* another vbox for everything except the statusbar */
disp_vbox = gtk_vbox_new (FALSE, 1);
shell->disp_vbox = gtk_vbox_new (FALSE, 1);
#if 0
gtk_box_pack_start (GTK_BOX (GIMP_IMAGE_WINDOW (shell)->main_vbox),
disp_vbox, TRUE, TRUE, 0);
gtk_widget_show (disp_vbox);
#endif
/* a hbox for the inner_table and the vertical scrollbar */
upper_hbox = gtk_hbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (shell->disp_vbox), upper_hbox, TRUE, TRUE, 0);
gtk_widget_show (upper_hbox);
/* the table containing origin, rulers and the canvas */
@ -936,7 +938,7 @@ gimp_display_shell_new (GimpDisplay *display,
/* the hbox containing the quickmask button, vertical scrollbar and
the navigation button */
lower_hbox = gtk_hbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (shell->disp_vbox), lower_hbox, FALSE, FALSE, 0);
gtk_widget_show (lower_hbox);
/* create the scrollbars *************************************************/

View File

@ -64,6 +64,8 @@ struct _GimpDisplayShell
/* --- cacheline 2 boundary (128 bytes) was 20 bytes ago --- */
GtkWidget *disp_vbox; /* FIXME temp hack */
GimpDisplay *display;
GimpUIManager *popup_manager;

View File

@ -446,6 +446,26 @@ gimp_image_window_style_set (GtkWidget *widget,
/* public functions */
void
gimp_image_window_add_display (GimpImageWindow *window,
GimpDisplay *display)
{
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
g_return_if_fail (GIMP_IS_DISPLAY (display));
g_return_if_fail (g_list_find (window->displays, display) == NULL);
/* FIXME multiple shells */
g_assert (window->displays == NULL);
window->displays = g_list_append (window->displays, display);
/* FIXME multiple shells */
gtk_box_pack_start (GTK_BOX (window->main_vbox),
GIMP_DISPLAY_SHELL (display->shell)->disp_vbox,
TRUE, TRUE, 0);
gtk_widget_show (GIMP_DISPLAY_SHELL (display->shell)->disp_vbox);
}
void
gimp_image_window_set_active_display (GimpImageWindow *window,
GimpDisplay *display)

View File

@ -36,6 +36,7 @@ struct _GimpImageWindow
{
GimpWindow parent_instance;
GList *displays;
GimpDisplay *active_display;
GimpUIManager *menubar_manager;
@ -56,6 +57,9 @@ struct _GimpImageWindowClass
GType gimp_image_window_get_type (void) G_GNUC_CONST;
void gimp_image_window_add_display (GimpImageWindow *window,
GimpDisplay *display);
void gimp_image_window_set_active_display (GimpImageWindow *window,
GimpDisplay *display);
GimpDisplay * gimp_image_window_get_active_display (GimpImageWindow *window);