set the "tooltip" return value to NULL before calling the virtual

2005-10-10  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpviewable.c (gimp_viewable_get_description): set the
	"tooltip" return value to NULL before calling the virtual function.

	* app/core/gimpbrush.c
	* app/core/gimpbuffer.c
	* app/core/gimpchannel.c
	* app/core/gimplayer.c
	* app/core/gimppaintinfo.c
	* app/core/gimppalette.c
	* app/core/gimppattern.c
	* app/core/gimptoolinfo.c (get_description): don't do it here.

	* app/core/gimpbuffer.c
	* app/core/gimppaintinfo.c: untabbify, cleanup.

	* app/core/gimpobject.c: emit "notify::name" whenerver the name
	changes, clenup.
This commit is contained in:
Michael Natterer 2005-10-09 23:05:25 +00:00 committed by Michael Natterer
parent 16bb98eeeb
commit 34697840ed
14 changed files with 66 additions and 94 deletions

View file

@ -1,3 +1,23 @@
2005-10-10 Michael Natterer <mitch@gimp.org>
* app/core/gimpviewable.c (gimp_viewable_get_description): set the
"tooltip" return value to NULL before calling the virtual function.
* app/core/gimpbrush.c
* app/core/gimpbuffer.c
* app/core/gimpchannel.c
* app/core/gimplayer.c
* app/core/gimppaintinfo.c
* app/core/gimppalette.c
* app/core/gimppattern.c
* app/core/gimptoolinfo.c (get_description): don't do it here.
* app/core/gimpbuffer.c
* app/core/gimppaintinfo.c: untabbify, cleanup.
* app/core/gimpobject.c: emit "notify::name" whenerver the name
changes, clenup.
2005-10-09 DindinX <dindinx@gimp.org>
* libgimp/gimpzoompreview.c: Enable selection masking, even if it

View file

