app: clean up GimpPrefsBox and the prefs dialog a bit
Better API for getting properties of the current page, add missing help IDs, fix the icon of the resolution calibrate dialog, ...
This commit is contained in:
@ -556,14 +556,14 @@ prefs_resolution_calibrate_callback (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *prefs_box;
|
GtkWidget *prefs_box;
|
||||||
GtkWidget *image;
|
const gchar *icon_name;
|
||||||
|
|
||||||
dialog = gtk_widget_get_toplevel (entry);
|
dialog = gtk_widget_get_toplevel (entry);
|
||||||
|
|
||||||
prefs_box = g_object_get_data (G_OBJECT (dialog), "prefs-box");
|
prefs_box = g_object_get_data (G_OBJECT (dialog), "prefs-box");
|
||||||
image = gimp_prefs_box_get_image (GIMP_PREFS_BOX (prefs_box));
|
icon_name = gimp_prefs_box_get_current_icon_name (GIMP_PREFS_BOX (prefs_box));
|
||||||
|
|
||||||
resolution_calibrate_dialog (entry, gtk_image_get_pixbuf (GTK_IMAGE (image)));
|
resolution_calibrate_dialog (entry, icon_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1023,16 +1023,11 @@ prefs_help_func (const gchar *help_id,
|
|||||||
gpointer help_data)
|
gpointer help_data)
|
||||||
{
|
{
|
||||||
GtkWidget *prefs_box;
|
GtkWidget *prefs_box;
|
||||||
GtkWidget *notebook;
|
|
||||||
GtkWidget *page;
|
|
||||||
gint page_num;
|
|
||||||
|
|
||||||
prefs_box = g_object_get_data (G_OBJECT (help_data), "prefs-box");
|
prefs_box = g_object_get_data (G_OBJECT (help_data), "prefs-box");
|
||||||
notebook = gimp_prefs_box_get_notebook (GIMP_PREFS_BOX (prefs_box));
|
|
||||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
|
|
||||||
page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
|
|
||||||
|
|
||||||
help_id = g_object_get_data (G_OBJECT (page), "gimp-help-id");
|
help_id = gimp_prefs_box_get_current_help_id (GIMP_PREFS_BOX (prefs_box));
|
||||||
|
|
||||||
gimp_standard_help_func (help_id, NULL);
|
gimp_standard_help_func (help_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,7 +1452,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
"gimp-prefs-import-export",
|
"gimp-prefs-import-export",
|
||||||
_("Image Import & Export"),
|
_("Image Import & Export"),
|
||||||
_("Image Import & Export"),
|
_("Image Import & Export"),
|
||||||
GIMP_HELP_PREFS_DIALOG,
|
GIMP_HELP_PREFS_IMPORT_EXPORT,
|
||||||
NULL,
|
NULL,
|
||||||
&top_iter);
|
&top_iter);
|
||||||
|
|
||||||
@ -1539,7 +1534,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
"gimp-prefs-playground",
|
"gimp-prefs-playground",
|
||||||
_("Experimental Playground"),
|
_("Experimental Playground"),
|
||||||
_("Playground"),
|
_("Playground"),
|
||||||
GIMP_HELP_PREFS_DIALOG,
|
GIMP_HELP_PREFS_PLAYGROUND,
|
||||||
NULL,
|
NULL,
|
||||||
&top_iter);
|
&top_iter);
|
||||||
|
|
||||||
@ -2943,7 +2938,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
"gimp-prefs-image-windows-snapping",
|
"gimp-prefs-image-windows-snapping",
|
||||||
_("Image Window Snapping Behavior"),
|
_("Image Window Snapping Behavior"),
|
||||||
_("Snapping"),
|
_("Snapping"),
|
||||||
GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE,
|
GIMP_HELP_PREFS_IMAGE_WINDOW_SNAPPING,
|
||||||
&top_iter,
|
&top_iter,
|
||||||
&child_iter);
|
&child_iter);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ static gint ruler_height = 1;
|
|||||||
/**
|
/**
|
||||||
* resolution_calibrate_dialog:
|
* resolution_calibrate_dialog:
|
||||||
* @resolution_entry: a #GimpSizeEntry to connect the dialog to
|
* @resolution_entry: a #GimpSizeEntry to connect the dialog to
|
||||||
* @pixbuf: an optional #GdkPixbuf for the upper left corner
|
* @icon_name: an optional icon-name for the upper left corner
|
||||||
*
|
*
|
||||||
* Displays a dialog that allows the user to interactively determine
|
* Displays a dialog that allows the user to interactively determine
|
||||||
* her monitor resolution. This dialog runs it's own GTK main loop and
|
* her monitor resolution. This dialog runs it's own GTK main loop and
|
||||||
@ -47,7 +47,7 @@ static gint ruler_height = 1;
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
||||||
GdkPixbuf *pixbuf)
|
const gchar *icon_name)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
@ -61,7 +61,6 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
|||||||
|
|
||||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
|
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
|
||||||
g_return_if_fail (gtk_widget_get_realized (resolution_entry));
|
g_return_if_fail (gtk_widget_get_realized (resolution_entry));
|
||||||
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
|
|
||||||
|
|
||||||
/* this dialog can only exist once */
|
/* this dialog can only exist once */
|
||||||
if (calibrate_entry)
|
if (calibrate_entry)
|
||||||
@ -97,9 +96,10 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
|||||||
table, TRUE, TRUE, 0);
|
table, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
if (pixbuf)
|
if (icon_name)
|
||||||
{
|
{
|
||||||
GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
|
GtkWidget *image = gtk_image_new_from_icon_name (icon_name,
|
||||||
|
GTK_ICON_SIZE_DIALOG);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1,
|
gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1,
|
||||||
GTK_SHRINK, GTK_SHRINK, 4, 4);
|
GTK_SHRINK, GTK_SHRINK, 4, 4);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
void resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
void resolution_calibrate_dialog (GtkWidget *resolution_entry,
|
||||||
GdkPixbuf *pixbuf);
|
const gchar *icon_name);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __RESOLUTION_CALIBRATE_DIALOG_H__ */
|
#endif /* __RESOLUTION_CALIBRATE_DIALOG_H__ */
|
||||||
|
@ -611,27 +611,28 @@
|
|||||||
#define GIMP_HELP_ERRORS_SELECT_ALL "gimp-errors-select-all"
|
#define GIMP_HELP_ERRORS_SELECT_ALL "gimp-errors-select-all"
|
||||||
|
|
||||||
#define GIMP_HELP_PREFS_DIALOG "gimp-prefs-dialog"
|
#define GIMP_HELP_PREFS_DIALOG "gimp-prefs-dialog"
|
||||||
#define GIMP_HELP_PREFS_NEW_IMAGE "gimp-prefs-new-image"
|
#define GIMP_HELP_PREFS_SYSTEM_RESOURCES "gimp-prefs-system-resources"
|
||||||
#define GIMP_HELP_PREFS_DEBUGGING "gimp-prefs-debugging"
|
#define GIMP_HELP_PREFS_DEBUGGING "gimp-prefs-debugging"
|
||||||
|
#define GIMP_HELP_PREFS_COLOR_MANAGEMENT "gimp-prefs-color-management"
|
||||||
|
#define GIMP_HELP_PREFS_IMPORT_EXPORT "gimp-prefs-import-export"
|
||||||
|
#define GIMP_HELP_PREFS_PLAYGROUND "gimp-prefs-playground"
|
||||||
|
#define GIMP_HELP_PREFS_TOOL_OPTIONS "gimp-prefs-tool-options"
|
||||||
|
#define GIMP_HELP_PREFS_NEW_IMAGE "gimp-prefs-new-image"
|
||||||
#define GIMP_HELP_PREFS_DEFAULT_GRID "gimp-prefs-default-grid"
|
#define GIMP_HELP_PREFS_DEFAULT_GRID "gimp-prefs-default-grid"
|
||||||
#define GIMP_HELP_PREFS_INTERFACE "gimp-prefs-interface"
|
#define GIMP_HELP_PREFS_INTERFACE "gimp-prefs-interface"
|
||||||
#define GIMP_HELP_PREFS_HELP "gimp-prefs-help"
|
|
||||||
#define GIMP_HELP_PREFS_THEME "gimp-prefs-theme"
|
#define GIMP_HELP_PREFS_THEME "gimp-prefs-theme"
|
||||||
#define GIMP_HELP_PREFS_ICON_THEME "gimp-prefs-icon-theme"
|
#define GIMP_HELP_PREFS_ICON_THEME "gimp-prefs-icon-theme"
|
||||||
#define GIMP_HELP_PREFS_TOOL_OPTIONS "gimp-prefs-tool-options"
|
|
||||||
#define GIMP_HELP_PREFS_TOOLBOX "gimp-prefs-toolbox"
|
#define GIMP_HELP_PREFS_TOOLBOX "gimp-prefs-toolbox"
|
||||||
#define GIMP_HELP_PREFS_DIALOG_DEFAULTS "gimp-prefs-dialog-defaults"
|
#define GIMP_HELP_PREFS_DIALOG_DEFAULTS "gimp-prefs-dialog-defaults"
|
||||||
#define GIMP_HELP_PREFS_INPUT_DEVICES "gimp-prefs-input-devices"
|
#define GIMP_HELP_PREFS_HELP "gimp-prefs-help"
|
||||||
#define GIMP_HELP_PREFS_INPUT_CONTROLLERS "gimp-prefs-input-controllers"
|
#define GIMP_HELP_PREFS_DISPLAY "gimp-prefs-display"
|
||||||
|
#define GIMP_HELP_PREFS_WINDOW_MANAGEMENT "gimp-prefs-window-management"
|
||||||
#define GIMP_HELP_PREFS_IMAGE_WINDOW "gimp-prefs-image-window"
|
#define GIMP_HELP_PREFS_IMAGE_WINDOW "gimp-prefs-image-window"
|
||||||
#define GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE "gimp-prefs-image-window-appearance"
|
#define GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE "gimp-prefs-image-window-appearance"
|
||||||
#define GIMP_HELP_PREFS_IMAGE_WINDOW_TITLE "gimp-prefs-image-window-title"
|
#define GIMP_HELP_PREFS_IMAGE_WINDOW_TITLE "gimp-prefs-image-window-title"
|
||||||
#define GIMP_HELP_PREFS_DISPLAY "gimp-prefs-display"
|
#define GIMP_HELP_PREFS_IMAGE_WINDOW_SNAPPING "gimp-prefs-image-window-snapping"
|
||||||
#define GIMP_HELP_PREFS_MONITOR "gimp-prefs-monitor"
|
#define GIMP_HELP_PREFS_INPUT_DEVICES "gimp-prefs-input-devices"
|
||||||
#define GIMP_HELP_PREFS_COLOR_MANAGEMENT "gimp-prefs-color-management"
|
#define GIMP_HELP_PREFS_INPUT_CONTROLLERS "gimp-prefs-input-controllers"
|
||||||
#define GIMP_HELP_PREFS_WINDOW_MANAGEMENT "gimp-prefs-window-management"
|
|
||||||
#define GIMP_HELP_PREFS_SESSION "gimp-prefs-session"
|
|
||||||
#define GIMP_HELP_PREFS_SYSTEM_RESOURCES "gimp-prefs-system-resources"
|
|
||||||
#define GIMP_HELP_PREFS_FOLDERS "gimp-prefs-folders"
|
#define GIMP_HELP_PREFS_FOLDERS "gimp-prefs-folders"
|
||||||
#define GIMP_HELP_PREFS_FOLDERS_BRUSHES "gimp-prefs-folders-brushes"
|
#define GIMP_HELP_PREFS_FOLDERS_BRUSHES "gimp-prefs-folders-brushes"
|
||||||
#define GIMP_HELP_PREFS_FOLDERS_DYNAMICS "gimp-prefs-folders-dynamics"
|
#define GIMP_HELP_PREFS_FOLDERS_DYNAMICS "gimp-prefs-folders-dynamics"
|
||||||
|
@ -38,13 +38,13 @@ enum
|
|||||||
COLUMN_TREE_ICON_NAME,
|
COLUMN_TREE_ICON_NAME,
|
||||||
COLUMN_TREE_ICON_SIZE,
|
COLUMN_TREE_ICON_SIZE,
|
||||||
COLUMN_TREE_LABEL,
|
COLUMN_TREE_LABEL,
|
||||||
COLUMN_NOTEBOOK_ICON_NAME,
|
COLUMN_PAGE_ICON_NAME,
|
||||||
COLUMN_NOTEBOOK_ICON_SIZE,
|
COLUMN_PAGE_ICON_SIZE,
|
||||||
COLUMN_NOTEBOOK_LABEL,
|
COLUMN_PAGE_TITLE,
|
||||||
|
COLUMN_PAGE_HELP_ID,
|
||||||
COLUMN_PAGE_INDEX
|
COLUMN_PAGE_INDEX
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GimpPrefsBoxPrivate GimpPrefsBoxPrivate;
|
|
||||||
|
|
||||||
struct _GimpPrefsBoxPrivate
|
struct _GimpPrefsBoxPrivate
|
||||||
{
|
{
|
||||||
@ -55,16 +55,18 @@ struct _GimpPrefsBoxPrivate
|
|||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
|
||||||
gint tree_icon_size;
|
gint tree_icon_size;
|
||||||
gint notebook_icon_size;
|
gint page_icon_size;
|
||||||
|
|
||||||
gint page_index;
|
gint page_index;
|
||||||
|
gchar *page_icon_name;
|
||||||
|
gchar *page_help_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_PRIVATE(item) G_TYPE_INSTANCE_GET_PRIVATE (item, \
|
#define GET_PRIVATE(obj) (((GimpPrefsBox *) (obj))->priv)
|
||||||
GIMP_TYPE_PREFS_BOX, \
|
|
||||||
GimpPrefsBoxPrivate)
|
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_prefs_box_finalize (GObject *object);
|
||||||
|
|
||||||
static void gimp_prefs_box_tree_select_callback (GtkTreeSelection *sel,
|
static void gimp_prefs_box_tree_select_callback (GtkTreeSelection *sel,
|
||||||
GimpPrefsBox *box);
|
GimpPrefsBox *box);
|
||||||
static void gimp_prefs_box_notebook_page_callback (GtkNotebook *notebook,
|
static void gimp_prefs_box_notebook_page_callback (GtkNotebook *notebook,
|
||||||
@ -81,13 +83,17 @@ G_DEFINE_TYPE (GimpPrefsBox, gimp_prefs_box, GTK_TYPE_BOX)
|
|||||||
static void
|
static void
|
||||||
gimp_prefs_box_class_init (GimpPrefsBoxClass *klass)
|
gimp_prefs_box_class_init (GimpPrefsBoxClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->finalize = gimp_prefs_box_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GimpPrefsBoxPrivate));
|
g_type_class_add_private (klass, sizeof (GimpPrefsBoxPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prefs_box_init (GimpPrefsBox *box)
|
gimp_prefs_box_init (GimpPrefsBox *box)
|
||||||
{
|
{
|
||||||
GimpPrefsBoxPrivate *private = GET_PRIVATE (box);
|
GimpPrefsBoxPrivate *private;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GtkCellRenderer *cell;
|
GtkCellRenderer *cell;
|
||||||
GtkTreeSelection *sel;
|
GtkTreeSelection *sel;
|
||||||
@ -96,8 +102,14 @@ gimp_prefs_box_init (GimpPrefsBox *box)
|
|||||||
GtkWidget *ebox;
|
GtkWidget *ebox;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
|
|
||||||
|
box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box,
|
||||||
|
GIMP_TYPE_PREFS_BOX,
|
||||||
|
GimpPrefsBoxPrivate);
|
||||||
|
|
||||||
|
private = box->priv;
|
||||||
|
|
||||||
private->tree_icon_size = GTK_ICON_SIZE_BUTTON;
|
private->tree_icon_size = GTK_ICON_SIZE_BUTTON;
|
||||||
private->notebook_icon_size = GTK_ICON_SIZE_DIALOG;
|
private->page_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);
|
||||||
@ -114,13 +126,14 @@ gimp_prefs_box_init (GimpPrefsBox *box)
|
|||||||
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
private->store = gtk_tree_store_new (7,
|
private->store = gtk_tree_store_new (8,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_INT,
|
G_TYPE_INT,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_INT,
|
G_TYPE_INT,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
|
G_TYPE_STRING,
|
||||||
G_TYPE_INT);
|
G_TYPE_INT);
|
||||||
private->tree_view =
|
private->tree_view =
|
||||||
gtk_tree_view_new_with_model (GTK_TREE_MODEL (private->store));
|
gtk_tree_view_new_with_model (GTK_TREE_MODEL (private->store));
|
||||||
@ -194,6 +207,17 @@ gimp_prefs_box_init (GimpPrefsBox *box)
|
|||||||
box);
|
box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prefs_box_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GimpPrefsBoxPrivate *private = GET_PRIVATE (object);
|
||||||
|
|
||||||
|
g_clear_pointer (&private->page_icon_name, g_free);
|
||||||
|
g_clear_pointer (&private->page_help_id, g_free);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prefs_box_tree_select_callback (GtkTreeSelection *sel,
|
gimp_prefs_box_tree_select_callback (GtkTreeSelection *sel,
|
||||||
GimpPrefsBox *box)
|
GimpPrefsBox *box)
|
||||||
@ -201,35 +225,35 @@ gimp_prefs_box_tree_select_callback (GtkTreeSelection *sel,
|
|||||||
GimpPrefsBoxPrivate *private = GET_PRIVATE (box);
|
GimpPrefsBoxPrivate *private = GET_PRIVATE (box);
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gchar *notebook_text;
|
gchar *page_title;
|
||||||
gchar *notebook_icon_name;
|
gchar *page_icon_name;
|
||||||
gint notebook_icon_size;
|
gint page_icon_size;
|
||||||
gint notebook_index;
|
gint page_index;
|
||||||
|
|
||||||
if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
COLUMN_NOTEBOOK_ICON_NAME, ¬ebook_icon_name,
|
COLUMN_PAGE_ICON_NAME, &page_icon_name,
|
||||||
COLUMN_NOTEBOOK_ICON_SIZE, ¬ebook_icon_size,
|
COLUMN_PAGE_ICON_SIZE, &page_icon_size,
|
||||||
COLUMN_NOTEBOOK_LABEL, ¬ebook_text,
|
COLUMN_PAGE_TITLE, &page_title,
|
||||||
COLUMN_PAGE_INDEX, ¬ebook_index,
|
COLUMN_PAGE_INDEX, &page_index,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (private->label), notebook_text);
|
gtk_label_set_text (GTK_LABEL (private->label), page_title);
|
||||||
g_free (notebook_text);
|
g_free (page_title);
|
||||||
|
|
||||||
gtk_image_set_from_icon_name (GTK_IMAGE (private->image),
|
gtk_image_set_from_icon_name (GTK_IMAGE (private->image),
|
||||||
notebook_icon_name,
|
page_icon_name,
|
||||||
notebook_icon_size);
|
page_icon_size);
|
||||||
g_free (notebook_icon_name);
|
g_free (page_icon_name);
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (private->notebook,
|
g_signal_handlers_block_by_func (private->notebook,
|
||||||
gimp_prefs_box_notebook_page_callback,
|
gimp_prefs_box_notebook_page_callback,
|
||||||
sel);
|
sel);
|
||||||
|
|
||||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (private->notebook),
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (private->notebook),
|
||||||
notebook_index);
|
page_index);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (private->notebook,
|
g_signal_handlers_unblock_by_func (private->notebook,
|
||||||
gimp_prefs_box_notebook_page_callback,
|
gimp_prefs_box_notebook_page_callback,
|
||||||
@ -310,7 +334,7 @@ gimp_prefs_box_new (void)
|
|||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_prefs_box_add_page (GimpPrefsBox *box,
|
gimp_prefs_box_add_page (GimpPrefsBox *box,
|
||||||
const gchar *icon_name,
|
const gchar *icon_name,
|
||||||
const gchar *notebook_label,
|
const gchar *page_title,
|
||||||
const gchar *tree_label,
|
const gchar *tree_label,
|
||||||
const gchar *help_id,
|
const gchar *help_id,
|
||||||
GtkTreeIter *parent,
|
GtkTreeIter *parent,
|
||||||
@ -352,15 +376,68 @@ gimp_prefs_box_add_page (GimpPrefsBox *box,
|
|||||||
COLUMN_TREE_ICON_NAME, icon_name,
|
COLUMN_TREE_ICON_NAME, icon_name,
|
||||||
COLUMN_TREE_ICON_SIZE, private->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, icon_name,
|
COLUMN_PAGE_ICON_NAME, icon_name,
|
||||||
COLUMN_NOTEBOOK_ICON_SIZE, private->notebook_icon_size,
|
COLUMN_PAGE_ICON_SIZE, private->page_icon_size,
|
||||||
COLUMN_NOTEBOOK_LABEL , notebook_label,
|
COLUMN_PAGE_TITLE , page_title,
|
||||||
|
COLUMN_PAGE_HELP_ID, help_id,
|
||||||
COLUMN_PAGE_INDEX, private->page_index++,
|
COLUMN_PAGE_INDEX, private->page_index++,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
gimp_prefs_box_get_current_icon_name (GimpPrefsBox *box)
|
||||||
|
{
|
||||||
|
GimpPrefsBoxPrivate *private = GET_PRIVATE (box);
|
||||||
|
GtkTreeSelection *sel;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_PREFS_BOX (box), NULL);
|
||||||
|
|
||||||
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (private->tree_view));
|
||||||
|
|
||||||
|
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
||||||
|
{
|
||||||
|
g_clear_pointer (&private->page_icon_name, g_free);
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter,
|
||||||
|
COLUMN_PAGE_ICON_NAME, &private->page_icon_name,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
return private->page_icon_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
gimp_prefs_box_get_current_help_id (GimpPrefsBox *box)
|
||||||
|
{
|
||||||
|
GimpPrefsBoxPrivate *private = GET_PRIVATE (box);
|
||||||
|
GtkTreeSelection *sel;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_PREFS_BOX (box), NULL);
|
||||||
|
|
||||||
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (private->tree_view));
|
||||||
|
|
||||||
|
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
||||||
|
{
|
||||||
|
g_clear_pointer (&private->page_help_id, g_free);
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter,
|
||||||
|
COLUMN_PAGE_HELP_ID, &private->page_help_id,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
return private->page_help_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_prefs_box_set_page_scrollable (GimpPrefsBox *box,
|
gimp_prefs_box_set_page_scrollable (GimpPrefsBox *box,
|
||||||
GtkWidget *page,
|
GtkWidget *page,
|
||||||
@ -429,19 +506,3 @@ gimp_prefs_box_get_tree_view (GimpPrefsBox *box)
|
|||||||
|
|
||||||
return GET_PRIVATE (box)->tree_view;
|
return GET_PRIVATE (box)->tree_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gimp_prefs_box_get_notebook (GimpPrefsBox *box)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GIMP_IS_PREFS_BOX (box), NULL);
|
|
||||||
|
|
||||||
return GET_PRIVATE (box)->notebook;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gimp_prefs_box_get_image (GimpPrefsBox *box)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GIMP_IS_PREFS_BOX (box), NULL);
|
|
||||||
|
|
||||||
return GET_PRIVATE (box)->image;
|
|
||||||
}
|
|
||||||
|
@ -30,11 +30,14 @@
|
|||||||
#define GIMP_PREFS_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PREFS_BOX, GimpPrefsBoxClass))
|
#define GIMP_PREFS_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PREFS_BOX, GimpPrefsBoxClass))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpPrefsBoxPrivate GimpPrefsBoxPrivate;
|
||||||
typedef struct _GimpPrefsBoxClass GimpPrefsBoxClass;
|
typedef struct _GimpPrefsBoxClass GimpPrefsBoxClass;
|
||||||
|
|
||||||
struct _GimpPrefsBox
|
struct _GimpPrefsBox
|
||||||
{
|
{
|
||||||
GtkBox parent_instance;
|
GtkBox parent_instance;
|
||||||
|
|
||||||
|
GimpPrefsBoxPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpPrefsBoxClass
|
struct _GimpPrefsBoxClass
|
||||||
@ -55,6 +58,9 @@ GtkWidget * gimp_prefs_box_add_page (GimpPrefsBox *box,
|
|||||||
GtkTreeIter *parent,
|
GtkTreeIter *parent,
|
||||||
GtkTreeIter *iter);
|
GtkTreeIter *iter);
|
||||||
|
|
||||||
|
const gchar * gimp_prefs_box_get_current_icon_name (GimpPrefsBox *box);
|
||||||
|
const gchar * gimp_prefs_box_get_current_help_id (GimpPrefsBox *box);
|
||||||
|
|
||||||
void gimp_prefs_box_set_page_scrollable (GimpPrefsBox *box,
|
void gimp_prefs_box_set_page_scrollable (GimpPrefsBox *box,
|
||||||
GtkWidget *page,
|
GtkWidget *page,
|
||||||
gboolean scrollable);
|
gboolean scrollable);
|
||||||
@ -63,8 +69,6 @@ GtkWidget * gimp_prefs_box_set_page_resettable (GimpPrefsBox *box,
|
|||||||
const gchar *label);
|
const gchar *label);
|
||||||
|
|
||||||
GtkWidget * gimp_prefs_box_get_tree_view (GimpPrefsBox *box);
|
GtkWidget * gimp_prefs_box_get_tree_view (GimpPrefsBox *box);
|
||||||
GtkWidget * gimp_prefs_box_get_notebook (GimpPrefsBox *box);
|
|
||||||
GtkWidget * gimp_prefs_box_get_image (GimpPrefsBox *box);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_PREFS_BOX_H__ */
|
#endif /* __GIMP_PREFS_BOX_H__ */
|
||||||
|
Reference in New Issue
Block a user