mirror of https://github.com/GNOME/gimp.git
app: big porting of weak pointers to g_set,clear_weak_pointer()
This started as review of weak pointers, but using g_set_weak_pointer() and g_clear_weak_pointer() is almost always better, and shorter.
This commit is contained in:
parent
4789a31a15
commit
7ada432690
|
@ -110,8 +110,7 @@ error_console_save_cmd_callback (GimpAction *action,
|
||||||
|
|
||||||
console->save_selection = selection;
|
console->save_selection = selection;
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dialog),
|
g_set_weak_pointer (&console->file_dialog, dialog);
|
||||||
(gpointer) &console->file_dialog);
|
|
||||||
|
|
||||||
gtk_window_set_screen (GTK_WINDOW (dialog),
|
gtk_window_set_screen (GTK_WINDOW (dialog),
|
||||||
gtk_widget_get_screen (GTK_WIDGET (console)));
|
gtk_widget_get_screen (GTK_WIDGET (console)));
|
||||||
|
|
|
@ -1177,15 +1177,7 @@ image_convert_indexed_callback (GtkWidget *dialog,
|
||||||
"image-convert-indexed-dither-text-layers", dither_text_layers,
|
"image-convert-indexed-dither-text-layers", dither_text_layers,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (image_convert_indexed_custom_palette)
|
g_set_weak_pointer (&image_convert_indexed_custom_palette, custom_palette);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (image_convert_indexed_custom_palette),
|
|
||||||
(gpointer) &image_convert_indexed_custom_palette);
|
|
||||||
|
|
||||||
image_convert_indexed_custom_palette = custom_palette;
|
|
||||||
|
|
||||||
if (image_convert_indexed_custom_palette)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (image_convert_indexed_custom_palette),
|
|
||||||
(gpointer) &image_convert_indexed_custom_palette);
|
|
||||||
|
|
||||||
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
||||||
_("Converting to indexed colors"));
|
_("Converting to indexed colors"));
|
||||||
|
|
|
@ -77,8 +77,7 @@ text_editor_load_cmd_callback (GimpAction *action,
|
||||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dialog),
|
g_set_weak_pointer (&editor->file_dialog, dialog);
|
||||||
(gpointer) &editor->file_dialog);
|
|
||||||
|
|
||||||
g_signal_connect (dialog, "response",
|
g_signal_connect (dialog, "response",
|
||||||
G_CALLBACK (text_editor_load_response),
|
G_CALLBACK (text_editor_load_response),
|
||||||
|
|
|
@ -544,13 +544,11 @@ gimp_brush_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_brush)
|
if (! standard_brush)
|
||||||
{
|
{
|
||||||
standard_brush = gimp_brush_new (context, "Standard");
|
g_set_weak_pointer (&standard_brush,
|
||||||
|
gimp_brush_new (context, "Standard"));
|
||||||
|
|
||||||
gimp_data_clean (standard_brush);
|
gimp_data_clean (standard_brush);
|
||||||
gimp_data_make_internal (standard_brush, "gimp-brush-standard");
|
gimp_data_make_internal (standard_brush, "gimp-brush-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_brush),
|
|
||||||
(gpointer *) &standard_brush);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_brush;
|
return standard_brush;
|
||||||
|
|
|
@ -1532,18 +1532,12 @@ gimp_context_set_parent (GimpContext *context,
|
||||||
g_signal_handlers_disconnect_by_func (context->parent,
|
g_signal_handlers_disconnect_by_func (context->parent,
|
||||||
gimp_context_parent_notify,
|
gimp_context_parent_notify,
|
||||||
context);
|
context);
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (context->parent),
|
|
||||||
(gpointer) &context->parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context->parent = parent;
|
g_set_weak_pointer (&context->parent, parent);
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (context->parent),
|
|
||||||
(gpointer) &context->parent);
|
|
||||||
|
|
||||||
/* copy all undefined properties from the new parent */
|
/* copy all undefined properties from the new parent */
|
||||||
gimp_context_copy_properties (parent, context,
|
gimp_context_copy_properties (parent, context,
|
||||||
~context->defined_props &
|
~context->defined_props &
|
||||||
|
|
|
@ -490,13 +490,11 @@ gimp_dynamics_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_dynamics)
|
if (! standard_dynamics)
|
||||||
{
|
{
|
||||||
standard_dynamics = gimp_dynamics_new (context, "Standard dynamics");
|
g_set_weak_pointer (&standard_dynamics,
|
||||||
|
gimp_dynamics_new (context, "Standard dynamics"));
|
||||||
|
|
||||||
gimp_data_clean (standard_dynamics);
|
gimp_data_clean (standard_dynamics);
|
||||||
gimp_data_make_internal (standard_dynamics, "gimp-dynamics-standard");
|
gimp_data_make_internal (standard_dynamics, "gimp-dynamics-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_dynamics),
|
|
||||||
(gpointer *) &standard_dynamics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_dynamics;
|
return standard_dynamics;
|
||||||
|
|
|
@ -411,13 +411,11 @@ gimp_gradient_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_gradient)
|
if (! standard_gradient)
|
||||||
{
|
{
|
||||||
standard_gradient = gimp_gradient_new (context, "Standard");
|
g_set_weak_pointer (&standard_gradient,
|
||||||
|
gimp_gradient_new (context, "Standard"));
|
||||||
|
|
||||||
gimp_data_clean (standard_gradient);
|
gimp_data_clean (standard_gradient);
|
||||||
gimp_data_make_internal (standard_gradient, "gimp-gradient-standard");
|
gimp_data_make_internal (standard_gradient, "gimp-gradient-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_gradient),
|
|
||||||
(gpointer *) &standard_gradient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_gradient;
|
return standard_gradient;
|
||||||
|
|
|
@ -220,13 +220,11 @@ gimp_mybrush_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_mybrush)
|
if (! standard_mybrush)
|
||||||
{
|
{
|
||||||
standard_mybrush = gimp_mybrush_new (context, "Standard");
|
g_set_weak_pointer (&standard_mybrush,
|
||||||
|
gimp_mybrush_new (context, "Standard"));
|
||||||
|
|
||||||
gimp_data_clean (standard_mybrush);
|
gimp_data_clean (standard_mybrush);
|
||||||
gimp_data_make_internal (standard_mybrush, "gimp-mybrush-standard");
|
gimp_data_make_internal (standard_mybrush, "gimp-mybrush-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_mybrush),
|
|
||||||
(gpointer *) &standard_mybrush);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_mybrush;
|
return standard_mybrush;
|
||||||
|
|
|
@ -294,13 +294,11 @@ gimp_palette_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_palette)
|
if (! standard_palette)
|
||||||
{
|
{
|
||||||
standard_palette = gimp_palette_new (context, "Standard");
|
g_set_weak_pointer (&standard_palette,
|
||||||
|
gimp_palette_new (context, "Standard"));
|
||||||
|
|
||||||
gimp_data_clean (standard_palette);
|
gimp_data_clean (standard_palette);
|
||||||
gimp_data_make_internal (standard_palette, "gimp-palette-standard");
|
gimp_data_make_internal (standard_palette, "gimp-palette-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_palette),
|
|
||||||
(gpointer *) &standard_palette);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_palette;
|
return standard_palette;
|
||||||
|
|
|
@ -258,13 +258,11 @@ gimp_pattern_get_standard (GimpContext *context)
|
||||||
|
|
||||||
if (! standard_pattern)
|
if (! standard_pattern)
|
||||||
{
|
{
|
||||||
standard_pattern = gimp_pattern_new (context, "Standard");
|
g_set_weak_pointer (&standard_pattern,
|
||||||
|
gimp_pattern_new (context, "Standard"));
|
||||||
|
|
||||||
gimp_data_clean (standard_pattern);
|
gimp_data_clean (standard_pattern);
|
||||||
gimp_data_make_internal (standard_pattern, "gimp-pattern-standard");
|
gimp_data_make_internal (standard_pattern, "gimp-pattern-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_pattern),
|
|
||||||
(gpointer *) &standard_pattern);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_pattern;
|
return standard_pattern;
|
||||||
|
|
|
@ -155,9 +155,7 @@ about_dialog_create (GimpCoreConfig *config)
|
||||||
g_free (copyright);
|
g_free (copyright);
|
||||||
g_free (version);
|
g_free (version);
|
||||||
|
|
||||||
dialog.dialog = widget;
|
g_set_weak_pointer (&dialog.dialog, widget);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog.dialog);
|
|
||||||
|
|
||||||
g_signal_connect (widget, "response",
|
g_signal_connect (widget, "response",
|
||||||
G_CALLBACK (gtk_widget_destroy),
|
G_CALLBACK (gtk_widget_destroy),
|
||||||
|
@ -467,8 +465,7 @@ about_dialog_add_update (GimpAboutDialog *dialog,
|
||||||
gtk_widget_show (box);
|
gtk_widget_show (box);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
dialog->update_frame = frame;
|
g_set_weak_pointer (&dialog->update_frame, frame);
|
||||||
g_object_add_weak_pointer (G_OBJECT (frame), (gpointer) &dialog->update_frame);
|
|
||||||
|
|
||||||
/* Reconstruct the dialog when release info changes. */
|
/* Reconstruct the dialog when release info changes. */
|
||||||
g_signal_connect (config, "notify::last-known-release",
|
g_signal_connect (config, "notify::last-known-release",
|
||||||
|
|
|
@ -191,10 +191,7 @@ preferences_dialog_create (Gimp *gimp)
|
||||||
G_CALLBACK (prefs_config_copy_notify),
|
G_CALLBACK (prefs_config_copy_notify),
|
||||||
config, 0);
|
config, 0);
|
||||||
|
|
||||||
prefs_dialog = prefs_dialog_new (gimp, config_copy);
|
g_set_weak_pointer (&prefs_dialog, prefs_dialog_new (gimp, config_copy));
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (prefs_dialog),
|
|
||||||
(gpointer) &prefs_dialog);
|
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (prefs_dialog), "gimp", gimp);
|
g_object_set_data (G_OBJECT (prefs_dialog), "gimp", gimp);
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,7 @@ gimp_canvas_canvas_boundary_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GimpCanvasCanvasBoundaryPrivate *private = GET_PRIVATE (object);
|
GimpCanvasCanvasBoundaryPrivate *private = GET_PRIVATE (object);
|
||||||
|
|
||||||
if (private->image)
|
g_clear_weak_pointer (&private->image);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->image),
|
|
||||||
(gpointer) &private->image);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -125,13 +123,7 @@ gimp_canvas_canvas_boundary_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_IMAGE:
|
case PROP_IMAGE:
|
||||||
if (private->image)
|
g_set_weak_pointer (&private->image, g_value_get_object (value));
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->image),
|
|
||||||
(gpointer) &private->image);
|
|
||||||
private->image = g_value_get_object (value); /* don't ref */
|
|
||||||
if (private->image)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->image),
|
|
||||||
(gpointer) &private->image);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -120,9 +120,7 @@ gimp_canvas_layer_boundary_finalize (GObject *object)
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
for (iter = private->layers; iter; iter = iter->next)
|
for (iter = private->layers; iter; iter = iter->next)
|
||||||
if (iter->data)
|
g_clear_weak_pointer (&iter->data);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (iter->data),
|
|
||||||
(gpointer) &iter->data);
|
|
||||||
|
|
||||||
g_list_free (private->layers);
|
g_list_free (private->layers);
|
||||||
}
|
}
|
||||||
|
@ -144,23 +142,26 @@ gimp_canvas_layer_boundary_set_property (GObject *object,
|
||||||
if (private->layers)
|
if (private->layers)
|
||||||
{
|
{
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
for (iter = private->layers; iter; iter = iter->next)
|
for (iter = private->layers; iter; iter = iter->next)
|
||||||
{
|
g_clear_weak_pointer (&iter->data);
|
||||||
if (iter->data)
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (iter->data),
|
|
||||||
(gpointer) &iter->data);
|
|
||||||
}
|
|
||||||
g_list_free (private->layers);
|
g_list_free (private->layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private->layers = g_list_copy (g_value_get_pointer (value));
|
private->layers = g_list_copy (g_value_get_pointer (value));
|
||||||
|
|
||||||
if (private->layers)
|
if (private->layers)
|
||||||
{
|
{
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
for (iter = private->layers; iter; iter = iter->next)
|
for (iter = private->layers; iter; iter = iter->next)
|
||||||
|
/* NOT g_set_weak_pointer() because the pointer is already set */
|
||||||
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
||||||
(gpointer) &iter->data);
|
(gpointer) &iter->data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EDIT_MASK:
|
case PROP_EDIT_MASK:
|
||||||
private->edit_mask = g_value_get_boolean (value);
|
private->edit_mask = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -108,7 +108,8 @@ gimp_display_shell_rotate_dialog (GimpDisplayShell *shell)
|
||||||
data->shell = shell;
|
data->shell = shell;
|
||||||
data->old_angle = shell->rotate_angle;
|
data->old_angle = shell->rotate_angle;
|
||||||
|
|
||||||
shell->rotate_dialog =
|
g_set_weak_pointer
|
||||||
|
(&shell->rotate_dialog,
|
||||||
gimp_viewable_dialog_new (g_list_prepend (NULL, image),
|
gimp_viewable_dialog_new (g_list_prepend (NULL, image),
|
||||||
gimp_get_user_context (shell->display->gimp),
|
gimp_get_user_context (shell->display->gimp),
|
||||||
_("Rotate View"), "display-rotate",
|
_("Rotate View"), "display-rotate",
|
||||||
|
@ -122,7 +123,7 @@ gimp_display_shell_rotate_dialog (GimpDisplayShell *shell)
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||||
_("_OK"), GTK_RESPONSE_OK,
|
_("_OK"), GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL));
|
||||||
|
|
||||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (shell->rotate_dialog),
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (shell->rotate_dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
|
@ -132,9 +133,6 @@ gimp_display_shell_rotate_dialog (GimpDisplayShell *shell)
|
||||||
g_object_weak_ref (G_OBJECT (shell->rotate_dialog),
|
g_object_weak_ref (G_OBJECT (shell->rotate_dialog),
|
||||||
(GWeakNotify) gimp_display_shell_rotate_dialog_free, data);
|
(GWeakNotify) gimp_display_shell_rotate_dialog_free, data);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (shell->rotate_dialog),
|
|
||||||
(gpointer) &shell->rotate_dialog);
|
|
||||||
|
|
||||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (shell->rotate_dialog),
|
gtk_window_set_transient_for (GTK_WINDOW (shell->rotate_dialog),
|
||||||
|
|
|
@ -109,7 +109,8 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
||||||
"value", fabs (shell->other_scale),
|
"value", fabs (shell->other_scale),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
shell->scale_dialog =
|
g_set_weak_pointer
|
||||||
|
(&shell->scale_dialog,
|
||||||
gimp_viewable_dialog_new (g_list_prepend (NULL, image),
|
gimp_viewable_dialog_new (g_list_prepend (NULL, image),
|
||||||
gimp_get_user_context (shell->display->gimp),
|
gimp_get_user_context (shell->display->gimp),
|
||||||
_("Zoom Ratio"), "display_scale",
|
_("Zoom Ratio"), "display_scale",
|
||||||
|
@ -122,7 +123,7 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||||
_("_OK"), GTK_RESPONSE_OK,
|
_("_OK"), GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL));
|
||||||
|
|
||||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (shell->scale_dialog),
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (shell->scale_dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
|
@ -134,9 +135,6 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
||||||
g_object_weak_ref (G_OBJECT (shell->scale_dialog),
|
g_object_weak_ref (G_OBJECT (shell->scale_dialog),
|
||||||
(GWeakNotify) g_object_unref, data->model);
|
(GWeakNotify) g_object_unref, data->model);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (shell->scale_dialog),
|
|
||||||
(gpointer) &shell->scale_dialog);
|
|
||||||
|
|
||||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (shell->scale_dialog),
|
gtk_window_set_transient_for (GTK_WINDOW (shell->scale_dialog),
|
||||||
|
|
|
@ -76,12 +76,7 @@ gimp_tool_dialog_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GimpToolDialogPrivate *private = GET_PRIVATE (object);
|
GimpToolDialogPrivate *private = GET_PRIVATE (object);
|
||||||
|
|
||||||
if (private->shell)
|
g_clear_weak_pointer (&private->shell);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->shell),
|
|
||||||
(gpointer) &private->shell);
|
|
||||||
private->shell = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gimp_tool_dialog_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gimp_tool_dialog_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -179,8 +174,6 @@ gimp_tool_dialog_set_shell (GimpToolDialog *tool_dialog,
|
||||||
|
|
||||||
if (private->shell)
|
if (private->shell)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->shell),
|
|
||||||
(gpointer) &private->shell);
|
|
||||||
g_signal_handlers_disconnect_by_func (private->shell,
|
g_signal_handlers_disconnect_by_func (private->shell,
|
||||||
gimp_tool_dialog_shell_unmap,
|
gimp_tool_dialog_shell_unmap,
|
||||||
tool_dialog);
|
tool_dialog);
|
||||||
|
@ -188,7 +181,7 @@ gimp_tool_dialog_set_shell (GimpToolDialog *tool_dialog,
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (tool_dialog), NULL);
|
gtk_window_set_transient_for (GTK_WINDOW (tool_dialog), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private->shell = shell;
|
g_set_weak_pointer (&private->shell, shell);
|
||||||
|
|
||||||
if (private->shell)
|
if (private->shell)
|
||||||
{
|
{
|
||||||
|
@ -200,8 +193,6 @@ gimp_tool_dialog_set_shell (GimpToolDialog *tool_dialog,
|
||||||
g_signal_connect_object (private->shell, "unmap",
|
g_signal_connect_object (private->shell, "unmap",
|
||||||
G_CALLBACK (gimp_tool_dialog_shell_unmap),
|
G_CALLBACK (gimp_tool_dialog_shell_unmap),
|
||||||
tool_dialog, 0);
|
tool_dialog, 0);
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->shell),
|
|
||||||
(gpointer) &private->shell);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,24 +377,16 @@ gimp_tool_gui_set_shell (GimpToolGui *gui,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (private->shell)
|
if (private->shell)
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->shell),
|
|
||||||
(gpointer) &private->shell);
|
|
||||||
g_signal_handlers_disconnect_by_func (private->shell->canvas,
|
g_signal_handlers_disconnect_by_func (private->shell->canvas,
|
||||||
gimp_tool_gui_canvas_resized,
|
gimp_tool_gui_canvas_resized,
|
||||||
gui);
|
gui);
|
||||||
}
|
|
||||||
|
|
||||||
private->shell = shell;
|
g_set_weak_pointer (&private->shell, shell);
|
||||||
|
|
||||||
if (private->shell)
|
if (private->shell)
|
||||||
{
|
|
||||||
g_signal_connect (private->shell->canvas, "size-allocate",
|
g_signal_connect (private->shell->canvas, "size-allocate",
|
||||||
G_CALLBACK (gimp_tool_gui_canvas_resized),
|
G_CALLBACK (gimp_tool_gui_canvas_resized),
|
||||||
gui);
|
gui);
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->shell),
|
|
||||||
(gpointer) &private->shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_tool_gui_update_shell (gui);
|
gimp_tool_gui_update_shell (gui);
|
||||||
}
|
}
|
||||||
|
@ -428,11 +420,7 @@ gimp_tool_gui_set_viewables (GimpToolGui *gui,
|
||||||
if (private->viewables)
|
if (private->viewables)
|
||||||
{
|
{
|
||||||
for (iter = private->viewables; iter; iter = iter->next)
|
for (iter = private->viewables; iter; iter = iter->next)
|
||||||
{
|
g_clear_weak_pointer (&iter->data);
|
||||||
if (iter->data)
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (iter->data),
|
|
||||||
(gpointer) &iter->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (private->viewables);
|
g_list_free (private->viewables);
|
||||||
}
|
}
|
||||||
|
@ -442,6 +430,7 @@ gimp_tool_gui_set_viewables (GimpToolGui *gui,
|
||||||
if (private->viewables)
|
if (private->viewables)
|
||||||
{
|
{
|
||||||
for (iter = private->viewables; iter; iter = iter->next)
|
for (iter = private->viewables; iter; iter = iter->next)
|
||||||
|
/* NOT g_set_weak_pointer() because the pointer is alrerady set */
|
||||||
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
||||||
(gpointer) &iter->data);
|
(gpointer) &iter->data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,9 +377,8 @@ gimp_babl_get_builtin_color_profile (GimpImageBaseType base_type,
|
||||||
{
|
{
|
||||||
if (! linear_gray_profile)
|
if (! linear_gray_profile)
|
||||||
{
|
{
|
||||||
linear_gray_profile = gimp_color_profile_new_d65_gray_linear ();
|
g_set_weak_pointer (&linear_gray_profile,
|
||||||
g_object_add_weak_pointer (G_OBJECT (linear_gray_profile),
|
gimp_color_profile_new_d65_gray_linear ());
|
||||||
(gpointer) &linear_gray_profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return linear_gray_profile;
|
return linear_gray_profile;
|
||||||
|
@ -388,9 +387,8 @@ gimp_babl_get_builtin_color_profile (GimpImageBaseType base_type,
|
||||||
{
|
{
|
||||||
if (! gray_profile)
|
if (! gray_profile)
|
||||||
{
|
{
|
||||||
gray_profile = gimp_color_profile_new_d65_gray_srgb_trc ();
|
g_set_weak_pointer (&gray_profile,
|
||||||
g_object_add_weak_pointer (G_OBJECT (gray_profile),
|
gimp_color_profile_new_d65_gray_srgb_trc ());
|
||||||
(gpointer) &gray_profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gray_profile;
|
return gray_profile;
|
||||||
|
@ -402,9 +400,8 @@ gimp_babl_get_builtin_color_profile (GimpImageBaseType base_type,
|
||||||
{
|
{
|
||||||
if (! linear_rgb_profile)
|
if (! linear_rgb_profile)
|
||||||
{
|
{
|
||||||
linear_rgb_profile = gimp_color_profile_new_rgb_srgb_linear ();
|
g_set_weak_pointer (&linear_rgb_profile,
|
||||||
g_object_add_weak_pointer (G_OBJECT (linear_rgb_profile),
|
gimp_color_profile_new_rgb_srgb_linear ());
|
||||||
(gpointer) &linear_rgb_profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return linear_rgb_profile;
|
return linear_rgb_profile;
|
||||||
|
@ -413,9 +410,8 @@ gimp_babl_get_builtin_color_profile (GimpImageBaseType base_type,
|
||||||
{
|
{
|
||||||
if (! srgb_profile)
|
if (! srgb_profile)
|
||||||
{
|
{
|
||||||
srgb_profile = gimp_color_profile_new_rgb_srgb ();
|
g_set_weak_pointer (&srgb_profile,
|
||||||
g_object_add_weak_pointer (G_OBJECT (srgb_profile),
|
gimp_color_profile_new_rgb_srgb ());
|
||||||
(gpointer) &srgb_profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return srgb_profile;
|
return srgb_profile;
|
||||||
|
|
|
@ -223,6 +223,7 @@ gimp_ui_configurer_move_docks_to_columns (GimpUIConfigurer *ui_configurer,
|
||||||
dock_columns = gimp_image_window_get_right_docks (uber_image_window);
|
dock_columns = gimp_image_window_get_right_docks (uber_image_window);
|
||||||
|
|
||||||
dock_container = GIMP_DOCK_CONTAINER (dock_window);
|
dock_container = GIMP_DOCK_CONTAINER (dock_window);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dock_window),
|
g_object_add_weak_pointer (G_OBJECT (dock_window),
|
||||||
(gpointer) &dock_window);
|
(gpointer) &dock_window);
|
||||||
|
|
||||||
|
|
|
@ -514,9 +514,9 @@ menus_get_global_menu_factory (Gimp *gimp)
|
||||||
|
|
||||||
if (global_menu_factory == NULL && ! created)
|
if (global_menu_factory == NULL && ! created)
|
||||||
{
|
{
|
||||||
global_menu_factory = gimp_menu_factory_new (gimp, global_action_factory);
|
g_set_weak_pointer (&global_menu_factory,
|
||||||
g_object_add_weak_pointer (G_OBJECT (global_menu_factory),
|
gimp_menu_factory_new (gimp, global_action_factory));
|
||||||
(gpointer *) &global_menu_factory);
|
|
||||||
created = TRUE;
|
created = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,16 +141,8 @@ gimp_paintbrush_paint (GimpPaintCore *paint_core,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_PAINT_STATE_FINISH:
|
case GIMP_PAINT_STATE_FINISH:
|
||||||
{
|
g_clear_weak_pointer (&paintbrush->paint_buffer);
|
||||||
if (paintbrush->paint_buffer)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (paintbrush->paint_buffer),
|
|
||||||
(gpointer) &paintbrush->paint_buffer);
|
|
||||||
paintbrush->paint_buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_pointer (&paintbrush->paint_pixmap, gimp_temp_buf_unref);
|
g_clear_pointer (&paintbrush->paint_pixmap, gimp_temp_buf_unref);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,19 +330,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
||||||
(! paint_pixmap && (gimp_rgba_distance (&paint_color,
|
(! paint_pixmap && (gimp_rgba_distance (&paint_color,
|
||||||
&paintbrush->paint_color))))
|
&paintbrush->paint_color))))
|
||||||
{
|
{
|
||||||
if (paint_buffer != paintbrush->paint_buffer)
|
g_set_weak_pointer (&paintbrush->paint_buffer, paint_buffer);
|
||||||
{
|
|
||||||
if (paintbrush->paint_buffer)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (paintbrush->paint_buffer),
|
|
||||||
(gpointer) &paintbrush->paint_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
paintbrush->paint_buffer = paint_buffer;
|
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (paintbrush->paint_buffer),
|
|
||||||
(gpointer) &paintbrush->paint_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paint_pixmap != paintbrush->paint_pixmap)
|
if (paint_pixmap != paintbrush->paint_pixmap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,9 +92,6 @@ gimp_paint_core_undo_constructed (GObject *object)
|
||||||
gimp_assert (GIMP_IS_PAINT_CORE (paint_core_undo->paint_core));
|
gimp_assert (GIMP_IS_PAINT_CORE (paint_core_undo->paint_core));
|
||||||
|
|
||||||
paint_core_undo->last_coords = paint_core_undo->paint_core->start_coords;
|
paint_core_undo->last_coords = paint_core_undo->paint_core->start_coords;
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (paint_core_undo->paint_core),
|
|
||||||
(gpointer) &paint_core_undo->paint_core);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -108,7 +105,8 @@ gimp_paint_core_undo_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_PAINT_CORE:
|
case PROP_PAINT_CORE:
|
||||||
paint_core_undo->paint_core = g_value_get_object (value);
|
g_set_weak_pointer (&paint_core_undo->paint_core,
|
||||||
|
g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -163,12 +161,7 @@ gimp_paint_core_undo_free (GimpUndo *undo,
|
||||||
{
|
{
|
||||||
GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (undo);
|
GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (undo);
|
||||||
|
|
||||||
if (paint_core_undo->paint_core)
|
g_clear_weak_pointer (&paint_core_undo->paint_core);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (paint_core_undo->paint_core),
|
|
||||||
(gpointer) &paint_core_undo->paint_core);
|
|
||||||
paint_core_undo->paint_core = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,9 +479,7 @@ gimp_paint_options_dispose (GObject *object)
|
||||||
g_signal_handlers_disconnect_by_func (options->brush,
|
g_signal_handlers_disconnect_by_func (options->brush,
|
||||||
gimp_paint_options_brush_notify,
|
gimp_paint_options_brush_notify,
|
||||||
options);
|
options);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (options->brush),
|
g_clear_weak_pointer (&options->brush);
|
||||||
(gpointer) &options->brush);
|
|
||||||
options->brush = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
@ -807,16 +805,12 @@ gimp_paint_options_brush_changed (GimpContext *context,
|
||||||
g_signal_handlers_disconnect_by_func (options->brush,
|
g_signal_handlers_disconnect_by_func (options->brush,
|
||||||
gimp_paint_options_brush_notify,
|
gimp_paint_options_brush_notify,
|
||||||
options);
|
options);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (options->brush),
|
|
||||||
(gpointer) &options->brush);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options->brush = brush;
|
g_set_weak_pointer (&options->brush, brush);
|
||||||
|
|
||||||
if (options->brush)
|
if (options->brush)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (options->brush),
|
|
||||||
(gpointer) &options->brush);
|
|
||||||
g_signal_connect_object (options->brush, "notify",
|
g_signal_connect_object (options->brush, "notify",
|
||||||
G_CALLBACK (gimp_paint_options_brush_notify),
|
G_CALLBACK (gimp_paint_options_brush_notify),
|
||||||
options, 0);
|
options, 0);
|
||||||
|
|
|
@ -335,15 +335,13 @@ gimp_font_get_standard (void)
|
||||||
|
|
||||||
if (! standard_font)
|
if (! standard_font)
|
||||||
{
|
{
|
||||||
standard_font = g_object_new (GIMP_TYPE_FONT,
|
g_set_weak_pointer (&standard_font,
|
||||||
|
g_object_new (GIMP_TYPE_FONT,
|
||||||
"name", "Standard",
|
"name", "Standard",
|
||||||
NULL);
|
NULL));;
|
||||||
|
|
||||||
gimp_data_clean (standard_font);
|
gimp_data_clean (standard_font);
|
||||||
gimp_data_make_internal (standard_font, "gimp-font-standard");
|
gimp_data_make_internal (standard_font, "gimp-font-standard");
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (standard_font),
|
|
||||||
(gpointer *) &standard_font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return standard_font;
|
return standard_font;
|
||||||
|
|
|
@ -648,18 +648,12 @@ gimp_crop_tool_image_changed (GimpCropTool *crop_tool,
|
||||||
g_signal_handlers_disconnect_by_func (crop_tool->current_image,
|
g_signal_handlers_disconnect_by_func (crop_tool->current_image,
|
||||||
gimp_crop_tool_image_selected_layers_changed,
|
gimp_crop_tool_image_selected_layers_changed,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (crop_tool->current_image),
|
|
||||||
(gpointer) &crop_tool->current_image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
crop_tool->current_image = image;
|
g_set_weak_pointer (&crop_tool->current_image, image);
|
||||||
|
|
||||||
if (crop_tool->current_image)
|
if (crop_tool->current_image)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (crop_tool->current_image),
|
|
||||||
(gpointer) &crop_tool->current_image);
|
|
||||||
|
|
||||||
g_signal_connect_object (crop_tool->current_image, "size-changed",
|
g_signal_connect_object (crop_tool->current_image, "size-changed",
|
||||||
G_CALLBACK (gimp_crop_tool_image_size_changed),
|
G_CALLBACK (gimp_crop_tool_image_size_changed),
|
||||||
crop_tool,
|
crop_tool,
|
||||||
|
@ -699,8 +693,7 @@ gimp_crop_tool_image_selected_layers_changed (GimpCropTool *crop_tool)
|
||||||
gimp_crop_tool_layer_size_changed,
|
gimp_crop_tool_layer_size_changed,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (iter->data),
|
g_clear_weak_pointer (&iter->data);
|
||||||
(gpointer) &iter->data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_list_free (crop_tool->current_layers);
|
g_list_free (crop_tool->current_layers);
|
||||||
|
@ -721,6 +714,7 @@ gimp_crop_tool_image_selected_layers_changed (GimpCropTool *crop_tool)
|
||||||
{
|
{
|
||||||
for (iter = crop_tool->current_layers; iter; iter = iter->next)
|
for (iter = crop_tool->current_layers; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
|
/* NOT g_set_weak_pointer() because the pointer is already set */
|
||||||
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
g_object_add_weak_pointer (G_OBJECT (iter->data),
|
||||||
(gpointer) &iter->data);
|
(gpointer) &iter->data);
|
||||||
|
|
||||||
|
|
|
@ -493,13 +493,10 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
||||||
GIMP_HISTOGRAM_VALUE,
|
GIMP_HISTOGRAM_VALUE,
|
||||||
GIMP_HISTOGRAM_ALPHA);
|
GIMP_HISTOGRAM_ALPHA);
|
||||||
tool->channel_menu =
|
g_set_weak_pointer (&tool->channel_menu,
|
||||||
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
|
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)));
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (tool->channel_menu),
|
|
||||||
(gpointer) &tool->channel_menu);
|
|
||||||
|
|
||||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
||||||
config->channel);
|
config->channel);
|
||||||
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
|
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
|
||||||
|
@ -568,10 +565,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
gtk_grid_attach (GTK_GRID (grid), frame, 1, 0, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), frame, 1, 0, 1, 1);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
tool->graph = gimp_curve_view_new ();
|
g_set_weak_pointer (&tool->graph, gimp_curve_view_new ());
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (tool->graph),
|
|
||||||
(gpointer) &tool->graph);
|
|
||||||
|
|
||||||
gimp_curve_view_set_range_x (GIMP_CURVE_VIEW (tool->graph), 0, 255);
|
gimp_curve_view_set_range_x (GIMP_CURVE_VIEW (tool->graph), 0, 255);
|
||||||
gimp_curve_view_set_range_y (GIMP_CURVE_VIEW (tool->graph), 0, 255);
|
gimp_curve_view_set_range_y (GIMP_CURVE_VIEW (tool->graph), 0, 255);
|
||||||
|
|
|
@ -387,8 +387,7 @@ gimp_filter_tool_controller_free (Controller *controller)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_data (controller->widget, controller);
|
g_signal_handlers_disconnect_by_data (controller->widget, controller);
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (controller->widget),
|
g_clear_weak_pointer (&controller->widget);
|
||||||
(gpointer) &controller->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slice_free (Controller, controller);
|
g_slice_free (Controller, controller);
|
||||||
|
|
|
@ -94,9 +94,6 @@ gimp_foreground_select_tool_undo_constructed (GObject *object)
|
||||||
fg_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
|
fg_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
|
||||||
|
|
||||||
gimp_assert (GIMP_IS_FOREGROUND_SELECT_TOOL (fg_select_tool_undo->foreground_select_tool));
|
gimp_assert (GIMP_IS_FOREGROUND_SELECT_TOOL (fg_select_tool_undo->foreground_select_tool));
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (fg_select_tool_undo->foreground_select_tool),
|
|
||||||
(gpointer) &fg_select_tool_undo->foreground_select_tool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -111,7 +108,8 @@ gimp_foreground_select_tool_undo_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_FOREGROUND_SELECT_TOOL:
|
case PROP_FOREGROUND_SELECT_TOOL:
|
||||||
fg_select_tool_undo->foreground_select_tool = g_value_get_object (value);
|
g_set_weak_pointer (&fg_select_tool_undo->foreground_select_tool,
|
||||||
|
g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -155,12 +153,7 @@ gimp_foreground_select_tool_undo_free (GimpUndo *undo,
|
||||||
{
|
{
|
||||||
GimpForegroundSelectToolUndo *fg_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (undo);
|
GimpForegroundSelectToolUndo *fg_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (undo);
|
||||||
|
|
||||||
if (fg_select_tool_undo->foreground_select_tool)
|
g_clear_weak_pointer (&fg_select_tool_undo->foreground_select_tool);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (fg_select_tool_undo->foreground_select_tool),
|
|
||||||
(gpointer) &fg_select_tool_undo->foreground_select_tool);
|
|
||||||
fg_select_tool_undo->foreground_select_tool = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,13 +374,10 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
||||||
GIMP_HISTOGRAM_VALUE,
|
GIMP_HISTOGRAM_VALUE,
|
||||||
GIMP_HISTOGRAM_ALPHA);
|
GIMP_HISTOGRAM_ALPHA);
|
||||||
tool->channel_menu =
|
g_set_weak_pointer (&tool->channel_menu,
|
||||||
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
|
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)));
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (tool->channel_menu),
|
|
||||||
(gpointer) &tool->channel_menu);
|
|
||||||
|
|
||||||
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
|
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
|
||||||
"gimp-channel");
|
"gimp-channel");
|
||||||
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
||||||
|
@ -436,10 +433,8 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
|
||||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||||
gtk_widget_show (vbox2);
|
gtk_widget_show (vbox2);
|
||||||
|
|
||||||
tool->histogram_view = gimp_histogram_view_new (FALSE);
|
g_set_weak_pointer (&tool->histogram_view,
|
||||||
|
gimp_histogram_view_new (FALSE));
|
||||||
g_object_add_weak_pointer (G_OBJECT (tool->histogram_view),
|
|
||||||
(gpointer) &tool->histogram_view);
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), tool->histogram_view, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), tool->histogram_view, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (GTK_WIDGET (tool->histogram_view));
|
gtk_widget_show (GTK_WIDGET (tool->histogram_view));
|
||||||
|
|
|
@ -265,9 +265,8 @@ gimp_measure_tool_button_press (GimpTool *tool,
|
||||||
if (options->use_info_window ||
|
if (options->use_info_window ||
|
||||||
! gimp_display_shell_get_show_statusbar (shell))
|
! gimp_display_shell_get_show_statusbar (shell))
|
||||||
{
|
{
|
||||||
measure->gui = gimp_measure_tool_dialog_new (measure);
|
g_set_weak_pointer (&measure->gui,
|
||||||
g_object_add_weak_pointer (G_OBJECT (measure->gui),
|
gimp_measure_tool_dialog_new (measure));
|
||||||
(gpointer) &measure->gui);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -881,16 +881,14 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
|
||||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||||
|
|
||||||
/* Fixed aspect entry/buttons */
|
/* Fixed aspect entry/buttons */
|
||||||
private->fixed_aspect_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
g_set_weak_pointer (&private->fixed_aspect_hbox,
|
||||||
|
gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_aspect_hbox,
|
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_aspect_hbox,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_size_group_add_widget (size_group, private->fixed_aspect_hbox);
|
gtk_size_group_add_widget (size_group, private->fixed_aspect_hbox);
|
||||||
g_object_unref (size_group);
|
g_object_unref (size_group);
|
||||||
/* don't show */
|
/* don't show */
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->fixed_aspect_hbox),
|
|
||||||
(gpointer) &private->fixed_aspect_hbox);
|
|
||||||
|
|
||||||
entry = gimp_prop_number_pair_entry_new (config,
|
entry = gimp_prop_number_pair_entry_new (config,
|
||||||
"aspect-numerator",
|
"aspect-numerator",
|
||||||
"aspect-denominator",
|
"aspect-denominator",
|
||||||
|
@ -915,15 +913,12 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
|
||||||
entry,
|
entry,
|
||||||
private->aspect_history);
|
private->aspect_history);
|
||||||
|
|
||||||
private->aspect_button_box =
|
g_set_weak_pointer (&private->aspect_button_box,
|
||||||
gimp_prop_enum_icon_box_new (G_OBJECT (entry),
|
gimp_prop_enum_icon_box_new (G_OBJECT (entry),
|
||||||
"aspect", "gimp", -1, -1);
|
"aspect", "gimp", -1, -1));
|
||||||
gtk_box_pack_start (GTK_BOX (private->fixed_aspect_hbox),
|
gtk_box_pack_start (GTK_BOX (private->fixed_aspect_hbox),
|
||||||
private->aspect_button_box, FALSE, FALSE, 0);
|
private->aspect_button_box, FALSE, FALSE, 0);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->aspect_button_box),
|
|
||||||
(gpointer) &private->aspect_button_box);
|
|
||||||
|
|
||||||
/* hide "square" */
|
/* hide "square" */
|
||||||
children =
|
children =
|
||||||
gtk_container_get_children (GTK_CONTAINER (private->aspect_button_box));
|
gtk_container_get_children (GTK_CONTAINER (private->aspect_button_box));
|
||||||
|
@ -931,41 +926,37 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
|
||||||
g_list_free (children);
|
g_list_free (children);
|
||||||
|
|
||||||
/* Fixed width entry */
|
/* Fixed width entry */
|
||||||
private->fixed_width_entry =
|
g_set_weak_pointer (&private->fixed_width_entry,
|
||||||
gimp_prop_size_entry_new (config,
|
gimp_prop_size_entry_new (config,
|
||||||
"desired-fixed-width", TRUE, "fixed-unit", "%a",
|
"desired-fixed-width",
|
||||||
GIMP_SIZE_ENTRY_UPDATE_SIZE, 300);
|
TRUE, "fixed-unit", "%a",
|
||||||
|
GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||||
|
300));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_width_entry,
|
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_width_entry,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_size_group_add_widget (size_group, private->fixed_width_entry);
|
gtk_size_group_add_widget (size_group, private->fixed_width_entry);
|
||||||
gtk_widget_hide (private->fixed_width_entry);
|
gtk_widget_hide (private->fixed_width_entry);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->fixed_width_entry),
|
|
||||||
(gpointer) &private->fixed_width_entry);
|
|
||||||
|
|
||||||
/* Fixed height entry */
|
/* Fixed height entry */
|
||||||
private->fixed_height_entry =
|
g_set_weak_pointer (&private->fixed_height_entry,
|
||||||
gimp_prop_size_entry_new (config,
|
gimp_prop_size_entry_new (config,
|
||||||
"desired-fixed-height", TRUE, "fixed-unit", "%a",
|
"desired-fixed-height",
|
||||||
GIMP_SIZE_ENTRY_UPDATE_SIZE, 300);
|
TRUE, "fixed-unit", "%a",
|
||||||
|
GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||||
|
300));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_height_entry,
|
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_height_entry,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_size_group_add_widget (size_group, private->fixed_height_entry);
|
gtk_size_group_add_widget (size_group, private->fixed_height_entry);
|
||||||
gtk_widget_hide (private->fixed_height_entry);
|
gtk_widget_hide (private->fixed_height_entry);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->fixed_height_entry),
|
|
||||||
(gpointer) &private->fixed_height_entry);
|
|
||||||
|
|
||||||
/* Fixed size entry */
|
/* Fixed size entry */
|
||||||
private->fixed_size_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
g_set_weak_pointer (&private->fixed_size_hbox,
|
||||||
|
gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_size_hbox,
|
gtk_box_pack_start (GTK_BOX (vbox2), private->fixed_size_hbox,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_size_group_add_widget (size_group, private->fixed_size_hbox);
|
gtk_size_group_add_widget (size_group, private->fixed_size_hbox);
|
||||||
gtk_widget_hide (private->fixed_size_hbox);
|
gtk_widget_hide (private->fixed_size_hbox);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->fixed_size_hbox),
|
|
||||||
(gpointer) &private->fixed_size_hbox);
|
|
||||||
|
|
||||||
entry = gimp_prop_number_pair_entry_new (config,
|
entry = gimp_prop_number_pair_entry_new (config,
|
||||||
"desired-fixed-size-width",
|
"desired-fixed-size-width",
|
||||||
"desired-fixed-size-height",
|
"desired-fixed-size-height",
|
||||||
|
@ -1040,15 +1031,13 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
|
||||||
|
|
||||||
/* Auto Shrink */
|
/* Auto Shrink */
|
||||||
private->auto_shrink_button = gtk_button_new_with_label (_("Auto Shrink"));
|
g_set_weak_pointer (&private->auto_shrink_button,
|
||||||
|
gtk_button_new_with_label (_("Auto Shrink")));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), private->auto_shrink_button,
|
gtk_box_pack_start (GTK_BOX (vbox), private->auto_shrink_button,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_set_sensitive (private->auto_shrink_button, FALSE);
|
gtk_widget_set_sensitive (private->auto_shrink_button, FALSE);
|
||||||
gtk_widget_show (private->auto_shrink_button);
|
gtk_widget_show (private->auto_shrink_button);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->auto_shrink_button),
|
|
||||||
(gpointer) &private->auto_shrink_button);
|
|
||||||
|
|
||||||
button = gimp_prop_check_button_new (config, "shrink-merged", NULL);
|
button = gimp_prop_check_button_new (config, "shrink-merged", NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,6 @@ static gboolean gimp_selection_tool_check (GimpSelectionTool *s
|
||||||
static gboolean gimp_selection_tool_have_selection (GimpSelectionTool *sel_tool,
|
static gboolean gimp_selection_tool_have_selection (GimpSelectionTool *sel_tool,
|
||||||
GimpDisplay *display);
|
GimpDisplay *display);
|
||||||
|
|
||||||
static void gimp_selection_tool_set_undo_ptr (GimpUndo **undo_ptr,
|
|
||||||
GimpUndo *undo);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpSelectionTool, gimp_selection_tool, GIMP_TYPE_DRAW_TOOL)
|
G_DEFINE_TYPE (GimpSelectionTool, gimp_selection_tool, GIMP_TYPE_DRAW_TOOL)
|
||||||
|
|
||||||
|
@ -477,7 +474,7 @@ static void
|
||||||
gimp_selection_tool_commit (GimpSelectionTool *sel_tool)
|
gimp_selection_tool_commit (GimpSelectionTool *sel_tool)
|
||||||
{
|
{
|
||||||
/* make sure gimp_selection_tool_halt() doesn't undo the change, if any */
|
/* make sure gimp_selection_tool_halt() doesn't undo the change, if any */
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -509,8 +506,8 @@ gimp_selection_tool_halt (GimpSelectionTool *sel_tool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset the automatic undo/redo mechanism */
|
/* reset the automatic undo/redo mechanism */
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->redo, NULL);
|
g_clear_weak_pointer (&sel_tool->redo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,25 +601,6 @@ gimp_selection_tool_have_selection (GimpSelectionTool *sel_tool,
|
||||||
display);
|
display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_selection_tool_set_undo_ptr (GimpUndo **undo_ptr,
|
|
||||||
GimpUndo *undo)
|
|
||||||
{
|
|
||||||
if (*undo_ptr)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (*undo_ptr),
|
|
||||||
(gpointer *) undo_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
*undo_ptr = undo;
|
|
||||||
|
|
||||||
if (*undo_ptr)
|
|
||||||
{
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (*undo_ptr),
|
|
||||||
(gpointer *) undo_ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
|
|
||||||
|
@ -730,7 +708,7 @@ gimp_selection_tool_start_change (GimpSelectionTool *sel_tool,
|
||||||
|
|
||||||
if (create)
|
if (create)
|
||||||
{
|
{
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -748,11 +726,10 @@ gimp_selection_tool_start_change (GimpSelectionTool *sel_tool,
|
||||||
|
|
||||||
gimp_tool_control_pop_preserve (tool->control);
|
gimp_tool_control_pop_preserve (tool->control);
|
||||||
|
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
|
|
||||||
/* we will need to redo if the user cancels or executes */
|
/* we will need to redo if the user cancels or executes */
|
||||||
gimp_selection_tool_set_undo_ptr (
|
g_set_weak_pointer (&sel_tool->redo,
|
||||||
&sel_tool->redo,
|
|
||||||
gimp_undo_stack_peek (redo_stack));
|
gimp_undo_stack_peek (redo_stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,8 +749,7 @@ gimp_selection_tool_start_change (GimpSelectionTool *sel_tool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_selection_tool_set_undo_ptr (
|
g_set_weak_pointer (&sel_tool->undo,
|
||||||
&sel_tool->undo,
|
|
||||||
gimp_undo_stack_peek (undo_stack));
|
gimp_undo_stack_peek (undo_stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,13 +790,12 @@ gimp_selection_tool_end_change (GimpSelectionTool *sel_tool,
|
||||||
|
|
||||||
gimp_tool_control_pop_preserve (tool->control);
|
gimp_tool_control_pop_preserve (tool->control);
|
||||||
|
|
||||||
gimp_selection_tool_set_undo_ptr (
|
g_set_weak_pointer (&sel_tool->undo,
|
||||||
&sel_tool->undo,
|
|
||||||
gimp_undo_stack_peek (undo_stack));
|
gimp_undo_stack_peek (undo_stack));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -831,12 +806,12 @@ gimp_selection_tool_end_change (GimpSelectionTool *sel_tool,
|
||||||
* we actually selected something
|
* we actually selected something
|
||||||
*/
|
*/
|
||||||
if (undo && undo != sel_tool->undo)
|
if (undo && undo != sel_tool->undo)
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, undo);
|
g_set_weak_pointer (&sel_tool->undo, undo);
|
||||||
else
|
else
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->undo, NULL);
|
g_clear_weak_pointer (&sel_tool->undo);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_selection_tool_set_undo_ptr (&sel_tool->redo, NULL);
|
g_clear_weak_pointer (&sel_tool->redo);
|
||||||
|
|
||||||
if (sel_tool->idle_id)
|
if (sel_tool->idle_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1354,15 +1354,13 @@ gimp_text_tool_editor_dialog (GimpTextTool *text_tool)
|
||||||
if (text_tool->image)
|
if (text_tool->image)
|
||||||
gimp_image_get_resolution (text_tool->image, &xres, &yres);
|
gimp_image_get_resolution (text_tool->image, &xres, &yres);
|
||||||
|
|
||||||
text_tool->editor_dialog =
|
g_set_weak_pointer
|
||||||
|
(&text_tool->editor_dialog,
|
||||||
gimp_text_options_editor_new (parent, tool->tool_info->gimp, options,
|
gimp_text_options_editor_new (parent, tool->tool_info->gimp, options,
|
||||||
menus_get_global_menu_factory (tool->tool_info->gimp),
|
menus_get_global_menu_factory (tool->tool_info->gimp),
|
||||||
_("GIMP Text Editor"),
|
_("GIMP Text Editor"),
|
||||||
text_tool->proxy, text_tool->buffer,
|
text_tool->proxy, text_tool->buffer,
|
||||||
xres, yres);
|
xres, yres));
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (text_tool->editor_dialog),
|
|
||||||
(gpointer) &text_tool->editor_dialog);
|
|
||||||
|
|
||||||
gimp_dialog_factory_add_foreign (dialog_factory,
|
gimp_dialog_factory_add_foreign (dialog_factory,
|
||||||
"gimp-text-tool-dialog",
|
"gimp-text-tool-dialog",
|
||||||
|
|
|
@ -1848,12 +1848,9 @@ gimp_text_tool_set_image (GimpTextTool *text_tool,
|
||||||
g_signal_handlers_disconnect_by_func (text_tool->image,
|
g_signal_handlers_disconnect_by_func (text_tool->image,
|
||||||
gimp_text_tool_layer_changed,
|
gimp_text_tool_layer_changed,
|
||||||
text_tool);
|
text_tool);
|
||||||
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (text_tool->image),
|
|
||||||
(gpointer) &text_tool->image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text_tool->image = image;
|
g_set_weak_pointer (&text_tool->image, image);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
|
@ -1861,9 +1858,6 @@ gimp_text_tool_set_image (GimpTextTool *text_tool,
|
||||||
gdouble xres;
|
gdouble xres;
|
||||||
gdouble yres;
|
gdouble yres;
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (text_tool->image),
|
|
||||||
(gpointer) &text_tool->image);
|
|
||||||
|
|
||||||
g_signal_connect_object (text_tool->image, "selected-layers-changed",
|
g_signal_connect_object (text_tool->image, "selected-layers-changed",
|
||||||
G_CALLBACK (gimp_text_tool_layer_changed),
|
G_CALLBACK (gimp_text_tool_layer_changed),
|
||||||
text_tool, 0);
|
text_tool, 0);
|
||||||
|
|
|
@ -780,6 +780,8 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool)
|
||||||
tr_tool->x2,
|
tr_tool->x2,
|
||||||
tr_tool->y2);
|
tr_tool->y2);
|
||||||
tg_tool->previews = g_list_prepend (tg_tool->previews, preview);
|
tg_tool->previews = g_list_prepend (tg_tool->previews, preview);
|
||||||
|
|
||||||
|
/* NOT g_set_weak_pointr() because the pointer is already set */
|
||||||
g_object_add_weak_pointer (G_OBJECT (tg_tool->previews->data),
|
g_object_add_weak_pointer (G_OBJECT (tg_tool->previews->data),
|
||||||
(gpointer) &tg_tool->previews->data);
|
(gpointer) &tg_tool->previews->data);
|
||||||
}
|
}
|
||||||
|
@ -800,13 +802,12 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool)
|
||||||
|
|
||||||
if (segs_in)
|
if (segs_in)
|
||||||
{
|
{
|
||||||
tg_tool->boundary_in =
|
g_set_weak_pointer
|
||||||
|
(&tg_tool->boundary_in,
|
||||||
gimp_draw_tool_add_boundary (draw_tool,
|
gimp_draw_tool_add_boundary (draw_tool,
|
||||||
segs_in, n_segs_in,
|
segs_in, n_segs_in,
|
||||||
&matrix,
|
&matrix,
|
||||||
0, 0);
|
0, 0));
|
||||||
g_object_add_weak_pointer (G_OBJECT (tg_tool->boundary_in),
|
|
||||||
(gpointer) &tg_tool->boundary_in);
|
|
||||||
|
|
||||||
gimp_canvas_item_set_visible (tg_tool->boundary_in,
|
gimp_canvas_item_set_visible (tg_tool->boundary_in,
|
||||||
tr_tool->transform_valid);
|
tr_tool->transform_valid);
|
||||||
|
@ -814,13 +815,12 @@ gimp_transform_grid_tool_draw (GimpDrawTool *draw_tool)
|
||||||
|
|
||||||
if (segs_out)
|
if (segs_out)
|
||||||
{
|
{
|
||||||
tg_tool->boundary_out =
|
g_set_weak_pointer
|
||||||
|
(&tg_tool->boundary_out,
|
||||||
gimp_draw_tool_add_boundary (draw_tool,
|
gimp_draw_tool_add_boundary (draw_tool,
|
||||||
segs_out, n_segs_out,
|
segs_out, n_segs_out,
|
||||||
&matrix,
|
&matrix,
|
||||||
0, 0);
|
0, 0));
|
||||||
g_object_add_weak_pointer (G_OBJECT (tg_tool->boundary_out),
|
|
||||||
(gpointer) &tg_tool->boundary_out);
|
|
||||||
|
|
||||||
gimp_canvas_item_set_visible (tg_tool->boundary_out,
|
gimp_canvas_item_set_visible (tg_tool->boundary_out,
|
||||||
tr_tool->transform_valid);
|
tr_tool->transform_valid);
|
||||||
|
|
|
@ -105,9 +105,6 @@ gimp_transform_grid_tool_undo_constructed (GObject *object)
|
||||||
if (tg_tool->original)
|
if (tg_tool->original)
|
||||||
tg_tool_undo->original = tile_manager_ref (tg_tool->original);
|
tg_tool_undo->original = tile_manager_ref (tg_tool->original);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (tg_tool_undo->tg_tool),
|
|
||||||
(gpointer) &tg_tool_undo->tg_tool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -121,7 +118,8 @@ gimp_transform_grid_tool_undo_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_TRANSFORM_TOOL:
|
case PROP_TRANSFORM_TOOL:
|
||||||
tg_tool_undo->tg_tool = g_value_get_object (value);
|
g_set_weak_pointer (&tg_tool_undo->tg_tool,
|
||||||
|
g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -203,12 +201,7 @@ gimp_transform_grid_tool_undo_free (GimpUndo *undo,
|
||||||
{
|
{
|
||||||
GimpTransformGridToolUndo *tg_tool_undo = GIMP_TRANSFORM_GRID_TOOL_UNDO (undo);
|
GimpTransformGridToolUndo *tg_tool_undo = GIMP_TRANSFORM_GRID_TOOL_UNDO (undo);
|
||||||
|
|
||||||
if (tg_tool_undo->tg_tool)
|
g_clear_weak_pointer (&tg_tool_undo->tg_tool);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (tg_tool_undo->tg_tool),
|
|
||||||
(gpointer) &tg_tool_undo->tg_tool);
|
|
||||||
tg_tool_undo->tg_tool = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (tg_tool_undo->original)
|
if (tg_tool_undo->original)
|
||||||
|
|
|
@ -382,14 +382,12 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
|
||||||
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 3.0, 100.0);
|
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 3.0, 100.0);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
||||||
|
|
||||||
options->animate_button = gtk_button_new_with_label (_("Create Animation"));
|
g_set_weak_pointer (&options->animate_button,
|
||||||
|
gtk_button_new_with_label (_("Create Animation")));
|
||||||
gtk_widget_set_sensitive (options->animate_button, FALSE);
|
gtk_widget_set_sensitive (options->animate_button, FALSE);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), options->animate_button,
|
gtk_box_pack_start (GTK_BOX (vbox2), options->animate_button,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (options->animate_button);
|
gtk_widget_show (options->animate_button);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (options->animate_button),
|
|
||||||
(gpointer) &options->animate_button);
|
|
||||||
|
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
|
@ -710,8 +710,6 @@ gimp_color_dialog_image_changed (GimpContext *context,
|
||||||
{
|
{
|
||||||
if (dialog->active_image)
|
if (dialog->active_image)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dialog->active_image),
|
|
||||||
(gpointer) &dialog->active_image);
|
|
||||||
g_signal_handlers_disconnect_by_func (dialog->active_image,
|
g_signal_handlers_disconnect_by_func (dialog->active_image,
|
||||||
G_CALLBACK (gimp_color_dialog_update),
|
G_CALLBACK (gimp_color_dialog_update),
|
||||||
dialog);
|
dialog);
|
||||||
|
@ -719,11 +717,11 @@ gimp_color_dialog_image_changed (GimpContext *context,
|
||||||
gimp_color_dialog_update_simulation,
|
gimp_color_dialog_update_simulation,
|
||||||
dialog);
|
dialog);
|
||||||
}
|
}
|
||||||
dialog->active_image = image;
|
|
||||||
|
g_set_weak_pointer (&dialog->active_image, image);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (dialog->active_image),
|
|
||||||
(gpointer) &dialog->active_image);
|
|
||||||
g_signal_connect_swapped (image, "notify::base-type",
|
g_signal_connect_swapped (image, "notify::base-type",
|
||||||
G_CALLBACK (gimp_color_dialog_update),
|
G_CALLBACK (gimp_color_dialog_update),
|
||||||
dialog);
|
dialog);
|
||||||
|
@ -739,6 +737,7 @@ gimp_color_dialog_image_changed (GimpContext *context,
|
||||||
|
|
||||||
gimp_color_dialog_update_simulation (image, dialog);
|
gimp_color_dialog_update_simulation (image, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_dialog_update (dialog);
|
gimp_color_dialog_update (dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,12 +349,7 @@ gimp_color_display_editor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GimpColorDisplayEditor *editor = GIMP_COLOR_DISPLAY_EDITOR (object);
|
GimpColorDisplayEditor *editor = GIMP_COLOR_DISPLAY_EDITOR (object);
|
||||||
|
|
||||||
if (editor->selected)
|
g_clear_weak_pointer (&editor->selected);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (editor->selected),
|
|
||||||
(gpointer) &editor->selected);
|
|
||||||
editor->selected = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&editor->stack);
|
g_clear_object (&editor->stack);
|
||||||
g_clear_object (&editor->config);
|
g_clear_object (&editor->config);
|
||||||
|
@ -547,12 +542,7 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
||||||
GimpColorDisplay *display = NULL;
|
GimpColorDisplay *display = NULL;
|
||||||
gchar *tip = NULL;
|
gchar *tip = NULL;
|
||||||
|
|
||||||
if (editor->selected)
|
g_clear_weak_pointer (&editor->selected);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (editor->selected),
|
|
||||||
(gpointer) &editor->selected);
|
|
||||||
editor->selected = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
if (gtk_tree_selection_get_selected (sel, &model, &iter))
|
||||||
{
|
{
|
||||||
|
@ -580,10 +570,7 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
|
||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
{
|
{
|
||||||
editor->selected = display;
|
g_set_weak_pointer (&editor->selected, display);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (display),
|
|
||||||
(gpointer) &editor->selected);
|
|
||||||
|
|
||||||
editor->config_widget = gimp_color_display_configure (display);
|
editor->config_widget = gimp_color_display_configure (display);
|
||||||
|
|
||||||
|
|
|
@ -721,8 +721,6 @@ gimp_colormap_selection_image_changed (GimpColormapSelection *selection,
|
||||||
{
|
{
|
||||||
if (selection->active_image)
|
if (selection->active_image)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (selection->active_image),
|
|
||||||
(gpointer) &selection->active_image);
|
|
||||||
g_signal_handlers_disconnect_by_func (selection->active_image,
|
g_signal_handlers_disconnect_by_func (selection->active_image,
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
selection);
|
selection);
|
||||||
|
@ -758,11 +756,11 @@ gimp_colormap_selection_image_changed (GimpColormapSelection *selection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selection->active_image = image;
|
|
||||||
|
g_set_weak_pointer (&selection->active_image, image);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (selection->active_image),
|
|
||||||
(gpointer) &selection->active_image);
|
|
||||||
g_signal_connect_swapped (image, "colormap-changed",
|
g_signal_connect_swapped (image, "colormap-changed",
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
selection);
|
selection);
|
||||||
|
@ -770,6 +768,7 @@ gimp_colormap_selection_image_changed (GimpColormapSelection *selection,
|
||||||
G_CALLBACK (gimp_colormap_selection_set_palette),
|
G_CALLBACK (gimp_colormap_selection_set_palette),
|
||||||
selection);
|
selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_colormap_selection_set_palette (selection);
|
gimp_colormap_selection_set_palette (selection);
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (selection));
|
gtk_widget_queue_draw (GTK_WIDGET (selection));
|
||||||
}
|
}
|
||||||
|
@ -786,25 +785,22 @@ gimp_colormap_selection_set_palette (GimpColormapSelection *selection)
|
||||||
{
|
{
|
||||||
if (selection->active_palette)
|
if (selection->active_palette)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (selection->active_palette),
|
|
||||||
(gpointer) &selection->active_palette);
|
|
||||||
g_signal_handlers_disconnect_by_func (selection->active_palette,
|
g_signal_handlers_disconnect_by_func (selection->active_palette,
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
selection);
|
selection);
|
||||||
gimp_view_set_viewable (GIMP_VIEW (selection->view), NULL);
|
gimp_view_set_viewable (GIMP_VIEW (selection->view), NULL);
|
||||||
gtk_adjustment_set_upper (selection->index_adjustment, 0);
|
gtk_adjustment_set_upper (selection->index_adjustment, 0);
|
||||||
}
|
}
|
||||||
selection->active_palette = palette;
|
|
||||||
|
g_set_weak_pointer (&selection->active_palette, palette);
|
||||||
|
|
||||||
if (palette)
|
if (palette)
|
||||||
{
|
{
|
||||||
g_object_add_weak_pointer (G_OBJECT (selection->active_palette),
|
|
||||||
(gpointer) &selection->active_palette);
|
|
||||||
g_signal_connect_swapped (palette, "dirty",
|
g_signal_connect_swapped (palette, "dirty",
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
selection);
|
selection);
|
||||||
gimp_view_set_viewable (GIMP_VIEW (selection->view),
|
gimp_view_set_viewable (GIMP_VIEW (selection->view),
|
||||||
GIMP_VIEWABLE (palette));
|
GIMP_VIEWABLE (palette));
|
||||||
|
|
||||||
gtk_adjustment_set_upper (selection->index_adjustment,
|
gtk_adjustment_set_upper (selection->index_adjustment,
|
||||||
gimp_image_get_colormap_size (selection->active_image) - 1);
|
gimp_image_get_colormap_size (selection->active_image) - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,12 +224,7 @@ gimp_container_entry_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GimpContainerEntry *entry = GIMP_CONTAINER_ENTRY (object);
|
GimpContainerEntry *entry = GIMP_CONTAINER_ENTRY (object);
|
||||||
|
|
||||||
if (entry->viewable)
|
g_clear_weak_pointer (&entry->viewable);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (entry->viewable),
|
|
||||||
(gpointer) &entry->viewable);
|
|
||||||
entry->viewable = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -331,19 +326,10 @@ gimp_container_entry_select_items (GimpContainerView *view,
|
||||||
gimp_container_entry_changed,
|
gimp_container_entry_changed,
|
||||||
view);
|
view);
|
||||||
|
|
||||||
if (container_entry->viewable)
|
g_set_weak_pointer (&container_entry->viewable, viewable);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (container_entry->viewable),
|
|
||||||
(gpointer) &container_entry->viewable);
|
|
||||||
container_entry->viewable = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewable)
|
if (viewable)
|
||||||
{
|
{
|
||||||
container_entry->viewable = viewable;
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (container_entry->viewable),
|
|
||||||
(gpointer) &container_entry->viewable);
|
|
||||||
|
|
||||||
gtk_entry_set_icon_from_icon_name (entry,
|
gtk_entry_set_icon_from_icon_name (entry,
|
||||||
GTK_ENTRY_ICON_SECONDARY,
|
GTK_ENTRY_ICON_SECONDARY,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -415,24 +401,14 @@ gimp_container_entry_changed (GtkEntry *entry,
|
||||||
if (! container)
|
if (! container)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (container_entry->viewable)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (container_entry->viewable),
|
|
||||||
(gpointer) &container_entry->viewable);
|
|
||||||
container_entry->viewable = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
text = gtk_entry_get_text (entry);
|
text = gtk_entry_get_text (entry);
|
||||||
|
|
||||||
object = gimp_container_get_child_by_name (container, text);
|
object = gimp_container_get_child_by_name (container, text);
|
||||||
|
|
||||||
if (object)
|
g_set_weak_pointer (&container_entry->viewable, GIMP_VIEWABLE (object));
|
||||||
{
|
|
||||||
container_entry->viewable = GIMP_VIEWABLE (object);
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (container_entry->viewable),
|
|
||||||
(gpointer) &container_entry->viewable);
|
|
||||||
|
|
||||||
gimp_container_view_item_selected (view, GIMP_VIEWABLE (object));
|
if (container_entry->viewable)
|
||||||
|
{
|
||||||
|
gimp_container_view_item_selected (view, container_entry->viewable);
|
||||||
|
|
||||||
gtk_entry_set_icon_from_icon_name (entry,
|
gtk_entry_set_icon_from_icon_name (entry,
|
||||||
GTK_ENTRY_ICON_SECONDARY,
|
GTK_ENTRY_ICON_SECONDARY,
|
||||||
|
|
|
@ -648,7 +648,8 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
|
||||||
title = g_strdup_printf (_("Select Action for Event '%s'"),
|
title = g_strdup_printf (_("Select Action for Event '%s'"),
|
||||||
event_blurb);
|
event_blurb);
|
||||||
|
|
||||||
editor->edit_dialog =
|
g_set_weak_pointer
|
||||||
|
(&editor->edit_dialog,
|
||||||
gimp_viewable_dialog_new (g_list_prepend (NULL, editor->info), editor->context,
|
gimp_viewable_dialog_new (g_list_prepend (NULL, editor->info), editor->context,
|
||||||
_("Select Controller Event Action"),
|
_("Select Controller Event Action"),
|
||||||
"gimp-controller-action-dialog",
|
"gimp-controller-action-dialog",
|
||||||
|
@ -661,7 +662,7 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||||
_("_OK"), GTK_RESPONSE_OK,
|
_("_OK"), GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL));
|
||||||
|
|
||||||
g_free (title);
|
g_free (title);
|
||||||
|
|
||||||
|
@ -670,9 +671,6 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
|
||||||
GTK_RESPONSE_CANCEL,
|
GTK_RESPONSE_CANCEL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (editor->edit_dialog),
|
|
||||||
(gpointer) &editor->edit_dialog);
|
|
||||||
|
|
||||||
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
|
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
|
||||||
"gimp-controller-action-dialog",
|
"gimp-controller-action-dialog",
|
||||||
editor->edit_dialog,
|
editor->edit_dialog,
|
||||||
|
@ -693,10 +691,9 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
|
||||||
G_CALLBACK (gimp_controller_editor_edit_activated),
|
G_CALLBACK (gimp_controller_editor_edit_activated),
|
||||||
editor);
|
editor);
|
||||||
|
|
||||||
editor->edit_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (GIMP_ACTION_EDITOR (view)->view));
|
g_set_weak_pointer
|
||||||
|
(&editor->edit_sel,
|
||||||
g_object_add_weak_pointer (G_OBJECT (editor->edit_sel),
|
gtk_tree_view_get_selection (GTK_TREE_VIEW (GIMP_ACTION_EDITOR (view)->view)));
|
||||||
(gpointer) &editor->edit_sel);
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
||||||
gtk_widget_show (editor->edit_dialog);
|
gtk_widget_show (editor->edit_dialog);
|
||||||
|
|
|
@ -238,7 +238,7 @@ gimp_controller_list_init (GimpControllerList *list)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
list->add_button = gtk_button_new ();
|
g_set_weak_pointer (&list->add_button, gtk_button_new ());
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), list->add_button, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), list->add_button, TRUE, FALSE, 0);
|
||||||
gtk_widget_set_sensitive (list->add_button, FALSE);
|
gtk_widget_set_sensitive (list->add_button, FALSE);
|
||||||
gtk_widget_show (list->add_button);
|
gtk_widget_show (list->add_button);
|
||||||
|
@ -252,10 +252,7 @@ gimp_controller_list_init (GimpControllerList *list)
|
||||||
G_CALLBACK (gimp_controller_list_add_clicked),
|
G_CALLBACK (gimp_controller_list_add_clicked),
|
||||||
list);
|
list);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (list->add_button),
|
g_set_weak_pointer (&list->remove_button, gtk_button_new ());
|
||||||
(gpointer) &list->add_button);
|
|
||||||
|
|
||||||
list->remove_button = gtk_button_new ();
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), list->remove_button, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), list->remove_button, TRUE, FALSE, 0);
|
||||||
gtk_widget_set_sensitive (list->remove_button, FALSE);
|
gtk_widget_set_sensitive (list->remove_button, FALSE);
|
||||||
gtk_widget_show (list->remove_button);
|
gtk_widget_show (list->remove_button);
|
||||||
|
@ -269,9 +266,6 @@ gimp_controller_list_init (GimpControllerList *list)
|
||||||
G_CALLBACK (gimp_controller_list_remove_clicked),
|
G_CALLBACK (gimp_controller_list_remove_clicked),
|
||||||
list);
|
list);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (list->remove_button),
|
|
||||||
(gpointer) &list->remove_button);
|
|
||||||
|
|
||||||
gtk_icon_size_lookup (icon_size, &icon_width, &icon_height);
|
gtk_icon_size_lookup (icon_size, &icon_width, &icon_height);
|
||||||
list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0);
|
list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0);
|
||||||
gimp_container_tree_view_set_main_column_title (GIMP_CONTAINER_TREE_VIEW (list->dest),
|
gimp_container_tree_view_set_main_column_title (GIMP_CONTAINER_TREE_VIEW (list->dest),
|
||||||
|
|
|
@ -187,26 +187,9 @@ gimp_dock_columns_dispose (GObject *object)
|
||||||
g_object_unref (dock);
|
g_object_unref (dock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dock_columns->p->context)
|
g_clear_weak_pointer (&dock_columns->p->context);
|
||||||
{
|
g_clear_weak_pointer (&dock_columns->p->dialog_factory);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->context),
|
g_clear_weak_pointer (&dock_columns->p->ui_manager);
|
||||||
(gpointer) &dock_columns->p->context);
|
|
||||||
dock_columns->p->context = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dock_columns->p->dialog_factory)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->dialog_factory),
|
|
||||||
(gpointer) &dock_columns->p->dialog_factory);
|
|
||||||
dock_columns->p->dialog_factory = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dock_columns->p->ui_manager)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->ui_manager),
|
|
||||||
(gpointer)&dock_columns->p->ui_manager);
|
|
||||||
dock_columns->p->ui_manager = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -222,33 +205,18 @@ gimp_dock_columns_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_CONTEXT:
|
case PROP_CONTEXT:
|
||||||
if (dock_columns->p->context)
|
g_set_weak_pointer (&dock_columns->p->context,
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->context),
|
g_value_get_object (value));
|
||||||
(gpointer) &dock_columns->p->context);
|
|
||||||
dock_columns->p->context = g_value_get_object (value);
|
|
||||||
if (dock_columns->p->context)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dock_columns->p->context),
|
|
||||||
(gpointer) &dock_columns->p->context);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DIALOG_FACTORY:
|
case PROP_DIALOG_FACTORY:
|
||||||
if (dock_columns->p->dialog_factory)
|
g_set_weak_pointer (&dock_columns->p->dialog_factory,
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->dialog_factory),
|
g_value_get_object (value));
|
||||||
(gpointer) &dock_columns->p->dialog_factory);
|
|
||||||
dock_columns->p->dialog_factory = g_value_get_object (value);
|
|
||||||
if (dock_columns->p->dialog_factory)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dock_columns->p->dialog_factory),
|
|
||||||
(gpointer) &dock_columns->p->dialog_factory);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_UI_MANAGER:
|
case PROP_UI_MANAGER:
|
||||||
if (dock_columns->p->ui_manager)
|
g_set_weak_pointer (&dock_columns->p->ui_manager,
|
||||||
g_object_remove_weak_pointer (G_OBJECT (dock_columns->p->ui_manager),
|
g_value_get_object (value));
|
||||||
(gpointer) &dock_columns->p->ui_manager);
|
|
||||||
dock_columns->p->ui_manager = g_value_get_object (value);
|
|
||||||
if (dock_columns->p->ui_manager)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dock_columns->p->ui_manager),
|
|
||||||
(gpointer) &dock_columns->p->ui_manager);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -240,12 +240,11 @@ gimp_editor_constructed (GObject *object)
|
||||||
|
|
||||||
if (editor->priv->menu_factory && editor->priv->menu_identifier)
|
if (editor->priv->menu_factory && editor->priv->menu_identifier)
|
||||||
{
|
{
|
||||||
editor->priv->ui_manager =
|
g_set_weak_pointer
|
||||||
|
(&editor->priv->ui_manager,
|
||||||
gimp_menu_factory_get_manager (editor->priv->menu_factory,
|
gimp_menu_factory_get_manager (editor->priv->menu_factory,
|
||||||
editor->priv->menu_identifier,
|
editor->priv->menu_identifier,
|
||||||
editor->priv->popup_data);
|
editor->priv->popup_data));
|
||||||
g_object_add_weak_pointer (G_OBJECT (editor->priv->ui_manager),
|
|
||||||
(gpointer) &editor->priv->ui_manager);
|
|
||||||
|
|
||||||
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
||||||
"notify::theme",
|
"notify::theme",
|
||||||
|
@ -268,17 +267,9 @@ gimp_editor_dispose (GObject *object)
|
||||||
GimpEditor *editor = GIMP_EDITOR (object);
|
GimpEditor *editor = GIMP_EDITOR (object);
|
||||||
|
|
||||||
g_clear_object (&editor->priv->menu_factory);
|
g_clear_object (&editor->priv->menu_factory);
|
||||||
|
|
||||||
g_clear_pointer (&editor->priv->menu_identifier, g_free);
|
g_clear_pointer (&editor->priv->menu_identifier, g_free);
|
||||||
|
|
||||||
g_clear_pointer (&editor->priv->ui_path, g_free);
|
g_clear_pointer (&editor->priv->ui_path, g_free);
|
||||||
|
g_clear_weak_pointer (&editor->priv->ui_manager);
|
||||||
if (editor->priv->ui_manager)
|
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (editor->priv->ui_manager),
|
|
||||||
(gpointer) &editor->priv->ui_manager);
|
|
||||||
editor->priv->ui_manager = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -448,19 +439,14 @@ gimp_editor_create_menu (GimpEditor *editor,
|
||||||
editor->priv->menu_factory = g_object_ref (menu_factory);
|
editor->priv->menu_factory = g_object_ref (menu_factory);
|
||||||
|
|
||||||
if (editor->priv->ui_manager)
|
if (editor->priv->ui_manager)
|
||||||
{
|
|
||||||
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
|
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
|
||||||
G_CALLBACK (gimp_editor_style_updated),
|
G_CALLBACK (gimp_editor_style_updated),
|
||||||
editor);
|
editor);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (editor->priv->ui_manager),
|
|
||||||
(gpointer) &editor->priv->ui_manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
editor->priv->ui_manager = gimp_menu_factory_get_manager (menu_factory,
|
g_set_weak_pointer (&editor->priv->ui_manager,
|
||||||
|
gimp_menu_factory_get_manager (menu_factory,
|
||||||
menu_identifier,
|
menu_identifier,
|
||||||
popup_data);
|
popup_data));
|
||||||
g_object_add_weak_pointer (G_OBJECT (editor->priv->ui_manager),
|
|
||||||
(gpointer) &editor->priv->ui_manager);
|
|
||||||
|
|
||||||
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
||||||
"notify::theme",
|
"notify::theme",
|
||||||
|
|
|
@ -713,10 +713,8 @@ gimp_modifiers_editor_search_clicked (GtkWidget *button,
|
||||||
G_CALLBACK (gimp_controller_modifiers_action_activated),
|
G_CALLBACK (gimp_controller_modifiers_action_activated),
|
||||||
edit_dialog, 0);
|
edit_dialog, 0);
|
||||||
|
|
||||||
editor->priv->action_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (GIMP_ACTION_EDITOR (view)->view));
|
g_set_weak_pointer (&editor->priv->action_selection,
|
||||||
|
gtk_tree_view_get_selection (GTK_TREE_VIEW (GIMP_ACTION_EDITOR (view)->view)));
|
||||||
g_object_add_weak_pointer (G_OBJECT (editor->priv->action_selection),
|
|
||||||
(gpointer) &editor->priv->action_selection);
|
|
||||||
|
|
||||||
gtk_widget_show (edit_dialog);
|
gtk_widget_show (edit_dialog);
|
||||||
|
|
||||||
|
|
|
@ -108,18 +108,7 @@ gimp_open_dialog_set_image (GimpOpenDialog *dialog,
|
||||||
|
|
||||||
file_dialog = GIMP_FILE_DIALOG (dialog);
|
file_dialog = GIMP_FILE_DIALOG (dialog);
|
||||||
|
|
||||||
if (file_dialog->image)
|
g_set_weak_pointer (&file_dialog->image, image);
|
||||||
{
|
|
||||||
g_object_remove_weak_pointer (G_OBJECT (file_dialog->image),
|
|
||||||
(gpointer *) &file_dialog->image);
|
|
||||||
}
|
|
||||||
|
|
||||||
file_dialog->image = image;
|
|
||||||
dialog->open_as_layers = open_as_layers;
|
dialog->open_as_layers = open_as_layers;
|
||||||
|
|
||||||
if (file_dialog->image)
|
|
||||||
{
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (file_dialog->image),
|
|
||||||
(gpointer *) &file_dialog->image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -633,17 +633,16 @@ gimp_settings_box_manage_activate (GtkWidget *widget,
|
||||||
|
|
||||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
||||||
|
|
||||||
private->editor_dialog = gimp_dialog_new (_("Manage Saved Presets"),
|
g_set_weak_pointer (&private->editor_dialog,
|
||||||
|
gimp_dialog_new (_("Manage Saved Presets"),
|
||||||
"gimp-settings-editor-dialog",
|
"gimp-settings-editor-dialog",
|
||||||
toplevel, 0,
|
toplevel, 0,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
|
||||||
_("_Close"), GTK_RESPONSE_CLOSE,
|
_("_Close"), GTK_RESPONSE_CLOSE,
|
||||||
|
|
||||||
NULL);
|
NULL));
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->editor_dialog),
|
|
||||||
(gpointer) &private->editor_dialog);
|
|
||||||
g_signal_connect_object (toplevel, "unmap",
|
g_signal_connect_object (toplevel, "unmap",
|
||||||
G_CALLBACK (gimp_settings_box_toplevel_unmap),
|
G_CALLBACK (gimp_settings_box_toplevel_unmap),
|
||||||
private->editor_dialog, 0);
|
private->editor_dialog, 0);
|
||||||
|
@ -703,7 +702,7 @@ gimp_settings_box_file_dialog (GimpSettingsBox *box,
|
||||||
|
|
||||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
||||||
|
|
||||||
private->file_dialog = dialog =
|
dialog =
|
||||||
gtk_file_chooser_dialog_new (title, GTK_WINDOW (toplevel),
|
gtk_file_chooser_dialog_new (title, GTK_WINDOW (toplevel),
|
||||||
save ?
|
save ?
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE :
|
GTK_FILE_CHOOSER_ACTION_SAVE :
|
||||||
|
@ -715,6 +714,8 @@ gimp_settings_box_file_dialog (GimpSettingsBox *box,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
g_set_weak_pointer (&private->file_dialog, dialog);
|
||||||
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
|
@ -727,8 +728,6 @@ gimp_settings_box_file_dialog (GimpSettingsBox *box,
|
||||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dialog),
|
|
||||||
(gpointer) &private->file_dialog);
|
|
||||||
g_signal_connect_object (toplevel, "unmap",
|
g_signal_connect_object (toplevel, "unmap",
|
||||||
G_CALLBACK (gimp_settings_box_toplevel_unmap),
|
G_CALLBACK (gimp_settings_box_toplevel_unmap),
|
||||||
dialog, 0);
|
dialog, 0);
|
||||||
|
|
|
@ -585,9 +585,6 @@ gimp_view_real_set_viewable (GimpView *view,
|
||||||
|
|
||||||
if (view->viewable)
|
if (view->viewable)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (view->viewable),
|
|
||||||
(gpointer) &view->viewable);
|
|
||||||
|
|
||||||
if (! viewable && ! view->renderer->is_popup)
|
if (! viewable && ! view->renderer->is_popup)
|
||||||
{
|
{
|
||||||
if (gimp_dnd_viewable_source_remove (GTK_WIDGET (view),
|
if (gimp_dnd_viewable_source_remove (GTK_WIDGET (view),
|
||||||
|
@ -620,13 +617,8 @@ gimp_view_real_set_viewable (GimpView *view,
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_view_renderer_set_viewable (view->renderer, viewable);
|
gimp_view_renderer_set_viewable (view->renderer, viewable);
|
||||||
view->viewable = viewable;
|
|
||||||
|
|
||||||
if (view->viewable)
|
g_set_weak_pointer (&view->viewable, viewable);
|
||||||
{
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (view->viewable),
|
|
||||||
(gpointer) &view->viewable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
|
|
|
@ -334,13 +334,11 @@ gimp_viewable_dialog_set_viewables (GimpViewableDialog *dialog,
|
||||||
|
|
||||||
box = gtk_widget_get_parent (dialog->icon);
|
box = gtk_widget_get_parent (dialog->icon);
|
||||||
|
|
||||||
dialog->view = gimp_view_new (context, viewable, 32, 1, TRUE);
|
g_set_weak_pointer (&dialog->view,
|
||||||
|
gimp_view_new (context, viewable, 32, 1, TRUE));
|
||||||
gtk_box_pack_end (GTK_BOX (box), dialog->view, FALSE, FALSE, 2);
|
gtk_box_pack_end (GTK_BOX (box), dialog->view, FALSE, FALSE, 2);
|
||||||
gtk_widget_show (dialog->view);
|
gtk_widget_show (dialog->view);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (dialog->view),
|
|
||||||
(gpointer) &dialog->view);
|
|
||||||
|
|
||||||
gimp_viewable_dialog_name_changed (GIMP_OBJECT (viewable), dialog);
|
gimp_viewable_dialog_name_changed (GIMP_OBJECT (viewable), dialog);
|
||||||
|
|
||||||
if (GIMP_IS_ITEM (viewable))
|
if (GIMP_IS_ITEM (viewable))
|
||||||
|
|
|
@ -273,15 +273,7 @@ gimp_window_set_primary_focus_widget (GimpWindow *window,
|
||||||
|
|
||||||
private = window->private;
|
private = window->private;
|
||||||
|
|
||||||
if (private->primary_focus_widget)
|
g_set_weak_pointer (&private->primary_focus_widget, primary_focus);
|
||||||
g_object_remove_weak_pointer (G_OBJECT (private->primary_focus_widget),
|
|
||||||
(gpointer) &private->primary_focus_widget);
|
|
||||||
|
|
||||||
private->primary_focus_widget = primary_focus;
|
|
||||||
|
|
||||||
if (private->primary_focus_widget)
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (private->primary_focus_widget),
|
|
||||||
(gpointer) &private->primary_focus_widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
|
Loading…
Reference in New Issue