@ -298,9 +298,6 @@ gimp_brush_get_description (GimpViewable *viewable,
{
GimpBrush *brush = GIMP_BRUSH (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (brush)->name,
brush->mask->width,

View file

@ -76,19 +76,19 @@ gimp_buffer_get_type (void)
static const GTypeInfo buffer_info =
{
sizeof (GimpBufferClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_buffer_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBuffer),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_buffer_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_buffer_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBuffer),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_buffer_init,
};
buffer_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpBuffer",
&buffer_info, 0);
"GimpBuffer",
&buffer_info, 0);
}
return buffer_type;
@ -164,11 +164,11 @@ gimp_buffer_get_size (GimpViewable *viewable,
static void
gimp_buffer_get_preview_size (GimpViewable *viewable,
gint size,
gint size,
gboolean is_popup,
gboolean dot_for_dot,
gint *width,
gint *height)
gint *width,
gint *height)
{
GimpBuffer *buffer = GIMP_BUFFER (viewable);
@ -225,8 +225,8 @@ gimp_buffer_get_popup_size (GimpViewable *viewable,
static TempBuf *
gimp_buffer_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
gint width,
gint height)
{
GimpBuffer *buffer = GIMP_BUFFER (viewable);
TempBuf *temp_buf;
@ -242,10 +242,10 @@ gimp_buffer_get_new_preview (GimpViewable *viewable,
bytes = tile_manager_bpp (buffer->tiles);
pixel_region_init (&srcPR, buffer->tiles,
0, 0,
buffer_width,
buffer_height,
FALSE);
0, 0,
buffer_width,
buffer_height,
FALSE);
if (buffer_height > height || buffer_width > width)
temp_buf = temp_buf_new (width, height, bytes, 0, 0, NULL);
@ -282,9 +282,6 @@ gimp_buffer_get_description (GimpViewable *viewable,
{
GimpBuffer *buffer = GIMP_BUFFER (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (buffer)->name,
gimp_buffer_get_width (buffer),
@ -293,7 +290,7 @@ gimp_buffer_get_description (GimpViewable *viewable,
GimpBuffer *
gimp_buffer_new (TileManager *tiles,
const gchar *name,
const gchar *name,
gboolean copy_pixels)
{
GimpBuffer *buffer;

View file

@ -398,9 +398,6 @@ gimp_channel_get_description (GimpViewable *viewable,
if (! strcmp (GIMP_IMAGE_QUICK_MASK_NAME,
gimp_object_get_name (GIMP_OBJECT (viewable))))
{
if (tooltip)
*tooltip = NULL;
return g_strdup (_("Quick Mask"));
}

View file

@ -481,9 +481,6 @@ gimp_layer_get_description (GimpViewable *viewable,
{
if (gimp_layer_is_floating_sel (GIMP_LAYER (viewable)))
{
if (tooltip)
*tooltip = NULL;
return g_strdup_printf (_("Floating Selection\n(%s)"),
gimp_object_get_name (GIMP_OBJECT (viewable)));
}

View file

@ -99,9 +99,7 @@ gimp_object_get_type (void)
static void
gimp_object_class_init (GimpObjectClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -132,8 +130,7 @@ gimp_object_class_init (GimpObjectClass *klass)
klass->name_changed = NULL;
klass->get_memsize = gimp_object_real_get_memsize;
g_object_class_install_property (object_class,
PROP_NAME,
g_object_class_install_property (object_class, PROP_NAME,
g_param_spec_string ("name",
NULL, NULL,
NULL,
@ -152,15 +149,13 @@ gimp_object_dispose (GObject *object)
{
gboolean disconnected;
disconnected = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (object),
"disconnected"));
disconnected = GPOINTER_TO_INT (g_object_get_data (object, "disconnected"));
if (! disconnected)
{
g_signal_emit (object, object_signals[DISCONNECT], 0);
g_object_set_data (G_OBJECT (object), "disconnected",
GINT_TO_POINTER (TRUE));
g_object_set_data (object, "disconnected", GINT_TO_POINTER (TRUE));
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -235,6 +230,7 @@ gimp_object_set_name (GimpObject *object,
object->name = g_strdup (name);
gimp_object_name_changed (object);
g_object_notify (G_OBJECT (object), "name");
}
/**
@ -261,6 +257,7 @@ gimp_object_set_name_safe (GimpObject *object,
object->name = gimp_utf8_strtrim (name, 30);
gimp_object_name_changed (object);
g_object_notify (G_OBJECT (object), "name");
}
/**
@ -284,7 +281,7 @@ gimp_object_get_name (const GimpObject *object)
* gimp_object_name_changed:
* @object: a #GimpObject
*
* Causes the "name_changed" signal to be emitted.
* Causes the "name-changed" signal to be emitted.
**/
void
gimp_object_name_changed (GimpObject *object)
@ -303,7 +300,7 @@ gimp_object_name_changed (GimpObject *object)
*
* In general you should be using gimp_object_set_name() instead. But
* if you ever need to free the object name but don't want the
* "name_changed" signal to be emitted, then use this function. Never
* "name-changed" signal to be emitted, then use this function. Never
* ever free the object name directly!
**/
void
@ -451,11 +448,10 @@ static gint64
gimp_object_real_get_memsize (GimpObject *object,
gint64 *gui_size)
{
gint64 memsize = 0;
gint64 memsize = 0;
if (object->name)
memsize += strlen (object->name) + 1;
return memsize + gimp_g_object_get_memsize ((GObject *) object);
}

View file

@ -47,17 +47,17 @@ gimp_paint_info_get_type (void)
if (! paint_info_type)
{
static const GTypeInfo paint_info_info =
{
sizeof (GimpPaintInfoClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_paint_info_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPaintInfo),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_paint_info_init,
};
{
sizeof (GimpPaintInfoClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_paint_info_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPaintInfo),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_paint_info_init,
};
paint_info_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpPaintInfo",
@ -70,11 +70,8 @@ gimp_paint_info_get_type (void)
static void
gimp_paint_info_class_init (GimpPaintInfoClass *klass)
{
GObjectClass *object_class;
GimpViewableClass *viewable_class;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -95,9 +92,7 @@ gimp_paint_info_init (GimpPaintInfo *paint_info)
static void
gimp_paint_info_finalize (GObject *object)
{
GimpPaintInfo *paint_info;
paint_info = GIMP_PAINT_INFO (object);
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (object);
if (paint_info->blurb)
{
@ -120,9 +115,6 @@ gimp_paint_info_get_description (GimpViewable *viewable,
{
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup (paint_info->blurb);
}

View file

@ -295,9 +295,6 @@ gimp_palette_get_description (GimpViewable *viewable,
{
GimpPalette *palette = GIMP_PALETTE (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d)",
GIMP_OBJECT (palette)->name,
palette->n_colors);

View file

@ -295,9 +295,6 @@ gimp_palette_get_description (GimpViewable *viewable,
{
GimpPalette *palette = GIMP_PALETTE (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d)",
GIMP_OBJECT (palette)->name,
palette->n_colors);

View file

@ -295,9 +295,6 @@ gimp_palette_get_description (GimpViewable *viewable,
{
GimpPalette *palette = GIMP_PALETTE (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d)",
GIMP_OBJECT (palette)->name,
palette->n_colors);

View file

@ -205,9 +205,6 @@ gimp_pattern_get_description (GimpViewable *viewable,
{
GimpPattern *pattern = GIMP_PATTERN (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (pattern)->name,
pattern->mask->width,

View file

@ -205,9 +205,6 @@ gimp_pattern_get_description (GimpViewable *viewable,
{
GimpPattern *pattern = GIMP_PATTERN (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (pattern)->name,
pattern->mask->width,

View file

@ -229,9 +229,6 @@ gimp_tool_info_get_description (GimpViewable *viewable,
{
GimpToolInfo *tool_info = GIMP_TOOL_INFO (viewable);
if (tooltip)
*tooltip = NULL;
return g_strdup (tool_info->blurb);
}

View file

@ -293,8 +293,6 @@ gimp_viewable_get_memsize (GimpObject *object,
static void
gimp_viewable_real_invalidate_preview (GimpViewable *viewable)
{
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
g_object_set_qdata (G_OBJECT (viewable), quark_preview_temp_buf, NULL);
g_object_set_qdata (G_OBJECT (viewable), quark_preview_pixbuf, NULL);
}
@ -343,10 +341,6 @@ gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
TempBuf *temp_buf;
GdkPixbuf *pixbuf = NULL;
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
temp_buf = gimp_viewable_get_preview (viewable, width, height);
if (temp_buf)
@ -395,9 +389,6 @@ static gchar *
gimp_viewable_real_get_description (GimpViewable *viewable,
gchar **tooltip)
{
if (tooltip)
*tooltip = NULL;
return g_strdup (gimp_object_get_name (GIMP_OBJECT (viewable)));
}
@ -999,6 +990,9 @@ gimp_viewable_get_description (GimpViewable *viewable,
{
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
if (tooltip)
*tooltip = NULL;
return GIMP_VIEWABLE_GET_CLASS (viewable)->get_description (viewable,
tooltip);
}