app/actions/image-commands.c allocate structs using GSlice.
2007-05-23 Sven Neumann <sven@gimp.org> * app/actions/image-commands.c * app/actions/templates-commands.c: allocate structs using GSlice. svn path=/trunk/; revision=22592
This commit is contained in:

committed by
Sven Neumann

parent
9ab35b10ce
commit
16f34d2143
@ -1,3 +1,8 @@
|
|||||||
|
2007-05-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/actions/image-commands.c
|
||||||
|
* app/actions/templates-commands.c: allocate structs using GSlice.
|
||||||
|
|
||||||
2007-05-23 Tor Lillqvist <tml@novell.com>
|
2007-05-23 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* plug-ins/common/tiff-save.c (save_paths): Use memset() instead
|
* plug-ins/common/tiff-save.c (save_paths): Use memset() instead
|
||||||
|
@ -65,13 +65,11 @@
|
|||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _ImageResizeOptions ImageResizeOptions;
|
typedef struct
|
||||||
|
|
||||||
struct _ImageResizeOptions
|
|
||||||
{
|
{
|
||||||
GimpContext *context;
|
GimpContext *context;
|
||||||
GimpDisplay *display;
|
GimpDisplay *display;
|
||||||
};
|
} ImageResizeOptions;
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
@ -85,12 +83,15 @@ static void image_resize_callback (GtkWidget *dialog,
|
|||||||
gint offset_y,
|
gint offset_y,
|
||||||
GimpItemSet layer_set,
|
GimpItemSet layer_set,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
static void image_resize_options_free (ImageResizeOptions *options);
|
||||||
|
|
||||||
static void image_print_size_callback (GtkWidget *dialog,
|
static void image_print_size_callback (GtkWidget *dialog,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
gdouble xresolution,
|
gdouble xresolution,
|
||||||
gdouble yresolution,
|
gdouble yresolution,
|
||||||
GimpUnit resolution_unit,
|
GimpUnit resolution_unit,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void image_scale_callback (GtkWidget *dialog,
|
static void image_scale_callback (GtkWidget *dialog,
|
||||||
GimpViewable *viewable,
|
GimpViewable *viewable,
|
||||||
gint width,
|
gint width,
|
||||||
@ -233,7 +234,7 @@ image_resize_cmd_callback (GtkAction *action,
|
|||||||
return_if_no_widget (widget, data);
|
return_if_no_widget (widget, data);
|
||||||
return_if_no_display (display, data);
|
return_if_no_display (display, data);
|
||||||
|
|
||||||
options = g_new0 (ImageResizeOptions, 1);
|
options = g_slice_new (ImageResizeOptions);
|
||||||
|
|
||||||
options->display = display;
|
options->display = display;
|
||||||
options->context = action_data_get_context (data);
|
options->context = action_data_get_context (data);
|
||||||
@ -254,7 +255,8 @@ image_resize_cmd_callback (GtkAction *action,
|
|||||||
G_CALLBACK (gtk_widget_destroy),
|
G_CALLBACK (gtk_widget_destroy),
|
||||||
dialog, G_CONNECT_SWAPPED);
|
dialog, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, options);
|
g_object_weak_ref (G_OBJECT (dialog),
|
||||||
|
(GWeakNotify) image_resize_options_free, options);
|
||||||
|
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
}
|
}
|
||||||
@ -565,6 +567,12 @@ image_resize_callback (GtkWidget *dialog,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
image_resize_options_free (ImageResizeOptions *options)
|
||||||
|
{
|
||||||
|
g_slice_free (ImageResizeOptions, options);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
image_print_size_callback (GtkWidget *dialog,
|
image_print_size_callback (GtkWidget *dialog,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
|
@ -49,26 +49,25 @@
|
|||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _TemplateDeleteData TemplateDeleteData;
|
typedef struct
|
||||||
|
|
||||||
struct _TemplateDeleteData
|
|
||||||
{
|
{
|
||||||
GimpContainer *container;
|
GimpContainer *container;
|
||||||
GimpTemplate *template;
|
GimpTemplate *template;
|
||||||
};
|
} TemplateDeleteData;
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
|
||||||
static void templates_new_response (GtkWidget *dialog,
|
static void templates_new_response (GtkWidget *dialog,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
TemplateOptionsDialog *options);
|
TemplateOptionsDialog *options);
|
||||||
static void templates_edit_response (GtkWidget *widget,
|
static void templates_edit_response (GtkWidget *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
TemplateOptionsDialog *options);
|
TemplateOptionsDialog *options);
|
||||||
static void templates_delete_response (GtkWidget *dialog,
|
static void templates_delete_response (GtkWidget *dialog,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
TemplateDeleteData *delete_data);
|
TemplateDeleteData *delete_data);
|
||||||
|
static void templates_delete_data_free (TemplateDeleteData *delete_data);
|
||||||
|
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
@ -89,11 +88,9 @@ templates_create_image_cmd_callback (GtkAction *action,
|
|||||||
|
|
||||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||||
{
|
{
|
||||||
GdkScreen *screen;
|
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (editor));
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
screen = gtk_widget_get_screen (GTK_WIDGET (editor));
|
|
||||||
|
|
||||||
dialog = gimp_dialog_factory_dialog_new (global_dialog_factory, screen,
|
dialog = gimp_dialog_factory_dialog_new (global_dialog_factory, screen,
|
||||||
"gimp-image-new-dialog",
|
"gimp-image-new-dialog",
|
||||||
-1, FALSE);
|
-1, FALSE);
|
||||||
@ -211,10 +208,8 @@ templates_delete_cmd_callback (GtkAction *action,
|
|||||||
|
|
||||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||||
{
|
{
|
||||||
TemplateDeleteData *delete_data;
|
TemplateDeleteData *delete_data = g_slice_new (TemplateDeleteData);
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
delete_data = g_new0 (TemplateDeleteData, 1);
|
|
||||||
|
|
||||||
delete_data->container = container;
|
delete_data->container = container;
|
||||||
delete_data->template = template;
|
delete_data->template = template;
|
||||||
@ -234,7 +229,9 @@ templates_delete_cmd_callback (GtkAction *action,
|
|||||||
GTK_RESPONSE_CANCEL,
|
GTK_RESPONSE_CANCEL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, delete_data);
|
g_object_weak_ref (G_OBJECT (dialog),
|
||||||
|
(GWeakNotify) templates_delete_data_free, delete_data);
|
||||||
|
|
||||||
g_signal_connect_object (template, "disconnect",
|
g_signal_connect_object (template, "disconnect",
|
||||||
G_CALLBACK (gtk_widget_destroy),
|
G_CALLBACK (gtk_widget_destroy),
|
||||||
dialog, G_CONNECT_SWAPPED);
|
dialog, G_CONNECT_SWAPPED);
|
||||||
@ -306,3 +303,9 @@ templates_delete_response (GtkWidget *dialog,
|
|||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
templates_delete_data_free (TemplateDeleteData *delete_data)
|
||||||
|
{
|
||||||
|
g_slice_free (TemplateDeleteData, delete_data);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user