app: some random cleanups in widgets

This commit is contained in:
Michael Natterer 2025-05-29 17:01:08 +02:00
parent 3b60a1e01d
commit 624a62d489
8 changed files with 132 additions and 156 deletions

View file

@ -97,38 +97,39 @@ gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass)
GimpContainerTreeViewClass *view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass);
GimpItemTreeViewClass *iv_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
object_class->constructed = gimp_channel_tree_view_constructed;
object_class->constructed = gimp_channel_tree_view_constructed;
view_class->drop_viewables = gimp_channel_tree_view_drop_viewables;
view_class->drop_component = gimp_channel_tree_view_drop_component;
view_class->drop_viewables = gimp_channel_tree_view_drop_viewables;
view_class->drop_component = gimp_channel_tree_view_drop_component;
iv_class->set_image = gimp_channel_tree_view_set_image;
iv_class->item_type = GIMP_TYPE_CHANNEL;
iv_class->signal_name = "selected-channels-changed";
iv_class->get_container = gimp_image_get_channels;
iv_class->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_channels;
iv_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_channels;
iv_class->add_item = (GimpAddItemFunc) gimp_image_add_channel;
iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_channel;
iv_class->new_item = gimp_channel_tree_view_item_new;
iv_class->action_group = "channels";
iv_class->activate_action = "channels-edit-attributes";
iv_class->new_action = "channels-new";
iv_class->new_default_action = "channels-new-last-values";
iv_class->raise_action = "channels-raise";
iv_class->raise_top_action = "channels-raise-to-top";
iv_class->lower_action = "channels-lower";
iv_class->lower_bottom_action = "channels-lower-to-bottom";
iv_class->duplicate_action = "channels-duplicate";
iv_class->delete_action = "channels-delete";
iv_class->move_cursor_up_action = "channels-select-previous";
iv_class->move_cursor_down_action = "channels-select-next";
iv_class->move_cursor_start_action = "channels-select-top";
iv_class->move_cursor_end_action = "channels-select-bottom";
iv_class->set_image = gimp_channel_tree_view_set_image;
iv_class->item_type = GIMP_TYPE_CHANNEL;
iv_class->signal_name = "selected-channels-changed";
iv_class->get_container = gimp_image_get_channels;
iv_class->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_channels;
iv_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_channels;
iv_class->add_item = (GimpAddItemFunc) gimp_image_add_channel;
iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_channel;
iv_class->new_item = gimp_channel_tree_view_item_new;
iv_class->action_group = "channels";
iv_class->activate_action = "channels-edit-attributes";
iv_class->new_action = "channels-new";
iv_class->new_default_action = "channels-new-last-values";
iv_class->raise_action = "channels-raise";
iv_class->raise_top_action = "channels-raise-to-top";
iv_class->lower_action = "channels-lower";
iv_class->lower_bottom_action = "channels-lower-to-bottom";
iv_class->duplicate_action = "channels-duplicate";
iv_class->delete_action = "channels-delete";
iv_class->lock_content_help_id = GIMP_HELP_CHANNEL_LOCK_PIXELS;
iv_class->lock_position_help_id = GIMP_HELP_CHANNEL_LOCK_POSITION;
iv_class->lock_visibility_help_id = GIMP_HELP_CHANNEL_LOCK_VISIBILITY;

View file

@ -111,11 +111,7 @@ gimp_color_panel_dispose (GObject *object)
{
GimpColorPanel *panel = GIMP_COLOR_PANEL (object);
if (panel->color_dialog)
{
gtk_widget_destroy (panel->color_dialog);
panel->color_dialog = NULL;
}
g_clear_pointer (&panel->color_dialog, gtk_widget_destroy);
G_OBJECT_CLASS (parent_class)->dispose (object);
}

View file

