Commit 16c6ee03 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

removed the ugly check whether we need gtk_widget_destroy or

Sun Mar 15 20:13:42 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
                we need gtk_widget_destroy or gtk_object_destroy. these functions are
                        by no means allowed to act differently!

                                * gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
                                        of _VISIBLE to operate on widget->window.
                                                (gtk_misc_set_padding): likewise.

                                                        * gtk/gtkwidget.c: slightly reordered object arguments.

                                                                * gtk/gtkobject.c (gtk_object_setv):
                                                                        * gtk/gtkobject.c (gtk_object_getv):
                                                                                operator `!' has precedence over `&'.
parent eac28852
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
Sun Mar 15 20:13:42 1998 Tim Janik <timj@gimp.org>
* gtk/gtkmain.c (gtk_quit_destructor): removed the ugly check whether
we need gtk_widget_destroy or gtk_object_destroy. these functions are
by no means allowed to act differently!
* gtk/gtkmisc.c (gtk_misc_set_alignment): check for _DRAWABLE instead
of _VISIBLE to operate on widget->window.
(gtk_misc_set_padding): likewise.
* gtk/gtkwidget.c: slightly reordered object arguments.
* gtk/gtkobject.c (gtk_object_setv):
* gtk/gtkobject.c (gtk_object_getv):
operator `!' has precedence over `&'.
Sun Mar 15 14:38:34 1998 Tim Janik <timj@gimp.org>
* gtk/gtknotebook.c (gtk_notebook_pages_allocate): applied a fix from
......
......@@ -949,12 +949,7 @@ static gint
gtk_quit_destructor (GtkObject **object_p)
{
if (*object_p)
{
if (GTK_IS_WIDGET (*object_p))
gtk_widget_destroy ((GtkWidget*) *object_p);
else
gtk_object_destroy (*object_p);
}
gtk_object_destroy (*object_p);
g_free (object_p);
return FALSE;
......
......@@ -91,22 +91,21 @@ gtk_misc_set_alignment (GtkMisc *misc,
{
misc->xalign = xalign;
misc->yalign = yalign;
/* clear the area that was allocated before the change
*/
if (GTK_WIDGET_VISIBLE (misc))
*/
if (GTK_WIDGET_DRAWABLE (misc))
{
GtkWidget *widget;
widget = GTK_WIDGET (misc);
gdk_window_clear_area (widget->window,
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
gtk_widget_queue_draw (GTK_WIDGET (misc));
}
gtk_widget_queue_draw (GTK_WIDGET (misc));
}
}
......@@ -116,28 +115,28 @@ gtk_misc_set_padding (GtkMisc *misc,
gint ypad)
{
GtkRequisition *requisition;
g_return_if_fail (misc != NULL);
g_return_if_fail (GTK_IS_MISC (misc));
if (xpad < 0)
xpad = 0;
if (ypad < 0)
ypad = 0;
if ((xpad != misc->xpad) || (ypad != misc->ypad))
{
requisition = &(GTK_WIDGET (misc)->requisition);
requisition->width -= misc->xpad * 2;
requisition->height -= misc->ypad * 2;
misc->xpad = xpad;
misc->ypad = ypad;
requisition->width += misc->xpad * 2;
requisition->height += misc->ypad * 2;
if (GTK_WIDGET (misc)->parent && GTK_WIDGET_VISIBLE (misc))
if (GTK_WIDGET_DRAWABLE (misc))
gtk_widget_queue_resize (GTK_WIDGET (misc));
}
}
......
......@@ -593,9 +593,10 @@ gtk_object_getv (GtkObject *object,
guint nargs,
GtkArg *args)
{
int i;
guint i;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
if (!arg_info_ht)
return;
......@@ -636,7 +637,7 @@ gtk_object_getv (GtkObject *object,
g_free (lookup_name);
continue;
}
else if (!info->arg_flags & GTK_ARG_READABLE)
else if (! (info->arg_flags & GTK_ARG_READABLE))
{
g_warning ("arg is not supplied for read-access: \"%s\"\n", lookup_name);
args[i].type = GTK_TYPE_INVALID;
......@@ -793,9 +794,10 @@ gtk_object_setv (GtkObject *object,
guint nargs,
GtkArg *args)
{
int i;
guint i;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_OBJECT (object));
if (!arg_info_ht)
return;
......@@ -837,7 +839,7 @@ gtk_object_setv (GtkObject *object,
g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
arg_ok = FALSE;
}
else if (!info->arg_flags & GTK_ARG_WRITABLE)
else if (! (info->arg_flags & GTK_ARG_WRITABLE))
{
g_warning ("arg is not supplied for write-access: \"%s\"\n", lookup_name);
arg_ok = FALSE;
......
......@@ -86,6 +86,8 @@ enum {
enum {
ARG_0,
ARG_NAME,
ARG_PARENT,
ARG_X,
ARG_Y,
ARG_WIDTH,
......@@ -96,11 +98,9 @@ enum {
ARG_HAS_FOCUS,
ARG_CAN_DEFAULT,
ARG_HAS_DEFAULT,
ARG_EVENTS,
ARG_EXTENSION_EVENTS,
ARG_NAME,
ARG_STYLE,
ARG_PARENT
ARG_EVENTS,
ARG_EXTENSION_EVENTS
};
......@@ -295,6 +295,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
parent_class = gtk_type_class (gtk_object_get_type ());
gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NAME);
gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER, GTK_ARG_READWRITE, ARG_PARENT);
gtk_object_add_arg_type ("GtkWidget::x", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_X);
gtk_object_add_arg_type ("GtkWidget::y", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_Y);
gtk_object_add_arg_type ("GtkWidget::width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_WIDTH);
......@@ -305,11 +307,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EXTENSION_EVENTS);
gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NAME);
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER, GTK_ARG_READWRITE, ARG_PARENT);
widget_signals[SHOW] =
gtk_signal_new ("show",
......@@ -762,6 +762,12 @@ gtk_widget_set_arg (GtkWidget *widget,
{
switch (arg_id)
{
case ARG_NAME:
gtk_widget_set_name (widget, GTK_VALUE_STRING (*arg));
break;
case ARG_PARENT:
gtk_container_add (GTK_CONTAINER (GTK_VALUE_OBJECT (*arg)), widget);
break;
case ARG_X:
gtk_widget_set_uposition (widget, GTK_VALUE_INT (*arg), -2);
break;
......@@ -803,21 +809,15 @@ gtk_widget_set_arg (GtkWidget *widget,
if (GTK_VALUE_BOOL (*arg))
gtk_widget_grab_default (widget);
break;
case ARG_STYLE:
gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
break;
case ARG_EVENTS:
gtk_widget_set_events (widget, GTK_VALUE_FLAGS (*arg));
break;
case ARG_EXTENSION_EVENTS:
gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS (*arg));
break;
case ARG_NAME:
gtk_widget_set_name (widget, GTK_VALUE_STRING (*arg));
break;
case ARG_STYLE:
gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
break;
case ARG_PARENT:
gtk_container_add (GTK_CONTAINER (GTK_VALUE_OBJECT (*arg)), widget);
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
......@@ -843,6 +843,15 @@ gtk_widget_get_arg (GtkWidget *widget,
switch (arg_id)
{
case ARG_NAME:
if (widget->name)
GTK_VALUE_STRING (*arg) = g_strdup (widget->name);
else
GTK_VALUE_STRING (*arg) = g_strdup ("");
break;
case ARG_PARENT:
GTK_VALUE_OBJECT (*arg) = (GtkObject*) widget->parent;
break;
case ARG_X:
aux_info = gtk_object_get_data_by_id (GTK_OBJECT (widget), aux_info_key_id);
if (!aux_info)
......@@ -889,6 +898,9 @@ gtk_widget_get_arg (GtkWidget *widget,
case ARG_HAS_DEFAULT:
GTK_VALUE_BOOL (*arg) = GTK_WIDGET_HAS_DEFAULT (widget);
break;
case ARG_STYLE:
GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
break;
case ARG_EVENTS:
eventp = gtk_object_get_data_by_id (GTK_OBJECT (widget), event_key_id);
if (!eventp)
......@@ -903,18 +915,6 @@ gtk_widget_get_arg (GtkWidget *widget,
else
GTK_VALUE_FLAGS (*arg) = *modep;
break;
case ARG_NAME:
if (widget->name)
GTK_VALUE_STRING (*arg) = g_strdup (widget->name);
else
GTK_VALUE_STRING (*arg) = g_strdup ("");
break;
case ARG_STYLE:
GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
break;
case ARG_PARENT:
GTK_VALUE_OBJECT (*arg) = (GtkObject*) widget->parent;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
......@@ -4009,12 +4009,18 @@ gtk_widget_dnd_data_set (GtkWidget *widget,
void
gtk_widget_ref (GtkWidget *widget)
{
gtk_object_ref (GTK_OBJECT (widget));
volatile GtkObject *object;
object = GTK_OBJECT (widget);
gtk_object_ref (object);
}
void
gtk_widget_unref (GtkWidget *widget)
{
gtk_object_unref (GTK_OBJECT (widget));
volatile GtkObject *object;
object = GTK_OBJECT (widget);
gtk_object_unref (object);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment