mirror of https://github.com/GNOME/gimp.git
app: move all GimpToolPresetEditor members to a private struct
This commit is contained in:
parent
6699ed185c
commit
313430b738
|
@ -37,6 +37,15 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
struct _GimpToolPresetEditorPrivate
|
||||
{
|
||||
GimpToolPreset *tool_preset_model;
|
||||
|
||||
GtkWidget *tool_icon;
|
||||
GtkWidget *tool_label;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_tool_preset_editor_constructed (GObject *object);
|
||||
|
@ -73,11 +82,16 @@ gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
|
|||
|
||||
editor_class->set_data = gimp_tool_preset_editor_set_data;
|
||||
editor_class->title = _("Tool Preset Editor");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GimpToolPresetEditorPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_tool_preset_editor_init (GimpToolPresetEditor *editor)
|
||||
{
|
||||
editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor,
|
||||
GIMP_TYPE_TOOL_PRESET_EDITOR,
|
||||
GimpToolPresetEditorPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -93,7 +107,7 @@ gimp_tool_preset_editor_constructed (GObject *object)
|
|||
if (G_OBJECT_CLASS (parent_class)->constructed)
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
preset = editor->tool_preset_model =
|
||||
preset = editor->priv->tool_preset_model =
|
||||
g_object_new (GIMP_TYPE_TOOL_PRESET,
|
||||
"gimp", data_editor->context->gimp,
|
||||
NULL);
|
||||
|
@ -106,18 +120,18 @@ gimp_tool_preset_editor_constructed (GObject *object)
|
|||
gtk_box_pack_start (GTK_BOX (data_editor), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
editor->tool_icon = gtk_image_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), editor->tool_icon,
|
||||
editor->priv->tool_icon = gtk_image_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), editor->priv->tool_icon,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (editor->tool_icon);
|
||||
gtk_widget_show (editor->priv->tool_icon);
|
||||
|
||||
editor->tool_label = gtk_label_new ("");
|
||||
gimp_label_set_attributes (GTK_LABEL (editor->tool_label),
|
||||
editor->priv->tool_label = gtk_label_new ("");
|
||||
gimp_label_set_attributes (GTK_LABEL (editor->priv->tool_label),
|
||||
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
||||
-1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), editor->tool_label,
|
||||
gtk_box_pack_start (GTK_BOX (hbox), editor->priv->tool_label,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (editor->tool_label);
|
||||
gtk_widget_show (editor->priv->tool_label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||
gtk_box_pack_start (GTK_BOX (data_editor), hbox, FALSE, FALSE, 0);
|
||||
|
@ -176,10 +190,10 @@ gimp_tool_preset_editor_finalize (GObject *object)
|
|||
{
|
||||
GimpToolPresetEditor *editor = GIMP_TOOL_PRESET_EDITOR (object);
|
||||
|
||||
if (editor->tool_preset_model)
|
||||
if (editor->priv->tool_preset_model)
|
||||
{
|
||||
g_object_unref (editor->tool_preset_model);
|
||||
editor->tool_preset_model = NULL;
|
||||
g_object_unref (editor->priv->tool_preset_model);
|
||||
editor->priv->tool_preset_model = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
|
@ -204,7 +218,7 @@ gimp_tool_preset_editor_set_data (GimpDataEditor *editor,
|
|||
G_CALLBACK (gimp_tool_preset_editor_notify_data),
|
||||
editor);
|
||||
|
||||
if (preset_editor->tool_preset_model)
|
||||
if (preset_editor->priv->tool_preset_model)
|
||||
gimp_tool_preset_editor_sync_data (preset_editor);
|
||||
}
|
||||
}
|
||||
|
@ -240,26 +254,26 @@ gimp_tool_preset_editor_sync_data (GimpToolPresetEditor *editor)
|
|||
const gchar *stock_id;
|
||||
gchar *label;
|
||||
|
||||
g_signal_handlers_block_by_func (editor->tool_preset_model,
|
||||
g_signal_handlers_block_by_func (editor->priv->tool_preset_model,
|
||||
gimp_tool_preset_editor_notify_model,
|
||||
editor);
|
||||
|
||||
gimp_config_copy (GIMP_CONFIG (data_editor->data),
|
||||
GIMP_CONFIG (editor->tool_preset_model),
|
||||
GIMP_CONFIG (editor->priv->tool_preset_model),
|
||||
GIMP_CONFIG_PARAM_SERIALIZE);
|
||||
|
||||
g_signal_handlers_unblock_by_func (editor->tool_preset_model,
|
||||
g_signal_handlers_unblock_by_func (editor->priv->tool_preset_model,
|
||||
gimp_tool_preset_editor_notify_model,
|
||||
editor);
|
||||
|
||||
tool_info = editor->tool_preset_model->tool_options->tool_info;
|
||||
tool_info = editor->priv->tool_preset_model->tool_options->tool_info;
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
|
||||
label = g_strdup_printf (_("%s Preset"), tool_info->blurb);
|
||||
|
||||
gtk_image_set_from_stock (GTK_IMAGE (editor->tool_icon),
|
||||
gtk_image_set_from_stock (GTK_IMAGE (editor->priv->tool_icon),
|
||||
stock_id, GTK_ICON_SIZE_MENU);
|
||||
gtk_label_set_text (GTK_LABEL (editor->tool_label), label);
|
||||
gtk_label_set_text (GTK_LABEL (editor->priv->tool_label), label);
|
||||
|
||||
g_free (label);
|
||||
}
|
||||
|
@ -277,7 +291,7 @@ gimp_tool_preset_editor_notify_model (GimpToolPreset *options,
|
|||
gimp_tool_preset_editor_notify_data,
|
||||
editor);
|
||||
|
||||
gimp_config_copy (GIMP_CONFIG (editor->tool_preset_model),
|
||||
gimp_config_copy (GIMP_CONFIG (editor->priv->tool_preset_model),
|
||||
GIMP_CONFIG (data_editor->data),
|
||||
GIMP_CONFIG_PARAM_SERIALIZE);
|
||||
|
||||
|
@ -294,15 +308,15 @@ gimp_tool_preset_editor_notify_data (GimpToolPreset *options,
|
|||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
|
||||
g_signal_handlers_block_by_func (editor->tool_preset_model,
|
||||
g_signal_handlers_block_by_func (editor->priv->tool_preset_model,
|
||||
gimp_tool_preset_editor_notify_model,
|
||||
editor);
|
||||
|
||||
gimp_config_copy (GIMP_CONFIG (data_editor->data),
|
||||
GIMP_CONFIG (editor->tool_preset_model),
|
||||
GIMP_CONFIG (editor->priv->tool_preset_model),
|
||||
GIMP_CONFIG_PARAM_SERIALIZE);
|
||||
|
||||
g_signal_handlers_unblock_by_func (editor->tool_preset_model,
|
||||
g_signal_handlers_unblock_by_func (editor->priv->tool_preset_model,
|
||||
gimp_tool_preset_editor_notify_model,
|
||||
editor);
|
||||
}
|
||||
|
|
|
@ -30,16 +30,14 @@
|
|||
#define GIMP_TOOL_PRESET_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TOOL_PRESET_EDITOR, GimpToolPresetEditorClass))
|
||||
|
||||
|
||||
typedef struct _GimpToolPresetEditorClass GimpToolPresetEditorClass;
|
||||
typedef struct _GimpToolPresetEditorPrivate GimpToolPresetEditorPrivate;
|
||||
typedef struct _GimpToolPresetEditorClass GimpToolPresetEditorClass;
|
||||
|
||||
struct _GimpToolPresetEditor
|
||||
{
|
||||
GimpDataEditor parent_instance;
|
||||
GimpDataEditor parent_instance;
|
||||
|
||||
GimpToolPreset *tool_preset_model;
|
||||
|
||||
GtkWidget *tool_icon;
|
||||
GtkWidget *tool_label;
|
||||
GimpToolPresetEditorPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GimpToolPresetEditorClass
|
||||
|
|
Loading…
Reference in New Issue