@ -188,11 +188,7 @@ gimp_dialog_factory_dispose (GObject *object)
}
}
if (factory->p->open_dialogs)
{
g_list_free (factory->p->open_dialogs);
factory->p->open_dialogs = NULL;
}
g_clear_pointer (&factory->p->open_dialogs, g_list_free);
if (factory->p->session_infos)
{
@ -223,11 +219,7 @@ gimp_dialog_factory_finalize (GObject *object)
g_slice_free (GimpDialogFactoryEntry, entry);
}
if (factory->p->registered_dialogs)
{
g_list_free (factory->p->registered_dialogs);
factory->p->registered_dialogs = NULL;
}
g_clear_pointer (&factory->p->registered_dialogs, g_list_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View file

@ -453,11 +453,7 @@ gimp_drawable_tree_view_dispose (GObject *object)
{
GimpDrawableTreeView *view = GIMP_DRAWABLE_TREE_VIEW (object);
if (view->priv->effects_popover)
{
gtk_widget_destroy (view->priv->effects_popover);
view->priv->effects_popover = NULL;
}
g_clear_pointer (&view->priv->effects_popover, gtk_widget_destroy);
view->priv->effects_drawable = NULL;
view->priv->effects_filter = NULL;

View file

@ -320,35 +320,42 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
G_TYPE_NONE, 1,
GIMP_TYPE_OBJECT);
object_class->constructed = gimp_item_tree_view_constructed;
object_class->dispose = gimp_item_tree_view_dispose;
object_class->constructed = gimp_item_tree_view_constructed;
object_class->dispose = gimp_item_tree_view_dispose;
widget_class->style_updated = gimp_item_tree_view_style_updated;
widget_class->style_updated = gimp_item_tree_view_style_updated;
tree_view_class->drop_possible = gimp_item_tree_view_drop_possible;
tree_view_class->drop_viewables = gimp_item_tree_view_drop_viewables;
klass->set_image = gimp_item_tree_view_real_set_image;
klass->set_image = gimp_item_tree_view_real_set_image;
klass->item_type = G_TYPE_NONE;
klass->signal_name = NULL;
klass->item_type = G_TYPE_NONE;
klass->signal_name = NULL;
klass->get_container = NULL;
klass->get_selected_items = NULL;
klass->set_selected_items = NULL;
klass->add_item = NULL;
klass->remove_item = NULL;
klass->new_item = NULL;
klass->get_container = NULL;
klass->get_selected_items = NULL;
klass->set_selected_items = NULL;
klass->add_item = NULL;
klass->remove_item = NULL;
klass->new_item = NULL;
klass->action_group = NULL;
klass->new_action = NULL;
klass->new_default_action = NULL;
klass->raise_action = NULL;
klass->raise_top_action = NULL;
klass->lower_action = NULL;
klass->lower_bottom_action = NULL;
klass->duplicate_action = NULL;
klass->delete_action = NULL;
klass->action_group = NULL;
klass->new_action = NULL;
klass->new_default_action = NULL;
klass->raise_action = NULL;
klass->raise_top_action = NULL;
klass->lower_action = NULL;
klass->lower_bottom_action = NULL;
klass->duplicate_action = NULL;
klass->delete_action = NULL;
klass->move_cursor_up_action = NULL;
klass->move_cursor_down_action = NULL;
klass->move_cursor_up_flat_action = NULL;
klass->move_cursor_down_flat_action = NULL;
klass->move_cursor_start_action = NULL;
klass->move_cursor_end_action = NULL;
klass->lock_content_icon_name = NULL;
klass->lock_content_tooltip = NULL;
@ -361,13 +368,6 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
klass->lock_visibility_icon_name = NULL;
klass->lock_visibility_tooltip = NULL;
klass->lock_visibility_help_id = NULL;
klass->move_cursor_up_action = NULL;
klass->move_cursor_down_action = NULL;
klass->move_cursor_up_flat_action = NULL;
klass->move_cursor_down_flat_action = NULL;
klass->move_cursor_start_action = NULL;
klass->move_cursor_end_action = NULL;
}
static void
@ -701,22 +701,12 @@ gimp_item_tree_view_dispose (GObject *object)
if (view->priv->image)
gimp_item_tree_view_set_image (view, NULL);
if (view->priv->lock_popover)
{
gtk_widget_destroy (view->priv->lock_popover);
view->priv->lock_popover = NULL;
}
if (view->priv->lock_box_path)
{
gtk_tree_path_free (view->priv->lock_box_path);
view->priv->lock_box_path = NULL;
}
g_clear_pointer (&view->priv->lock_popover, gtk_widget_destroy);
g_clear_pointer (&view->priv->lock_box_path, gtk_tree_path_free);
if (view->priv->locks)
{
g_list_free_full (view->priv->locks,
(GDestroyNotify) g_free);
g_list_free_full (view->priv->locks, g_free);
view->priv->locks = NULL;
}

View file

