Commit 91195e85 authored by Michael Natterer's avatar Michael Natterer

app: remove the old tool presets system

Instead, keep around a GimpFilteredContainer in GimpToolInfo that
maintains a per-tool list of presets from the global preset factory.
Turn the tool options dialog's preset Save/Restore/Edit/Delete menus
and buttons into shortcuts for managing the active tool's presets.
parent f3a99ed8
......@@ -42,7 +42,6 @@
static void tool_options_actions_update_presets (GimpActionGroup *group,
const gchar *action_prefix,
GCallback callback,
const gchar *stock_id,
const gchar *help_id,
GimpContainer *presets);
......@@ -55,25 +54,25 @@ static const GimpActionEntry tool_options_actions[] =
NC_("tool-options-action", "Tool Options Menu"), NULL, NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_DIALOG },
{ "tool-options-save-menu", GTK_STOCK_SAVE,
NC_("tool-options-action", "_Save Options To"), "", NULL, NULL,
{ "tool-options-save-preset-menu", GTK_STOCK_SAVE,
NC_("tool-options-action", "_Save Tool Preset"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_SAVE },
{ "tool-options-restore-menu", GTK_STOCK_REVERT_TO_SAVED,
NC_("tool-options-action", "_Restore Options From"), "", NULL, NULL,
{ "tool-options-restore-preset-menu", GTK_STOCK_REVERT_TO_SAVED,
NC_("tool-options-action", "_Restore Tool Preset"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_RESTORE },
{ "tool-options-rename-menu", GTK_STOCK_EDIT,
NC_("tool-options-action", "Re_name Saved Options"), NULL, NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_RENAME },
{ "tool-options-edit-preset-menu", GTK_STOCK_EDIT,
NC_("tool-options-action", "E_dit Tool Preset"), NULL, NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_EDIT },
{ "tool-options-delete-menu", GTK_STOCK_DELETE,
NC_("tool-options-action", "_Delete Saved Options"), "", NULL, NULL,
{ "tool-options-delete-preset-menu", GTK_STOCK_DELETE,
NC_("tool-options-action", "_Delete Tool Preset"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_DELETE },
{ "tool-options-save-new", GTK_STOCK_NEW,
NC_("tool-options-action", "_New Entry..."), "", NULL,
G_CALLBACK (tool_options_save_new_cmd_callback),
{ "tool-options-save-new-preset", GTK_STOCK_NEW,
NC_("tool-options-action", "_New Tool Preset..."), "", NULL,
G_CALLBACK (tool_options_save_new_preset_cmd_callback),
GIMP_HELP_TOOL_OPTIONS_SAVE },
{ "tool-options-reset", GIMP_STOCK_RESET,
......@@ -104,9 +103,9 @@ tool_options_actions_setup (GimpActionGroup *group)
tool_options_actions,
G_N_ELEMENTS (tool_options_actions));
SET_HIDE_EMPTY ("tool-options-restore-menu", FALSE);
SET_HIDE_EMPTY ("tool-options-rename-menu", FALSE);
SET_HIDE_EMPTY ("tool-options-delete-menu", FALSE);
SET_HIDE_EMPTY ("tool-options-restore-preset-menu", FALSE);
SET_HIDE_EMPTY ("tool-options-edit-preset-menu", FALSE);
SET_HIDE_EMPTY ("tool-options-delete-preset-menu", FALSE);
}
void
......@@ -116,34 +115,30 @@ tool_options_actions_update (GimpActionGroup *group,
GimpContext *context = gimp_get_user_context (group->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
SET_VISIBLE ("tool-options-save-menu", tool_info->presets);
SET_VISIBLE ("tool-options-restore-menu", tool_info->presets);
SET_VISIBLE ("tool-options-rename-menu", tool_info->presets);
SET_VISIBLE ("tool-options-delete-menu", tool_info->presets);
SET_VISIBLE ("tool-options-save-preset-menu", tool_info->presets);
SET_VISIBLE ("tool-options-restore-preset-menu", tool_info->presets);
SET_VISIBLE ("tool-options-edit-preset-menu", tool_info->presets);
SET_VISIBLE ("tool-options-delete-preset-menu", tool_info->presets);
tool_options_actions_update_presets (group, "tool-options-save-",
G_CALLBACK (tool_options_save_to_cmd_callback),
GTK_STOCK_SAVE,
tool_options_actions_update_presets (group, "tool-options-save-preset",
G_CALLBACK (tool_options_save_preset_cmd_callback),
GIMP_HELP_TOOL_OPTIONS_SAVE,
GIMP_CONTAINER (tool_info->presets));
tool_info->presets);
tool_options_actions_update_presets (group, "tool-options-restore-",
G_CALLBACK (tool_options_restore_from_cmd_callback),
GTK_STOCK_REVERT_TO_SAVED,
tool_options_actions_update_presets (group, "tool-options-restore-preset",
G_CALLBACK (tool_options_restore_preset_cmd_callback),
GIMP_HELP_TOOL_OPTIONS_RESTORE,
GIMP_CONTAINER (tool_info->presets));
tool_info->presets);
tool_options_actions_update_presets (group, "tool-options-rename-",
G_CALLBACK (tool_options_rename_saved_cmd_callback),
GTK_STOCK_EDIT,
GIMP_HELP_TOOL_OPTIONS_RENAME,
GIMP_CONTAINER (tool_info->presets));
tool_options_actions_update_presets (group, "tool-options-edit-preset",
G_CALLBACK (tool_options_edit_preset_cmd_callback),
GIMP_HELP_TOOL_OPTIONS_EDIT,
tool_info->presets);
tool_options_actions_update_presets (group, "tool-options-delete-",
G_CALLBACK (tool_options_delete_saved_cmd_callback),
GTK_STOCK_DELETE,
tool_options_actions_update_presets (group, "tool-options-delete-preset",
G_CALLBACK (tool_options_delete_preset_cmd_callback),
GIMP_HELP_TOOL_OPTIONS_DELETE,
GIMP_CONTAINER (tool_info->presets));
tool_info->presets);
}
......@@ -153,7 +148,6 @@ static void
tool_options_actions_update_presets (GimpActionGroup *group,
const gchar *action_prefix,
GCallback callback,
const gchar *stock_id,
const gchar *help_id,
GimpContainer *presets)
{
......@@ -166,7 +160,7 @@ tool_options_actions_update_presets (GimpActionGroup *group,
gchar *action_name;
GtkAction *action;
action_name = g_strdup_printf ("%s%03d", action_prefix, i);
action_name = g_strdup_printf ("%s-%03d", action_prefix, i);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
g_free (action_name);
......@@ -185,7 +179,6 @@ tool_options_actions_update_presets (GimpActionGroup *group,
GimpEnumActionEntry entry;
entry.name = NULL;
entry.stock_id = stock_id;
entry.label = NULL;
entry.accelerator = "";
entry.tooltip = NULL;
......@@ -197,11 +190,12 @@ tool_options_actions_update_presets (GimpActionGroup *group,
list;
list = g_list_next (list), i++)
{
GimpToolOptions *options = list->data;
GimpObject *options = list->data;
entry.name = g_strdup_printf ("%s%03d", action_prefix, i);
entry.label = gimp_object_get_name (options);
entry.value = i;
entry.name = g_strdup_printf ("%s-%03d", action_prefix, i);
entry.label = gimp_object_get_name (options);
entry.stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (options));
entry.value = i;
gimp_action_group_add_enum_actions (group, NULL, &entry, 1, callback);
......
......@@ -27,10 +27,14 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimptoolinfo.h"
#include "core/gimptooloptions.h"
#include "core/gimptoolpresets.h"
#include "core/gimptoolpreset.h"
#include "widgets/gimpdataeditor.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpeditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
......@@ -45,123 +49,109 @@
/* local function prototypes */
static void tool_options_save_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void tool_options_rename_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void tool_options_show_preset_editor (GimpEditor *editor,
GimpToolPreset *preset);
/* public functions */
void
tool_options_save_new_cmd_callback (GtkAction *action,
gpointer data)
tool_options_save_new_preset_cmd_callback (GtkAction *action,
gpointer user_data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GtkWidget *dialog;
context = gimp_get_user_context (editor->ui_manager->gimp);
tool_info = gimp_context_get_tool (context);
dialog = gimp_query_string_box (_("Save Tool Options"),
gtk_widget_get_toplevel (GTK_WIDGET (editor)),
gimp_standard_help_func,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
_("Enter a name for the saved options"),
_("Saved Options"),
NULL, NULL,
tool_options_save_callback, tool_info);
gtk_widget_show (dialog);
GimpEditor *editor = GIMP_EDITOR (user_data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpData *data;
data = gimp_data_factory_data_new (context->gimp->tool_preset_factory,
context, _("Untitled"));
tool_options_show_preset_editor (editor, GIMP_TOOL_PRESET (data));
}
void
tool_options_save_to_cmd_callback (GtkAction *action,
gint value,
gpointer data)
tool_options_save_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolOptions *options;
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
options = gimp_tool_presets_get_options (tool_info->presets, value);
preset = (GimpToolPreset *)
gimp_container_get_child_by_index (tool_info->presets, value);
if (options)
if (preset)
{
gchar *name = g_strdup (gimp_object_get_name (options));
gimp_config_sync (G_OBJECT (tool_info->tool_options),
G_OBJECT (options),
GIMP_CONFIG_PARAM_SERIALIZE);
gimp_object_take_name (GIMP_OBJECT (options), name);
G_OBJECT (preset->tool_options), 0);
tool_options_show_preset_editor (editor, preset);
}
}
void
tool_options_restore_from_cmd_callback (GtkAction *action,
gint value,
gpointer data)
tool_options_restore_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolOptions *options;
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
options = gimp_tool_presets_get_options (tool_info->presets, value);
preset = (GimpToolPreset *)
gimp_container_get_child_by_index (tool_info->presets, value);
if (options)
gimp_config_sync (G_OBJECT (options),
G_OBJECT (tool_info->tool_options),
GIMP_CONFIG_PARAM_SERIALIZE);
if (preset)
{
if (gimp_context_get_tool_preset (context) != preset)
gimp_context_set_tool_preset (context, preset);
else
gimp_context_tool_preset_changed (context);
}
}
void
tool_options_rename_saved_cmd_callback (GtkAction *action,
gint value,
gpointer data)
tool_options_edit_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolOptions *options;
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
options = gimp_tool_presets_get_options (tool_info->presets, value);
preset = (GimpToolPreset *)
gimp_container_get_child_by_index (tool_info->presets, value);
if (options)
if (preset)
{
GtkWidget *dialog;
dialog = gimp_query_string_box (_("Rename Saved Tool Options"),
gtk_widget_get_toplevel (GTK_WIDGET (editor)),
gimp_standard_help_func,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
_("Enter a new name for the saved options"),
gimp_object_get_name (options),
NULL, NULL,
tool_options_rename_callback, options);
gtk_widget_show (dialog);
tool_options_show_preset_editor (editor, preset);
}
}
void
tool_options_delete_saved_cmd_callback (GtkAction *action,
gint value,
gpointer data)
tool_options_delete_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolOptions *options;
GimpEditor *editor = GIMP_EDITOR (data);
GimpContext *context = gimp_get_user_context (editor->ui_manager->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
GimpToolPreset *preset;
options = gimp_tool_presets_get_options (tool_info->presets, value);
preset = (GimpToolPreset *)
gimp_container_get_child_by_index (tool_info->presets, value);
if (options)
gimp_container_remove (GIMP_CONTAINER (tool_info->presets),
GIMP_OBJECT (options));
if (preset)
{
GimpDataFactory *preset_factory = context->gimp->tool_preset_factory;
gimp_container_remove (gimp_data_factory_get_container (preset_factory),
GIMP_OBJECT (preset));
}
}
void
......@@ -230,34 +220,16 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
/* private functions */
static void
tool_options_save_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
tool_options_show_preset_editor (GimpEditor *editor,
GimpToolPreset *preset)
{
GimpToolInfo *tool_info = GIMP_TOOL_INFO (data);
GimpConfig *copy;
copy = gimp_config_duplicate (GIMP_CONFIG (tool_info->tool_options));
if (name && strlen (name))
gimp_object_set_name (GIMP_OBJECT (copy), name);
else
gimp_object_set_static_name (GIMP_OBJECT (copy), _("Saved Options"));
GtkWidget *dockable;
gimp_container_insert (GIMP_CONTAINER (tool_info->presets),
GIMP_OBJECT (copy), -1);
g_object_unref (copy);
}
static void
tool_options_rename_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
dockable =
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (GTK_WIDGET (editor)),
"gimp-tool-preset-editor", -1);
if (name && strlen (name))
gimp_object_set_name (GIMP_OBJECT (options), name);
else
gimp_object_set_static_name (GIMP_OBJECT (options), _("Saved Options"));
gimp_data_editor_set_data (GIMP_DATA_EDITOR (gtk_bin_get_child (GTK_BIN (dockable))),
GIMP_DATA (preset));
}
......@@ -19,26 +19,26 @@
#define __TOOL_OPTIONS_COMMANDS_H__
void tool_options_save_new_cmd_callback (GtkAction *action,
gpointer data);
void tool_options_save_new_preset_cmd_callback (GtkAction *action,
gpointer data);
void tool_options_save_to_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_restore_from_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_rename_saved_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_delete_saved_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_save_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_restore_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_edit_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_delete_preset_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void tool_options_reset_cmd_callback (GtkAction *action,
gpointer data);
void tool_options_reset_all_cmd_callback (GtkAction *action,
gpointer data);
void tool_options_reset_cmd_callback (GtkAction *action,
gpointer data);
void tool_options_reset_all_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __TOOL_OPTIONS_COMMANDS_H__ */
......@@ -367,8 +367,6 @@ libappcore_a_sources = \
gimptoolpreset-load.h \
gimptoolpreset-save.c \
gimptoolpreset-save.h \
gimptoolpresets.c \
gimptoolpresets.h \
gimptreehandler.c \
gimptreehandler.h \
gimpunit.c \
......
......@@ -73,7 +73,6 @@ typedef struct _GimpDrawableStack GimpDrawableStack;
typedef struct _GimpFilteredContainer GimpFilteredContainer;
typedef struct _GimpItemStack GimpItemStack;
typedef struct _GimpTaggedContainer GimpTaggedContainer;
typedef struct _GimpToolPresets GimpToolPresets;
/* not really a container */
......
......@@ -29,13 +29,12 @@
#include "base/temp-buf.h"
#include "gimp.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimpdatafactory.h"
#include "gimpfilteredcontainer.h"
#include "gimppaintinfo.h"
#include "gimptoolinfo.h"
#include "gimptooloptions.h"
#include "gimptoolpresets.h"
#include "gimptoolpreset.h"
enum
......@@ -214,6 +213,16 @@ gimp_tool_info_get_description (GimpViewable *viewable,
return g_strdup (tool_info->blurb);
}
static gboolean
gimp_tool_info_filter_preset (const GimpObject *object,
gpointer user_data)
{
GimpToolPreset *preset = GIMP_TOOL_PRESET (object);
GimpToolInfo *tool_info = user_data;
return preset->tool_options->tool_info == tool_info;
}
GimpToolInfo *
gimp_tool_info_new (Gimp *gimp,
GType tool_type,
......@@ -294,7 +303,14 @@ gimp_tool_info_new (Gimp *gimp,
if (tool_info->tool_options_type != GIMP_TYPE_TOOL_OPTIONS)
{
tool_info->presets = gimp_tool_presets_new (tool_info);
GimpContainer *presets;
presets = gimp_data_factory_get_container (gimp->tool_preset_factory);
tool_info->presets =
gimp_filtered_container_new (presets,
gimp_tool_info_filter_preset,
tool_info);
}
return tool_info;
......
......@@ -55,7 +55,7 @@ struct _GimpToolInfo
GimpToolOptions *tool_options;
GimpPaintInfo *paint_info;
GimpToolPresets *presets;
GimpContainer *presets;
};
struct _GimpToolInfoClass
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimptoolpresets.c
* Copyright (C) 2006 Sven Neumann <sven@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "gimp.h"
#include "gimpmarshal.h"
#include "gimptoolinfo.h"
#include "gimptooloptions.h"
#include "gimptoolpresets.h"
#include "gimp-intl.h"
enum
{
CHANGED,
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_TOOL_INFO
};
static void gimp_tool_presets_finalize (GObject *object);
static void gimp_tool_presets_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_tool_presets_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_tool_presets_add (GimpContainer *container,
GimpObject *object);
static void gimp_tool_presets_remove (GimpContainer *container,
GimpObject *object);
static void gimp_tool_presets_notify (GimpToolPresets *presets);
G_DEFINE_TYPE (GimpToolPresets, gimp_tool_presets, GIMP_TYPE_LIST)
#define parent_class gimp_tool_presets_parent_class
static guint gimp_tool_presets_signals[LAST_SIGNAL] = { 0 };
static void
gimp_tool_presets_class_init (GimpToolPresetsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpContainerClass *container_class = GIMP_CONTAINER_CLASS (klass);
gimp_tool_presets_signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpToolPresetsClass, changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->set_property = gimp_tool_presets_set_property;
object_class->get_property = gimp_tool_presets_get_property;
object_class->finalize = gimp_tool_presets_finalize;
container_class->add = gimp_tool_presets_add;
container_class->remove = gimp_tool_presets_remove;
klass->changed = NULL;
g_object_class_install_property (object_class, PROP_TOOL_INFO,
g_param_spec_object ("tool-info",
NULL, NULL,
GIMP_TYPE_TOOL_INFO,
G_PARAM_CONSTRUCT_ONLY |
GIMP_PARAM_READWRITE));
}
static void
gimp_tool_presets_init (GimpToolPresets *presets)
{
presets->tool_info = NULL;
}
static void
gimp_tool_presets_finalize (GObject *object)
{
GimpToolPresets *presets = GIMP_TOOL_PRESETS (object);
if (presets->tool_info)
{
g_object_unref (presets->tool_info);
presets->tool_info = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_tool_presets_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpToolPresets *presets = GIMP_TOOL_PRESETS (object);
switch (property_id)
{
case PROP_TOOL_INFO:
presets->tool_info = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_tool_presets_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpToolPresets *presets = GIMP_TOOL_PRESETS (object);
switch (property_id)
{
case PROP_TOOL_INFO:
g_value_set_object (value, presets->tool_info);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_tool_presets_add (GimpContainer *container,
GimpObject *object)
{
GIMP_CONTAINER_CLASS (parent_class)->add (container, object);
g_signal_connect_swapped (object, "notify",
G_CALLBACK (gimp_tool_presets_notify),
container);
g_signal_emit (container, gimp_tool_presets_signals[CHANGED], 0);
}
static void
gimp_tool_presets_remove (GimpContainer *container,
GimpObject *object)
{
g_signal_handlers_disconnect_by_func (object,
G_CALLBACK (gimp_tool_presets_notify),
container);
GIMP_CONTAINER_CLASS (parent_class)->remove (container, object);
g_signal_emit (container, gimp_tool_presets_signals[CHANGED], 0);
}
static void
gimp_tool_presets_notify (GimpToolPresets *presets)
{
g_signal_emit (presets, gimp_tool_presets_signals[CHANGED], 0);
}
GimpToolPresets *