From cac3f7cb2503d6d49630581b35f51ca2c6f6799a Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 14 Jan 2001 03:55:56 +0000 Subject: [PATCH] app/apptypes.h app/brush_edit.c app/brush_select.c app/brushes_cmds.c 2001-01-14 Michael Natterer * app/apptypes.h * app/brush_edit.c * app/brush_select.c * app/brushes_cmds.c * app/channel.h * app/colormap_dialog.c * app/datafiles.[ch] * app/devices.c * app/docindex.c * app/fileops.c * app/gdisplay.c * app/gimage.c * app/gimpbrush.[ch] * app/gimpbrushgenerated.[ch] * app/gimpbrushlist.[ch] * app/gimpbrushpipe.[ch] * app/gimpcontext.[ch] * app/gimpcontextpreview.c * app/gimpdnd.c * app/gimpdrawable.h * app/gimpimage.[ch] * app/gimplist.h * app/gimpobject.h * app/gimpset.[ch] * app/gradient.c * app/info_window.c * app/layer.[ch] * app/module_db.c * app/palette.[ch] * app/patterns.[ch] * app/plug_in.[ch] * app/undo_history.c * app/xcf.c * tools/pdbgen/pdb/brushes.pdb - Removed the "name" argument from all objects and use GimpObject's name. - Use the same code in all "uniquefy name" functions (this functionality will be a method of the "GimpContainer" class). - Renamed the parent instances of all objects to "parent instance". - Added missing instance and class cast macros. - Changed some "gchar *" to "const gchar *" parameters. --- ChangeLog | 45 ++++++++ app/actions/plug-in-commands.c | 10 +- app/apptypes.h | 9 +- app/brush_edit.c | 15 +-- app/brush_select.c | 23 ++-- app/brushes_cmds.c | 8 +- app/channel.h | 30 ++--- app/colormap_dialog.c | 2 +- app/core/gimpbrush-load.c | 68 +++--------- app/core/gimpbrush.c | 68 +++--------- app/core/gimpbrush.h | 33 +++--- app/core/gimpbrushgenerated-load.c | 12 +- app/core/gimpbrushgenerated-save.c | 12 +- app/core/gimpbrushgenerated.c | 12 +- app/core/gimpbrushgenerated.h | 24 ++-- app/core/gimpbrushpipe-load.c | 37 +++---- app/core/gimpbrushpipe.c | 37 +++---- app/core/gimpbrushpipe.h | 12 +- app/core/gimpchannel-combine.h | 30 ++--- app/core/gimpchannel.h | 30 ++--- app/core/gimpcontext.c | 40 +++---- app/core/gimpcontext.h | 19 ++-- app/core/gimpdatafiles.c | 8 +- app/core/gimpdatafiles.h | 16 ++- app/core/gimpdrawable.h | 4 +- app/core/gimpimage-guides.c | 64 ++++------- app/core/gimpimage-guides.h | 6 +- app/core/gimpimage-merge.c | 64 ++++------- app/core/gimpimage-merge.h | 6 +- app/core/gimpimage-projection.c | 64 ++++------- app/core/gimpimage-projection.h | 6 +- app/core/gimpimage-resize.c | 64 ++++------- app/core/gimpimage-resize.h | 6 +- app/core/gimpimage-scale.c | 64 ++++------- app/core/gimpimage-scale.h | 6 +- app/core/gimpimage.c | 64 ++++------- app/core/gimpimage.h | 6 +- app/core/gimplayer.c | 7 +- app/core/gimplayer.h | 38 +++---- app/core/gimplist.h | 19 ++-- app/core/gimpobject.h | 6 +- app/core/gimpprojection-construct.c | 64 ++++------- app/core/gimpprojection-construct.h | 6 +- app/core/gimpprojection.c | 2 +- app/datafiles.c | 8 +- app/datafiles.h | 16 ++- app/devices.c | 2 +- app/dialogs/info-window.c | 8 +- app/dialogs/module-dialog.c | 77 +++++++------ app/display/gimpdisplay.c | 2 +- app/docindex.c | 3 +- app/fileops.c | 2 +- app/gdisplay.c | 2 +- app/gimage.c | 2 +- app/gimpbrush.c | 68 +++--------- app/gimpbrush.h | 33 +++--- app/gimpbrushgenerated.c | 12 +- app/gimpbrushgenerated.h | 24 ++-- app/gimpbrushlist.c | 158 +++++++++++++++------------ app/gimpbrushlist.h | 16 +-- app/gimpbrushpipe.c | 37 +++---- app/gimpbrushpipe.h | 12 +- app/gimpchannel.h | 30 ++--- app/gimpcontext.c | 40 +++---- app/gimpcontext.h | 19 ++-- app/gimpcontextpreview.c | 9 +- app/gimpdnd.c | 2 +- app/gimpdrawable.h | 4 +- app/gimpimage.c | 64 ++++------- app/gimpimage.h | 6 +- app/gimplayer.c | 7 +- app/gimplayer.h | 38 +++---- app/gimplist.h | 19 ++-- app/gimpobject.h | 6 +- app/gimpset.c | 2 +- app/gimpset.h | 13 ++- app/gradient.c | 26 ++--- app/gradient_editor.c | 26 ++--- app/gui/brush-editor.c | 15 +-- app/gui/brush-select.c | 23 ++-- app/gui/colormap-dialog.c | 2 +- app/gui/device-status-dialog.c | 2 +- app/gui/gradient-editor.c | 26 ++--- app/gui/info-window.c | 8 +- app/gui/input-dialog.c | 2 +- app/gui/module-browser.c | 77 +++++++------ app/gui/palette-editor.c | 29 ++--- app/gui/palette-editor.h | 1 + app/gui/plug-in-commands.c | 10 +- app/gui/plug-in-menus.c | 10 +- app/info_window.c | 8 +- app/layer.c | 7 +- app/layer.h | 38 +++---- app/menus/plug-in-menus.c | 10 +- app/module_db.c | 77 +++++++------ app/palette.c | 29 ++--- app/palette.h | 1 + app/patterns.c | 33 +++--- app/patterns.h | 28 ++--- app/plug-in/gimpplugin-message.c | 10 +- app/plug-in/gimpplugin-progress.c | 10 +- app/plug-in/gimpplugin-progress.h | 2 +- app/plug-in/gimpplugin.c | 10 +- app/plug-in/gimpplugin.h | 2 +- app/plug-in/gimppluginmanager-call.c | 10 +- app/plug-in/gimppluginmanager-run.c | 10 +- app/plug-in/gimppluginmanager.c | 10 +- app/plug-in/gimppluginmanager.h | 2 +- app/plug-in/gimppluginshm.c | 10 +- app/plug-in/plug-in-def.c | 10 +- app/plug-in/plug-in-def.h | 2 +- app/plug-in/plug-in-message.c | 10 +- app/plug-in/plug-in-params.c | 10 +- app/plug-in/plug-in-params.h | 2 +- app/plug-in/plug-in-progress.c | 10 +- app/plug-in/plug-in-progress.h | 2 +- app/plug-in/plug-in-run.c | 10 +- app/plug-in/plug-in-shm.c | 10 +- app/plug-in/plug-in.c | 10 +- app/plug-in/plug-in.h | 2 +- app/plug-in/plug-ins.c | 10 +- app/plug-in/plug-ins.h | 2 +- app/plug_in.c | 10 +- app/plug_in.h | 2 +- app/undo_history.c | 2 +- app/widgets/gimpbrusheditor.c | 15 +-- app/widgets/gimpcolormapeditor.c | 2 +- app/widgets/gimpdeviceinfo.c | 2 +- app/widgets/gimpdevices.c | 2 +- app/widgets/gimpdnd.c | 2 +- app/widgets/gimpgradienteditor.c | 26 ++--- app/widgets/gimppaletteeditor.c | 29 ++--- app/widgets/gimppaletteeditor.h | 1 + app/xcf.c | 20 ++-- app/xcf/xcf.c | 20 ++-- libgimpbase/gimpdatafiles.c | 8 +- libgimpbase/gimpdatafiles.h | 16 ++- tools/pdbgen/pdb/brushes.pdb | 7 +- 138 files changed, 1287 insertions(+), 1438 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07d83c9d87..c6557d75f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2001-01-14 Michael Natterer + + * app/apptypes.h + * app/brush_edit.c + * app/brush_select.c + * app/brushes_cmds.c + * app/channel.h + * app/colormap_dialog.c + * app/datafiles.[ch] + * app/devices.c + * app/docindex.c + * app/fileops.c + * app/gdisplay.c + * app/gimage.c + * app/gimpbrush.[ch] + * app/gimpbrushgenerated.[ch] + * app/gimpbrushlist.[ch] + * app/gimpbrushpipe.[ch] + * app/gimpcontext.[ch] + * app/gimpcontextpreview.c + * app/gimpdnd.c + * app/gimpdrawable.h + * app/gimpimage.[ch] + * app/gimplist.h + * app/gimpobject.h + * app/gimpset.[ch] + * app/gradient.c + * app/info_window.c + * app/layer.[ch] + * app/module_db.c + * app/palette.[ch] + * app/patterns.[ch] + * app/plug_in.[ch] + * app/undo_history.c + * app/xcf.c + * tools/pdbgen/pdb/brushes.pdb + + - Removed the "name" argument from all objects and use + GimpObject's name. + - Use the same code in all "uniquefy name" functions (this + functionality will be a method of the "GimpContainer" class). + - Renamed the parent instances of all objects to "parent instance". + - Added missing instance and class cast macros. + - Changed some "gchar *" to "const gchar *" parameters. + 2001-01-12 Sven Neumann * TODO.xml: updated status diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 432aaecd81..1981ec16ad 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/apptypes.h b/app/apptypes.h index e38dcfc1c8..059f60fc15 100644 --- a/app/apptypes.h +++ b/app/apptypes.h @@ -88,9 +88,9 @@ typedef enum COLOR_MODE, VALUE_MODE, DIVIDE_MODE, - DODGE_MODE, - BURN_MODE, - HARDLIGHT_MODE, + DODGE_MODE, + BURN_MODE, + HARDLIGHT_MODE, ERASE_MODE, /*< skip >*/ REPLACE_MODE, /*< skip >*/ ANTI_ERASE_MODE /*< skip >*/ @@ -152,7 +152,7 @@ typedef enum } InterpolationType; typedef enum /*< skip >*/ -{ +{ ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL @@ -203,7 +203,6 @@ typedef enum PDB_CANCEL } PDBStatusType; - /* Procedure types */ typedef enum /*< chop=PDB_ >*/ { diff --git a/app/brush_edit.c b/app/brush_edit.c index 2ea93642f2..1b3bf5179c 100644 --- a/app/brush_edit.c +++ b/app/brush_edit.c @@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush, } static void -brush_renamed_callback (GtkWidget *widget, - BrushEditGeneratedWindow *begw) +brush_name_changed_callback (GtkWidget *widget, + BrushEditGeneratedWindow *begw) { gtk_entry_set_text (GTK_ENTRY (begw->name), - gimp_brush_get_name (GIMP_BRUSH (begw->brush))); + gimp_object_get_name (GIMP_OBJECT (begw->brush))); } void @@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback), begw); - gtk_signal_connect (GTK_OBJECT (brush), "rename", - GTK_SIGNAL_FUNC (brush_renamed_callback), + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", + GTK_SIGNAL_FUNC (brush_name_changed_callback), begw); begw->brush = NULL; @@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gimp_brush_generated_get_angle (brush)); gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data), gimp_brush_generated_get_aspect_ratio (brush)); - gtk_entry_set_text (GTK_ENTRY (begw->name), gimp_brush_get_name (gbrush)); + gtk_entry_set_text (GTK_ENTRY (begw->name), + gimp_object_get_name (GIMP_OBJECT (gbrush))); begw->brush = brush; gtk_object_ref (GTK_OBJECT (begw->brush)); @@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget, gchar *entry_text; entry_text = gtk_entry_get_text (GTK_ENTRY (widget)); - gimp_brush_set_name (GIMP_BRUSH (begw->brush), entry_text); + gimp_object_set_name (GIMP_OBJECT (begw->brush), entry_text); } void diff --git a/app/brush_select.c b/app/brush_select.c index 24bb569a16..3fbf2e6eba 100644 --- a/app/brush_select.c +++ b/app/brush_select.c @@ -676,10 +676,11 @@ static void brush_change_callbacks (BrushSelect *bsp, gboolean closing) { - gchar *name; + gchar *name; ProcRecord *prec = NULL; - GimpBrush *brush; - gint nreturn_vals; + GimpBrush *brush; + gint nreturn_vals; + static gboolean busy = FALSE; /* Any procs registered to callback? */ @@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp, if (!bsp || !bsp->callback_name || busy) return; - busy = TRUE; - name = bsp->callback_name; + busy = TRUE; + name = bsp->callback_name; brush = gimp_context_get_brush (bsp->context); /* If its still registered run it */ @@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp, return_vals = procedural_db_run_proc (name, &nreturn_vals, - PDB_STRING, brush->name, + PDB_STRING, GIMP_OBJECT (brush)->name, PDB_FLOAT, gimp_context_get_opacity (bsp->context), PDB_INT32, bsp->spacing_value, PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context), @@ -725,9 +726,9 @@ void brushes_check_dialogs (void) { BrushSelect *bsp; - GSList *list; - gchar *name; - ProcRecord *prec = NULL; + GSList *list; + gchar *name; + ProcRecord *prec = NULL; list = brush_active_dialogs; @@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), bsp); - gtk_signal_connect (GTK_OBJECT (brush), "rename", + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), bsp); } @@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp) return; /* Set brush name */ - gtk_label_set_text (GTK_LABEL (bsp->brush_name), brush->name); + gtk_label_set_text (GTK_LABEL (bsp->brush_name), GIMP_OBJECT (brush)->name); /* Set brush size */ g_snprintf (buf, sizeof (buf), "(%d x %d)", diff --git a/app/brushes_cmds.c b/app/brushes_cmds.c index e3c5711b34..086479da4a 100644 --- a/app/brushes_cmds.c +++ b/app/brushes_cmds.c @@ -106,7 +106,7 @@ brushes_get_brush_invoker (Argument *args) if (success) { - return_args[1].value.pdb_pointer = g_strdup (brush->name); + return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); return_args[2].value.pdb_int = brush->mask->width; return_args[3].value.pdb_int = brush->mask->height; return_args[4].value.pdb_int = brush->spacing; @@ -450,7 +450,7 @@ brushes_list_invoker (Argument *args) while (list) { - brushes[i++] = g_strdup (((GimpBrush *) list->data)->name); + brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name); list = list->next; } @@ -521,7 +521,7 @@ brushes_get_brush_data_invoker (Argument *args) { brush = (GimpBrush *) list->data; - if (!strcmp (brush->name, name)) + if (!strcmp (GIMP_OBJECT (brush)->name, name)) { success = TRUE; break; @@ -543,7 +543,7 @@ brushes_get_brush_data_invoker (Argument *args) if (success) { - return_args[1].value.pdb_pointer = g_strdup (brush->name); + return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); return_args[2].value.pdb_float = 1.0; return_args[3].value.pdb_int = brush->spacing; return_args[4].value.pdb_int = 0; diff --git a/app/channel.h b/app/channel.h index 719d4f22c8..0e8a7816ef 100644 --- a/app/channel.h +++ b/app/channel.h @@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass; struct _GimpChannel { - GimpDrawable drawable; + GimpDrawable parent_instance; - guchar col[3]; /* RGB triplet for channel color */ - gint opacity; /* Channel opacity */ - gboolean show_masked; /* Show masked areas--as */ - /* opposed to selected areas */ + guchar col[3]; /* RGB triplet for channel color */ + gint opacity; /* Channel opacity */ + gboolean show_masked; /* Show masked areas--as */ + /* opposed to selected areas */ /* Selection mask variables */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs_in; /* outline of selected region */ - BoundSeg *segs_out; /* outline of selected region */ - gint num_segs_in; /* number of lines in boundary */ - gint num_segs_out; /* number of lines in boundary */ - gboolean empty; /* is the region empty? */ - gboolean bounds_known; /* recalculate the bounds? */ - gint x1, y1; /* coordinates for bounding box */ - gint x2, y2; /* lower right hand coordinate */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs_in; /* outline of selected region */ + BoundSeg *segs_out; /* outline of selected region */ + gint num_segs_in; /* number of lines in boundary */ + gint num_segs_out; /* number of lines in boundary */ + gboolean empty; /* is the region empty? */ + gboolean bounds_known; /* recalculate the bounds? */ + gint x1, y1; /* coordinates for bounding box */ + gint x2, y2; /* lower right hand coordinate */ }; struct _GimpChannelClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpChannel *channel); }; diff --git a/app/colormap_dialog.c b/app/colormap_dialog.c index c9903c47b5..124371fe12 100644 --- a/app/colormap_dialog.c +++ b/app/colormap_dialog.c @@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context) image_cmap_change_cb, ipal); ipal->rename_handler = gimp_set_add_handler (context, - "rename", + "name_changed", image_rename_cb, ipal); diff --git a/app/core/gimpbrush-load.c b/app/core/gimpbrush-load.c index 0bc11ed089..b0878d201b 100644 --- a/app/core/gimpbrush-load.c +++ b/app/core/gimpbrush-load.c @@ -59,7 +59,6 @@ enum { DIRTY, - RENAME, LAST_SIGNAL }; @@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object) GimpBrush *brush = GIMP_BRUSH (object); g_free (brush->filename); - g_free (brush->name); if (brush->mask) temp_buf_free (brush->mask); @@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass) gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); - gimp_brush_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpBrushClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, gimp_brush_signals, LAST_SIGNAL); object_class->destroy = gimp_brush_destroy; klass->dirty = NULL; - klass->rename = NULL; klass->select_brush = gimp_brush_select_brush; klass->want_null_motion = gimp_brush_want_null_motion; @@ -129,7 +117,6 @@ void gimp_brush_init (GimpBrush *brush) { brush->filename = NULL; - brush->name = NULL; brush->spacing = 20; brush->x_axis.x = 15.0; @@ -167,7 +154,7 @@ gimp_brush_get_type (void) } GimpBrush * -gimp_brush_load (gchar *filename) +gimp_brush_load (const gchar *filename) { GimpBrush *brush; gint fd; @@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core) } TempBuf * -gimp_brush_get_mask (GimpBrush *brush) +gimp_brush_get_mask (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush) } TempBuf * -gimp_brush_get_pixmap (GimpBrush *brush) +gimp_brush_get_pixmap (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush) return brush->pixmap; } -gchar * -gimp_brush_get_name (GimpBrush *brush) -{ - g_return_val_if_fail (brush != NULL, NULL); - g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); - - return brush->name; -} - -void -gimp_brush_set_name (GimpBrush *brush, - gchar *name) -{ - g_return_if_fail (brush != NULL); - g_return_if_fail (GIMP_IS_BRUSH (brush)); - - if (strcmp (brush->name, name) == 0) - return; - - if (brush->name) - g_free (brush->name); - brush->name = g_strdup (name); - - gtk_signal_emit (GTK_OBJECT (brush), gimp_brush_signals[RENAME]); -} - gint -gimp_brush_get_spacing (GimpBrush *brush) +gimp_brush_get_spacing (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, 0); g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0); @@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush, } GimpBrush * -gimp_brush_load_brush (gint fd, - gchar *filename) +gimp_brush_load_brush (gint fd, + const gchar *filename) { GimpBrush *brush; GPattern *pattern; @@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd, g_return_val_if_fail (fd != -1, NULL); /* Read in the header size */ - if (read (fd, &header, sizeof (header)) != sizeof (header)) + if (read (fd, &header, sizeof (header)) != sizeof (header)) return NULL; /* rearrange the bytes in each unsigned int */ @@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd, switch (header.bytes) { case 1: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); - if (read (fd, + if (read (fd, temp_buf_data (brush->mask), header.width * header.height) < header.width * header.height) { @@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd, gtk_object_unref (GTK_OBJECT (brush)); return NULL; } - + /* For backwards-compatibility, check if a pattern follows. The obsolete .gpb format did it this way. */ pattern = pattern_load (fd, filename); @@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd, break; case 4: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL); for (i = 0; i < header.width * header.height; i++) { - if (read (fd, temp_buf_data (brush->pixmap) + if (read (fd, temp_buf_data (brush->pixmap) + i * 3, 3) != 3 || read (fd, temp_buf_data (brush->mask) + i, 1) != 1) { @@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd, return NULL; } - brush->name = name; + gimp_object_set_name (GIMP_OBJECT (brush), name); + + g_free (name); + brush->spacing = header.spacing; brush->x_axis.x = header.width / 2.0; brush->x_axis.y = 0.0; diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c index 0bc11ed089..b0878d201b 100644 --- a/app/core/gimpbrush.c +++ b/app/core/gimpbrush.c @@ -59,7 +59,6 @@ enum { DIRTY, - RENAME, LAST_SIGNAL }; @@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object) GimpBrush *brush = GIMP_BRUSH (object); g_free (brush->filename); - g_free (brush->name); if (brush->mask) temp_buf_free (brush->mask); @@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass) gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); - gimp_brush_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpBrushClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, gimp_brush_signals, LAST_SIGNAL); object_class->destroy = gimp_brush_destroy; klass->dirty = NULL; - klass->rename = NULL; klass->select_brush = gimp_brush_select_brush; klass->want_null_motion = gimp_brush_want_null_motion; @@ -129,7 +117,6 @@ void gimp_brush_init (GimpBrush *brush) { brush->filename = NULL; - brush->name = NULL; brush->spacing = 20; brush->x_axis.x = 15.0; @@ -167,7 +154,7 @@ gimp_brush_get_type (void) } GimpBrush * -gimp_brush_load (gchar *filename) +gimp_brush_load (const gchar *filename) { GimpBrush *brush; gint fd; @@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core) } TempBuf * -gimp_brush_get_mask (GimpBrush *brush) +gimp_brush_get_mask (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush) } TempBuf * -gimp_brush_get_pixmap (GimpBrush *brush) +gimp_brush_get_pixmap (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush) return brush->pixmap; } -gchar * -gimp_brush_get_name (GimpBrush *brush) -{ - g_return_val_if_fail (brush != NULL, NULL); - g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); - - return brush->name; -} - -void -gimp_brush_set_name (GimpBrush *brush, - gchar *name) -{ - g_return_if_fail (brush != NULL); - g_return_if_fail (GIMP_IS_BRUSH (brush)); - - if (strcmp (brush->name, name) == 0) - return; - - if (brush->name) - g_free (brush->name); - brush->name = g_strdup (name); - - gtk_signal_emit (GTK_OBJECT (brush), gimp_brush_signals[RENAME]); -} - gint -gimp_brush_get_spacing (GimpBrush *brush) +gimp_brush_get_spacing (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, 0); g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0); @@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush, } GimpBrush * -gimp_brush_load_brush (gint fd, - gchar *filename) +gimp_brush_load_brush (gint fd, + const gchar *filename) { GimpBrush *brush; GPattern *pattern; @@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd, g_return_val_if_fail (fd != -1, NULL); /* Read in the header size */ - if (read (fd, &header, sizeof (header)) != sizeof (header)) + if (read (fd, &header, sizeof (header)) != sizeof (header)) return NULL; /* rearrange the bytes in each unsigned int */ @@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd, switch (header.bytes) { case 1: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); - if (read (fd, + if (read (fd, temp_buf_data (brush->mask), header.width * header.height) < header.width * header.height) { @@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd, gtk_object_unref (GTK_OBJECT (brush)); return NULL; } - + /* For backwards-compatibility, check if a pattern follows. The obsolete .gpb format did it this way. */ pattern = pattern_load (fd, filename); @@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd, break; case 4: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL); for (i = 0; i < header.width * header.height; i++) { - if (read (fd, temp_buf_data (brush->pixmap) + if (read (fd, temp_buf_data (brush->pixmap) + i * 3, 3) != 3 || read (fd, temp_buf_data (brush->mask) + i, 1) != 1) { @@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd, return NULL; } - brush->name = name; + gimp_object_set_name (GIMP_OBJECT (brush), name); + + g_free (name); + brush->spacing = header.spacing; brush->x_axis.x = header.width / 2.0; brush->x_axis.y = 0.0; diff --git a/app/core/gimpbrush.h b/app/core/gimpbrush.h index 3fef4331cc..4e7841a700 100644 --- a/app/core/gimpbrush.h +++ b/app/core/gimpbrush.h @@ -23,20 +23,20 @@ #include "gimpobject.h" -#define GIMP_TYPE_BRUSH (gimp_brush_get_type ()) -#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush)) -#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH)) -#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_brush_get_type(), GimpBrushClass)) +#define GIMP_TYPE_BRUSH (gimp_brush_get_type ()) +#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush)) +#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass)) +#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH)) +#define GIMP_IS_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH)) typedef struct _GimpBrushClass GimpBrushClass; struct _GimpBrush { - GimpObject gobject; + GimpObject parent_instance; gchar *filename; /* actual filename--brush's location on disk */ - gchar *name; /* brush's name--for brush selection dialog */ gint spacing; /* brush's spacing */ GimpVector2 x_axis; /* for calculating brush spacing */ GimpVector2 y_axis; /* for calculating brush spacing */ @@ -49,7 +49,6 @@ struct _GimpBrushClass GimpObjectClass parent_class; void (* dirty) (GimpBrush *brush); - void (* rename) (GimpBrush *brush); /* FIXME: these are no virtual function pointers but bad hacks: */ GimpBrush * (* select_brush) (PaintCore *paint_core); @@ -58,21 +57,17 @@ struct _GimpBrushClass GtkType gimp_brush_get_type (void); -GimpBrush * gimp_brush_load (gchar *filename); +GimpBrush * gimp_brush_load (const gchar *filename); -GimpBrush * gimp_brush_load_brush (gint fd, - gchar *filename); +GimpBrush * gimp_brush_load_brush (gint fd, + const gchar *filename); -TempBuf * gimp_brush_get_mask (GimpBrush *brush); -TempBuf * gimp_brush_get_pixmap (GimpBrush *brush); +TempBuf * gimp_brush_get_mask (const GimpBrush *brush); +TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush); -gchar * gimp_brush_get_name (GimpBrush *brush); -void gimp_brush_set_name (GimpBrush *brush, - gchar *name); - -gint gimp_brush_get_spacing (GimpBrush *brush); -void gimp_brush_set_spacing (GimpBrush *brush, - gint spacing); +gint gimp_brush_get_spacing (const GimpBrush *brush); +void gimp_brush_set_spacing (GimpBrush *brush, + gint spacing); #endif /* __GIMP_BRUSH_H__ */ diff --git a/app/core/gimpbrushgenerated-load.c b/app/core/gimpbrushgenerated-load.c index ca94a4beef..b58855cebb 100644 --- a/app/core/gimpbrushgenerated-load.c +++ b/app/core/gimpbrushgenerated-load.c @@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius, GimpBrushGenerated *brush; /* set up normal brush data */ - brush = - GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ())); + brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED)); + + gimp_object_set_name (GIMP_OBJECT (brush), "Untitled"); - GIMP_BRUSH (brush)->name = g_strdup ("Untitled"); GIMP_BRUSH (brush)->spacing = 20; /* set up gimp_brush_generated data */ @@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name) fgets (string, 255, fp); if (string[strlen (string) - 1] == '\n') string[strlen (string) - 1] = 0; - GIMP_BRUSH (brush)->name = g_strdup (string); + gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ fscanf (fp, "%f", &fl); @@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush, fprintf (fp, "1.0\n"); /* write name */ - fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name); + fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); /* write brush radius */ fprintf (fp, "%f\n", brush->radius); diff --git a/app/core/gimpbrushgenerated-save.c b/app/core/gimpbrushgenerated-save.c index ca94a4beef..b58855cebb 100644 --- a/app/core/gimpbrushgenerated-save.c +++ b/app/core/gimpbrushgenerated-save.c @@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius, GimpBrushGenerated *brush; /* set up normal brush data */ - brush = - GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ())); + brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED)); + + gimp_object_set_name (GIMP_OBJECT (brush), "Untitled"); - GIMP_BRUSH (brush)->name = g_strdup ("Untitled"); GIMP_BRUSH (brush)->spacing = 20; /* set up gimp_brush_generated data */ @@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name) fgets (string, 255, fp); if (string[strlen (string) - 1] == '\n') string[strlen (string) - 1] = 0; - GIMP_BRUSH (brush)->name = g_strdup (string); + gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ fscanf (fp, "%f", &fl); @@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush, fprintf (fp, "1.0\n"); /* write name */ - fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name); + fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); /* write brush radius */ fprintf (fp, "%f\n", brush->radius); diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c index ca94a4beef..b58855cebb 100644 --- a/app/core/gimpbrushgenerated.c +++ b/app/core/gimpbrushgenerated.c @@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius, GimpBrushGenerated *brush; /* set up normal brush data */ - brush = - GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ())); + brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED)); + + gimp_object_set_name (GIMP_OBJECT (brush), "Untitled"); - GIMP_BRUSH (brush)->name = g_strdup ("Untitled"); GIMP_BRUSH (brush)->spacing = 20; /* set up gimp_brush_generated data */ @@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name) fgets (string, 255, fp); if (string[strlen (string) - 1] == '\n') string[strlen (string) - 1] = 0; - GIMP_BRUSH (brush)->name = g_strdup (string); + gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ fscanf (fp, "%f", &fl); @@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush, fprintf (fp, "1.0\n"); /* write name */ - fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name); + fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); /* write brush radius */ fprintf (fp, "%f\n", brush->radius); diff --git a/app/core/gimpbrushgenerated.h b/app/core/gimpbrushgenerated.h index 3b9e325165..84d1c4e2d9 100644 --- a/app/core/gimpbrushgenerated.h +++ b/app/core/gimpbrushgenerated.h @@ -25,29 +25,31 @@ #include "gimpbrush.h" -#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ()) -#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated)) -#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED)) +#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ()) +#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated)) +#define GIMP_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGeneratedClass)) +#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED)) +#define GIMP_IS_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_GENERATED)) + typedef struct _GimpBrushGeneratedClass GimpBrushGeneratedClass; struct _GimpBrushGenerated { - GimpBrush gbrush; + GimpBrush parent_instance; - gfloat radius; - gfloat hardness; /* 0.0 - 1.0 */ - gfloat angle; /* in degrees */ - gfloat aspect_ratio; /* y/x */ + gfloat radius; + gfloat hardness; /* 0.0 - 1.0 */ + gfloat angle; /* in degrees */ + gfloat aspect_ratio; /* y/x */ + /* private */ gint freeze; - - /*GSpline *profile_curve */ /* Some lazy day... */ }; struct _GimpBrushGeneratedClass { - GimpBrushClass parent_class; + GimpBrushClass parent_class; }; diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c index 7699cbe388..1eea53e299 100644 --- a/app/core/gimpbrushpipe-load.c +++ b/app/core/gimpbrushpipe-load.c @@ -19,6 +19,7 @@ #include "config.h" +#include #include #include #include @@ -68,8 +69,8 @@ static GimpBrush * gimp_brush_pipe_select_brush (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i, brushix, ix; - gdouble angle; + gint i, brushix, ix; + gdouble angle; g_return_val_if_fail (paint_core != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL); @@ -133,7 +134,7 @@ static gboolean gimp_brush_pipe_want_null_motion (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_val_if_fail (paint_core != NULL, TRUE); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE); @@ -154,7 +155,7 @@ static void gimp_brush_pipe_destroy (GtkObject *object) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_if_fail (object != NULL); g_return_if_fail (GIMP_IS_BRUSH_PIPE (object)); @@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void) return type; } -#include - GimpBrush * -gimp_brush_pipe_load (gchar *filename) +gimp_brush_pipe_load (const gchar *filename) { GimpBrushPipe *pipe = NULL; GimpPixPipeParams params; - gint i; - gint num_of_brushes = 0; - gint totalcells; - gchar *paramstring; - GString *buffer; - gchar c; - gint fd; + gint i; + gint num_of_brushes = 0; + gint totalcells; + gchar *paramstring; + GString *buffer; + gchar c; + gint fd; g_return_val_if_fail (filename != NULL, NULL); @@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename) if (buffer->len > 0 && buffer->len < 1024) { pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE)); - GIMP_BRUSH (pipe)->name = buffer->str; + gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str); } - g_string_free (buffer, FALSE); + g_string_free (buffer, TRUE); if (!pipe) { @@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename) { gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); - - g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name); - GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL; + + gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]), + NULL); } else { diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index 7699cbe388..1eea53e299 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -19,6 +19,7 @@ #include "config.h" +#include #include #include #include @@ -68,8 +69,8 @@ static GimpBrush * gimp_brush_pipe_select_brush (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i, brushix, ix; - gdouble angle; + gint i, brushix, ix; + gdouble angle; g_return_val_if_fail (paint_core != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL); @@ -133,7 +134,7 @@ static gboolean gimp_brush_pipe_want_null_motion (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_val_if_fail (paint_core != NULL, TRUE); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE); @@ -154,7 +155,7 @@ static void gimp_brush_pipe_destroy (GtkObject *object) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_if_fail (object != NULL); g_return_if_fail (GIMP_IS_BRUSH_PIPE (object)); @@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void) return type; } -#include - GimpBrush * -gimp_brush_pipe_load (gchar *filename) +gimp_brush_pipe_load (const gchar *filename) { GimpBrushPipe *pipe = NULL; GimpPixPipeParams params; - gint i; - gint num_of_brushes = 0; - gint totalcells; - gchar *paramstring; - GString *buffer; - gchar c; - gint fd; + gint i; + gint num_of_brushes = 0; + gint totalcells; + gchar *paramstring; + GString *buffer; + gchar c; + gint fd; g_return_val_if_fail (filename != NULL, NULL); @@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename) if (buffer->len > 0 && buffer->len < 1024) { pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE)); - GIMP_BRUSH (pipe)->name = buffer->str; + gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str); } - g_string_free (buffer, FALSE); + g_string_free (buffer, TRUE); if (!pipe) { @@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename) { gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); - - g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name); - GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL; + + gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]), + NULL); } else { diff --git a/app/core/gimpbrushpipe.h b/app/core/gimpbrushpipe.h index 14e12610b3..e6470f54f9 100644 --- a/app/core/gimpbrushpipe.h +++ b/app/core/gimpbrushpipe.h @@ -24,9 +24,11 @@ #include "gimpbrush.h" -#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ()) -#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe)) -#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE)) +#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ()) +#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe)) +#define GIMP_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipeClass)) +#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE)) +#define GIMP_IS_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_PIPE)) typedef enum @@ -46,7 +48,7 @@ typedef struct _GimpBrushPipeClass GimpBrushPipeClass; struct _GimpBrushPipe { - GimpBrush gbrush; /* Also itself a brush */ + GimpBrush parent_instance; gint dimension; gint *rank; /* Size in each dimension */ @@ -69,7 +71,7 @@ struct _GimpBrushPipeClass GtkType gimp_brush_pipe_get_type (void); -GimpBrush * gimp_brush_pipe_load (gchar *filename); +GimpBrush * gimp_brush_pipe_load (const gchar *filename); #endif /* __GIMP_BRUSH_PIPE_H__ */ diff --git a/app/core/gimpchannel-combine.h b/app/core/gimpchannel-combine.h index 719d4f22c8..0e8a7816ef 100644 --- a/app/core/gimpchannel-combine.h +++ b/app/core/gimpchannel-combine.h @@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass; struct _GimpChannel { - GimpDrawable drawable; + GimpDrawable parent_instance; - guchar col[3]; /* RGB triplet for channel color */ - gint opacity; /* Channel opacity */ - gboolean show_masked; /* Show masked areas--as */ - /* opposed to selected areas */ + guchar col[3]; /* RGB triplet for channel color */ + gint opacity; /* Channel opacity */ + gboolean show_masked; /* Show masked areas--as */ + /* opposed to selected areas */ /* Selection mask variables */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs_in; /* outline of selected region */ - BoundSeg *segs_out; /* outline of selected region */ - gint num_segs_in; /* number of lines in boundary */ - gint num_segs_out; /* number of lines in boundary */ - gboolean empty; /* is the region empty? */ - gboolean bounds_known; /* recalculate the bounds? */ - gint x1, y1; /* coordinates for bounding box */ - gint x2, y2; /* lower right hand coordinate */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs_in; /* outline of selected region */ + BoundSeg *segs_out; /* outline of selected region */ + gint num_segs_in; /* number of lines in boundary */ + gint num_segs_out; /* number of lines in boundary */ + gboolean empty; /* is the region empty? */ + gboolean bounds_known; /* recalculate the bounds? */ + gint x1, y1; /* coordinates for bounding box */ + gint x2, y2; /* lower right hand coordinate */ }; struct _GimpChannelClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpChannel *channel); }; diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h index 719d4f22c8..0e8a7816ef 100644 --- a/app/core/gimpchannel.h +++ b/app/core/gimpchannel.h @@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass; struct _GimpChannel { - GimpDrawable drawable; + GimpDrawable parent_instance; - guchar col[3]; /* RGB triplet for channel color */ - gint opacity; /* Channel opacity */ - gboolean show_masked; /* Show masked areas--as */ - /* opposed to selected areas */ + guchar col[3]; /* RGB triplet for channel color */ + gint opacity; /* Channel opacity */ + gboolean show_masked; /* Show masked areas--as */ + /* opposed to selected areas */ /* Selection mask variables */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs_in; /* outline of selected region */ - BoundSeg *segs_out; /* outline of selected region */ - gint num_segs_in; /* number of lines in boundary */ - gint num_segs_out; /* number of lines in boundary */ - gboolean empty; /* is the region empty? */ - gboolean bounds_known; /* recalculate the bounds? */ - gint x1, y1; /* coordinates for bounding box */ - gint x2, y2; /* lower right hand coordinate */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs_in; /* outline of selected region */ + BoundSeg *segs_out; /* outline of selected region */ + gint num_segs_in; /* number of lines in boundary */ + gint num_segs_out; /* number of lines in boundary */ + gboolean empty; /* is the region empty? */ + gboolean bounds_known; /* recalculate the bounds? */ + gint x1, y1; /* coordinates for bounding box */ + gint x2, y2; /* lower right hand coordinate */ }; struct _GimpChannelClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpChannel *channel); }; diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index ed79f1654f..589ad41bf1 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -347,12 +347,6 @@ gimp_context_destroy (GtkObject *object) if (context->parent) gimp_context_unset_parent (context); - if (context->name) - { - g_free (context->name); - context->name = NULL; - } - if (context->image) gtk_signal_disconnect_by_data (GTK_OBJECT (image_context), context); @@ -397,6 +391,8 @@ gimp_context_class_init (GimpContextClass *klass) object_class = GTK_OBJECT_CLASS (klass); + parent_class = gtk_type_class (GIMP_TYPE_OBJECT); + gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED], GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE); gtk_object_add_arg_type (gimp_context_arg_names[DISPLAY_CHANGED], @@ -418,8 +414,6 @@ gimp_context_class_init (GimpContextClass *klass) gtk_object_add_arg_type (gimp_context_arg_names[GRADIENT_CHANGED], GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_GRADIENT); - parent_class = gtk_type_class (gimp_object_get_type ()); - gimp_context_signals[IMAGE_CHANGED] = gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED], GTK_RUN_FIRST, @@ -546,7 +540,6 @@ gimp_context_class_init (GimpContextClass *klass) static void gimp_context_init (GimpContext *context) { - context->name = NULL; context->parent = NULL; context->defined_args = GIMP_CONTEXT_ALL_ARGS_MASK; @@ -601,7 +594,7 @@ gimp_context_get_type (void) (GtkClassInitFunc) NULL }; - context_type = gtk_type_unique (gimp_object_get_type (), &context_info); + context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info); } return context_type; @@ -615,10 +608,13 @@ gimp_context_new (const gchar *name, g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL); - context = gtk_type_new (gimp_context_get_type ()); + context = gtk_type_new (GIMP_TYPE_CONTEXT); /* FIXME: need unique names here */ - context->name = g_strdup (name ? name : "Unnamed"); + if (! name) + name = "Unnamed"; + + gimp_object_set_name (GIMP_OBJECT (context), name); if (template) { @@ -685,13 +681,13 @@ gimp_context_get_standard (void) /*****************************************************************************/ /* functions manipulating a single context *********************************/ -gchar * -gimp_context_get_name (GimpContext *context) +const gchar * +gimp_context_get_name (const GimpContext *context) { context_check_current (context); context_return_val_if_fail (context, NULL); - return context->name; + return gimp_object_get_name (GIMP_OBJECT (context)); } void @@ -701,14 +697,14 @@ gimp_context_set_name (GimpContext *context, context_check_current (context); context_return_if_fail (context); - if (context->name) - g_free (context->name); + if (! name) + name = "Unnamed"; - context->name = g_strdup (name ? name : "Unnamed"); + gimp_object_set_name (GIMP_OBJECT (context), name); } GimpContext * -gimp_context_get_parent (GimpContext *context) +gimp_context_get_parent (const GimpContext *context) { context_check_current (context); context_return_val_if_fail (context, NULL); @@ -1387,7 +1383,7 @@ gimp_context_brush_dirty (GimpBrush *brush, GimpContext *context) { g_free (context->brush_name); - context->brush_name = g_strdup (brush->name); + context->brush_name = g_strdup (GIMP_OBJECT (brush)->name); gimp_context_brush_changed (context); } @@ -1461,7 +1457,7 @@ gimp_context_real_set_brush (GimpContext *context, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (gimp_context_brush_dirty), context); - gtk_signal_connect (GTK_OBJECT (brush), "rename", + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", GTK_SIGNAL_FUNC (gimp_context_brush_dirty), context); @@ -1474,7 +1470,7 @@ gimp_context_real_set_brush (GimpContext *context, } if (brush != standard_brush) - context->brush_name = g_strdup (brush->name); + context->brush_name = g_strdup (GIMP_OBJECT (brush)->name); } gimp_context_brush_changed (context); diff --git a/app/core/gimpcontext.h b/app/core/gimpcontext.h index f6439ec423..df4be083c4 100644 --- a/app/core/gimpcontext.h +++ b/app/core/gimpcontext.h @@ -77,9 +77,8 @@ typedef struct _GimpContextClass GimpContextClass; struct _GimpContext { - GimpObject object; + GimpObject parent_instance; - gchar *name; GimpContext *parent; guint32 defined_args; @@ -107,7 +106,7 @@ struct _GimpContext struct _GimpContextClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* image_changed) (GimpContext *context, GimpImage *image); @@ -168,14 +167,14 @@ GimpContext * gimp_context_get_standard (void); /* functions for manipulating a single context */ -gchar * gimp_context_get_name (GimpContext *context); -void gimp_context_set_name (GimpContext *context, - const gchar *name); +const gchar * gimp_context_get_name (const GimpContext *context); +void gimp_context_set_name (GimpContext *context, + const gchar *name); -GimpContext * gimp_context_get_parent (GimpContext *context); -void gimp_context_set_parent (GimpContext *context, - GimpContext *parent); -void gimp_context_unset_parent (GimpContext *context); +GimpContext * gimp_context_get_parent (const GimpContext *context); +void gimp_context_set_parent (GimpContext *context, + GimpContext *parent); +void gimp_context_unset_parent (GimpContext *context); /* define / undefinine context arguments * diff --git a/app/core/gimpdatafiles.c b/app/core/gimpdatafiles.c index 5523f08de5..d3c30eb3e4 100644 --- a/app/core/gimpdatafiles.c +++ b/app/core/gimpdatafiles.c @@ -53,11 +53,10 @@ #include "libgimp/gimpenv.h" -/***** Functions *****/ - static gboolean filestat_valid = FALSE; static struct stat filestat; + #ifdef G_OS_WIN32 /* * On Windows there is no concept like the Unix executable flag. @@ -103,7 +102,7 @@ is_script (const gchar *filename) #endif void -datafiles_read_directories (gchar *path_str, +datafiles_read_directories (const gchar *path_str, GimpDataFileLoaderFunc loader_func, GimpDataFileFlags flags) { @@ -179,6 +178,7 @@ datafile_atime (void) { if (filestat_valid) return filestat.st_atime; + return 0; } @@ -187,6 +187,7 @@ datafile_mtime (void) { if (filestat_valid) return filestat.st_mtime; + return 0; } @@ -195,5 +196,6 @@ datafile_ctime (void) { if (filestat_valid) return filestat.st_ctime; + return 0; } diff --git a/app/core/gimpdatafiles.h b/app/core/gimpdatafiles.h index d5c721e02b..6667b3622e 100644 --- a/app/core/gimpdatafiles.h +++ b/app/core/gimpdatafiles.h @@ -29,23 +29,21 @@ typedef enum MODE_EXECUTABLE = 1 << 1 } GimpDataFileFlags; -typedef void (* GimpDataFileLoaderFunc) (gchar *filename); +typedef void (* GimpDataFileLoaderFunc) (const gchar *filename); -/***** Functions *****/ - -void datafiles_read_directories (gchar *path_str, - GimpDataFileLoaderFunc loader_func, - GimpDataFileFlags flags); +void datafiles_read_directories (const gchar *path_str, + GimpDataFileLoaderFunc loader_func, + GimpDataFileFlags flags); /* Return the current datafiles access, modification * or change time. The current datafile is the one for * which the "DataFileLoaderFunc" function has been called * on. */ -time_t datafile_atime (void); -time_t datafile_mtime (void); -time_t datafile_ctime (void); +time_t datafile_atime (void); +time_t datafile_mtime (void); +time_t datafile_ctime (void); #endif /* __DATAFILES_H__ */ diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h index 147c53c2d8..ca5ac4b59d 100644 --- a/app/core/gimpdrawable.h +++ b/app/core/gimpdrawable.h @@ -34,7 +34,7 @@ typedef struct _GimpDrawableClass GimpDrawableClass; struct _GimpDrawable { - GimpObject data; + GimpObject parent_instance; TileManager *tiles; /* tiles for drawable data */ gboolean visible; /* controls visibility */ @@ -57,7 +57,7 @@ struct _GimpDrawable struct _GimpDrawableClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* invalidate_preview) (GimpDrawable *drawable); }; diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage-guides.h b/app/core/gimpimage-guides.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage-guides.h +++ b/app/core/gimpimage-guides.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage-merge.h b/app/core/gimpimage-merge.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage-merge.h +++ b/app/core/gimpimage-merge.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage-projection.h b/app/core/gimpimage-projection.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage-projection.h +++ b/app/core/gimpimage-projection.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index b87d749a92..53b8186c81 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void) (GtkClassInitFunc) NULL, }; - layer_mask_type = gtk_type_unique (gimp_channel_get_type (), - &layer_mask_info); + layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info); } return layer_mask_type; @@ -284,7 +283,7 @@ layer_new (GimpImage *gimage, return NULL; } - layer = gtk_type_new (gimp_layer_get_type ()); + layer = gtk_type_new (GIMP_TYPE_LAYER); gimp_drawable_configure (GIMP_DRAWABLE (layer), gimage, width, height, type, name); @@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage, LayerMask *layer_mask; gint i; - layer_mask = gtk_type_new (gimp_layer_mask_get_type ()); + layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK); gimp_drawable_configure (GIMP_DRAWABLE (layer_mask), gimage, width, height, GRAY_GIMAGE, name); diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h index 899c852c10..c2e5367c7c 100644 --- a/app/core/gimplayer.h +++ b/app/core/gimplayer.h @@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass; struct _GimpLayer { - GimpDrawable drawable; + GimpDrawable parent_instance; - gboolean linked; /* control linkage */ - gboolean preserve_trans; /* preserve transparency */ + gboolean linked; /* control linkage */ + gboolean preserve_trans; /* preserve transparency */ - LayerMask *mask; /* possible layer mask */ - gint apply_mask; /* controls mask application */ - gboolean edit_mask; /* edit mask or layer? */ - gboolean show_mask; /* show mask or layer? */ + LayerMask *mask; /* possible layer mask */ + gint apply_mask; /* controls mask application */ + gboolean edit_mask; /* edit mask or layer? */ + gboolean show_mask; /* show mask or layer? */ - gint opacity; /* layer opacity */ - LayerModeEffects mode; /* layer combination mode */ + gint opacity; /* layer opacity */ + LayerModeEffects mode; /* layer combination mode */ /* Floating selections */ struct { - TileManager *backing_store; /* for obscured regions */ - GimpDrawable *drawable; /* floating sel is attached to */ - gboolean initial; /* is fs composited yet? */ + TileManager *backing_store; /* for obscured regions */ + GimpDrawable *drawable; /* floating sel is attached to */ + gboolean initial; /* is fs composited yet? */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs; /* boundary of floating sel */ - gint num_segs; /* number of segs in boundary */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs; /* boundary of floating sel */ + gint num_segs; /* number of segs in boundary */ } fs; }; struct _GimpLayerClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpLayer *layer); }; struct _GimpLayerMask { - GimpChannel drawable; + GimpChannel parent_instance; - Layer *layer; + Layer *layer; }; struct _GimpLayerMaskClass { - GimpChannelClass parent_class; + GimpChannelClass parent_class; }; /* Special undo types */ diff --git a/app/core/gimplist.h b/app/core/gimplist.h index bd66071c80..f8aae6fc80 100644 --- a/app/core/gimplist.h +++ b/app/core/gimplist.h @@ -30,26 +30,27 @@ */ -#define GIMP_TYPE_LIST (gimp_list_get_type ()) -#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList)) -#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST)) -#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass)) +#define GIMP_TYPE_LIST (gimp_list_get_type ()) +#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList)) +#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass)) +#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST)) +#define GIMP_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LIST)) typedef struct _GimpListClass GimpListClass; struct _GimpList { - GimpObject gobject; + GimpObject parent_instance; - GtkType type; - GSList *list; - gboolean weak; + GtkType type; + GSList *list; + gboolean weak; }; struct _GimpListClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* add) (GimpList *list, gpointer object); diff --git a/app/core/gimpobject.h b/app/core/gimpobject.h index 5a67fe9d31..29165eb20c 100644 --- a/app/core/gimpobject.h +++ b/app/core/gimpobject.h @@ -34,14 +34,14 @@ typedef struct _GimpObjectClass GimpObjectClass; struct _GimpObject { - GtkObject object; + GtkObject parent_instance; - gchar *name; + gchar *name; }; struct _GimpObjectClass { - GtkObjectClass parent_class; + GtkObjectClass parent_class; void (* name_changed) (GimpObject *object); }; diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index 8ecca5c387..daae3fcb96 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/core/gimpprojection-construct.h b/app/core/gimpprojection-construct.h index 7663816033..bab5760d8f 100644 --- a/app/core/gimpprojection-construct.h +++ b/app/core/gimpprojection-construct.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 600fdcd9a4..55ad1016f1 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) SET_SENSITIVE ("File/Save", gdisp && drawable); SET_SENSITIVE ("File/Save as...", gdisp && drawable); SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable); - SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename); + SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename); SET_SENSITIVE ("File/Close", gdisp); SET_SENSITIVE ("Edit", gdisp); diff --git a/app/datafiles.c b/app/datafiles.c index 5523f08de5..d3c30eb3e4 100644 --- a/app/datafiles.c +++ b/app/datafiles.c @@ -53,11 +53,10 @@ #include "libgimp/gimpenv.h" -/***** Functions *****/ - static gboolean filestat_valid = FALSE; static struct stat filestat; + #ifdef G_OS_WIN32 /* * On Windows there is no concept like the Unix executable flag. @@ -103,7 +102,7 @@ is_script (const gchar *filename) #endif void -datafiles_read_directories (gchar *path_str, +datafiles_read_directories (const gchar *path_str, GimpDataFileLoaderFunc loader_func, GimpDataFileFlags flags) { @@ -179,6 +178,7 @@ datafile_atime (void) { if (filestat_valid) return filestat.st_atime; + return 0; } @@ -187,6 +187,7 @@ datafile_mtime (void) { if (filestat_valid) return filestat.st_mtime; + return 0; } @@ -195,5 +196,6 @@ datafile_ctime (void) { if (filestat_valid) return filestat.st_ctime; + return 0; } diff --git a/app/datafiles.h b/app/datafiles.h index d5c721e02b..6667b3622e 100644 --- a/app/datafiles.h +++ b/app/datafiles.h @@ -29,23 +29,21 @@ typedef enum MODE_EXECUTABLE = 1 << 1 } GimpDataFileFlags; -typedef void (* GimpDataFileLoaderFunc) (gchar *filename); +typedef void (* GimpDataFileLoaderFunc) (const gchar *filename); -/***** Functions *****/ - -void datafiles_read_directories (gchar *path_str, - GimpDataFileLoaderFunc loader_func, - GimpDataFileFlags flags); +void datafiles_read_directories (const gchar *path_str, + GimpDataFileLoaderFunc loader_func, + GimpDataFileFlags flags); /* Return the current datafiles access, modification * or change time. The current datafile is the one for * which the "DataFileLoaderFunc" function has been called * on. */ -time_t datafile_atime (void); -time_t datafile_mtime (void); -time_t datafile_ctime (void); +time_t datafile_atime (void); +time_t datafile_mtime (void); +time_t datafile_ctime (void); #endif /* __DATAFILES_H__ */ diff --git a/app/devices.c b/app/devices.c index b3c7991749..b69315dea6 100644 --- a/app/devices.c +++ b/app/devices.c @@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info, if (gimp_context_get_brush (device_info->context)) { fprintf (fp, "\n (brush \"%s\")", - gimp_context_get_brush (device_info->context)->name); + GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name); } if (gimp_context_get_pattern (device_info->context)) diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index 6c12d5df5a..3622dbfb7f 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -85,9 +85,9 @@ static void info_window_image_rename_callback (GimpImage *gimage, gpointer data) { - InfoDialog *id; - gchar *title; - GDisplay * gdisp; + InfoDialog *id; + gchar *title; + GDisplay *gdisp; InfoWinData *iwd; id = (InfoDialog *) data; @@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp) info_window_create_extended (info_win); /* keep track of image name changes */ - gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename", + gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed", GTK_SIGNAL_FUNC (info_window_image_rename_callback), info_win); diff --git a/app/dialogs/module-dialog.c b/app/dialogs/module-dialog.c index 75ccf850e9..b4332f2b1b 100644 --- a/app/dialogs/module-dialog.c +++ b/app/dialogs/module-dialog.c @@ -95,7 +95,7 @@ gimp_main_funcs[] = /* one of these objects is kept per-module */ typedef struct { - GtkObject object; + GtkObject parent_instance; gchar *fullpath; /* path to the module */ module_state state; /* what's happened to the module */ @@ -115,9 +115,9 @@ typedef struct static guint module_info_get_type (void); -#define MODULE_INFO_TYPE module_info_get_type() -#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo) -#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE) +#define MODULE_INFO_TYPE (module_info_get_type ()) +#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)) +#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)) #define NUM_INFO_LINES 7 @@ -138,7 +138,8 @@ static GimpSet *modules; static GimpSetHandlerId modules_handler; /* If the inhibit state of any modules changes, we might need to - * re-write the modulerc. */ + * re-write the modulerc. + */ static gboolean need_to_rewrite_modulerc = FALSE; @@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE; /* prototypes */ -static void module_initialize (gchar *filename); +static void module_initialize (const gchar *filename); static void mod_load (ModuleInfo *mod, gboolean verbose); static void mod_unload (ModuleInfo *mod, @@ -389,24 +390,29 @@ module_db_browser_new (void) } -/**************************************************************/ +/**************************/ /* ModuleInfo object glue */ -typedef struct -{ - GtkObjectClass parent_class; - - void (* modified) (ModuleInfo *module_info); -} ModuleInfoClass; - enum { MODIFIED, LAST_SIGNAL }; + +typedef struct _ModuleInfoClass ModuleInfoClass; + +struct _ModuleInfoClass +{ + GimpObjectClass parent_class; + + void (* modified) (ModuleInfo *module_info); +}; + + static guint module_info_signals[LAST_SIGNAL]; +static GimpObjectClass *parent_class = NULL; static void module_info_destroy (GtkObject *object) @@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object) if (mod->last_module_error) g_free (mod->last_module_error); g_free (mod->fullpath); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass) object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (GIMP_TYPE_OBJECT); + module_info_signals[MODIFIED] = gtk_signal_new ("modified", GTK_RUN_FIRST, @@ -469,8 +480,7 @@ module_info_get_type (void) (GtkClassInitFunc) NULL, }; - module_info_type = - gtk_type_unique (gtk_object_get_type (), &module_info_info); + module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info); } return module_info_type; @@ -506,7 +516,7 @@ static gboolean valid_module_name (const gchar *filename) { const gchar *basename; - gint len; + gint len; basename = g_basename (filename); @@ -537,8 +547,8 @@ static gboolean module_inhibited (const gchar *fullpath, const gchar *inhibit_list) { - gchar *p; - gint pathlen; + gchar *p; + gint pathlen; const gchar *start; const gchar *end; @@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath, static void -module_initialize (gchar *filename) +module_initialize (const gchar *filename) { ModuleInfo *mod; @@ -583,23 +593,24 @@ module_initialize (gchar *filename) mod = module_info_new (); - mod->fullpath = g_strdup (filename); - mod->ondisk = TRUE; - mod->state = ST_MODULE_ERROR; + mod->fullpath = g_strdup (filename); + mod->ondisk = TRUE; + mod->state = ST_MODULE_ERROR; - mod->info = NULL; - mod->module = NULL; + mod->info = NULL; + mod->module = NULL; mod->last_module_error = NULL; - mod->init = NULL; - mod->unload = NULL; + mod->init = NULL; + mod->unload = NULL; /* Count of times main gimp is within the module. Normally, this * will be 1, and we assume that the module won't call its * unload callback until it is satisfied that it's not in use any * more. refs can be 2 temporarily while we're running the module's * unload function, to stop the module attempting to unload - * itself. */ - mod->refs = 0; + * itself. + */ + mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit); if (!mod->load_inhibit) @@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod, #ifdef __EMX__ if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol)) { - *(struct main_funcs_struc **)symbol = gimp_main_funcs; + *(struct main_funcs_struc **) symbol = gimp_main_funcs; } #endif /* find the module_init symbol */ @@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod, g_module_close (mod->module); mod->module = NULL; - mod->info = NULL; + mod->info = NULL; return; } @@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod, static void -mod_unload_completed_callback (void *data) +mod_unload_completed_callback (gpointer data) { ModuleInfo *mod = data; @@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod) mod->module = NULL; } } - -/* End of module_db.c */ diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 600fdcd9a4..55ad1016f1 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) SET_SENSITIVE ("File/Save", gdisp && drawable); SET_SENSITIVE ("File/Save as...", gdisp && drawable); SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable); - SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename); + SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename); SET_SENSITIVE ("File/Close", gdisp); SET_SENSITIVE ("Edit", gdisp); diff --git a/app/docindex.c b/app/docindex.c index 102a9060dd..a372debab8 100644 --- a/app/docindex.c +++ b/app/docindex.c @@ -486,7 +486,8 @@ raise_if_match (gpointer data, pair = (BoolCharPair *) user_data; if (gdisp->gimage->has_filename && - strcmp (pair->string, gdisp->gimage->filename) == 0) + strcmp (pair->string, + gimp_object_get_name (GIMP_OBJECT (gdisp->gimage))) == 0) { pair->boole = TRUE; gdk_window_raise (gdisp->shell->window); diff --git a/app/fileops.c b/app/fileops.c index 518f056f80..3777cbb2a3 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -1303,7 +1303,7 @@ file_save (GimpImage *gimage, if (set_filename) { /* set the image title */ - gimp_image_set_filename (gimage, filename); + gimp_object_set_name (GIMP_OBJECT (gimage), filename); /* note: 'filename' may have been free'd by above call! */ } } diff --git a/app/gdisplay.c b/app/gdisplay.c index 600fdcd9a4..55ad1016f1 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -1779,7 +1779,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp) SET_SENSITIVE ("File/Save", gdisp && drawable); SET_SENSITIVE ("File/Save as...", gdisp && drawable); SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable); - SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->filename); + SET_SENSITIVE ("File/Revert...", gdisp && gdisp->gimage->has_filename); SET_SENSITIVE ("File/Close", gdisp); SET_SENSITIVE ("Edit", gdisp); diff --git a/app/gimage.c b/app/gimage.c index 76538373dd..9d5d9a6168 100644 --- a/app/gimage.c +++ b/app/gimage.c @@ -69,7 +69,7 @@ gimage_new (gint width, gtk_signal_connect (GTK_OBJECT (gimage), "destroy", GTK_SIGNAL_FUNC (gimage_destroy_handler), NULL); - gtk_signal_connect (GTK_OBJECT (gimage), "rename", + gtk_signal_connect (GTK_OBJECT (gimage), "name_changed", GTK_SIGNAL_FUNC (gimage_rename_handler), NULL); gtk_signal_connect (GTK_OBJECT (gimage), "resize", diff --git a/app/gimpbrush.c b/app/gimpbrush.c index 0bc11ed089..b0878d201b 100644 --- a/app/gimpbrush.c +++ b/app/gimpbrush.c @@ -59,7 +59,6 @@ enum { DIRTY, - RENAME, LAST_SIGNAL }; @@ -78,7 +77,6 @@ gimp_brush_destroy (GtkObject *object) GimpBrush *brush = GIMP_BRUSH (object); g_free (brush->filename); - g_free (brush->name); if (brush->mask) temp_buf_free (brush->mask); @@ -105,21 +103,11 @@ gimp_brush_class_init (GimpBrushClass *klass) gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); - gimp_brush_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpBrushClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, gimp_brush_signals, LAST_SIGNAL); object_class->destroy = gimp_brush_destroy; klass->dirty = NULL; - klass->rename = NULL; klass->select_brush = gimp_brush_select_brush; klass->want_null_motion = gimp_brush_want_null_motion; @@ -129,7 +117,6 @@ void gimp_brush_init (GimpBrush *brush) { brush->filename = NULL; - brush->name = NULL; brush->spacing = 20; brush->x_axis.x = 15.0; @@ -167,7 +154,7 @@ gimp_brush_get_type (void) } GimpBrush * -gimp_brush_load (gchar *filename) +gimp_brush_load (const gchar *filename) { GimpBrush *brush; gint fd; @@ -208,7 +195,7 @@ gimp_brush_want_null_motion (PaintCore *paint_core) } TempBuf * -gimp_brush_get_mask (GimpBrush *brush) +gimp_brush_get_mask (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -217,7 +204,7 @@ gimp_brush_get_mask (GimpBrush *brush) } TempBuf * -gimp_brush_get_pixmap (GimpBrush *brush) +gimp_brush_get_pixmap (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); @@ -225,34 +212,8 @@ gimp_brush_get_pixmap (GimpBrush *brush) return brush->pixmap; } -gchar * -gimp_brush_get_name (GimpBrush *brush) -{ - g_return_val_if_fail (brush != NULL, NULL); - g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL); - - return brush->name; -} - -void -gimp_brush_set_name (GimpBrush *brush, - gchar *name) -{ - g_return_if_fail (brush != NULL); - g_return_if_fail (GIMP_IS_BRUSH (brush)); - - if (strcmp (brush->name, name) == 0) - return; - - if (brush->name) - g_free (brush->name); - brush->name = g_strdup (name); - - gtk_signal_emit (GTK_OBJECT (brush), gimp_brush_signals[RENAME]); -} - gint -gimp_brush_get_spacing (GimpBrush *brush) +gimp_brush_get_spacing (const GimpBrush *brush) { g_return_val_if_fail (brush != NULL, 0); g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0); @@ -271,8 +232,8 @@ gimp_brush_set_spacing (GimpBrush *brush, } GimpBrush * -gimp_brush_load_brush (gint fd, - gchar *filename) +gimp_brush_load_brush (gint fd, + const gchar *filename) { GimpBrush *brush; GPattern *pattern; @@ -285,7 +246,7 @@ gimp_brush_load_brush (gint fd, g_return_val_if_fail (fd != -1, NULL); /* Read in the header size */ - if (read (fd, &header, sizeof (header)) != sizeof (header)) + if (read (fd, &header, sizeof (header)) != sizeof (header)) return NULL; /* rearrange the bytes in each unsigned int */ @@ -335,10 +296,10 @@ gimp_brush_load_brush (gint fd, switch (header.bytes) { case 1: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); - if (read (fd, + if (read (fd, temp_buf_data (brush->mask), header.width * header.height) < header.width * header.height) { @@ -348,7 +309,7 @@ gimp_brush_load_brush (gint fd, gtk_object_unref (GTK_OBJECT (brush)); return NULL; } - + /* For backwards-compatibility, check if a pattern follows. The obsolete .gpb format did it this way. */ pattern = pattern_load (fd, filename); @@ -377,13 +338,13 @@ gimp_brush_load_brush (gint fd, break; case 4: - brush = GIMP_BRUSH (gtk_type_new (gimp_brush_get_type ())); + brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH)); brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL); brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL); for (i = 0; i < header.width * header.height; i++) { - if (read (fd, temp_buf_data (brush->pixmap) + if (read (fd, temp_buf_data (brush->pixmap) + i * 3, 3) != 3 || read (fd, temp_buf_data (brush->mask) + i, 1) != 1) { @@ -403,7 +364,10 @@ gimp_brush_load_brush (gint fd, return NULL; } - brush->name = name; + gimp_object_set_name (GIMP_OBJECT (brush), name); + + g_free (name); + brush->spacing = header.spacing; brush->x_axis.x = header.width / 2.0; brush->x_axis.y = 0.0; diff --git a/app/gimpbrush.h b/app/gimpbrush.h index 3fef4331cc..4e7841a700 100644 --- a/app/gimpbrush.h +++ b/app/gimpbrush.h @@ -23,20 +23,20 @@ #include "gimpobject.h" -#define GIMP_TYPE_BRUSH (gimp_brush_get_type ()) -#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush)) -#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH)) -#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_brush_get_type(), GimpBrushClass)) +#define GIMP_TYPE_BRUSH (gimp_brush_get_type ()) +#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush)) +#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass)) +#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH)) +#define GIMP_IS_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH)) typedef struct _GimpBrushClass GimpBrushClass; struct _GimpBrush { - GimpObject gobject; + GimpObject parent_instance; gchar *filename; /* actual filename--brush's location on disk */ - gchar *name; /* brush's name--for brush selection dialog */ gint spacing; /* brush's spacing */ GimpVector2 x_axis; /* for calculating brush spacing */ GimpVector2 y_axis; /* for calculating brush spacing */ @@ -49,7 +49,6 @@ struct _GimpBrushClass GimpObjectClass parent_class; void (* dirty) (GimpBrush *brush); - void (* rename) (GimpBrush *brush); /* FIXME: these are no virtual function pointers but bad hacks: */ GimpBrush * (* select_brush) (PaintCore *paint_core); @@ -58,21 +57,17 @@ struct _GimpBrushClass GtkType gimp_brush_get_type (void); -GimpBrush * gimp_brush_load (gchar *filename); +GimpBrush * gimp_brush_load (const gchar *filename); -GimpBrush * gimp_brush_load_brush (gint fd, - gchar *filename); +GimpBrush * gimp_brush_load_brush (gint fd, + const gchar *filename); -TempBuf * gimp_brush_get_mask (GimpBrush *brush); -TempBuf * gimp_brush_get_pixmap (GimpBrush *brush); +TempBuf * gimp_brush_get_mask (const GimpBrush *brush); +TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush); -gchar * gimp_brush_get_name (GimpBrush *brush); -void gimp_brush_set_name (GimpBrush *brush, - gchar *name); - -gint gimp_brush_get_spacing (GimpBrush *brush); -void gimp_brush_set_spacing (GimpBrush *brush, - gint spacing); +gint gimp_brush_get_spacing (const GimpBrush *brush); +void gimp_brush_set_spacing (GimpBrush *brush, + gint spacing); #endif /* __GIMP_BRUSH_H__ */ diff --git a/app/gimpbrushgenerated.c b/app/gimpbrushgenerated.c index ca94a4beef..b58855cebb 100644 --- a/app/gimpbrushgenerated.c +++ b/app/gimpbrushgenerated.c @@ -113,10 +113,10 @@ gimp_brush_generated_new (gfloat radius, GimpBrushGenerated *brush; /* set up normal brush data */ - brush = - GIMP_BRUSH_GENERATED (gtk_type_new (gimp_brush_generated_get_type ())); + brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED)); + + gimp_object_set_name (GIMP_OBJECT (brush), "Untitled"); - GIMP_BRUSH (brush)->name = g_strdup ("Untitled"); GIMP_BRUSH (brush)->spacing = 20; /* set up gimp_brush_generated data */ @@ -166,7 +166,7 @@ gimp_brush_generated_load (const gchar *file_name) fgets (string, 255, fp); if (string[strlen (string) - 1] == '\n') string[strlen (string) - 1] = 0; - GIMP_BRUSH (brush)->name = g_strdup (string); + gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ fscanf (fp, "%f", &fl); @@ -217,10 +217,10 @@ gimp_brush_generated_save (GimpBrushGenerated *brush, fprintf (fp, "1.0\n"); /* write name */ - fprintf (fp, "%.255s\n", GIMP_BRUSH (brush)->name); + fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (float) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); /* write brush radius */ fprintf (fp, "%f\n", brush->radius); diff --git a/app/gimpbrushgenerated.h b/app/gimpbrushgenerated.h index 3b9e325165..84d1c4e2d9 100644 --- a/app/gimpbrushgenerated.h +++ b/app/gimpbrushgenerated.h @@ -25,29 +25,31 @@ #include "gimpbrush.h" -#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ()) -#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated)) -#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED)) +#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ()) +#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated)) +#define GIMP_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGeneratedClass)) +#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED)) +#define GIMP_IS_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_GENERATED)) + typedef struct _GimpBrushGeneratedClass GimpBrushGeneratedClass; struct _GimpBrushGenerated { - GimpBrush gbrush; + GimpBrush parent_instance; - gfloat radius; - gfloat hardness; /* 0.0 - 1.0 */ - gfloat angle; /* in degrees */ - gfloat aspect_ratio; /* y/x */ + gfloat radius; + gfloat hardness; /* 0.0 - 1.0 */ + gfloat angle; /* in degrees */ + gfloat aspect_ratio; /* y/x */ + /* private */ gint freeze; - - /*GSpline *profile_curve */ /* Some lazy day... */ }; struct _GimpBrushGeneratedClass { - GimpBrushClass parent_class; + GimpBrushClass parent_class; }; diff --git a/app/gimpbrushlist.c b/app/gimpbrushlist.c index 65355f3b58..1a3190d9e6 100644 --- a/app/gimpbrushlist.c +++ b/app/gimpbrushlist.c @@ -58,7 +58,7 @@ GimpBrushList *brush_list = NULL; /* local function prototypes */ -static void brushes_brush_load (gchar *filename); +static void brushes_brush_load (const gchar *filename); static gint brush_compare_func (gconstpointer first, gconstpointer second); @@ -174,7 +174,7 @@ brushes_get_standard_brush (void) standard_brush = GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0)); - gimp_brush_set_name (standard_brush, "Standard"); + gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard"); /* set ref_count to 2 --> never swap the standard brush */ gtk_object_ref (GTK_OBJECT (standard_brush)); @@ -186,7 +186,7 @@ brushes_get_standard_brush (void) } static void -brushes_brush_load (gchar *filename) +brushes_brush_load (const gchar *filename) { GimpBrush *brush; @@ -224,8 +224,8 @@ static gint brush_compare_func (gconstpointer first, gconstpointer second) { - return strcmp (((const GimpBrush *) first)->name, - ((const GimpBrush *) second)->name); + return strcmp (((const GimpObject *) first)->name, + ((const GimpObject *) second)->name); } void @@ -257,10 +257,11 @@ brushes_free (void) if (vbr_dir) { - char *safe_name; - int i; + gchar *safe_name; + gint i; + /* make sure we don't create a naughty filename */ - safe_name = g_strdup(brush->name); + safe_name = g_strdup (GIMP_OBJECT (brush)->name); if (safe_name[0] == '.') safe_name[0] = '_'; for (i = 0; safe_name[i]; i++) @@ -271,13 +272,13 @@ brushes_free (void) vbr_dir, safe_name); while ((tmp_fp = fopen (filename, "r"))) - { /* make sure we don't overite an existing brush */ - fclose (tmp_fp); - g_free (filename); - filename = g_strdup_printf ("%s%s_%d.vbr", - vbr_dir, safe_name, unum); - unum++; - } + { /* make sure we don't overite an existing brush */ + fclose (tmp_fp); + g_free (filename); + filename = g_strdup_printf ("%s%s_%d.vbr", + vbr_dir, safe_name, unum); + unum++; + } g_free (safe_name); } } @@ -337,69 +338,90 @@ gimp_brush_list_uniquefy_brush_name (GimpBrushList *brush_list, GimpBrush *brush) { GSList *list; - GSList *listb; - GimpBrush *brushb; - gint number = 1; - gchar *newname; - gchar *oldname; + GSList *list2; + GSList *base_list; + GimpBrush *brush2; + gint unique_ext = 0; + gchar *new_name = NULL; gchar *ext; g_return_if_fail (GIMP_IS_BRUSH_LIST (brush_list)); g_return_if_fail (GIMP_IS_BRUSH (brush)); - for (list = GIMP_LIST (brush_list)->list; list; list = g_slist_next (list)) + base_list = GIMP_LIST (brush_list)->list; + + for (list = base_list; list; list = g_slist_next (list)) { - brushb = GIMP_BRUSH (list->data); + brush2 = GIMP_BRUSH (list->data); - if (brush != brushb && - strcmp (gimp_brush_get_name (brush), - gimp_brush_get_name (brushb)) == 0) + if (brush != brush2 && + strcmp (gimp_object_get_name (GIMP_OBJECT (brush)), + gimp_object_get_name (GIMP_OBJECT (brush2))) == 0) { - /* names conflict */ - oldname = gimp_brush_get_name (brush); - newname = g_malloc (strlen (oldname) + 10); /* if this aint enough - yer screwed */ - strcpy (newname, oldname); - if ((ext = strrchr (newname, '#'))) - { - number = atoi (ext + 1); + ext = strrchr (GIMP_OBJECT (brush)->name, '#'); - if (&ext[(gint)(log10 (number) + 1)] != - &newname[strlen (newname) - 1]) - { - number = 1; - ext = &newname[strlen (newname)]; - } - } - else - { - number = 1; - ext = &newname[strlen (newname)]; - } - sprintf (ext, "#%d", number + 1); - for (listb = GIMP_LIST (brush_list)->list; listb; listb = listb->next) - { - brushb = GIMP_BRUSH (listb->data); + if (ext) + { + gchar *ext_str; + + unique_ext = atoi (ext + 1); + + ext_str = g_strdup_printf ("%d", unique_ext); + + /* check if the extension really is of the form "#" */ + if (! strcmp (ext_str, ext + 1)) + { + *ext = '\0'; + } + else + { + unique_ext = 0; + } + + g_free (ext_str); + } + else + { + unique_ext = 0; + } + + do + { + unique_ext++; + + g_free (new_name); + + new_name = g_strdup_printf ("%s#%d", + GIMP_OBJECT (brush)->name, + unique_ext); + + for (list2 = base_list; list2; list2 = g_slist_next (list2)) + { + brush2 = GIMP_BRUSH (list2->data); + + if (brush == brush2) + continue; + + if (! strcmp (GIMP_OBJECT (brush2)->name, new_name)) + { + break; + } + } + } + while (list2); + + gimp_object_set_name (GIMP_OBJECT (brush), new_name); + g_free (new_name); - if (brush != brushb && - strcmp (newname, gimp_brush_get_name (brushb)) == 0) - { - number++; - sprintf (ext, "#%d", number+1); - listb = GIMP_LIST (brush_list)->list; - } - } - gimp_brush_set_name (brush, newname); - g_free (newname); if (gimp_list_have (GIMP_LIST (brush_list), brush)) { - /* ought to have a better way than this to resort the brush */ gtk_object_ref (GTK_OBJECT (brush)); gimp_brush_list_remove (brush_list, brush); gimp_brush_list_add (brush_list, brush); gtk_object_unref (GTK_OBJECT (brush)); } - return; + + break; } } } @@ -417,7 +439,7 @@ gimp_brush_list_add (GimpBrushList *brush_list, { gimp_brush_list_uniquefy_brush_name (brush_list, brush); gimp_list_add (GIMP_LIST (brush_list), brush); - gtk_signal_connect (GTK_OBJECT (brush), "rename", + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", GTK_SIGNAL_FUNC (brush_renamed), brush_list); } @@ -441,20 +463,20 @@ gimp_brush_list_length (GimpBrushList *brush_list) GimpBrush * gimp_brush_list_get_brush (GimpBrushList *blist, - gchar *name) + const gchar *name) { - GimpBrush *brushp; - GSList *list; + GimpObject *object; + GSList *list; if (blist == NULL || name == NULL) return NULL; for (list = GIMP_LIST (blist)->list; list; list = g_slist_next (list)) { - brushp = (GimpBrush *) list->data; + object = (GimpObject *) list->data; - if (!strcmp (brushp->name, name)) - return brushp; + if (!strcmp (object->name, name)) + return GIMP_BRUSH (object); } return NULL; diff --git a/app/gimpbrushlist.h b/app/gimpbrushlist.h index 4a6a5d62a4..2d353cebaf 100644 --- a/app/gimpbrushlist.h +++ b/app/gimpbrushlist.h @@ -23,19 +23,21 @@ #include "gimplist.h" -#define GIMP_TYPE_BRUSH_LIST (gimp_brush_list_get_type ()) -#define GIMP_BRUSH_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_LIST, GimpBrushList)) -#define GIMP_IS_BRUSH_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_LIST)) -#define GIMP_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_BRUSH_LIST, GimpBrushListClass)) +#define GIMP_TYPE_BRUSH_LIST (gimp_brush_list_get_type ()) +#define GIMP_BRUSH_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_LIST, GimpBrushList)) +#define GIMP_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_BRUSH_LIST, GimpBrushListClass)) +#define GIMP_IS_BRUSH_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_LIST)) +#define GIMP_IS_BRUSH_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_LIST)) + typedef struct _GimpBrushListClass GimpBrushListClass; struct _GimpBrushList { - GimpList gimplist; + GimpList parent_instance; - gint num_brushes; + gint num_brushes; }; struct _GimpBrushListClass @@ -59,7 +61,7 @@ void gimp_brush_list_remove (GimpBrushList *list, GimpBrush *brush); GimpBrush * gimp_brush_list_get_brush (GimpBrushList *list, - gchar *name); + const gchar *name); GimpBrush * gimp_brush_list_get_brush_by_index (GimpBrushList *list, gint index); diff --git a/app/gimpbrushpipe.c b/app/gimpbrushpipe.c index 7699cbe388..1eea53e299 100644 --- a/app/gimpbrushpipe.c +++ b/app/gimpbrushpipe.c @@ -19,6 +19,7 @@ #include "config.h" +#include #include #include #include @@ -68,8 +69,8 @@ static GimpBrush * gimp_brush_pipe_select_brush (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i, brushix, ix; - gdouble angle; + gint i, brushix, ix; + gdouble angle; g_return_val_if_fail (paint_core != NULL, NULL); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), NULL); @@ -133,7 +134,7 @@ static gboolean gimp_brush_pipe_want_null_motion (PaintCore *paint_core) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_val_if_fail (paint_core != NULL, TRUE); g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_core->brush), TRUE); @@ -154,7 +155,7 @@ static void gimp_brush_pipe_destroy (GtkObject *object) { GimpBrushPipe *pipe; - gint i; + gint i; g_return_if_fail (object != NULL); g_return_if_fail (GIMP_IS_BRUSH_PIPE (object)); @@ -231,20 +232,18 @@ gimp_brush_pipe_get_type (void) return type; } -#include - GimpBrush * -gimp_brush_pipe_load (gchar *filename) +gimp_brush_pipe_load (const gchar *filename) { GimpBrushPipe *pipe = NULL; GimpPixPipeParams params; - gint i; - gint num_of_brushes = 0; - gint totalcells; - gchar *paramstring; - GString *buffer; - gchar c; - gint fd; + gint i; + gint num_of_brushes = 0; + gint totalcells; + gchar *paramstring; + GString *buffer; + gchar c; + gint fd; g_return_val_if_fail (filename != NULL, NULL); @@ -265,9 +264,9 @@ gimp_brush_pipe_load (gchar *filename) if (buffer->len > 0 && buffer->len < 1024) { pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE)); - GIMP_BRUSH (pipe)->name = buffer->str; + gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str); } - g_string_free (buffer, FALSE); + g_string_free (buffer, TRUE); if (!pipe) { @@ -374,9 +373,9 @@ gimp_brush_pipe_load (gchar *filename) { gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes])); - - g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name); - GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL; + + gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]), + NULL); } else { diff --git a/app/gimpbrushpipe.h b/app/gimpbrushpipe.h index 14e12610b3..e6470f54f9 100644 --- a/app/gimpbrushpipe.h +++ b/app/gimpbrushpipe.h @@ -24,9 +24,11 @@ #include "gimpbrush.h" -#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ()) -#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe)) -#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE)) +#define GIMP_TYPE_BRUSH_PIPE (gimp_brush_pipe_get_type ()) +#define GIMP_BRUSH_PIPE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipe)) +#define GIMP_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_PIPE, GimpBrushPipeClass)) +#define GIMP_IS_BRUSH_PIPE(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_PIPE)) +#define GIMP_IS_BRUSH_PIPE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_PIPE)) typedef enum @@ -46,7 +48,7 @@ typedef struct _GimpBrushPipeClass GimpBrushPipeClass; struct _GimpBrushPipe { - GimpBrush gbrush; /* Also itself a brush */ + GimpBrush parent_instance; gint dimension; gint *rank; /* Size in each dimension */ @@ -69,7 +71,7 @@ struct _GimpBrushPipeClass GtkType gimp_brush_pipe_get_type (void); -GimpBrush * gimp_brush_pipe_load (gchar *filename); +GimpBrush * gimp_brush_pipe_load (const gchar *filename); #endif /* __GIMP_BRUSH_PIPE_H__ */ diff --git a/app/gimpchannel.h b/app/gimpchannel.h index 719d4f22c8..0e8a7816ef 100644 --- a/app/gimpchannel.h +++ b/app/gimpchannel.h @@ -41,28 +41,28 @@ typedef struct _GimpChannelClass GimpChannelClass; struct _GimpChannel { - GimpDrawable drawable; + GimpDrawable parent_instance; - guchar col[3]; /* RGB triplet for channel color */ - gint opacity; /* Channel opacity */ - gboolean show_masked; /* Show masked areas--as */ - /* opposed to selected areas */ + guchar col[3]; /* RGB triplet for channel color */ + gint opacity; /* Channel opacity */ + gboolean show_masked; /* Show masked areas--as */ + /* opposed to selected areas */ /* Selection mask variables */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs_in; /* outline of selected region */ - BoundSeg *segs_out; /* outline of selected region */ - gint num_segs_in; /* number of lines in boundary */ - gint num_segs_out; /* number of lines in boundary */ - gboolean empty; /* is the region empty? */ - gboolean bounds_known; /* recalculate the bounds? */ - gint x1, y1; /* coordinates for bounding box */ - gint x2, y2; /* lower right hand coordinate */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs_in; /* outline of selected region */ + BoundSeg *segs_out; /* outline of selected region */ + gint num_segs_in; /* number of lines in boundary */ + gint num_segs_out; /* number of lines in boundary */ + gboolean empty; /* is the region empty? */ + gboolean bounds_known; /* recalculate the bounds? */ + gint x1, y1; /* coordinates for bounding box */ + gint x2, y2; /* lower right hand coordinate */ }; struct _GimpChannelClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpChannel *channel); }; diff --git a/app/gimpcontext.c b/app/gimpcontext.c index ed79f1654f..589ad41bf1 100644 --- a/app/gimpcontext.c +++ b/app/gimpcontext.c @@ -347,12 +347,6 @@ gimp_context_destroy (GtkObject *object) if (context->parent) gimp_context_unset_parent (context); - if (context->name) - { - g_free (context->name); - context->name = NULL; - } - if (context->image) gtk_signal_disconnect_by_data (GTK_OBJECT (image_context), context); @@ -397,6 +391,8 @@ gimp_context_class_init (GimpContextClass *klass) object_class = GTK_OBJECT_CLASS (klass); + parent_class = gtk_type_class (GIMP_TYPE_OBJECT); + gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED], GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE); gtk_object_add_arg_type (gimp_context_arg_names[DISPLAY_CHANGED], @@ -418,8 +414,6 @@ gimp_context_class_init (GimpContextClass *klass) gtk_object_add_arg_type (gimp_context_arg_names[GRADIENT_CHANGED], GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_GRADIENT); - parent_class = gtk_type_class (gimp_object_get_type ()); - gimp_context_signals[IMAGE_CHANGED] = gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED], GTK_RUN_FIRST, @@ -546,7 +540,6 @@ gimp_context_class_init (GimpContextClass *klass) static void gimp_context_init (GimpContext *context) { - context->name = NULL; context->parent = NULL; context->defined_args = GIMP_CONTEXT_ALL_ARGS_MASK; @@ -601,7 +594,7 @@ gimp_context_get_type (void) (GtkClassInitFunc) NULL }; - context_type = gtk_type_unique (gimp_object_get_type (), &context_info); + context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info); } return context_type; @@ -615,10 +608,13 @@ gimp_context_new (const gchar *name, g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL); - context = gtk_type_new (gimp_context_get_type ()); + context = gtk_type_new (GIMP_TYPE_CONTEXT); /* FIXME: need unique names here */ - context->name = g_strdup (name ? name : "Unnamed"); + if (! name) + name = "Unnamed"; + + gimp_object_set_name (GIMP_OBJECT (context), name); if (template) { @@ -685,13 +681,13 @@ gimp_context_get_standard (void) /*****************************************************************************/ /* functions manipulating a single context *********************************/ -gchar * -gimp_context_get_name (GimpContext *context) +const gchar * +gimp_context_get_name (const GimpContext *context) { context_check_current (context); context_return_val_if_fail (context, NULL); - return context->name; + return gimp_object_get_name (GIMP_OBJECT (context)); } void @@ -701,14 +697,14 @@ gimp_context_set_name (GimpContext *context, context_check_current (context); context_return_if_fail (context); - if (context->name) - g_free (context->name); + if (! name) + name = "Unnamed"; - context->name = g_strdup (name ? name : "Unnamed"); + gimp_object_set_name (GIMP_OBJECT (context), name); } GimpContext * -gimp_context_get_parent (GimpContext *context) +gimp_context_get_parent (const GimpContext *context) { context_check_current (context); context_return_val_if_fail (context, NULL); @@ -1387,7 +1383,7 @@ gimp_context_brush_dirty (GimpBrush *brush, GimpContext *context) { g_free (context->brush_name); - context->brush_name = g_strdup (brush->name); + context->brush_name = g_strdup (GIMP_OBJECT (brush)->name); gimp_context_brush_changed (context); } @@ -1461,7 +1457,7 @@ gimp_context_real_set_brush (GimpContext *context, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (gimp_context_brush_dirty), context); - gtk_signal_connect (GTK_OBJECT (brush), "rename", + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", GTK_SIGNAL_FUNC (gimp_context_brush_dirty), context); @@ -1474,7 +1470,7 @@ gimp_context_real_set_brush (GimpContext *context, } if (brush != standard_brush) - context->brush_name = g_strdup (brush->name); + context->brush_name = g_strdup (GIMP_OBJECT (brush)->name); } gimp_context_brush_changed (context); diff --git a/app/gimpcontext.h b/app/gimpcontext.h index f6439ec423..df4be083c4 100644 --- a/app/gimpcontext.h +++ b/app/gimpcontext.h @@ -77,9 +77,8 @@ typedef struct _GimpContextClass GimpContextClass; struct _GimpContext { - GimpObject object; + GimpObject parent_instance; - gchar *name; GimpContext *parent; guint32 defined_args; @@ -107,7 +106,7 @@ struct _GimpContext struct _GimpContextClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* image_changed) (GimpContext *context, GimpImage *image); @@ -168,14 +167,14 @@ GimpContext * gimp_context_get_standard (void); /* functions for manipulating a single context */ -gchar * gimp_context_get_name (GimpContext *context); -void gimp_context_set_name (GimpContext *context, - const gchar *name); +const gchar * gimp_context_get_name (const GimpContext *context); +void gimp_context_set_name (GimpContext *context, + const gchar *name); -GimpContext * gimp_context_get_parent (GimpContext *context); -void gimp_context_set_parent (GimpContext *context, - GimpContext *parent); -void gimp_context_unset_parent (GimpContext *context); +GimpContext * gimp_context_get_parent (const GimpContext *context); +void gimp_context_set_parent (GimpContext *context, + GimpContext *parent); +void gimp_context_unset_parent (GimpContext *context); /* define / undefinine context arguments * diff --git a/app/gimpcontextpreview.c b/app/gimpcontextpreview.c index 87129cee5a..ef9903bc42 100644 --- a/app/gimpcontextpreview.c +++ b/app/gimpcontextpreview.c @@ -344,7 +344,7 @@ gimp_context_preview_update (GimpContextPreview *gcp, gimp_context_preview_draw_brush (gcp); gtk_signal_connect (GTK_OBJECT (gcp->data), "dirty", GTK_SIGNAL_FUNC (brush_dirty_callback), gcp); - gtk_signal_connect (GTK_OBJECT (gcp->data), "rename", + gtk_signal_connect (GTK_OBJECT (gcp->data), "name_changed", GTK_SIGNAL_FUNC (brush_rename_callback), gcp); break; case GCP_PATTERN: @@ -367,7 +367,7 @@ gimp_context_preview_update (GimpContextPreview *gcp, case GCP_BRUSH: { GimpBrush *brush = GIMP_BRUSH (gcp->data); - name = brush->name; + name = GIMP_OBJECT (brush)->name; } break; case GCP_PATTERN: @@ -385,6 +385,7 @@ gimp_context_preview_update (GimpContextPreview *gcp, default: break; } + gimp_help_set_help_data (GTK_WIDGET (gcp), name, NULL); } } @@ -572,7 +573,7 @@ gimp_context_preview_popup_timeout (gpointer data) default: break; - } + } gtk_widget_queue_draw (gcp_popup_preview); return FALSE; @@ -817,7 +818,7 @@ brush_rename_callback (GimpBrush *brush, GimpContextPreview *gcp) { if (gcp->show_tooltips) - gimp_help_set_help_data (GTK_WIDGET (gcp), brush->name, NULL); + gimp_help_set_help_data (GTK_WIDGET (gcp), GIMP_OBJECT (brush)->name, NULL); return TRUE; } diff --git a/app/gimpdnd.c b/app/gimpdnd.c index aaec5728f3..eb1b20e036 100644 --- a/app/gimpdnd.c +++ b/app/gimpdnd.c @@ -627,7 +627,7 @@ gimp_dnd_get_brush_data (GtkWidget *widget, if (! brush) return NULL; - name = g_strdup (gimp_brush_get_name (brush)); + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); if (! name) return NULL; diff --git a/app/gimpdrawable.h b/app/gimpdrawable.h index 147c53c2d8..ca5ac4b59d 100644 --- a/app/gimpdrawable.h +++ b/app/gimpdrawable.h @@ -34,7 +34,7 @@ typedef struct _GimpDrawableClass GimpDrawableClass; struct _GimpDrawable { - GimpObject data; + GimpObject parent_instance; TileManager *tiles; /* tiles for drawable data */ gboolean visible; /* controls visibility */ @@ -57,7 +57,7 @@ struct _GimpDrawable struct _GimpDrawableClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* invalidate_preview) (GimpDrawable *drawable); }; diff --git a/app/gimpimage.c b/app/gimpimage.c index 8ecca5c387..daae3fcb96 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -62,6 +62,7 @@ /* Local function declarations */ static void gimp_image_destroy (GtkObject *object); +static void gimp_image_name_changed (GimpObject *object); static void gimp_image_free_projection (GimpImage *gimage); static void gimp_image_allocate_shadow (GimpImage *gimage, gint width, @@ -145,7 +146,6 @@ enum CLEAN, DIRTY, REPAINT, - RENAME, RESIZE, RESTRUCTURE, COLORMAP_CHANGED, @@ -161,9 +161,11 @@ static GimpObjectClass *parent_class = NULL; static void gimp_image_class_init (GimpImageClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + GimpObjectClass *gimp_object_class; - object_class = (GtkObjectClass *) klass; + object_class = (GtkObjectClass *) klass; + gimp_object_class = (GimpObjectClass *) klass; parent_class = gtk_type_class (GIMP_TYPE_OBJECT); @@ -198,15 +200,6 @@ gimp_image_class_init (GimpImageClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); - gimp_image_signals[RENAME] = - gtk_signal_new ("rename", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (GimpImageClass, - rename), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - gimp_image_signals[RESIZE] = gtk_signal_new ("resize", GTK_RUN_FIRST, @@ -249,10 +242,11 @@ gimp_image_class_init (GimpImageClass *klass) object_class->destroy = gimp_image_destroy; + gimp_object_class->name_changed = gimp_image_name_changed; + klass->clean = NULL; klass->dirty = NULL; klass->repaint = NULL; - klass->rename = NULL; klass->resize = NULL; klass->restructure = NULL; klass->colormap_changed = NULL; @@ -381,10 +375,9 @@ gimp_image_new (gint width, gint height, GimpImageBaseType base_type) { - GimpImage *gimage = GIMP_IMAGE (gtk_type_new (gimp_image_get_type ())); + GimpImage *gimage = GIMP_IMAGE (gtk_type_new (GIMP_TYPE_IMAGE)); gint i; - gimage->filename = NULL; gimage->width = width; gimage->height = height; gimage->base_type = base_type; @@ -430,38 +423,32 @@ gimp_image_new (gint width, } void -gimp_image_set_filename (GimpImage *gimage, - gchar *filename) +gimp_image_set_filename (GimpImage *gimage, + const gchar *filename) { - gchar *new_filename; - gchar *old_filename; - gboolean free_old; + gimp_object_set_name (GIMP_OBJECT (gimage), filename); +} - /* - * WARNING: this function will free the current filename even if you are - * setting it to itself so any pointer you hold to the filename will be - * invalid after this call. So please use with care. - */ +static void +gimp_image_name_changed (GimpObject *object) +{ + GimpImage *gimage; + const gchar *name; - new_filename = g_strdup (filename); - old_filename = gimage->filename; - free_old = gimage->has_filename; + gimage = GIMP_IMAGE (object); + name = gimp_object_get_name (object); - if (filename && filename[0]) + if (name && name[0]) { - gimage->filename = new_filename; gimage->has_filename = TRUE; } else { - gimage->filename = NULL; gimage->has_filename = FALSE; } - if (free_old) - g_free (old_filename); - - gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RENAME]); + if (GIMP_OBJECT_CLASS (parent_class)->name_changed) + GIMP_OBJECT_CLASS (parent_class)->name_changed (object); } void @@ -795,10 +782,7 @@ gimp_image_destroy (GtkObject *object) if (gimage->cmap) g_free (gimage->cmap); - - if (gimage->has_filename) - g_free (gimage->filename); - + gimp_image_free_layers (gimage); gimp_image_free_channels (gimage); @@ -3627,7 +3611,7 @@ gimp_image_filename (const GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); if (gimage->has_filename) - return gimage->filename; + return gimp_object_get_name (GIMP_OBJECT (gimage)); else return _("Untitled"); } diff --git a/app/gimpimage.h b/app/gimpimage.h index 7663816033..bab5760d8f 100644 --- a/app/gimpimage.h +++ b/app/gimpimage.h @@ -46,9 +46,8 @@ typedef struct _GimpImageClass GimpImageClass; struct _GimpImage { - GimpObject gobject; + GimpObject parent_instance; - gchar *filename; /* original filename */ gboolean has_filename; /* has a valid filename */ PlugInProcDef *save_proc; /* last PDB save proc used */ @@ -126,7 +125,6 @@ struct _GimpImageClass void (* clean) (GimpImage *gimage); void (* dirty) (GimpImage *gimage); void (* repaint) (GimpImage *gimage); - void (* rename) (GimpImage *gimage); void (* resize) (GimpImage *gimage); void (* restructure) (GimpImage *gimage); void (* colormap_changed) (GimpImage *gimage); @@ -183,7 +181,7 @@ GimpImage * gimp_image_new (gint width, gint height, GimpImageBaseType base_type); void gimp_image_set_filename (GimpImage *gimage, - gchar *filename); + const gchar *filename); void gimp_image_set_resolution (GimpImage *gimage, gdouble xres, gdouble yres); diff --git a/app/gimplayer.c b/app/gimplayer.c index b87d749a92..53b8186c81 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void) (GtkClassInitFunc) NULL, }; - layer_mask_type = gtk_type_unique (gimp_channel_get_type (), - &layer_mask_info); + layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info); } return layer_mask_type; @@ -284,7 +283,7 @@ layer_new (GimpImage *gimage, return NULL; } - layer = gtk_type_new (gimp_layer_get_type ()); + layer = gtk_type_new (GIMP_TYPE_LAYER); gimp_drawable_configure (GIMP_DRAWABLE (layer), gimage, width, height, type, name); @@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage, LayerMask *layer_mask; gint i; - layer_mask = gtk_type_new (gimp_layer_mask_get_type ()); + layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK); gimp_drawable_configure (GIMP_DRAWABLE (layer_mask), gimage, width, height, GRAY_GIMAGE, name); diff --git a/app/gimplayer.h b/app/gimplayer.h index 899c852c10..c2e5367c7c 100644 --- a/app/gimplayer.h +++ b/app/gimplayer.h @@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass; struct _GimpLayer { - GimpDrawable drawable; + GimpDrawable parent_instance; - gboolean linked; /* control linkage */ - gboolean preserve_trans; /* preserve transparency */ + gboolean linked; /* control linkage */ + gboolean preserve_trans; /* preserve transparency */ - LayerMask *mask; /* possible layer mask */ - gint apply_mask; /* controls mask application */ - gboolean edit_mask; /* edit mask or layer? */ - gboolean show_mask; /* show mask or layer? */ + LayerMask *mask; /* possible layer mask */ + gint apply_mask; /* controls mask application */ + gboolean edit_mask; /* edit mask or layer? */ + gboolean show_mask; /* show mask or layer? */ - gint opacity; /* layer opacity */ - LayerModeEffects mode; /* layer combination mode */ + gint opacity; /* layer opacity */ + LayerModeEffects mode; /* layer combination mode */ /* Floating selections */ struct { - TileManager *backing_store; /* for obscured regions */ - GimpDrawable *drawable; /* floating sel is attached to */ - gboolean initial; /* is fs composited yet? */ + TileManager *backing_store; /* for obscured regions */ + GimpDrawable *drawable; /* floating sel is attached to */ + gboolean initial; /* is fs composited yet? */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs; /* boundary of floating sel */ - gint num_segs; /* number of segs in boundary */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs; /* boundary of floating sel */ + gint num_segs; /* number of segs in boundary */ } fs; }; struct _GimpLayerClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpLayer *layer); }; struct _GimpLayerMask { - GimpChannel drawable; + GimpChannel parent_instance; - Layer *layer; + Layer *layer; }; struct _GimpLayerMaskClass { - GimpChannelClass parent_class; + GimpChannelClass parent_class; }; /* Special undo types */ diff --git a/app/gimplist.h b/app/gimplist.h index bd66071c80..f8aae6fc80 100644 --- a/app/gimplist.h +++ b/app/gimplist.h @@ -30,26 +30,27 @@ */ -#define GIMP_TYPE_LIST (gimp_list_get_type ()) -#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList)) -#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST)) -#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass)) +#define GIMP_TYPE_LIST (gimp_list_get_type ()) +#define GIMP_LIST(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_LIST, GimpList)) +#define GIMP_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LIST, GimpListClass)) +#define GIMP_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_LIST)) +#define GIMP_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LIST)) typedef struct _GimpListClass GimpListClass; struct _GimpList { - GimpObject gobject; + GimpObject parent_instance; - GtkType type; - GSList *list; - gboolean weak; + GtkType type; + GSList *list; + gboolean weak; }; struct _GimpListClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* add) (GimpList *list, gpointer object); diff --git a/app/gimpobject.h b/app/gimpobject.h index 5a67fe9d31..29165eb20c 100644 --- a/app/gimpobject.h +++ b/app/gimpobject.h @@ -34,14 +34,14 @@ typedef struct _GimpObjectClass GimpObjectClass; struct _GimpObject { - GtkObject object; + GtkObject parent_instance; - gchar *name; + gchar *name; }; struct _GimpObjectClass { - GtkObjectClass parent_class; + GtkObjectClass parent_class; void (* name_changed) (GimpObject *object); }; diff --git a/app/gimpset.c b/app/gimpset.c index d57f6a4fbf..fbcfe2529a 100644 --- a/app/gimpset.c +++ b/app/gimpset.c @@ -172,7 +172,7 @@ gimp_set_new (GtkType type, */ g_assert (!(type == GTK_TYPE_NONE && weak == TRUE)); - set = gtk_type_new (gimp_set_get_type ()); + set = gtk_type_new (GIMP_TYPE_SET); set->type = type; set->weak = weak; diff --git a/app/gimpset.h b/app/gimpset.h index e456221b80..1d8cd5a10f 100644 --- a/app/gimpset.h +++ b/app/gimpset.h @@ -34,17 +34,18 @@ * is also illegal to ask for a weak untyped gimpset. */ -#define GIMP_TYPE_SET (gimp_set_get_type ()) -#define GIMP_SET(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_SET, GimpSet)) -#define GIMP_IS_SET(obj) (GTK_CHECK_TYPE ((obj), gimp_set_get_type())) -#define GIMP_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gimp_set_get_type(), GimpSetClass)) +#define GIMP_TYPE_SET (gimp_set_get_type ()) +#define GIMP_SET(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_SET, GimpSet)) +#define GIMP_SET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SET, GimpSetClass)) +#define GIMP_IS_SET(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_SET)) +#define GIMP_IS_SET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SET)) typedef struct _GimpSetClass GimpSetClass; struct _GimpSet { - GimpObject gobject; + GimpObject parent_instance; GtkType type; GSList *list; @@ -55,7 +56,7 @@ struct _GimpSet struct _GimpSetClass { - GimpObjectClass parent_class; + GimpObjectClass parent_class; void (* add) (GimpSet *gimpset, gpointer object); diff --git a/app/gradient.c b/app/gradient.c index 57b203904e..296aa121ed 100644 --- a/app/gradient.c +++ b/app/gradient.c @@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0, /* Gradient functions */ static gradient_t * grad_new_gradient (void); -static void grad_free_gradient (gradient_t *grad); +static void grad_free_gradient (gradient_t *grad); static void grad_free_gradients (void); -static void grad_load_gradient (gchar *filename); -static void grad_save_gradient (gradient_t *grad, - gchar *filename); -static void grad_save_all (gboolean need_free); +static void grad_load_gradient (const gchar *filename); +static void grad_save_gradient (gradient_t *grad, + const gchar *filename); +static void grad_save_all (gboolean need_free); static gradient_t * grad_create_default_gradient (void); -static gint grad_insert_in_gradients_list (gradient_t *grad); +static gint grad_insert_in_gradients_list (gradient_t *grad); -static void grad_dump_gradient (gradient_t *grad, - FILE *file); -static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); +static void grad_dump_gradient (gradient_t *grad, + FILE *file); +static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); /* Segment functions */ @@ -5844,7 +5844,7 @@ grad_free_gradients (void) /*****/ static void -grad_load_gradient (gchar *filename) +grad_load_gradient (const gchar *filename) { FILE *file; gradient_t *grad; @@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename) /*****/ static void -grad_save_gradient (gradient_t *grad, - char *filename) +grad_save_gradient (gradient_t *grad, + const gchar *filename) { FILE *file; - int num_segments; + gint num_segments; grad_segment_t *seg; g_assert (grad != NULL); diff --git a/app/gradient_editor.c b/app/gradient_editor.c index 57b203904e..296aa121ed 100644 --- a/app/gradient_editor.c +++ b/app/gradient_editor.c @@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0, /* Gradient functions */ static gradient_t * grad_new_gradient (void); -static void grad_free_gradient (gradient_t *grad); +static void grad_free_gradient (gradient_t *grad); static void grad_free_gradients (void); -static void grad_load_gradient (gchar *filename); -static void grad_save_gradient (gradient_t *grad, - gchar *filename); -static void grad_save_all (gboolean need_free); +static void grad_load_gradient (const gchar *filename); +static void grad_save_gradient (gradient_t *grad, + const gchar *filename); +static void grad_save_all (gboolean need_free); static gradient_t * grad_create_default_gradient (void); -static gint grad_insert_in_gradients_list (gradient_t *grad); +static gint grad_insert_in_gradients_list (gradient_t *grad); -static void grad_dump_gradient (gradient_t *grad, - FILE *file); -static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); +static void grad_dump_gradient (gradient_t *grad, + FILE *file); +static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); /* Segment functions */ @@ -5844,7 +5844,7 @@ grad_free_gradients (void) /*****/ static void -grad_load_gradient (gchar *filename) +grad_load_gradient (const gchar *filename) { FILE *file; gradient_t *grad; @@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename) /*****/ static void -grad_save_gradient (gradient_t *grad, - char *filename) +grad_save_gradient (gradient_t *grad, + const gchar *filename) { FILE *file; - int num_segments; + gint num_segments; grad_segment_t *seg; g_assert (grad != NULL); diff --git a/app/gui/brush-editor.c b/app/gui/brush-editor.c index 2ea93642f2..1b3bf5179c 100644 --- a/app/gui/brush-editor.c +++ b/app/gui/brush-editor.c @@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush, } static void -brush_renamed_callback (GtkWidget *widget, - BrushEditGeneratedWindow *begw) +brush_name_changed_callback (GtkWidget *widget, + BrushEditGeneratedWindow *begw) { gtk_entry_set_text (GTK_ENTRY (begw->name), - gimp_brush_get_name (GIMP_BRUSH (begw->brush))); + gimp_object_get_name (GIMP_OBJECT (begw->brush))); } void @@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback), begw); - gtk_signal_connect (GTK_OBJECT (brush), "rename", - GTK_SIGNAL_FUNC (brush_renamed_callback), + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", + GTK_SIGNAL_FUNC (brush_name_changed_callback), begw); begw->brush = NULL; @@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gimp_brush_generated_get_angle (brush)); gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data), gimp_brush_generated_get_aspect_ratio (brush)); - gtk_entry_set_text (GTK_ENTRY (begw->name), gimp_brush_get_name (gbrush)); + gtk_entry_set_text (GTK_ENTRY (begw->name), + gimp_object_get_name (GIMP_OBJECT (gbrush))); begw->brush = brush; gtk_object_ref (GTK_OBJECT (begw->brush)); @@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget, gchar *entry_text; entry_text = gtk_entry_get_text (GTK_ENTRY (widget)); - gimp_brush_set_name (GIMP_BRUSH (begw->brush), entry_text); + gimp_object_set_name (GIMP_OBJECT (begw->brush), entry_text); } void diff --git a/app/gui/brush-select.c b/app/gui/brush-select.c index 24bb569a16..3fbf2e6eba 100644 --- a/app/gui/brush-select.c +++ b/app/gui/brush-select.c @@ -676,10 +676,11 @@ static void brush_change_callbacks (BrushSelect *bsp, gboolean closing) { - gchar *name; + gchar *name; ProcRecord *prec = NULL; - GimpBrush *brush; - gint nreturn_vals; + GimpBrush *brush; + gint nreturn_vals; + static gboolean busy = FALSE; /* Any procs registered to callback? */ @@ -688,8 +689,8 @@ brush_change_callbacks (BrushSelect *bsp, if (!bsp || !bsp->callback_name || busy) return; - busy = TRUE; - name = bsp->callback_name; + busy = TRUE; + name = bsp->callback_name; brush = gimp_context_get_brush (bsp->context); /* If its still registered run it */ @@ -700,7 +701,7 @@ brush_change_callbacks (BrushSelect *bsp, return_vals = procedural_db_run_proc (name, &nreturn_vals, - PDB_STRING, brush->name, + PDB_STRING, GIMP_OBJECT (brush)->name, PDB_FLOAT, gimp_context_get_opacity (bsp->context), PDB_INT32, bsp->spacing_value, PDB_INT32, (gint) gimp_context_get_paint_mode (bsp->context), @@ -725,9 +726,9 @@ void brushes_check_dialogs (void) { BrushSelect *bsp; - GSList *list; - gchar *name; - ProcRecord *prec = NULL; + GSList *list; + gchar *name; + ProcRecord *prec = NULL; list = brush_active_dialogs; @@ -896,7 +897,7 @@ connect_signals_to_brush (GimpBrush *brush, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), bsp); - gtk_signal_connect (GTK_OBJECT (brush), "rename", + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", GTK_SIGNAL_FUNC (brush_select_brush_dirty_callback), bsp); } @@ -1484,7 +1485,7 @@ update_active_brush_field (BrushSelect *bsp) return; /* Set brush name */ - gtk_label_set_text (GTK_LABEL (bsp->brush_name), brush->name); + gtk_label_set_text (GTK_LABEL (bsp->brush_name), GIMP_OBJECT (brush)->name); /* Set brush size */ g_snprintf (buf, sizeof (buf), "(%d x %d)", diff --git a/app/gui/colormap-dialog.c b/app/gui/colormap-dialog.c index c9903c47b5..124371fe12 100644 --- a/app/gui/colormap-dialog.c +++ b/app/gui/colormap-dialog.c @@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context) image_cmap_change_cb, ipal); ipal->rename_handler = gimp_set_add_handler (context, - "rename", + "name_changed", image_rename_cb, ipal); diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index b3c7991749..b69315dea6 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info, if (gimp_context_get_brush (device_info->context)) { fprintf (fp, "\n (brush \"%s\")", - gimp_context_get_brush (device_info->context)->name); + GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name); } if (gimp_context_get_pattern (device_info->context)) diff --git a/app/gui/gradient-editor.c b/app/gui/gradient-editor.c index 57b203904e..296aa121ed 100644 --- a/app/gui/gradient-editor.c +++ b/app/gui/gradient-editor.c @@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0, /* Gradient functions */ static gradient_t * grad_new_gradient (void); -static void grad_free_gradient (gradient_t *grad); +static void grad_free_gradient (gradient_t *grad); static void grad_free_gradients (void); -static void grad_load_gradient (gchar *filename); -static void grad_save_gradient (gradient_t *grad, - gchar *filename); -static void grad_save_all (gboolean need_free); +static void grad_load_gradient (const gchar *filename); +static void grad_save_gradient (gradient_t *grad, + const gchar *filename); +static void grad_save_all (gboolean need_free); static gradient_t * grad_create_default_gradient (void); -static gint grad_insert_in_gradients_list (gradient_t *grad); +static gint grad_insert_in_gradients_list (gradient_t *grad); -static void grad_dump_gradient (gradient_t *grad, - FILE *file); -static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); +static void grad_dump_gradient (gradient_t *grad, + FILE *file); +static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); /* Segment functions */ @@ -5844,7 +5844,7 @@ grad_free_gradients (void) /*****/ static void -grad_load_gradient (gchar *filename) +grad_load_gradient (const gchar *filename) { FILE *file; gradient_t *grad; @@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename) /*****/ static void -grad_save_gradient (gradient_t *grad, - char *filename) +grad_save_gradient (gradient_t *grad, + const gchar *filename) { FILE *file; - int num_segments; + gint num_segments; grad_segment_t *seg; g_assert (grad != NULL); diff --git a/app/gui/info-window.c b/app/gui/info-window.c index 6c12d5df5a..3622dbfb7f 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -85,9 +85,9 @@ static void info_window_image_rename_callback (GimpImage *gimage, gpointer data) { - InfoDialog *id; - gchar *title; - GDisplay * gdisp; + InfoDialog *id; + gchar *title; + GDisplay *gdisp; InfoWinData *iwd; id = (InfoDialog *) data; @@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp) info_window_create_extended (info_win); /* keep track of image name changes */ - gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename", + gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed", GTK_SIGNAL_FUNC (info_window_image_rename_callback), info_win); diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index b3c7991749..b69315dea6 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info, if (gimp_context_get_brush (device_info->context)) { fprintf (fp, "\n (brush \"%s\")", - gimp_context_get_brush (device_info->context)->name); + GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name); } if (gimp_context_get_pattern (device_info->context)) diff --git a/app/gui/module-browser.c b/app/gui/module-browser.c index 75ccf850e9..b4332f2b1b 100644 --- a/app/gui/module-browser.c +++ b/app/gui/module-browser.c @@ -95,7 +95,7 @@ gimp_main_funcs[] = /* one of these objects is kept per-module */ typedef struct { - GtkObject object; + GtkObject parent_instance; gchar *fullpath; /* path to the module */ module_state state; /* what's happened to the module */ @@ -115,9 +115,9 @@ typedef struct static guint module_info_get_type (void); -#define MODULE_INFO_TYPE module_info_get_type() -#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo) -#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE) +#define MODULE_INFO_TYPE (module_info_get_type ()) +#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)) +#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)) #define NUM_INFO_LINES 7 @@ -138,7 +138,8 @@ static GimpSet *modules; static GimpSetHandlerId modules_handler; /* If the inhibit state of any modules changes, we might need to - * re-write the modulerc. */ + * re-write the modulerc. + */ static gboolean need_to_rewrite_modulerc = FALSE; @@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE; /* prototypes */ -static void module_initialize (gchar *filename); +static void module_initialize (const gchar *filename); static void mod_load (ModuleInfo *mod, gboolean verbose); static void mod_unload (ModuleInfo *mod, @@ -389,24 +390,29 @@ module_db_browser_new (void) } -/**************************************************************/ +/**************************/ /* ModuleInfo object glue */ -typedef struct -{ - GtkObjectClass parent_class; - - void (* modified) (ModuleInfo *module_info); -} ModuleInfoClass; - enum { MODIFIED, LAST_SIGNAL }; + +typedef struct _ModuleInfoClass ModuleInfoClass; + +struct _ModuleInfoClass +{ + GimpObjectClass parent_class; + + void (* modified) (ModuleInfo *module_info); +}; + + static guint module_info_signals[LAST_SIGNAL]; +static GimpObjectClass *parent_class = NULL; static void module_info_destroy (GtkObject *object) @@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object) if (mod->last_module_error) g_free (mod->last_module_error); g_free (mod->fullpath); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass) object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (GIMP_TYPE_OBJECT); + module_info_signals[MODIFIED] = gtk_signal_new ("modified", GTK_RUN_FIRST, @@ -469,8 +480,7 @@ module_info_get_type (void) (GtkClassInitFunc) NULL, }; - module_info_type = - gtk_type_unique (gtk_object_get_type (), &module_info_info); + module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info); } return module_info_type; @@ -506,7 +516,7 @@ static gboolean valid_module_name (const gchar *filename) { const gchar *basename; - gint len; + gint len; basename = g_basename (filename); @@ -537,8 +547,8 @@ static gboolean module_inhibited (const gchar *fullpath, const gchar *inhibit_list) { - gchar *p; - gint pathlen; + gchar *p; + gint pathlen; const gchar *start; const gchar *end; @@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath, static void -module_initialize (gchar *filename) +module_initialize (const gchar *filename) { ModuleInfo *mod; @@ -583,23 +593,24 @@ module_initialize (gchar *filename) mod = module_info_new (); - mod->fullpath = g_strdup (filename); - mod->ondisk = TRUE; - mod->state = ST_MODULE_ERROR; + mod->fullpath = g_strdup (filename); + mod->ondisk = TRUE; + mod->state = ST_MODULE_ERROR; - mod->info = NULL; - mod->module = NULL; + mod->info = NULL; + mod->module = NULL; mod->last_module_error = NULL; - mod->init = NULL; - mod->unload = NULL; + mod->init = NULL; + mod->unload = NULL; /* Count of times main gimp is within the module. Normally, this * will be 1, and we assume that the module won't call its * unload callback until it is satisfied that it's not in use any * more. refs can be 2 temporarily while we're running the module's * unload function, to stop the module attempting to unload - * itself. */ - mod->refs = 0; + * itself. + */ + mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit); if (!mod->load_inhibit) @@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod, #ifdef __EMX__ if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol)) { - *(struct main_funcs_struc **)symbol = gimp_main_funcs; + *(struct main_funcs_struc **) symbol = gimp_main_funcs; } #endif /* find the module_init symbol */ @@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod, g_module_close (mod->module); mod->module = NULL; - mod->info = NULL; + mod->info = NULL; return; } @@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod, static void -mod_unload_completed_callback (void *data) +mod_unload_completed_callback (gpointer data) { ModuleInfo *mod = data; @@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod) mod->module = NULL; } } - -/* End of module_db.c */ diff --git a/app/gui/palette-editor.c b/app/gui/palette-editor.c index 09f6828a0f..82b808b0b5 100644 --- a/app/gui/palette-editor.c +++ b/app/gui/palette-editor.c @@ -146,19 +146,20 @@ struct _PaletteDialog }; /* local function prototypes */ -static void palette_entry_free (PaletteEntry *); -static void palette_entries_free (PaletteEntries *); -static void palette_entries_load (gchar *); -static void palette_entries_save (PaletteEntries *, gchar *); -static void palette_save_palettes (void); +static void palette_entry_free (PaletteEntry *entry); +static void palette_entries_free (PaletteEntries *entries); +static void palette_entries_load (const gchar *filename); +static void palette_entries_save (PaletteEntries *entries, + const gchar *filename); +static void palette_save_palettes (void); static void palette_entries_list_insert (PaletteEntries *entries); -static void palette_dialog_draw_entries (PaletteDialog *palette, - gint row_start, - gint column_highlight); -static void palette_dialog_redraw (PaletteDialog *palette); -static void palette_dialog_scroll_top_left (PaletteDialog *palette); +static void palette_dialog_draw_entries (PaletteDialog *palette, + gint row_start, + gint column_highlight); +static void palette_dialog_redraw (PaletteDialog *palette); +static void palette_dialog_scroll_top_left (PaletteDialog *palette); static PaletteDialog * palette_dialog_new (gboolean editor); static ImportDialog * palette_import_dialog_new (PaletteDialog *palette); @@ -375,7 +376,7 @@ palette_entries_add_entry (PaletteEntries *entries, } static void -palette_entries_load (gchar *filename) +palette_entries_load (const gchar *filename) { PaletteEntries *entries; gchar str[512]; @@ -505,11 +506,11 @@ palette_entries_delete (gchar *filename) static void palette_entries_save (PaletteEntries *palette, - gchar *filename) + const gchar *filename) { PaletteEntry *entry; - GSList *list; - FILE *fp; + GSList *list; + FILE *fp; if (! filename) return; diff --git a/app/gui/palette-editor.h b/app/gui/palette-editor.h index 3059ca3ff2..5d8c945930 100644 --- a/app/gui/palette-editor.h +++ b/app/gui/palette-editor.h @@ -25,6 +25,7 @@ #define COLOR_UPDATE_NEW 1 #define COLOR_UPDATE 2 + void palettes_init (gboolean no_data); void palettes_free (void); diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 432aaecd81..1981ec16ad 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 432aaecd81..1981ec16ad 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/info_window.c b/app/info_window.c index 6c12d5df5a..3622dbfb7f 100644 --- a/app/info_window.c +++ b/app/info_window.c @@ -85,9 +85,9 @@ static void info_window_image_rename_callback (GimpImage *gimage, gpointer data) { - InfoDialog *id; - gchar *title; - GDisplay * gdisp; + InfoDialog *id; + gchar *title; + GDisplay *gdisp; InfoWinData *iwd; id = (InfoDialog *) data; @@ -302,7 +302,7 @@ info_window_create (GDisplay *gdisp) info_window_create_extended (info_win); /* keep track of image name changes */ - gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename", + gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed", GTK_SIGNAL_FUNC (info_window_image_rename_callback), info_win); diff --git a/app/layer.c b/app/layer.c index b87d749a92..53b8186c81 100644 --- a/app/layer.c +++ b/app/layer.c @@ -160,8 +160,7 @@ gimp_layer_mask_get_type (void) (GtkClassInitFunc) NULL, }; - layer_mask_type = gtk_type_unique (gimp_channel_get_type (), - &layer_mask_info); + layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info); } return layer_mask_type; @@ -284,7 +283,7 @@ layer_new (GimpImage *gimage, return NULL; } - layer = gtk_type_new (gimp_layer_get_type ()); + layer = gtk_type_new (GIMP_TYPE_LAYER); gimp_drawable_configure (GIMP_DRAWABLE (layer), gimage, width, height, type, name); @@ -1771,7 +1770,7 @@ layer_mask_new (GimpImage *gimage, LayerMask *layer_mask; gint i; - layer_mask = gtk_type_new (gimp_layer_mask_get_type ()); + layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK); gimp_drawable_configure (GIMP_DRAWABLE (layer_mask), gimage, width, height, GRAY_GIMAGE, name); diff --git a/app/layer.h b/app/layer.h index 899c852c10..c2e5367c7c 100644 --- a/app/layer.h +++ b/app/layer.h @@ -42,49 +42,49 @@ typedef struct _GimpLayerMaskClass GimpLayerMaskClass; struct _GimpLayer { - GimpDrawable drawable; + GimpDrawable parent_instance; - gboolean linked; /* control linkage */ - gboolean preserve_trans; /* preserve transparency */ + gboolean linked; /* control linkage */ + gboolean preserve_trans; /* preserve transparency */ - LayerMask *mask; /* possible layer mask */ - gint apply_mask; /* controls mask application */ - gboolean edit_mask; /* edit mask or layer? */ - gboolean show_mask; /* show mask or layer? */ + LayerMask *mask; /* possible layer mask */ + gint apply_mask; /* controls mask application */ + gboolean edit_mask; /* edit mask or layer? */ + gboolean show_mask; /* show mask or layer? */ - gint opacity; /* layer opacity */ - LayerModeEffects mode; /* layer combination mode */ + gint opacity; /* layer opacity */ + LayerModeEffects mode; /* layer combination mode */ /* Floating selections */ struct { - TileManager *backing_store; /* for obscured regions */ - GimpDrawable *drawable; /* floating sel is attached to */ - gboolean initial; /* is fs composited yet? */ + TileManager *backing_store; /* for obscured regions */ + GimpDrawable *drawable; /* floating sel is attached to */ + gboolean initial; /* is fs composited yet? */ - gboolean boundary_known; /* is the current boundary valid */ - BoundSeg *segs; /* boundary of floating sel */ - gint num_segs; /* number of segs in boundary */ + gboolean boundary_known; /* is the current boundary valid */ + BoundSeg *segs; /* boundary of floating sel */ + gint num_segs; /* number of segs in boundary */ } fs; }; struct _GimpLayerClass { - GimpDrawableClass parent_class; + GimpDrawableClass parent_class; void (* removed) (GimpLayer *layer); }; struct _GimpLayerMask { - GimpChannel drawable; + GimpChannel parent_instance; - Layer *layer; + Layer *layer; }; struct _GimpLayerMaskClass { - GimpChannelClass parent_class; + GimpChannelClass parent_class; }; /* Special undo types */ diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 432aaecd81..1981ec16ad 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/module_db.c b/app/module_db.c index 75ccf850e9..b4332f2b1b 100644 --- a/app/module_db.c +++ b/app/module_db.c @@ -95,7 +95,7 @@ gimp_main_funcs[] = /* one of these objects is kept per-module */ typedef struct { - GtkObject object; + GtkObject parent_instance; gchar *fullpath; /* path to the module */ module_state state; /* what's happened to the module */ @@ -115,9 +115,9 @@ typedef struct static guint module_info_get_type (void); -#define MODULE_INFO_TYPE module_info_get_type() -#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo) -#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE) +#define MODULE_INFO_TYPE (module_info_get_type ()) +#define MODULE_INFO(obj) (GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)) +#define IS_MODULE_INFO(obj) (GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)) #define NUM_INFO_LINES 7 @@ -138,7 +138,8 @@ static GimpSet *modules; static GimpSetHandlerId modules_handler; /* If the inhibit state of any modules changes, we might need to - * re-write the modulerc. */ + * re-write the modulerc. + */ static gboolean need_to_rewrite_modulerc = FALSE; @@ -157,7 +158,7 @@ static gboolean need_to_rewrite_modulerc = FALSE; /* prototypes */ -static void module_initialize (gchar *filename); +static void module_initialize (const gchar *filename); static void mod_load (ModuleInfo *mod, gboolean verbose); static void mod_unload (ModuleInfo *mod, @@ -389,24 +390,29 @@ module_db_browser_new (void) } -/**************************************************************/ +/**************************/ /* ModuleInfo object glue */ -typedef struct -{ - GtkObjectClass parent_class; - - void (* modified) (ModuleInfo *module_info); -} ModuleInfoClass; - enum { MODIFIED, LAST_SIGNAL }; + +typedef struct _ModuleInfoClass ModuleInfoClass; + +struct _ModuleInfoClass +{ + GimpObjectClass parent_class; + + void (* modified) (ModuleInfo *module_info); +}; + + static guint module_info_signals[LAST_SIGNAL]; +static GimpObjectClass *parent_class = NULL; static void module_info_destroy (GtkObject *object) @@ -419,6 +425,9 @@ module_info_destroy (GtkObject *object) if (mod->last_module_error) g_free (mod->last_module_error); g_free (mod->fullpath); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void @@ -428,6 +437,8 @@ module_info_class_init (ModuleInfoClass *klass) object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (GIMP_TYPE_OBJECT); + module_info_signals[MODIFIED] = gtk_signal_new ("modified", GTK_RUN_FIRST, @@ -469,8 +480,7 @@ module_info_get_type (void) (GtkClassInitFunc) NULL, }; - module_info_type = - gtk_type_unique (gtk_object_get_type (), &module_info_info); + module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info); } return module_info_type; @@ -506,7 +516,7 @@ static gboolean valid_module_name (const gchar *filename) { const gchar *basename; - gint len; + gint len; basename = g_basename (filename); @@ -537,8 +547,8 @@ static gboolean module_inhibited (const gchar *fullpath, const gchar *inhibit_list) { - gchar *p; - gint pathlen; + gchar *p; + gint pathlen; const gchar *start; const gchar *end; @@ -570,7 +580,7 @@ module_inhibited (const gchar *fullpath, static void -module_initialize (gchar *filename) +module_initialize (const gchar *filename) { ModuleInfo *mod; @@ -583,23 +593,24 @@ module_initialize (gchar *filename) mod = module_info_new (); - mod->fullpath = g_strdup (filename); - mod->ondisk = TRUE; - mod->state = ST_MODULE_ERROR; + mod->fullpath = g_strdup (filename); + mod->ondisk = TRUE; + mod->state = ST_MODULE_ERROR; - mod->info = NULL; - mod->module = NULL; + mod->info = NULL; + mod->module = NULL; mod->last_module_error = NULL; - mod->init = NULL; - mod->unload = NULL; + mod->init = NULL; + mod->unload = NULL; /* Count of times main gimp is within the module. Normally, this * will be 1, and we assume that the module won't call its * unload callback until it is satisfied that it's not in use any * more. refs can be 2 temporarily while we're running the module's * unload function, to stop the module attempting to unload - * itself. */ - mod->refs = 0; + * itself. + */ + mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, module_db_load_inhibit); if (!mod->load_inhibit) @@ -646,7 +657,7 @@ mod_load (ModuleInfo *mod, #ifdef __EMX__ if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol)) { - *(struct main_funcs_struc **)symbol = gimp_main_funcs; + *(struct main_funcs_struc **) symbol = gimp_main_funcs; } #endif /* find the module_init symbol */ @@ -663,7 +674,7 @@ mod_load (ModuleInfo *mod, g_module_close (mod->module); mod->module = NULL; - mod->info = NULL; + mod->info = NULL; return; } @@ -692,7 +703,7 @@ mod_load (ModuleInfo *mod, static void -mod_unload_completed_callback (void *data) +mod_unload_completed_callback (gpointer data) { ModuleInfo *mod = data; @@ -1149,5 +1160,3 @@ gimp_module_unref (ModuleInfo *mod) mod->module = NULL; } } - -/* End of module_db.c */ diff --git a/app/palette.c b/app/palette.c index 09f6828a0f..82b808b0b5 100644 --- a/app/palette.c +++ b/app/palette.c @@ -146,19 +146,20 @@ struct _PaletteDialog }; /* local function prototypes */ -static void palette_entry_free (PaletteEntry *); -static void palette_entries_free (PaletteEntries *); -static void palette_entries_load (gchar *); -static void palette_entries_save (PaletteEntries *, gchar *); -static void palette_save_palettes (void); +static void palette_entry_free (PaletteEntry *entry); +static void palette_entries_free (PaletteEntries *entries); +static void palette_entries_load (const gchar *filename); +static void palette_entries_save (PaletteEntries *entries, + const gchar *filename); +static void palette_save_palettes (void); static void palette_entries_list_insert (PaletteEntries *entries); -static void palette_dialog_draw_entries (PaletteDialog *palette, - gint row_start, - gint column_highlight); -static void palette_dialog_redraw (PaletteDialog *palette); -static void palette_dialog_scroll_top_left (PaletteDialog *palette); +static void palette_dialog_draw_entries (PaletteDialog *palette, + gint row_start, + gint column_highlight); +static void palette_dialog_redraw (PaletteDialog *palette); +static void palette_dialog_scroll_top_left (PaletteDialog *palette); static PaletteDialog * palette_dialog_new (gboolean editor); static ImportDialog * palette_import_dialog_new (PaletteDialog *palette); @@ -375,7 +376,7 @@ palette_entries_add_entry (PaletteEntries *entries, } static void -palette_entries_load (gchar *filename) +palette_entries_load (const gchar *filename) { PaletteEntries *entries; gchar str[512]; @@ -505,11 +506,11 @@ palette_entries_delete (gchar *filename) static void palette_entries_save (PaletteEntries *palette, - gchar *filename) + const gchar *filename) { PaletteEntry *entry; - GSList *list; - FILE *fp; + GSList *list; + FILE *fp; if (! filename) return; diff --git a/app/palette.h b/app/palette.h index 3059ca3ff2..5d8c945930 100644 --- a/app/palette.h +++ b/app/palette.h @@ -25,6 +25,7 @@ #define COLOR_UPDATE_NEW 1 #define COLOR_UPDATE 2 + void palettes_init (gboolean no_data); void palettes_free (void); diff --git a/app/patterns.c b/app/patterns.c index 4414e757d4..7331e2187a 100644 --- a/app/patterns.c +++ b/app/patterns.c @@ -67,9 +67,9 @@ static GPattern *standard_pattern = NULL; /* local function prototypes */ static GPattern * pattern_load_real (gint fd, - gchar *filename, + const gchar *filename, gboolean quiet); -static void load_pattern (gchar *filename); +static void load_pattern (const gchar *filename); static void pattern_free_func (gpointer data, gpointer dummy); static gint pattern_compare_func (gconstpointer second, @@ -153,8 +153,8 @@ pattern_list_get_pattern_by_index (GSList *list, } GPattern * -pattern_list_get_pattern (GSList *list, - gchar *name) +pattern_list_get_pattern (GSList *list, + const gchar *name) { GPattern *pattern; @@ -173,21 +173,21 @@ pattern_list_get_pattern (GSList *list, } GPattern * -pattern_load (gint fd, - gchar *filename) +pattern_load (gint fd, + const gchar *filename) { return pattern_load_real (fd, filename, TRUE); } static GPattern * -pattern_load_real (gint fd, - gchar *filename, - gboolean quiet) +pattern_load_real (gint fd, + const gchar *filename, + gboolean quiet) { GPattern *pattern; PatternHeader header; - gint bn_size; - gchar *name; + gint bn_size; + gchar *name; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (fd != -1, NULL); @@ -260,10 +260,9 @@ pattern_free (GPattern *pattern) { if (pattern->mask) temp_buf_free (pattern->mask); - if (pattern->filename) - g_free (pattern->filename); - if (pattern->name) - g_free (pattern->name); + + g_free (pattern->filename); + g_free (pattern->name); g_free (pattern); } @@ -286,7 +285,7 @@ pattern_compare_func (gconstpointer first, } static void -load_pattern (gchar *filename) +load_pattern (const gchar *filename) { GPattern *pattern; gint fd; @@ -299,7 +298,7 @@ load_pattern (gchar *filename) g_return_if_fail (filename != NULL); fd = open (filename, O_RDONLY | _O_BINARY); - if (fd == -1) + if (fd == -1) return; pattern = pattern_load_real (fd, filename, FALSE); diff --git a/app/patterns.h b/app/patterns.h index 269b84ddf7..5097f45ebd 100644 --- a/app/patterns.h +++ b/app/patterns.h @@ -22,29 +22,29 @@ struct _GPattern { - gchar * filename; /* actual filename--pattern's location on disk */ - gchar * name; /* pattern's name--for pattern selection dialog */ - gint index; /* pattern's index... */ - TempBuf * mask; /* the actual mask... */ + gchar *filename; /* actual filename--pattern's location on disk */ + gchar *name; /* pattern's name--for pattern selection dialog */ + gint index; /* pattern's index... */ + TempBuf *mask; /* the actual mask... */ }; /* global variables */ -extern GSList * pattern_list; -extern gint num_patterns; +extern GSList *pattern_list; +extern gint num_patterns; -void patterns_init (gboolean no_data); +void patterns_init (gboolean no_data); void patterns_free (void); GPattern * patterns_get_standard_pattern (void); -GPattern * pattern_list_get_pattern_by_index (GSList *list, - gint index); -GPattern * pattern_list_get_pattern (GSList *list, - gchar *name); +GPattern * pattern_list_get_pattern_by_index (GSList *list, + gint index); +GPattern * pattern_list_get_pattern (GSList *list, + const gchar *name); /* this is useful for pixmap brushes etc. */ -GPattern * pattern_load (gint fd, - gchar *filename); -void pattern_free (GPattern *pattern); +GPattern * pattern_load (gint fd, + const gchar *filename); +void pattern_free (GPattern *pattern); #endif /* __PATTERNS_H__ */ diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimpplugin-progress.h b/app/plug-in/gimpplugin-progress.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/gimpplugin-progress.h +++ b/app/plug-in/gimpplugin-progress.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/gimpplugin.h +++ b/app/plug-in/gimpplugin.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/gimppluginmanager.h b/app/plug-in/gimppluginmanager.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/gimppluginmanager.h +++ b/app/plug-in/gimppluginmanager.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-def.h b/app/plug-in/plug-in-def.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/plug-in-def.h +++ b/app/plug-in/plug-in-def.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-params.h b/app/plug-in/plug-in-params.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/plug-in-params.h +++ b/app/plug-in/plug-in-params.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-progress.h b/app/plug-in/plug-in-progress.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/plug-in-progress.h +++ b/app/plug-in/plug-in-progress.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-in.h b/app/plug-in/plug-in.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/plug-in.h +++ b/app/plug-in/plug-in.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug-in/plug-ins.h b/app/plug-in/plug-ins.h index c0764feb70..acca0d1d41 100644 --- a/app/plug-in/plug-ins.h +++ b/app/plug-in/plug-ins.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/plug_in.c b/app/plug_in.c index 432aaecd81..1981ec16ad 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -149,8 +149,8 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run); static void plug_in_handle_proc_return (GPProcReturn *proc_return); static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (gchar *filename); -static void plug_in_init_file (gchar *filename); +static void plug_in_write_rc (const gchar *filename); +static void plug_in_init_file (const gchar *filename); static void plug_in_query (PlugInDef *plug_in_def); static void plug_in_add_to_db (void); static void plug_in_make_menu (void); @@ -670,7 +670,7 @@ plug_in_file_handler (gchar *name, PlugInDef * -plug_in_def_new (gchar *prog) +plug_in_def_new (const gchar *prog) { PlugInDef *plug_in_def; @@ -2213,7 +2213,7 @@ plug_in_write_rc_string (FILE *fp, } static void -plug_in_write_rc (gchar *filename) +plug_in_write_rc (const gchar *filename) { FILE *fp; PlugInDef *plug_in_def; @@ -2327,7 +2327,7 @@ plug_in_write_rc (gchar *filename) } static void -plug_in_init_file (gchar *filename) +plug_in_init_file (const gchar *filename) { GSList *tmp; PlugInDef *plug_in_def; diff --git a/app/plug_in.h b/app/plug_in.h index c0764feb70..acca0d1d41 100644 --- a/app/plug_in.h +++ b/app/plug_in.h @@ -128,7 +128,7 @@ PlugInProcDef * plug_in_file_handler (gchar *name, void plug_in_def_add (PlugInDef *plug_in_def); /* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (gchar *prog); +PlugInDef * plug_in_def_new (const gchar *prog); void plug_in_def_free (PlugInDef *plug_in_def, gboolean free_proc_defs); diff --git a/app/undo_history.c b/app/undo_history.c index dabbedb953..189e67243d 100644 --- a/app/undo_history.c +++ b/app/undo_history.c @@ -745,7 +745,7 @@ undo_history_new (GImage *gimage) gtk_signal_connect (GTK_OBJECT (gimage), "undo_event", GTK_SIGNAL_FUNC (undo_history_undo_event), st); - gtk_signal_connect (GTK_OBJECT (gimage), "rename", + gtk_signal_connect (GTK_OBJECT (gimage), "name_changed", GTK_SIGNAL_FUNC (undo_history_gimage_rename_callback), st); gtk_signal_connect (GTK_OBJECT (gimage), "destroy", diff --git a/app/widgets/gimpbrusheditor.c b/app/widgets/gimpbrusheditor.c index 2ea93642f2..1b3bf5179c 100644 --- a/app/widgets/gimpbrusheditor.c +++ b/app/widgets/gimpbrusheditor.c @@ -140,11 +140,11 @@ brush_edit_brush_dirty_callback (GimpBrush *brush, } static void -brush_renamed_callback (GtkWidget *widget, - BrushEditGeneratedWindow *begw) +brush_name_changed_callback (GtkWidget *widget, + BrushEditGeneratedWindow *begw) { gtk_entry_set_text (GTK_ENTRY (begw->name), - gimp_brush_get_name (GIMP_BRUSH (begw->brush))); + gimp_object_get_name (GIMP_OBJECT (begw->brush))); } void @@ -178,8 +178,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gtk_signal_connect (GTK_OBJECT (brush), "dirty", GTK_SIGNAL_FUNC (brush_edit_brush_dirty_callback), begw); - gtk_signal_connect (GTK_OBJECT (brush), "rename", - GTK_SIGNAL_FUNC (brush_renamed_callback), + gtk_signal_connect (GTK_OBJECT (brush), "name_changed", + GTK_SIGNAL_FUNC (brush_name_changed_callback), begw); begw->brush = NULL; @@ -191,7 +191,8 @@ brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw, gimp_brush_generated_get_angle (brush)); gtk_adjustment_set_value (GTK_ADJUSTMENT (begw->aspect_ratio_data), gimp_brush_generated_get_aspect_ratio (brush)); - gtk_entry_set_text (GTK_ENTRY (begw->name), gimp_brush_get_name (gbrush)); + gtk_entry_set_text (GTK_ENTRY (begw->name), + gimp_object_get_name (GIMP_OBJECT (gbrush))); begw->brush = brush; gtk_object_ref (GTK_OBJECT (begw->brush)); @@ -205,7 +206,7 @@ name_changed_func (GtkWidget *widget, gchar *entry_text; entry_text = gtk_entry_get_text (GTK_ENTRY (widget)); - gimp_brush_set_name (GIMP_BRUSH (begw->brush), entry_text); + gimp_object_set_name (GIMP_OBJECT (begw->brush), entry_text); } void diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index c9903c47b5..124371fe12 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -263,7 +263,7 @@ gimp_colormap_dialog_create (GimpSet *context) image_cmap_change_cb, ipal); ipal->rename_handler = gimp_set_add_handler (context, - "rename", + "name_changed", image_rename_cb, ipal); diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index b3c7991749..b69315dea6 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info, if (gimp_context_get_brush (device_info->context)) { fprintf (fp, "\n (brush \"%s\")", - gimp_context_get_brush (device_info->context)->name); + GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name); } if (gimp_context_get_pattern (device_info->context)) diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index b3c7991749..b69315dea6 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -713,7 +713,7 @@ devices_write_rc_device (DeviceInfo *device_info, if (gimp_context_get_brush (device_info->context)) { fprintf (fp, "\n (brush \"%s\")", - gimp_context_get_brush (device_info->context)->name); + GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name); } if (gimp_context_get_pattern (device_info->context)) diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c index aaec5728f3..eb1b20e036 100644 --- a/app/widgets/gimpdnd.c +++ b/app/widgets/gimpdnd.c @@ -627,7 +627,7 @@ gimp_dnd_get_brush_data (GtkWidget *widget, if (! brush) return NULL; - name = g_strdup (gimp_brush_get_name (brush)); + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); if (! name) return NULL; diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c index 57b203904e..296aa121ed 100644 --- a/app/widgets/gimpgradienteditor.c +++ b/app/widgets/gimpgradienteditor.c @@ -575,20 +575,20 @@ static void cpopup_blend_endpoints (gdouble r0, /* Gradient functions */ static gradient_t * grad_new_gradient (void); -static void grad_free_gradient (gradient_t *grad); +static void grad_free_gradient (gradient_t *grad); static void grad_free_gradients (void); -static void grad_load_gradient (gchar *filename); -static void grad_save_gradient (gradient_t *grad, - gchar *filename); -static void grad_save_all (gboolean need_free); +static void grad_load_gradient (const gchar *filename); +static void grad_save_gradient (gradient_t *grad, + const gchar *filename); +static void grad_save_all (gboolean need_free); static gradient_t * grad_create_default_gradient (void); -static gint grad_insert_in_gradients_list (gradient_t *grad); +static gint grad_insert_in_gradients_list (gradient_t *grad); -static void grad_dump_gradient (gradient_t *grad, - FILE *file); -static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); +static void grad_dump_gradient (gradient_t *grad, + FILE *file); +static void gradients_list_uniquefy_gradient_name (gradient_t *gradient); /* Segment functions */ @@ -5844,7 +5844,7 @@ grad_free_gradients (void) /*****/ static void -grad_load_gradient (gchar *filename) +grad_load_gradient (const gchar *filename) { FILE *file; gradient_t *grad; @@ -5922,11 +5922,11 @@ grad_load_gradient (gchar *filename) /*****/ static void -grad_save_gradient (gradient_t *grad, - char *filename) +grad_save_gradient (gradient_t *grad, + const gchar *filename) { FILE *file; - int num_segments; + gint num_segments; grad_segment_t *seg; g_assert (grad != NULL); diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 09f6828a0f..82b808b0b5 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -146,19 +146,20 @@ struct _PaletteDialog }; /* local function prototypes */ -static void palette_entry_free (PaletteEntry *); -static void palette_entries_free (PaletteEntries *); -static void palette_entries_load (gchar *); -static void palette_entries_save (PaletteEntries *, gchar *); -static void palette_save_palettes (void); +static void palette_entry_free (PaletteEntry *entry); +static void palette_entries_free (PaletteEntries *entries); +static void palette_entries_load (const gchar *filename); +static void palette_entries_save (PaletteEntries *entries, + const gchar *filename); +static void palette_save_palettes (void); static void palette_entries_list_insert (PaletteEntries *entries); -static void palette_dialog_draw_entries (PaletteDialog *palette, - gint row_start, - gint column_highlight); -static void palette_dialog_redraw (PaletteDialog *palette); -static void palette_dialog_scroll_top_left (PaletteDialog *palette); +static void palette_dialog_draw_entries (PaletteDialog *palette, + gint row_start, + gint column_highlight); +static void palette_dialog_redraw (PaletteDialog *palette); +static void palette_dialog_scroll_top_left (PaletteDialog *palette); static PaletteDialog * palette_dialog_new (gboolean editor); static ImportDialog * palette_import_dialog_new (PaletteDialog *palette); @@ -375,7 +376,7 @@ palette_entries_add_entry (PaletteEntries *entries, } static void -palette_entries_load (gchar *filename) +palette_entries_load (const gchar *filename) { PaletteEntries *entries; gchar str[512]; @@ -505,11 +506,11 @@ palette_entries_delete (gchar *filename) static void palette_entries_save (PaletteEntries *palette, - gchar *filename) + const gchar *filename) { PaletteEntry *entry; - GSList *list; - FILE *fp; + GSList *list; + FILE *fp; if (! filename) return; diff --git a/app/widgets/gimppaletteeditor.h b/app/widgets/gimppaletteeditor.h index 3059ca3ff2..5d8c945930 100644 --- a/app/widgets/gimppaletteeditor.h +++ b/app/widgets/gimppaletteeditor.h @@ -25,6 +25,7 @@ #define COLOR_UPDATE_NEW 1 #define COLOR_UPDATE 2 + void palettes_init (gboolean no_data); void palettes_free (void); diff --git a/app/xcf.c b/app/xcf.c index eb0dd29759..aa283fc947 100644 --- a/app/xcf.c +++ b/app/xcf.c @@ -1694,7 +1694,7 @@ xcf_load_image (XcfInfo *info) if (!xcf_load_image_props (info, gimage)) goto hard_error; - while (1) + while (TRUE) { /* read in the offset of the next layer */ info->cp += xcf_read_int32 (info->fp, &offset, 1); @@ -1730,7 +1730,7 @@ xcf_load_image (XcfInfo *info) xcf_seek_pos (info, saved_pos); } - while (1) + while (TRUE) { /* read in the offset of the next channel */ info->cp += xcf_read_int32 (info->fp, &offset, 1); @@ -1772,7 +1772,7 @@ xcf_load_image (XcfInfo *info) if (info->active_channel) gimp_image_set_active_channel (gimage, info->active_channel); - gimp_image_set_filename (gimage, info->filename); + gimp_object_set_name (GIMP_OBJECT (gimage), info->filename); return gimage; @@ -1780,13 +1780,17 @@ xcf_load_image (XcfInfo *info) if (num_successful_elements == 0) goto hard_error; - g_message("XCF: This file is corrupt! I have loaded as much\nof it as I can, but it is incomplete."); + g_message ("XCF: This file is corrupt! I have loaded as much\n" + "of it as I can, but it is incomplete."); return gimage; hard_error: - g_message("XCF: This file is corrupt! I could not even\nsalvage any partial image data from it."); + g_message ("XCF: This file is corrupt! I could not even\n" + "salvage any partial image data from it."); + gimage_delete (gimage); + return NULL; } @@ -1797,7 +1801,7 @@ xcf_load_image_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; @@ -2020,7 +2024,7 @@ xcf_load_layer_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; @@ -2112,7 +2116,7 @@ xcf_load_channel_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index eb0dd29759..aa283fc947 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -1694,7 +1694,7 @@ xcf_load_image (XcfInfo *info) if (!xcf_load_image_props (info, gimage)) goto hard_error; - while (1) + while (TRUE) { /* read in the offset of the next layer */ info->cp += xcf_read_int32 (info->fp, &offset, 1); @@ -1730,7 +1730,7 @@ xcf_load_image (XcfInfo *info) xcf_seek_pos (info, saved_pos); } - while (1) + while (TRUE) { /* read in the offset of the next channel */ info->cp += xcf_read_int32 (info->fp, &offset, 1); @@ -1772,7 +1772,7 @@ xcf_load_image (XcfInfo *info) if (info->active_channel) gimp_image_set_active_channel (gimage, info->active_channel); - gimp_image_set_filename (gimage, info->filename); + gimp_object_set_name (GIMP_OBJECT (gimage), info->filename); return gimage; @@ -1780,13 +1780,17 @@ xcf_load_image (XcfInfo *info) if (num_successful_elements == 0) goto hard_error; - g_message("XCF: This file is corrupt! I have loaded as much\nof it as I can, but it is incomplete."); + g_message ("XCF: This file is corrupt! I have loaded as much\n" + "of it as I can, but it is incomplete."); return gimage; hard_error: - g_message("XCF: This file is corrupt! I could not even\nsalvage any partial image data from it."); + g_message ("XCF: This file is corrupt! I could not even\n" + "salvage any partial image data from it."); + gimage_delete (gimage); + return NULL; } @@ -1797,7 +1801,7 @@ xcf_load_image_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; @@ -2020,7 +2024,7 @@ xcf_load_layer_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; @@ -2112,7 +2116,7 @@ xcf_load_channel_props (XcfInfo *info, PropType prop_type; guint32 prop_size; - while (1) + while (TRUE) { if (!xcf_load_prop (info, &prop_type, &prop_size)) return FALSE; diff --git a/libgimpbase/gimpdatafiles.c b/libgimpbase/gimpdatafiles.c index 5523f08de5..d3c30eb3e4 100644 --- a/libgimpbase/gimpdatafiles.c +++ b/libgimpbase/gimpdatafiles.c @@ -53,11 +53,10 @@ #include "libgimp/gimpenv.h" -/***** Functions *****/ - static gboolean filestat_valid = FALSE; static struct stat filestat; + #ifdef G_OS_WIN32 /* * On Windows there is no concept like the Unix executable flag. @@ -103,7 +102,7 @@ is_script (const gchar *filename) #endif void -datafiles_read_directories (gchar *path_str, +datafiles_read_directories (const gchar *path_str, GimpDataFileLoaderFunc loader_func, GimpDataFileFlags flags) { @@ -179,6 +178,7 @@ datafile_atime (void) { if (filestat_valid) return filestat.st_atime; + return 0; } @@ -187,6 +187,7 @@ datafile_mtime (void) { if (filestat_valid) return filestat.st_mtime; + return 0; } @@ -195,5 +196,6 @@ datafile_ctime (void) { if (filestat_valid) return filestat.st_ctime; + return 0; } diff --git a/libgimpbase/gimpdatafiles.h b/libgimpbase/gimpdatafiles.h index d5c721e02b..6667b3622e 100644 --- a/libgimpbase/gimpdatafiles.h +++ b/libgimpbase/gimpdatafiles.h @@ -29,23 +29,21 @@ typedef enum MODE_EXECUTABLE = 1 << 1 } GimpDataFileFlags; -typedef void (* GimpDataFileLoaderFunc) (gchar *filename); +typedef void (* GimpDataFileLoaderFunc) (const gchar *filename); -/***** Functions *****/ - -void datafiles_read_directories (gchar *path_str, - GimpDataFileLoaderFunc loader_func, - GimpDataFileFlags flags); +void datafiles_read_directories (const gchar *path_str, + GimpDataFileLoaderFunc loader_func, + GimpDataFileFlags flags); /* Return the current datafiles access, modification * or change time. The current datafile is the one for * which the "DataFileLoaderFunc" function has been called * on. */ -time_t datafile_atime (void); -time_t datafile_mtime (void); -time_t datafile_ctime (void); +time_t datafile_atime (void); +time_t datafile_mtime (void); +time_t datafile_ctime (void); #endif /* __DATAFILES_H__ */ diff --git a/tools/pdbgen/pdb/brushes.pdb b/tools/pdbgen/pdb/brushes.pdb index 4541428ca7..f02f480265 100644 --- a/tools/pdbgen/pdb/brushes.pdb +++ b/tools/pdbgen/pdb/brushes.pdb @@ -51,7 +51,8 @@ sub paint_mode_arg () {{ sub brush_outargs { foreach (@outargs) { - my $alias = "brush->$_->{name}"; + my $alias = ($_->{type} eq 'string') ? + "GIMP_OBJECT (brush)->$_->{name}" : "brush->$_->{name}"; $alias = "g_strdup ($alias)" if $_->{type} eq 'string'; $alias =~ s/brush/brush->mask/ if $_->{name} =~ /width|height/; $_->{alias} = $alias; @@ -274,7 +275,7 @@ HELP while (list) { - brushes[i++] = g_strdup (((GimpBrush *) list->data)->name); + brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name); list = list->next; } } @@ -332,7 +333,7 @@ HELP { brush = (GimpBrush *) list->data; - if (!strcmp (brush->name, name)) + if (!strcmp (GIMP_OBJECT (brush)->name, name)) { success = TRUE; break;