@ -103,6 +103,13 @@ struct _GimpItemTreeViewClass
const gchar *duplicate_action;
const gchar *delete_action;
const gchar *move_cursor_up_action;
const gchar *move_cursor_down_action;
const gchar *move_cursor_up_flat_action;
const gchar *move_cursor_down_flat_action;
const gchar *move_cursor_start_action;
const gchar *move_cursor_end_action;
/* lock content button appearance */
const gchar *lock_content_icon_name;
const gchar *lock_content_tooltip;
@ -117,14 +124,6 @@ struct _GimpItemTreeViewClass
const gchar *lock_visibility_icon_name;
const gchar *lock_visibility_tooltip;
const gchar *lock_visibility_help_id;
/* cursor actions */
const gchar *move_cursor_up_action;
const gchar *move_cursor_down_action;
const gchar *move_cursor_up_flat_action;
const gchar *move_cursor_down_flat_action;
const gchar *move_cursor_start_action;
const gchar *move_cursor_end_action;
};

View file

@ -197,14 +197,36 @@ gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass)
tree_view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass);
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
object_class->constructed = gimp_layer_tree_view_constructed;
object_class->finalize = gimp_layer_tree_view_finalize;
object_class->constructed = gimp_layer_tree_view_constructed;
object_class->finalize = gimp_layer_tree_view_finalize;
tree_view_class->drop_possible = gimp_layer_tree_view_drop_possible;
tree_view_class->drop_color = gimp_layer_tree_view_drop_color;
tree_view_class->drop_uri_list = gimp_layer_tree_view_drop_uri_list;
tree_view_class->drop_component = gimp_layer_tree_view_drop_component;
tree_view_class->drop_pixbuf = gimp_layer_tree_view_drop_pixbuf;
tree_view_class->drop_possible = gimp_layer_tree_view_drop_possible;
tree_view_class->drop_color = gimp_layer_tree_view_drop_color;
tree_view_class->drop_uri_list = gimp_layer_tree_view_drop_uri_list;
tree_view_class->drop_component = gimp_layer_tree_view_drop_component;
tree_view_class->drop_pixbuf = gimp_layer_tree_view_drop_pixbuf;
item_view_class->item_type = GIMP_TYPE_LAYER;
item_view_class->signal_name = "selected-layers-changed";
item_view_class->set_image = gimp_layer_tree_view_set_image;
item_view_class->get_container = gimp_image_get_layers;
item_view_class->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_layers;
item_view_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_layers;
item_view_class->add_item = (GimpAddItemFunc) gimp_image_add_layer;
item_view_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_layer;
item_view_class->new_item = gimp_layer_tree_view_item_new;
item_view_class->action_group = "layers";
item_view_class->activate_action = "layers-edit";
item_view_class->new_action = "layers-new";
item_view_class->new_default_action = "layers-new-last-values";
item_view_class->raise_action = "layers-raise";
item_view_class->raise_top_action = "layers-raise-to-top";
item_view_class->lower_action = "layers-lower";
item_view_class->lower_bottom_action = "layers-lower-to-bottom";
item_view_class->duplicate_action = "layers-duplicate";
item_view_class->delete_action = "layers-delete";
item_view_class->move_cursor_up_action = "layers-select-previous";
item_view_class->move_cursor_down_action = "layers-select-next";
@ -213,27 +235,6 @@ gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass)
item_view_class->move_cursor_start_action = "layers-select-top";
item_view_class->move_cursor_end_action = "layers-select-bottom";
item_view_class->item_type = GIMP_TYPE_LAYER;
item_view_class->signal_name = "selected-layers-changed";
item_view_class->set_image = gimp_layer_tree_view_set_image;
item_view_class->get_container = gimp_image_get_layers;
item_view_class->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_layers;
item_view_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_layers;
item_view_class->add_item = (GimpAddItemFunc) gimp_image_add_layer;
item_view_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_layer;
item_view_class->new_item = gimp_layer_tree_view_item_new;
item_view_class->action_group = "layers";
item_view_class->activate_action = "layers-edit";
item_view_class->new_action = "layers-new";
item_view_class->new_default_action = "layers-new-last-values";
item_view_class->raise_action = "layers-raise";
item_view_class->raise_top_action = "layers-raise-to-top";
item_view_class->lower_action = "layers-lower";
item_view_class->lower_bottom_action = "layers-lower-to-bottom";
item_view_class->duplicate_action = "layers-duplicate";
item_view_class->delete_action = "layers-delete";
item_view_class->lock_content_help_id = GIMP_HELP_LAYER_LOCK_PIXELS;
item_view_class->lock_position_help_id = GIMP_HELP_LAYER_LOCK_POSITION;
item_view_class->lock_visibility_help_id = GIMP_HELP_LAYER_LOCK_VISIBILITY;

View file

