Apply property patch from Lee Mallabone

2001-03-23  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone

	* gtk/gtkbox.c: Apply property patch from Lee Mallabone

	* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
	and deprecated gtk_check_menu_item_set_show_toggle().

	* gtk/gtkbutton.c: Apply property patch from Lee Mallabone

	* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone

	* gtk/gtkframe.c: Apply property patch from Lee Mallabone
This commit is contained in:
Havoc Pennington 2001-03-23 23:39:24 +00:00 committed by Havoc Pennington
parent 4291350f89
commit dc0cd67d60
20 changed files with 643 additions and 165 deletions

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -1,3 +1,18 @@
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtkhandlebox.c: Apply property patch from Lee Mallabone
* gtk/gtkbox.c: Apply property patch from Lee Mallabone
* gtk/gtkcheckmenuitem.c: Apply property patch from Lee Mallabone,
and deprecated gtk_check_menu_item_set_show_toggle().
* gtk/gtkbutton.c: Apply property patch from Lee Mallabone
* gtk/gtkfilesel.c: Apply property patch from Lee Mallabone
* gtk/gtkframe.c: Apply property patch from Lee Mallabone
2001-03-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktoolbar.c, gtk/gtkimcontext.c, gtk/gtklabel.c: fix up

View File

@ -534,6 +534,12 @@ gtk_font_selection_set_filter().
@GTK_FONT_SCALABLE_BITMAP: scaled bitmap fonts.
@GTK_FONT_ALL: a bitwise combination of all of the above.
<!-- ##### ARG GtkFrame:shadow-type ##### -->
<para>
</para>
<!-- ##### STRUCT GtkIMContextSimple ##### -->
<para>

View File

@ -124,3 +124,8 @@ field of the #GtkCheckMenuItem-struct struct to discover the new state.
@checkmenuitem: the object which received the signal.
<!-- ##### ARG GtkCheckMenuItem:active ##### -->
<para>
</para>

View File

@ -169,3 +169,13 @@ Hides the file operation buttons that normally appear at the top of the dialog.
@filesel: a #GtkFileSelection.
<!-- ##### ARG GtkFileSelection:filename ##### -->
<para>
</para>
<!-- ##### ARG GtkFileSelection:show-fileops ##### -->
<para>
</para>

View File

@ -107,3 +107,8 @@ Set the shadow type for the Frame widget.
</para>
<!-- ##### ARG GtkFrame:label-widget ##### -->
<para>
</para>

View File

