diff --git a/ChangeLog b/ChangeLog index 63a9ab796f..d19c7a6d73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-06-06 Michael Natterer + + * app/gui/image-menu.c + * app/gui/toolbox-menu.c: moved the convenience items which + create new docks from the "Dialogs/" level to a new + "Dialogs/Create New Dock/" sub-menu. Fixes bug #111278. + + * app/gui/dialogs-commands.[ch] (dialogs_create_data_cmd_callback): + new convenience constructor callback. Factored out duplicated + code to the new dialogs_create_dock() utility function. + 2003-06-06 Michael Natterer * app/gui/image-menu.c: added CW/CCW to the "Rotate" menu entries diff --git a/app/actions/dialogs-commands.c b/app/actions/dialogs-commands.c index 5ec56f2983..cb391b9638 100644 --- a/app/actions/dialogs-commands.c +++ b/app/actions/dialogs-commands.c @@ -35,6 +35,14 @@ #include "dialogs-commands.h" +/* local function prototypes */ + +static void dialogs_create_dock (const gchar *tabs[], + gint n_tabs); + + +/* public functions */ + void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, gpointer data, @@ -296,37 +304,32 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget, gpointer data, guint action) { - GtkWidget *dock; - GtkWidget *dockbook; - GtkWidget *dockable; - - const gchar *tabs[] = + static const gchar *tabs[] = { "gimp-layer-list", "gimp-channel-list", "gimp-vectors-list", "gimp-indexed-palette" }; - gint i; - dock = gimp_dialog_factory_dock_new (global_dock_factory); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); +} - gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), TRUE); +void +dialogs_create_data_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + static const gchar *tabs[] = + { + "gimp-brush-grid", + "gimp-pattern-grid", + "gimp-gradient-list", + "gimp-palette-list", + "gimp-font-list" + }; - dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); - - gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); - - for (i = 0; i < G_N_ELEMENTS (tabs); i++) - { - dockable = gimp_dialog_factory_dialog_new (global_dock_factory, - tabs[i], -1); - - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); - } - - gtk_widget_show (dock); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); } void @@ -334,38 +337,15 @@ dialogs_create_stuff_cmd_callback (GtkWidget *widget, gpointer data, guint action) { - GtkWidget *dock; - GtkWidget *dockbook; - GtkWidget *dockable; - - const gchar *tabs[] = + static const gchar *tabs[] = { - "gimp-brush-grid", - "gimp-pattern-grid", - "gimp-gradient-list", - "gimp-palette-list", "gimp-buffer-list", "gimp-image-list", - "gimp-document-history" + "gimp-document-list", + "gimp-template-list" }; - gint i; - dock = gimp_dialog_factory_dock_new (global_dock_factory); - - dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); - - gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); - - for (i = 0; i < G_N_ELEMENTS (tabs); i++) - { - dockable = gimp_dialog_factory_dialog_new (global_dock_factory, - tabs[i], -1); - - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); - } - - gtk_widget_show (dock); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); } void @@ -395,3 +375,33 @@ dialogs_show_toolbox (void) } } } + + +/* private functions */ + +static void +dialogs_create_dock (const gchar *tabs[], + gint n_tabs) +{ + GtkWidget *dock; + GtkWidget *dockbook; + GtkWidget *dockable; + gint i; + + dock = gimp_dialog_factory_dock_new (global_dock_factory); + + dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); + + gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); + + for (i = 0; i < n_tabs; i++) + { + dockable = gimp_dialog_factory_dialog_new (global_dock_factory, + tabs[i], -1); + + if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) + gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); + } + + gtk_widget_show (dock); +} diff --git a/app/actions/dialogs-commands.h b/app/actions/dialogs-commands.h index 1da7b2bac8..140217e9ca 100644 --- a/app/actions/dialogs-commands.h +++ b/app/actions/dialogs-commands.h @@ -24,39 +24,42 @@ void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, gpointer data, guint action); void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_remove_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, gpointer data, guint action); void dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); +void dialogs_create_data_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_show_toolbox (void); diff --git a/app/gui/dialogs-commands.c b/app/gui/dialogs-commands.c index 5ec56f2983..cb391b9638 100644 --- a/app/gui/dialogs-commands.c +++ b/app/gui/dialogs-commands.c @@ -35,6 +35,14 @@ #include "dialogs-commands.h" +/* local function prototypes */ + +static void dialogs_create_dock (const gchar *tabs[], + gint n_tabs); + + +/* public functions */ + void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, gpointer data, @@ -296,37 +304,32 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget, gpointer data, guint action) { - GtkWidget *dock; - GtkWidget *dockbook; - GtkWidget *dockable; - - const gchar *tabs[] = + static const gchar *tabs[] = { "gimp-layer-list", "gimp-channel-list", "gimp-vectors-list", "gimp-indexed-palette" }; - gint i; - dock = gimp_dialog_factory_dock_new (global_dock_factory); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); +} - gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), TRUE); +void +dialogs_create_data_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + static const gchar *tabs[] = + { + "gimp-brush-grid", + "gimp-pattern-grid", + "gimp-gradient-list", + "gimp-palette-list", + "gimp-font-list" + }; - dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); - - gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); - - for (i = 0; i < G_N_ELEMENTS (tabs); i++) - { - dockable = gimp_dialog_factory_dialog_new (global_dock_factory, - tabs[i], -1); - - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); - } - - gtk_widget_show (dock); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); } void @@ -334,38 +337,15 @@ dialogs_create_stuff_cmd_callback (GtkWidget *widget, gpointer data, guint action) { - GtkWidget *dock; - GtkWidget *dockbook; - GtkWidget *dockable; - - const gchar *tabs[] = + static const gchar *tabs[] = { - "gimp-brush-grid", - "gimp-pattern-grid", - "gimp-gradient-list", - "gimp-palette-list", "gimp-buffer-list", "gimp-image-list", - "gimp-document-history" + "gimp-document-list", + "gimp-template-list" }; - gint i; - dock = gimp_dialog_factory_dock_new (global_dock_factory); - - dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); - - gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); - - for (i = 0; i < G_N_ELEMENTS (tabs); i++) - { - dockable = gimp_dialog_factory_dialog_new (global_dock_factory, - tabs[i], -1); - - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); - } - - gtk_widget_show (dock); + dialogs_create_dock (tabs, G_N_ELEMENTS (tabs)); } void @@ -395,3 +375,33 @@ dialogs_show_toolbox (void) } } } + + +/* private functions */ + +static void +dialogs_create_dock (const gchar *tabs[], + gint n_tabs) +{ + GtkWidget *dock; + GtkWidget *dockbook; + GtkWidget *dockable; + gint i; + + dock = gimp_dialog_factory_dock_new (global_dock_factory); + + dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); + + gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); + + for (i = 0; i < n_tabs; i++) + { + dockable = gimp_dialog_factory_dialog_new (global_dock_factory, + tabs[i], -1); + + if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) + gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); + } + + gtk_widget_show (dock); +} diff --git a/app/gui/dialogs-commands.h b/app/gui/dialogs-commands.h index 1da7b2bac8..140217e9ca 100644 --- a/app/gui/dialogs-commands.h +++ b/app/gui/dialogs-commands.h @@ -24,39 +24,42 @@ void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, gpointer data, guint action); void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_remove_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, gpointer data, guint action); void dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); +void dialogs_create_data_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data, + guint action); void dialogs_show_toolbox (void); diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index 067ea2b62c..85253c1571 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -777,14 +777,21 @@ GimpItemFactoryEntry image_menu_entries[] = MENU_BRANCH (N_("/_Dialogs")), - { { N_("/Dialogs/Layers, Channels & Paths..."), NULL, + MENU_BRANCH (N_("/Dialogs/_Create New Dock")), + + { { N_("/Dialogs/Create New Dock/Layers, Channels & Paths..."), NULL, dialogs_create_lc_cmd_callback, 0 }, NULL, "dialogs/layers_and_channels.html", NULL }, - { { N_("/Dialogs/Brushes, Patterns & Stuff..."), NULL, + { { N_("/Dialogs/Create New Dock/Brushes, Patterns & Gradients..."), NULL, + dialogs_create_data_cmd_callback, 0 }, + NULL, + NULL, NULL }, + { { N_("/Dialogs/Create New Dock/Misc. Stuff..."), NULL, dialogs_create_stuff_cmd_callback, 0 }, NULL, NULL, NULL }, + { { N_("/Dialogs/Tool Options..."), NULL, dialogs_create_dockable_cmd_callback, 0, "", GIMP_STOCK_TOOL_OPTIONS }, diff --git a/app/gui/toolbox-menu.c b/app/gui/toolbox-menu.c index 24e20b5211..09aa983abb 100644 --- a/app/gui/toolbox-menu.c +++ b/app/gui/toolbox-menu.c @@ -89,14 +89,21 @@ GimpItemFactoryEntry toolbox_menu_entries[] = MENU_BRANCH (N_("/File/_Dialogs")), - { { N_("/File/Dialogs/Layers, Channels & Paths..."), NULL, + MENU_BRANCH (N_("/File/Dialogs/_Create New Dock")), + + { { N_("/File/Dialogs/Create New Dock/Layers, Channels & Paths..."), NULL, dialogs_create_lc_cmd_callback, 0 }, NULL, "file/dialogs/layers_and_channels.html", NULL }, - { { N_("/File/Dialogs/Brushes, Patterns & Stuff..."), NULL, + { { N_("/File/Dialogs/Create New Dock/Brushes, Patterns & Gradients..."), NULL, + dialogs_create_data_cmd_callback, 0 }, + NULL, + NULL, NULL }, + { { N_("/File/Dialogs/Create New Dock/Misc. Stuff..."), NULL, dialogs_create_stuff_cmd_callback, 0 }, NULL, NULL, NULL }, + { { N_("/File/Dialogs/Tool Options..."), "T", dialogs_create_dockable_cmd_callback, 0, "", GIMP_STOCK_TOOL_OPTIONS }, diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index 067ea2b62c..85253c1571 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -777,14 +777,21 @@ GimpItemFactoryEntry image_menu_entries[] = MENU_BRANCH (N_("/_Dialogs")), - { { N_("/Dialogs/Layers, Channels & Paths..."), NULL, + MENU_BRANCH (N_("/Dialogs/_Create New Dock")), + + { { N_("/Dialogs/Create New Dock/Layers, Channels & Paths..."), NULL, dialogs_create_lc_cmd_callback, 0 }, NULL, "dialogs/layers_and_channels.html", NULL }, - { { N_("/Dialogs/Brushes, Patterns & Stuff..."), NULL, + { { N_("/Dialogs/Create New Dock/Brushes, Patterns & Gradients..."), NULL, + dialogs_create_data_cmd_callback, 0 }, + NULL, + NULL, NULL }, + { { N_("/Dialogs/Create New Dock/Misc. Stuff..."), NULL, dialogs_create_stuff_cmd_callback, 0 }, NULL, NULL, NULL }, + { { N_("/Dialogs/Tool Options..."), NULL, dialogs_create_dockable_cmd_callback, 0, "", GIMP_STOCK_TOOL_OPTIONS }, diff --git a/app/menus/toolbox-menu.c b/app/menus/toolbox-menu.c index 24e20b5211..09aa983abb 100644 --- a/app/menus/toolbox-menu.c +++ b/app/menus/toolbox-menu.c @@ -89,14 +89,21 @@ GimpItemFactoryEntry toolbox_menu_entries[] = MENU_BRANCH (N_("/File/_Dialogs")), - { { N_("/File/Dialogs/Layers, Channels & Paths..."), NULL, + MENU_BRANCH (N_("/File/Dialogs/_Create New Dock")), + + { { N_("/File/Dialogs/Create New Dock/Layers, Channels & Paths..."), NULL, dialogs_create_lc_cmd_callback, 0 }, NULL, "file/dialogs/layers_and_channels.html", NULL }, - { { N_("/File/Dialogs/Brushes, Patterns & Stuff..."), NULL, + { { N_("/File/Dialogs/Create New Dock/Brushes, Patterns & Gradients..."), NULL, + dialogs_create_data_cmd_callback, 0 }, + NULL, + NULL, NULL }, + { { N_("/File/Dialogs/Create New Dock/Misc. Stuff..."), NULL, dialogs_create_stuff_cmd_callback, 0 }, NULL, NULL, NULL }, + { { N_("/File/Dialogs/Tool Options..."), "T", dialogs_create_dockable_cmd_callback, 0, "", GIMP_STOCK_TOOL_OPTIONS },