@ -81,46 +81,47 @@ gimp_path_tree_view_class_init (GimpPathTreeViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpContainerTreeViewClass *view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass);
GimpItemTreeViewClass *iv_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
GimpItemTreeViewClass *pv_vlass = GIMP_ITEM_TREE_VIEW_CLASS (klass);
object_class->constructed = gimp_path_tree_view_constructed;
object_class->constructed = gimp_path_tree_view_constructed;
view_class->drop_svg = gimp_path_tree_view_drop_svg;
view_class->drop_svg = gimp_path_tree_view_drop_svg;
iv_class->move_cursor_up_action = "paths-select-previous";
iv_class->move_cursor_down_action = "paths-select-next";
iv_class->move_cursor_start_action = "paths-select-top";
iv_class->move_cursor_end_action = "paths-select-bottom";
pv_vlass->item_type = GIMP_TYPE_PATH;
pv_vlass->signal_name = "selected-paths-changed";
iv_class->item_type = GIMP_TYPE_PATH;
iv_class->signal_name = "selected-paths-changed";
pv_vlass->get_container = gimp_image_get_paths;
pv_vlass->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_paths;
pv_vlass->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_paths;
pv_vlass->add_item = (GimpAddItemFunc) gimp_image_add_path;
pv_vlass->remove_item = (GimpRemoveItemFunc) gimp_image_remove_path;
pv_vlass->new_item = gimp_path_tree_view_item_new;
iv_class->get_container = gimp_image_get_paths;
iv_class->get_selected_items = (GimpGetItemsFunc) gimp_image_get_selected_paths;
iv_class->set_selected_items = (GimpSetItemsFunc) gimp_image_set_selected_paths;
iv_class->add_item = (GimpAddItemFunc) gimp_image_add_path;
iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_path;
iv_class->new_item = gimp_path_tree_view_item_new;
pv_vlass->action_group = "paths";
pv_vlass->activate_action = "paths-edit";
pv_vlass->new_action = "paths-new";
pv_vlass->new_default_action = "paths-new-last-values";
pv_vlass->raise_action = "paths-raise";
pv_vlass->raise_top_action = "paths-raise-to-top";
pv_vlass->lower_action = "paths-lower";
pv_vlass->lower_bottom_action = "paths-lower-to-bottom";
pv_vlass->duplicate_action = "paths-duplicate";
pv_vlass->delete_action = "paths-delete";
iv_class->action_group = "paths";
iv_class->activate_action = "paths-edit";
iv_class->new_action = "paths-new";
iv_class->new_default_action = "paths-new-last-values";
iv_class->raise_action = "paths-raise";
iv_class->raise_top_action = "paths-raise-to-top";
iv_class->lower_action = "paths-lower";
iv_class->lower_bottom_action = "paths-lower-to-bottom";
iv_class->duplicate_action = "paths-duplicate";
iv_class->delete_action = "paths-delete";
iv_class->lock_content_icon_name = GIMP_ICON_LOCK_PATH;
iv_class->lock_content_tooltip = _("Lock path");
iv_class->lock_content_help_id = GIMP_HELP_PATH_LOCK_STROKES;
iv_class->lock_position_icon_name = GIMP_ICON_LOCK_POSITION;
iv_class->lock_position_tooltip = _("Lock path position");
iv_class->lock_position_help_id = GIMP_HELP_PATH_LOCK_POSITION;
iv_class->lock_visibility_icon_name = GIMP_ICON_LOCK_VISIBILITY;
iv_class->lock_visibility_tooltip = _("Lock path visibility");
iv_class->lock_position_help_id = GIMP_HELP_PATH_LOCK_VISIBILITY;
pv_vlass->move_cursor_up_action = "paths-select-previous";
pv_vlass->move_cursor_down_action = "paths-select-next";
pv_vlass->move_cursor_start_action = "paths-select-top";
pv_vlass->move_cursor_end_action = "paths-select-bottom";
pv_vlass->lock_content_icon_name = GIMP_ICON_LOCK_PATH;
pv_vlass->lock_content_tooltip = _("Lock path");
pv_vlass->lock_content_help_id = GIMP_HELP_PATH_LOCK_STROKES;
pv_vlass->lock_position_icon_name = GIMP_ICON_LOCK_POSITION;
pv_vlass->lock_position_tooltip = _("Lock path position");
pv_vlass->lock_position_help_id = GIMP_HELP_PATH_LOCK_POSITION;
pv_vlass->lock_visibility_icon_name = GIMP_ICON_LOCK_VISIBILITY;
pv_vlass->lock_visibility_tooltip = _("Lock path visibility");
pv_vlass->lock_position_help_id = GIMP_HELP_PATH_LOCK_VISIBILITY;
}
static void