app: don't hardcode the prefs icon sizes n_categories times

Remove the parameters from gimp_prefs_box_add_page() and instead
hardcode them once in GimpPrefsBox. This way they can also easily be
made configurable in the future.
This commit is contained in:
Michael Natterer 2015-12-13 13:33:55 +01:00
parent 8619852a6c
commit f7d33ac18f
3 changed files with 12 additions and 75 deletions

View File

@ -1359,10 +1359,7 @@ prefs_dialog_new (Gimp *gimp,
/**********************/ /**********************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-system-resources", "gimp-prefs-system-resources",
GTK_ICON_SIZE_DIALOG,
_("System Resources"), _("System Resources"),
"gimp-prefs-system-resources",
GTK_ICON_SIZE_BUTTON,
_("System Resources"), _("System Resources"),
GIMP_HELP_PREFS_SYSTEM_RESOURCES, GIMP_HELP_PREFS_SYSTEM_RESOURCES,
NULL, NULL,
@ -1435,10 +1432,7 @@ prefs_dialog_new (Gimp *gimp,
/**********************/ /**********************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-color-management", "gimp-prefs-color-management",
GTK_ICON_SIZE_DIALOG,
_("Color Management"), _("Color Management"),
"gimp-prefs-color-management",
GTK_ICON_SIZE_BUTTON,
_("Color Management"), _("Color Management"),
GIMP_HELP_PREFS_COLOR_MANAGEMENT, GIMP_HELP_PREFS_COLOR_MANAGEMENT,
NULL, NULL,
@ -1589,10 +1583,7 @@ prefs_dialog_new (Gimp *gimp,
{ {
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-playground", "gimp-prefs-playground",
GTK_ICON_SIZE_DIALOG,
_("Experimental Playground"), _("Experimental Playground"),
"gimp-prefs-playground",
GTK_ICON_SIZE_BUTTON,
_("Playground"), _("Playground"),
GIMP_HELP_PREFS_DIALOG, GIMP_HELP_PREFS_DIALOG,
NULL, NULL,
@ -1624,10 +1615,7 @@ prefs_dialog_new (Gimp *gimp,
/******************/ /******************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-tool-options", "gimp-prefs-tool-options",
GTK_ICON_SIZE_DIALOG,
C_("preferences", "Tool Options"), C_("preferences", "Tool Options"),
"gimp-prefs-tool-options",
GTK_ICON_SIZE_BUTTON,
C_("preferences", "Tool Options"), C_("preferences", "Tool Options"),
GIMP_HELP_PREFS_TOOL_OPTIONS, GIMP_HELP_PREFS_TOOL_OPTIONS,
NULL, NULL,
@ -1714,10 +1702,7 @@ prefs_dialog_new (Gimp *gimp,
/*******************/ /*******************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-new-image", "gimp-prefs-new-image",
GTK_ICON_SIZE_DIALOG,
_("Default New Image"), _("Default New Image"),
"gimp-prefs-new-image",
GTK_ICON_SIZE_BUTTON,
_("Default Image"), _("Default Image"),
GIMP_HELP_PREFS_NEW_IMAGE, GIMP_HELP_PREFS_NEW_IMAGE,
NULL, NULL,
@ -1767,10 +1752,7 @@ prefs_dialog_new (Gimp *gimp,
/**********************************/ /**********************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-default-grid", "gimp-prefs-default-grid",
GTK_ICON_SIZE_DIALOG,
_("Default Image Grid"), _("Default Image Grid"),
"gimp-prefs-default-grid",
GTK_ICON_SIZE_BUTTON,
_("Default Grid"), _("Default Grid"),
GIMP_HELP_PREFS_DEFAULT_GRID, GIMP_HELP_PREFS_DEFAULT_GRID,
&top_iter, &top_iter,
@ -1790,10 +1772,7 @@ prefs_dialog_new (Gimp *gimp,
/***************/ /***************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-interface", "gimp-prefs-interface",
GTK_ICON_SIZE_DIALOG,
_("User Interface"), _("User Interface"),
"gimp-prefs-interface",
GTK_ICON_SIZE_BUTTON,
_("Interface"), _("Interface"),
GIMP_HELP_PREFS_INTERFACE, GIMP_HELP_PREFS_INTERFACE,
NULL, NULL,
@ -1872,10 +1851,7 @@ prefs_dialog_new (Gimp *gimp,
/***********************/ /***********************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-theme", "gimp-prefs-theme",
GTK_ICON_SIZE_DIALOG,
_("Theme"), _("Theme"),
"gimp-prefs-theme",
GTK_ICON_SIZE_BUTTON,
_("Theme"), _("Theme"),
GIMP_HELP_PREFS_THEME, GIMP_HELP_PREFS_THEME,
&top_iter, &top_iter,
@ -1975,10 +1951,7 @@ prefs_dialog_new (Gimp *gimp,
/****************************/ /****************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-icon-theme", "gimp-prefs-icon-theme",
GTK_ICON_SIZE_DIALOG,
_("Icon Theme"), _("Icon Theme"),
"gimp-prefs-icon-theme",
GTK_ICON_SIZE_BUTTON,
_("Icon Theme"), _("Icon Theme"),
GIMP_HELP_PREFS_ICON_THEME, GIMP_HELP_PREFS_ICON_THEME,
&top_iter, &top_iter,
@ -2067,10 +2040,7 @@ prefs_dialog_new (Gimp *gimp,
/*************************/ /*************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-toolbox", "gimp-prefs-toolbox",
GTK_ICON_SIZE_DIALOG,
_("Toolbox"), _("Toolbox"),
"gimp-prefs-toolbox",
GTK_ICON_SIZE_BUTTON,
_("Toolbox"), _("Toolbox"),
GIMP_HELP_PREFS_TOOLBOX, GIMP_HELP_PREFS_TOOLBOX,
&top_iter, &top_iter,
@ -2114,10 +2084,7 @@ prefs_dialog_new (Gimp *gimp,
/*****************************/ /*****************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-help-system", "gimp-prefs-help-system",
GTK_ICON_SIZE_DIALOG,
_("Help System"), _("Help System"),
"gimp-prefs-help-system",
GTK_ICON_SIZE_BUTTON,
_("Help System"), _("Help System"),
GIMP_HELP_PREFS_HELP, GIMP_HELP_PREFS_HELP,
&top_iter, &top_iter,
@ -2216,10 +2183,7 @@ prefs_dialog_new (Gimp *gimp,
/*************************/ /*************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-display", "gimp-prefs-display",
GTK_ICON_SIZE_DIALOG,
_("Display"), _("Display"),
"gimp-prefs-display",
GTK_ICON_SIZE_BUTTON,
_("Display"), _("Display"),
GIMP_HELP_PREFS_DISPLAY, GIMP_HELP_PREFS_DISPLAY,
&top_iter, &top_iter,
@ -2343,10 +2307,7 @@ prefs_dialog_new (Gimp *gimp,
/***********************************/ /***********************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-window-management", "gimp-prefs-window-management",
GTK_ICON_SIZE_DIALOG,
_("Window Management"), _("Window Management"),
"gimp-prefs-window-management",
GTK_ICON_SIZE_BUTTON,
_("Window Management"), _("Window Management"),
GIMP_HELP_PREFS_WINDOW_MANAGEMENT, GIMP_HELP_PREFS_WINDOW_MANAGEMENT,
&top_iter, &top_iter,
@ -2401,10 +2362,7 @@ prefs_dialog_new (Gimp *gimp,
/*******************/ /*******************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-image-windows", "gimp-prefs-image-windows",
GTK_ICON_SIZE_DIALOG,
_("Image Windows"), _("Image Windows"),
"gimp-prefs-image-windows",
GTK_ICON_SIZE_BUTTON,
_("Image Windows"), _("Image Windows"),
GIMP_HELP_PREFS_IMAGE_WINDOW, GIMP_HELP_PREFS_IMAGE_WINDOW,
NULL, NULL,
@ -2483,10 +2441,7 @@ prefs_dialog_new (Gimp *gimp,
/********************************/ /********************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-image-windows", "gimp-prefs-image-windows",
GTK_ICON_SIZE_DIALOG,
_("Image Window Appearance"), _("Image Window Appearance"),
"gimp-prefs-image-windows",
GTK_ICON_SIZE_BUTTON,
_("Appearance"), _("Appearance"),
GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE, GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE,
&top_iter, &top_iter,
@ -2508,10 +2463,7 @@ prefs_dialog_new (Gimp *gimp,
/****************************************************/ /****************************************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-image-title", "gimp-prefs-image-title",
GTK_ICON_SIZE_DIALOG,
_("Image Title & Statusbar Format"), _("Image Title & Statusbar Format"),
"gimp-prefs-image-title",
GTK_ICON_SIZE_BUTTON,
_("Title & Status"), _("Title & Status"),
GIMP_HELP_PREFS_IMAGE_WINDOW_TITLE, GIMP_HELP_PREFS_IMAGE_WINDOW_TITLE,
&top_iter, &top_iter,
@ -2634,10 +2586,7 @@ prefs_dialog_new (Gimp *gimp,
/******************************/ /******************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-tool-options", "gimp-prefs-tool-options",
GTK_ICON_SIZE_DIALOG,
_("Image Window Snapping Behavior"), _("Image Window Snapping Behavior"),
"gimp-prefs-tool-options",
GTK_ICON_SIZE_BUTTON,
_("Snapping"), _("Snapping"),
GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE, GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE,
&top_iter, &top_iter,
@ -2658,10 +2607,7 @@ prefs_dialog_new (Gimp *gimp,
/*******************/ /*******************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-input-devices", "gimp-prefs-input-devices",
GTK_ICON_SIZE_DIALOG,
_("Input Devices"), _("Input Devices"),
"gimp-prefs-input-devices",
GTK_ICON_SIZE_BUTTON,
_("Input Devices"), _("Input Devices"),
GIMP_HELP_PREFS_INPUT_DEVICES, GIMP_HELP_PREFS_INPUT_DEVICES,
NULL, NULL,
@ -2705,10 +2651,7 @@ prefs_dialog_new (Gimp *gimp,
/****************************/ /****************************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-controllers", "gimp-prefs-controllers",
GTK_ICON_SIZE_DIALOG,
_("Additional Input Controllers"), _("Additional Input Controllers"),
"gimp-prefs-controllers",
GTK_ICON_SIZE_BUTTON,
_("Input Controllers"), _("Input Controllers"),
GIMP_HELP_PREFS_INPUT_CONTROLLERS, GIMP_HELP_PREFS_INPUT_CONTROLLERS,
&top_iter, &top_iter,
@ -2724,10 +2667,7 @@ prefs_dialog_new (Gimp *gimp,
/*************/ /*************/
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
"gimp-prefs-folders", "gimp-prefs-folders",
GTK_ICON_SIZE_DIALOG,
_("Folders"), _("Folders"),
"gimp-prefs-folders",
GTK_ICON_SIZE_BUTTON,
_("Folders"), _("Folders"),
GIMP_HELP_PREFS_FOLDERS, GIMP_HELP_PREFS_FOLDERS,
NULL, NULL,
@ -2865,10 +2805,7 @@ prefs_dialog_new (Gimp *gimp,
icon_name = g_strconcat ("gimp-prefs-", paths[i].icon, NULL); icon_name = g_strconcat ("gimp-prefs-", paths[i].icon, NULL);
vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box), vbox = gimp_prefs_box_add_page (GIMP_PREFS_BOX (prefs_box),
icon_name, icon_name,
GTK_ICON_SIZE_DIALOG,
gettext (paths[i].label), gettext (paths[i].label),
icon_name,
GTK_ICON_SIZE_BUTTON,
gettext (paths[i].tree_label), gettext (paths[i].tree_label),
paths[i].help_data, paths[i].help_data,
&top_iter, &top_iter,

View File

@ -53,6 +53,9 @@ struct _GimpPrefsBoxPrivate
GtkWidget *label; GtkWidget *label;
GtkWidget *image; GtkWidget *image;
gint tree_icon_size;
gint notebook_icon_size;
gint page_index; gint page_index;
}; };
@ -92,6 +95,9 @@ gimp_prefs_box_init (GimpPrefsBox *box)
GtkWidget *ebox; GtkWidget *ebox;
GtkWidget *vbox; GtkWidget *vbox;
private->tree_icon_size = GTK_ICON_SIZE_BUTTON;
private->notebook_icon_size = GTK_ICON_SIZE_DIALOG;
gtk_orientable_set_orientation (GTK_ORIENTABLE (box), gtk_orientable_set_orientation (GTK_ORIENTABLE (box),
GTK_ORIENTATION_HORIZONTAL); GTK_ORIENTATION_HORIZONTAL);
gtk_box_set_spacing (GTK_BOX (box), 12); gtk_box_set_spacing (GTK_BOX (box), 12);
@ -302,11 +308,8 @@ gimp_prefs_box_new (void)
GtkWidget * GtkWidget *
gimp_prefs_box_add_page (GimpPrefsBox *box, gimp_prefs_box_add_page (GimpPrefsBox *box,
const gchar *notebook_icon_name, const gchar *icon_name,
const GtkIconSize notebook_icon_size,
const gchar *notebook_label, const gchar *notebook_label,
const gchar *tree_icon_name,
const GtkIconSize tree_icon_size,
const gchar *tree_label, const gchar *tree_label,
const gchar *help_id, const gchar *help_id,
GtkTreeIter *parent, GtkTreeIter *parent,
@ -333,11 +336,11 @@ gimp_prefs_box_add_page (GimpPrefsBox *box,
gtk_tree_store_append (private->store, iter, parent); gtk_tree_store_append (private->store, iter, parent);
gtk_tree_store_set (private->store, iter, gtk_tree_store_set (private->store, iter,
COLUMN_TREE_ICON_NAME, tree_icon_name, COLUMN_TREE_ICON_NAME, icon_name,
COLUMN_TREE_ICON_SIZE, tree_icon_size, COLUMN_TREE_ICON_SIZE, private->tree_icon_size,
COLUMN_TREE_LABEL, tree_label, COLUMN_TREE_LABEL, tree_label,
COLUMN_NOTEBOOK_ICON_NAME, notebook_icon_name, COLUMN_NOTEBOOK_ICON_NAME, icon_name,
COLUMN_NOTEBOOK_ICON_SIZE, notebook_icon_size, COLUMN_NOTEBOOK_ICON_SIZE, private->notebook_icon_size,
COLUMN_NOTEBOOK_LABEL , notebook_label, COLUMN_NOTEBOOK_LABEL , notebook_label,
COLUMN_PAGE_INDEX, private->page_index++, COLUMN_PAGE_INDEX, private->page_index++,
-1); -1);

View File

@ -48,11 +48,8 @@ GType gimp_prefs_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_prefs_box_new (void); GtkWidget * gimp_prefs_box_new (void);
GtkWidget * gimp_prefs_box_add_page (GimpPrefsBox *box, GtkWidget * gimp_prefs_box_add_page (GimpPrefsBox *box,
const gchar *notebook_icon_name, const gchar *icon_name,
const GtkIconSize notebook_icon_size,
const gchar *notebook_label, const gchar *notebook_label,
const gchar *tree_icon_name,
const GtkIconSize tree_icon_size,
const gchar *tree_label, const gchar *tree_label,
const gchar *help_id, const gchar *help_id,
GtkTreeIter *parent, GtkTreeIter *parent,