@ -25,11 +25,12 @@
*/
#include "gtkbox.h"
#include "gtkintl.h"
enum {
ARG_0,
ARG_SPACING,
ARG_HOMOGENEOUS
PROP_0,
PROP_SPACING,
PROP_HOMOGENEOUS
};
enum {
@ -43,12 +44,14 @@ enum {
static void gtk_box_class_init (GtkBoxClass *klass);
static void gtk_box_init (GtkBox *box);
static void gtk_box_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_box_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_box_map (GtkWidget *widget);
static void gtk_box_unmap (GtkWidget *widget);
static void gtk_box_add (GtkContainer *container,
@ -101,27 +104,45 @@ gtk_box_get_type (void)
static void
gtk_box_class_init (GtkBoxClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
gobject_class = (GObjectClass*) class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gtk_object_add_arg_type ("GtkBox::spacing", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SPACING);
gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
gobject_class->set_property = gtk_box_set_property;
gobject_class->get_property = gtk_box_get_property;
g_object_class_install_property (gobject_class,
PROP_SPACING,
g_param_spec_int ("spacing",
_("Spacing"),
_("The amount of space between children."),
0,
G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_HOMOGENEOUS,
g_param_spec_boolean ("homogeneous",
_("Homogeneous"),
_("Whether the children should all be the same size."),
FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
gtk_container_add_child_arg_type ("GtkBox::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND);
gtk_container_add_child_arg_type ("GtkBox::fill", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_FILL);
gtk_container_add_child_arg_type ("GtkBox::padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_PADDING);
gtk_container_add_child_arg_type ("GtkBox::pack_type", GTK_TYPE_PACK_TYPE, GTK_ARG_READWRITE, CHILD_ARG_PACK_TYPE);
gtk_container_add_child_arg_type ("GtkBox::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION);
object_class->set_arg = gtk_box_set_arg;
object_class->get_arg = gtk_box_get_arg;
widget_class->map = gtk_box_map;
widget_class->unmap = gtk_box_unmap;
@ -144,46 +165,48 @@ gtk_box_init (GtkBox *box)
}
static void
gtk_box_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkBox *box;
box = GTK_BOX (object);
switch (arg_id)
switch (prop_id)
{
case ARG_SPACING:
gtk_box_set_spacing (box, GTK_VALUE_INT (*arg));
case PROP_SPACING:
gtk_box_set_spacing (box, g_value_get_int (value));
break;
case ARG_HOMOGENEOUS:
gtk_box_set_homogeneous (box, GTK_VALUE_BOOL (*arg));
case PROP_HOMOGENEOUS:
gtk_box_set_homogeneous (box, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_box_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
static void gtk_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkBox *box;
box = GTK_BOX (object);
switch (arg_id)
switch (prop_id)
{
case ARG_SPACING:
GTK_VALUE_INT (*arg) = box->spacing;
case PROP_SPACING:
g_value_set_int (value, box->spacing);
break;
case ARG_HOMOGENEOUS:
GTK_VALUE_BOOL (*arg) = box->homogeneous;
case PROP_HOMOGENEOUS:
g_value_set_boolean (value, box->homogeneous);
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -417,6 +440,7 @@ gtk_box_set_homogeneous (GtkBox *box,
if ((homogeneous ? TRUE : FALSE) != box->homogeneous)
{
box->homogeneous = homogeneous ? TRUE : FALSE;
g_object_notify (G_OBJECT (box), "homogeneous");
gtk_widget_queue_resize (GTK_WIDGET (box));
}
}
@ -431,6 +455,7 @@ gtk_box_set_spacing (GtkBox *box,
if (spacing != box->spacing)
{
box->spacing = spacing;
g_object_notify (G_OBJECT (box), "spacing");
gtk_widget_queue_resize (GTK_WIDGET (box));
}
}

View File

@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2001. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
@ -33,6 +33,7 @@
#include "gtkhbox.h"
#include "gtkstock.h"
#include "gtkiconfactory.h"
#include "gtkintl.h"
#define CHILD_SPACING 1
#define DEFAULT_LEFT_POS 4
@ -55,19 +56,21 @@ enum {
};
enum {
ARG_0,
ARG_LABEL,
ARG_RELIEF
PROP_0,
PROP_LABEL,
PROP_RELIEF
};
static void gtk_button_class_init (GtkButtonClass *klass);
static void gtk_button_init (GtkButton *button);
static void gtk_button_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_button_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_button_realize (GtkWidget *widget);
static void gtk_button_unrealize (GtkWidget *widget);
static void gtk_button_size_request (GtkWidget *widget,
@ -145,8 +148,8 @@ gtk_button_class_init (GtkButtonClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->set_arg = gtk_button_set_arg;
object_class->get_arg = gtk_button_get_arg;
G_OBJECT_CLASS(object_class)->set_property = gtk_button_set_property;
G_OBJECT_CLASS(object_class)->get_property = gtk_button_get_property;
widget_class->realize = gtk_button_realize;
widget_class->unrealize = gtk_button_unrealize;
@ -170,8 +173,22 @@ gtk_button_class_init (GtkButtonClass *klass)
klass->leave = gtk_real_button_leave;
klass->activate = gtk_real_button_activate;
gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
gtk_object_add_arg_type ("GtkButton::relief", GTK_TYPE_RELIEF_STYLE, GTK_ARG_READWRITE, ARG_RELIEF);
g_object_class_install_property (G_OBJECT_CLASS(object_class),
PROP_LABEL,
g_param_spec_string ("label",
_("Label"),
_("Text of the label widget inside the button, if the button contains a label widget."),
NULL,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS(object_class),
PROP_RELIEF,
g_param_spec_enum ("relief",
_("Border relief"),
_("The border relief style."),
GTK_TYPE_RELIEF_STYLE,
GTK_RELIEF_NORMAL,
G_PARAM_READABLE | G_PARAM_WRITABLE));
button_signals[PRESSED] =
gtk_signal_new ("pressed",
@ -240,19 +257,20 @@ gtk_button_child_type (GtkContainer *container)
}
static void
gtk_button_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkButton *button;
button = GTK_BUTTON (object);
switch (arg_id)
switch (prop_id)
{
GtkWidget *child;
case ARG_LABEL:
case PROP_LABEL:
child = GTK_BIN (button)->child;
if (!child)
child = gtk_widget_new (GTK_TYPE_LABEL,
@ -260,39 +278,43 @@ gtk_button_set_arg (GtkObject *object,
"parent", button,
NULL);
if (GTK_IS_LABEL (child))
gtk_label_set_text (GTK_LABEL (child),
GTK_VALUE_STRING (*arg) ? GTK_VALUE_STRING (*arg) : "");
{
gtk_label_set_text (GTK_LABEL (child),
g_value_get_string (value) ? g_value_get_string (value) : "");
}
break;
case ARG_RELIEF:
gtk_button_set_relief (button, GTK_VALUE_ENUM (*arg));
case PROP_RELIEF:
gtk_button_set_relief (button, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_button_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkButton *button;
button = GTK_BUTTON (object);
switch (arg_id)
switch (prop_id)
{
case ARG_LABEL:
case PROP_LABEL:
if (GTK_BIN (button)->child && GTK_IS_LABEL (GTK_BIN (button)->child))
GTK_VALUE_STRING (*arg) = g_strdup (GTK_LABEL (GTK_BIN (button)->child)->label);
g_value_set_string(value, g_strdup (GTK_LABEL (GTK_BIN (button)->child)->label));
else
GTK_VALUE_STRING (*arg) = NULL;
g_value_set_string(value, NULL);
break;
case ARG_RELIEF:
GTK_VALUE_ENUM (*arg) = gtk_button_get_relief (button);
case PROP_RELIEF:
g_value_set_enum(value, gtk_button_get_relief (button));
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -445,6 +467,7 @@ gtk_button_set_relief (GtkButton *button,
g_return_if_fail (GTK_IS_BUTTON (button));
button->relief = newrelief;
g_object_notify(G_OBJECT(button), "relief");
gtk_widget_queue_draw (GTK_WIDGET (button));
}

View File

@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2001. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.

View File

@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2001. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
@ -27,6 +27,7 @@
#include "gtkcheckmenuitem.h"
#include "gtkaccellabel.h"
#include "gtksignal.h"
#include "gtkintl.h"
#define CHECK_TOGGLE_SIZE 12
@ -35,6 +36,11 @@ enum {
LAST_SIGNAL
};
enum {
PROP_0,
PROP_ACTIVE,
PROP_INCONSISTENT
};
static void gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass);
static void gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item);
@ -47,6 +53,14 @@ static void gtk_check_menu_item_draw_indicator (GtkCheckMenuItem *che
GdkRectangle *area);
static void gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
GdkRectangle *area);
static void gtk_check_menu_item_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_check_menu_item_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GtkMenuItemClass *parent_class = NULL;
@ -91,6 +105,25 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM);
G_OBJECT_CLASS(object_class)->set_property = gtk_check_menu_item_set_property;
G_OBJECT_CLASS(object_class)->get_property = gtk_check_menu_item_get_property;
g_object_class_install_property (G_OBJECT_CLASS (object_class),
PROP_ACTIVE,
g_param_spec_boolean ("active",
_("Active"),
_("Whether the menu item is checked."),
FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (object_class),
PROP_ACTIVE,
g_param_spec_boolean ("inconsistent",
_("Inconsistent"),
_("Whether to display an \"inconsistent\" state."),
FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
widget_class->expose_event = gtk_check_menu_item_expose;
menu_item_class->activate = gtk_check_menu_item_activate;
@ -142,7 +175,10 @@ gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
is_active = is_active != 0;
if (check_menu_item->active != is_active)
gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
{
gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
g_object_notify (G_OBJECT(check_menu_item), "active");
}
}
static void
@ -200,6 +236,7 @@ gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
{
check_menu_item->inconsistent = setting;
gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
g_object_notify (G_OBJECT (check_menu_item), "inconsistent");
}
}
@ -326,3 +363,49 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
}
}
}
static void
gtk_check_menu_item_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
switch (prop_id)
{
case PROP_ACTIVE:
g_value_set_boolean (value, checkitem->active);
break;
case PROP_INCONSISTENT:
g_value_set_boolean (value, checkitem->inconsistent);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_check_menu_item_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
switch (prop_id)
{
case PROP_ACTIVE:
gtk_check_menu_item_set_active (checkitem, g_value_get_boolean (value));
break;
case PROP_INCONSISTENT:
gtk_check_menu_item_set_inconsistent (checkitem, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}

View File

@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2001. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
@ -72,14 +72,16 @@ GtkWidget* gtk_check_menu_item_new (void);
GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
gboolean is_active);
void gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item,
gboolean always);
void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
gboolean setting);
gboolean gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item);
#ifndef GTK_DISABLE_DEPRECATED
void gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item,
gboolean always);
#endif
#ifdef __cplusplus
}

View File

@ -225,6 +225,11 @@ struct _CompletionState
struct _CompletionUserDir *user_directories;
};
enum {
PROP_0,
PROP_SHOW_FILEOPS,
PROP_FILENAME
};
/* File completion functions which would be external, were they used
* outside of this file.
@ -339,6 +344,14 @@ static void update_cmpl(PossibleCompletion* poss,
CompletionState* cmpl_state);
static void gtk_file_selection_class_init (GtkFileSelectionClass *klass);
static void gtk_file_selection_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_selection_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_file_selection_init (GtkFileSelection *filesel);
static void gtk_file_selection_destroy (GtkObject *object);
static gint gtk_file_selection_key_press (GtkWidget *widget,
@ -472,15 +485,94 @@ gtk_file_selection_get_type (void)
static void
gtk_file_selection_class_init (GtkFileSelectionClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
gobject_class = (GObjectClass*) class;
object_class = (GtkObjectClass*) class;
parent_class = gtk_type_class (GTK_TYPE_DIALOG);
gobject_class->set_property = gtk_file_selection_set_property;
gobject_class->get_property = gtk_file_selection_get_property;
g_object_class_install_property (gobject_class,
PROP_FILENAME,
g_param_spec_string ("filename",
_("Filename"),
_("The currently selected filename."),
NULL,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_SHOW_FILEOPS,
g_param_spec_boolean ("show_fileops",
_("Show file operations"),
_("Whether buttons for creating/manipulating files should be displayed."),
FALSE,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
object_class->destroy = gtk_file_selection_destroy;
}
static void gtk_file_selection_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkFileSelection *filesel;
filesel = GTK_FILE_SELECTION (object);
switch (prop_id)
{
case PROP_FILENAME:
gtk_file_selection_set_filename (filesel,
g_value_get_string (value));
break;
case PROP_SHOW_FILEOPS:
if (g_value_get_boolean (value))
gtk_file_selection_show_fileop_buttons (filesel);
else
gtk_file_selection_hide_fileop_buttons (filesel);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void gtk_file_selection_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkFileSelection *filesel;
filesel = GTK_FILE_SELECTION (object);
switch (prop_id)
{
case PROP_FILENAME:
g_value_set_string (value,
gtk_file_selection_get_filename(filesel));
break;
case PROP_SHOW_FILEOPS:
/* This is a little bit hacky, but doing otherwise would require
* adding a field to the object.
*/
g_value_set_boolean (value, (filesel->fileop_c_dir &&
filesel->fileop_del_file &&
filesel->fileop_ren_file));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_file_selection_init (GtkFileSelection *filesel)
{
@ -681,7 +773,7 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
filesel->fileop_ren_file, TRUE, TRUE, 0);
gtk_widget_show (filesel->fileop_ren_file);
}
g_object_notify (G_OBJECT (filesel), "show_fileops");
gtk_widget_queue_resize (GTK_WIDGET (filesel));
}
@ -708,6 +800,7 @@ gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
gtk_widget_destroy (filesel->fileop_c_dir);
filesel->fileop_c_dir = NULL;
}
g_object_notify (G_OBJECT (filesel), "show_fileops");
}
@ -742,9 +835,22 @@ gtk_file_selection_set_filename (GtkFileSelection *filesel,
if (filesel->selection_entry)
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
g_free (buf);
g_object_notify (G_OBJECT (filesel), "filename");
}
gchar*
/**
* gtk_file_selection_get_filename:
* @filesel: a #GtkFileSelection
*
* This function returns the selected filename in the C runtime's
* multibyte string encoding, which may or may not be the same as that
* used by GTK+ (UTF-8). To convert to UTF-8, call g_filename_to_utf8().
* The returned string points to a statically allocated buffer and
* should be copied if you plan to keep it around.
*
* Return value: currently-selected filename in locale's encoding
**/
G_CONST_RETURN gchar*
gtk_file_selection_get_filename (GtkFileSelection *filesel)
{
static gchar nothing[2] = "";

View File

@ -93,7 +93,7 @@ void gtk_file_selection_set_filename (GtkFileSelection *filesel,
* The returned string points to a statically allocated buffer and
* should be copied away.
*/
gchar* gtk_file_selection_get_filename (GtkFileSelection *filesel);
G_CONST_RETURN gchar* gtk_file_selection_get_filename (GtkFileSelection *filesel);
void gtk_file_selection_complete (GtkFileSelection *filesel,
const gchar *pattern);

View File

@ -27,27 +27,31 @@
#include <string.h>
#include "gtkframe.h"
#include "gtklabel.h"
#include "gtkintl.h"
#define LABEL_PAD 1
#define LABEL_SIDE_PAD 2
enum {
ARG_0,
ARG_LABEL,
ARG_LABEL_XALIGN,
ARG_LABEL_YALIGN,
ARG_SHADOW
PROP_0,
PROP_LABEL,
PROP_LABEL_XALIGN,
PROP_LABEL_YALIGN,
PROP_SHADOW,
PROP_LABEL_WIDGET
};
static void gtk_frame_class_init (GtkFrameClass *klass);
static void gtk_frame_init (GtkFrame *frame);
static void gtk_frame_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_frame_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_frame_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_frame_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
static void gtk_frame_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_frame_expose (GtkWidget *widget,
@ -101,23 +105,65 @@ gtk_frame_get_type (void)
static void
gtk_frame_class_init (GtkFrameClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
gobject_class = (GObjectClass*) class;
object_class = GTK_OBJECT_CLASS (class);
widget_class = GTK_WIDGET_CLASS (class);
container_class = GTK_CONTAINER_CLASS (class);
parent_class = gtk_type_class (gtk_bin_get_type ());
gtk_object_add_arg_type ("GtkFrame::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
gtk_object_add_arg_type ("GtkFrame::label_xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_LABEL_XALIGN);
gtk_object_add_arg_type ("GtkFrame::label_yalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_LABEL_YALIGN);
gtk_object_add_arg_type ("GtkFrame::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW);
gobject_class->set_property = gtk_frame_set_property;
gobject_class->get_property = gtk_frame_get_property;
object_class->set_arg = gtk_frame_set_arg;
object_class->get_arg = gtk_frame_get_arg;
g_object_class_install_property (gobject_class,
PROP_LABEL,
g_param_spec_string ("label",
_("Label"),
_("Text of the frame's label."),
NULL,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_LABEL_XALIGN,
g_param_spec_double ("label_xalign",
_("Label xalign"),
_("The horizontal alignment of the label."),
0.0,
1.0,
0.5,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_LABEL_YALIGN,
g_param_spec_double ("label_yalign",
_("Label yalign"),
_("The vertical alignment of the label."),
0.0,
1.0,
0.5,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_SHADOW,
g_param_spec_enum ("shadow",
_("Frame shadow"),
_("Appearance of the frame border."),
GTK_TYPE_SHADOW_TYPE,
GTK_SHADOW_ETCHED_IN,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_LABEL_WIDGET,
g_param_spec_object ("label_widget",
_("Label widget"),
_("A widget to display in place of the usual frame label."),
GTK_TYPE_WIDGET,
G_PARAM_READABLE | G_PARAM_WRITABLE));
widget_class->expose_event = gtk_frame_expose;
widget_class->size_request = gtk_frame_size_request;
@ -141,58 +187,71 @@ gtk_frame_init (GtkFrame *frame)
}
static void
gtk_frame_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_frame_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkFrame *frame;
frame = GTK_FRAME (object);
switch (arg_id)
switch (prop_id)
{
case ARG_LABEL:
gtk_frame_set_label (frame, GTK_VALUE_STRING (*arg));
case PROP_LABEL:
gtk_frame_set_label (frame, g_value_get_string (value));
break;
case ARG_LABEL_XALIGN:
gtk_frame_set_label_align (frame, GTK_VALUE_FLOAT (*arg), frame->label_yalign);
case PROP_LABEL_XALIGN:
gtk_frame_set_label_align (frame, g_value_get_double (value),
frame->label_yalign);
break;
case ARG_LABEL_YALIGN:
gtk_frame_set_label_align (frame, frame->label_xalign, GTK_VALUE_FLOAT (*arg));
case PROP_LABEL_YALIGN:
gtk_frame_set_label_align (frame, frame->label_xalign,
g_value_get_double (value));
break;
case ARG_SHADOW:
gtk_frame_set_shadow_type (frame, GTK_VALUE_ENUM (*arg));
case PROP_SHADOW:
gtk_frame_set_shadow_type (frame, g_value_get_enum (value));
break;
case PROP_LABEL_WIDGET:
gtk_frame_set_label_widget (frame, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_frame_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_frame_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkFrame *frame;
frame = GTK_FRAME (object);
switch (arg_id)
switch (prop_id)
{
case ARG_LABEL:
GTK_VALUE_STRING (*arg) = gtk_frame_get_label (frame);
case PROP_LABEL:
g_value_set_string (value, gtk_frame_get_label (frame));
break;
case ARG_LABEL_XALIGN:
GTK_VALUE_FLOAT (*arg) = frame->label_xalign;
case PROP_LABEL_XALIGN:
g_value_set_double (value, frame->label_xalign);
break;
case ARG_LABEL_YALIGN:
GTK_VALUE_FLOAT (*arg) = frame->label_yalign;
case PROP_LABEL_YALIGN:
g_value_set_double (value, frame->label_yalign);
break;
case ARG_SHADOW:
GTK_VALUE_ENUM (*arg) = frame->shadow_type;
case PROP_SHADOW:
g_value_set_enum (value, frame->shadow_type);
break;
case PROP_LABEL_WIDGET:
g_value_set_object (value,
frame->label_widget ?
G_OBJECT (frame->label_widget) : NULL);
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -255,6 +314,8 @@ gtk_frame_set_label (GtkFrame *frame,
gtk_frame_set_label_widget (frame, child);
}
g_object_notify (G_OBJECT (frame), "label");
}
/**
@ -322,6 +383,8 @@ gtk_frame_set_label_widget (GtkFrame *frame,
if (GTK_WIDGET_VISIBLE (frame) && need_resize)
gtk_widget_queue_resize (GTK_WIDGET (frame));
g_object_notify (G_OBJECT (frame), "label_widget");
}
void
@ -335,13 +398,19 @@ gtk_frame_set_label_align (GtkFrame *frame,
xalign = CLAMP (xalign, 0.0, 1.0);
yalign = CLAMP (yalign, 0.0, 1.0);
if ((xalign != frame->label_xalign) || (yalign != frame->label_yalign))
if (xalign != frame->label_xalign)
{
frame->label_xalign = xalign;
frame->label_yalign = yalign;
gtk_widget_queue_resize (GTK_WIDGET (frame));
g_object_notify (G_OBJECT (frame), "label_xalign");
}
if (yalign != frame->label_yalign)
{
frame->label_yalign = yalign;
g_object_notify (G_OBJECT (frame), "label_yalign");
}
gtk_widget_queue_resize (GTK_WIDGET (frame));
}
void
@ -354,11 +423,13 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
if ((GtkShadowType) frame->shadow_type != type)
{
frame->shadow_type = type;
g_object_notify (G_OBJECT (frame), "shadow");
if (GTK_WIDGET_DRAWABLE (frame))
{
gtk_widget_queue_clear (GTK_WIDGET (frame));
}
gtk_widget_queue_resize (GTK_WIDGET (frame));
}
}

View File

@ -30,12 +30,13 @@
#include "gtkmain.h"
#include "gtksignal.h"
#include "gtkwindow.h"
#include "gtkintl.h"
enum {
ARG_0,
ARG_SHADOW,
ARG_HANDLE_POSITION,
ARG_SNAP_EDGE
PROP_0,
PROP_SHADOW,
PROP_HANDLE_POSITION,
PROP_SNAP_EDGE
};
#define DRAG_HANDLE_SIZE 10
@ -91,12 +92,14 @@ enum {
static void gtk_handle_box_class_init (GtkHandleBoxClass *klass);
static void gtk_handle_box_init (GtkHandleBox *handle_box);
static void gtk_handle_box_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_handle_box_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_handle_box_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_handle_box_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
static void gtk_handle_box_destroy (GtkObject *object);
static void gtk_handle_box_map (GtkWidget *widget);
static void gtk_handle_box_unmap (GtkWidget *widget);
@ -159,24 +162,47 @@ gtk_handle_box_get_type (void)
static void
gtk_handle_box_class_init (GtkHandleBoxClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
gobject_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
container_class = (GtkContainerClass *) class;
parent_class = gtk_type_class (GTK_TYPE_BIN);
gtk_object_add_arg_type ("GtkHandleBox::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW);
gtk_object_add_arg_type ("GtkHandleBox::handle_position", GTK_TYPE_POSITION_TYPE, GTK_ARG_READWRITE, ARG_HANDLE_POSITION);
gtk_object_add_arg_type ("GtkHandleBox::snap_edge", GTK_TYPE_POSITION_TYPE, GTK_ARG_READWRITE, ARG_SNAP_EDGE);
gobject_class->set_property = gtk_handle_box_set_property;
gobject_class->get_property = gtk_handle_box_get_property;
object_class->set_arg = gtk_handle_box_set_arg;
object_class->get_arg = gtk_handle_box_get_arg;
g_object_class_install_property (gobject_class,
PROP_SHADOW,
g_param_spec_enum ("shadow",
_("Shadow type"),
_("Appearance of the shadow that surrounds the container."),
GTK_TYPE_SHADOW_TYPE,
GTK_SHADOW_ETCHED_OUT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_HANDLE_POSITION,
g_param_spec_enum ("handle_position",
_("Handle position"),
_("Position of the handle relative to the child widget."),
GTK_TYPE_POSITION_TYPE,
GTK_POS_LEFT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_SNAP_EDGE,
g_param_spec_enum ("snap_edge",
_("Snap edge"),
_("Side of the handlebox that's lined up with the docking point to dock the handlebox."),
GTK_TYPE_POSITION_TYPE,
GTK_POS_LEFT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
object_class->destroy = gtk_handle_box_destroy;
widget_class->map = gtk_handle_box_map;
@ -233,46 +259,51 @@ gtk_handle_box_init (GtkHandleBox *handle_box)
}
static void
gtk_handle_box_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_handle_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
switch (arg_id)
switch (prop_id)
{
case ARG_SHADOW:
gtk_handle_box_set_shadow_type (handle_box, GTK_VALUE_ENUM (*arg));
case PROP_SHADOW:
gtk_handle_box_set_shadow_type (handle_box, g_value_get_enum (value));
break;
case ARG_HANDLE_POSITION:
gtk_handle_box_set_handle_position (handle_box, GTK_VALUE_ENUM (*arg));
case PROP_HANDLE_POSITION:
gtk_handle_box_set_handle_position (handle_box, g_value_get_enum (value));
break;
case ARG_SNAP_EDGE:
gtk_handle_box_set_snap_edge (handle_box, GTK_VALUE_ENUM (*arg));
case PROP_SNAP_EDGE:
gtk_handle_box_set_snap_edge (handle_box, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_handle_box_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_handle_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkHandleBox *handle_box = GTK_HANDLE_BOX (object);
switch (arg_id)
switch (prop_id)
{
case ARG_SHADOW:
GTK_VALUE_ENUM (*arg) = handle_box->shadow_type;
case PROP_SHADOW:
g_value_set_enum (value, handle_box->shadow_type);
break;
case ARG_HANDLE_POSITION:
GTK_VALUE_ENUM (*arg) = handle_box->handle_position;
case PROP_HANDLE_POSITION:
g_value_set_enum (value, handle_box->handle_position);
break;
case ARG_SNAP_EDGE:
GTK_VALUE_ENUM (*arg) = handle_box->snap_edge;
case PROP_SNAP_EDGE:
g_value_set_enum (value, handle_box->snap_edge);
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -712,6 +743,7 @@ gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box,
if ((GtkShadowType) handle_box->shadow_type != type)
{
handle_box->shadow_type = type;
g_object_notify (G_OBJECT (handle_box), "shadow");
gtk_widget_queue_resize (GTK_WIDGET (handle_box));
}
}
@ -723,6 +755,7 @@ gtk_handle_box_set_handle_position (GtkHandleBox *handle_box,
if ((GtkPositionType) handle_box->handle_position != position)
{
handle_box->handle_position = position;
g_object_notify (G_OBJECT (handle_box), "handle_position");
gtk_widget_queue_resize (GTK_WIDGET (handle_box));
}
}
@ -734,7 +767,11 @@ gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box,
g_return_if_fail (handle_box != NULL);
g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box));
handle_box->snap_edge = edge;
if (handle_box->snap_edge != edge)
{
handle_box->snap_edge = edge;
g_object_notify (G_OBJECT (handle_box), "snap_edge");
}
}
static void