diff options
author | Havoc Pennington <hp@redhat.com> | 2001-01-04 21:33:24 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-01-04 21:33:24 +0000 |
commit | c020b3b4f87fa978a6706e9b98faa5f522d6b002 (patch) | |
tree | 29e938e04b26f04b98139a83c8a1fa3c67673ee0 /gtk/gtkcellrenderertoggle.c | |
parent | ef069fa0a020e2fbe901fa94d1fc323934ab87fb (diff) | |
download | gtk+-c020b3b4f87fa978a6706e9b98faa5f522d6b002.tar.gz |
Rename some stuff:
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:
s/gtk_tree_view_column_set_size/gtk_tree_view_column_set_width/g;
s/GtkModelSimple/GtkTreeModelSimple/g;
s/GTK_MODEL_SIMPLE/GTK_TREE_MODEL_SIMPLE/g;
s/gtk_model_simple/gtk_tree_model_simple/g;
s/gtkmodelsimple/gtktreemodelsimple/g;
s/gtk_tree_view_column_set_header_active/gtk_tree_view_column_set_header_clickable/g;
s/GtkTreeViewColumnType/GtkTreeViewColumnSizing/g;
s/column_set_col_type/column_set_sizing/g;
s/GtkTreeSelectionType/GtkTreeSelectionMode/g;
s/gtk_tree_selection_set_type/gtk_tree_selection_set_mode/g;
s/GtkCellRendererType/GtkCellRendererState/g;
* gtk/gtkcellrenderertoggle.c: remove _ macro, include gtkintl.h
(gtk_cell_renderer_toggle_class_init): change "state" property to
"active", to match GtkToggleButton
(gtk_cell_renderer_toggle_get_active): new function, bug
40269
(gtk_cell_renderer_toggle_set_active): new function
(gtk_cell_renderer_toggle_set_property): route changes to toggle
state through gtk_cell_renderer_set_active
Diffstat (limited to 'gtk/gtkcellrenderertoggle.c')
-rw-r--r-- | gtk/gtkcellrenderertoggle.c | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c index fac044d657..8a1cc72e8f 100644 --- a/gtk/gtkcellrenderertoggle.c +++ b/gtk/gtkcellrenderertoggle.c @@ -20,11 +20,7 @@ #include <stdlib.h> #include <gtk/gtkcellrenderertoggle.h> #include <gtk/gtksignal.h> - -#ifndef _ -#define _(x) x -#endif - +#include "gtkintl.h" static void gtk_cell_renderer_toggle_get_property (GObject *object, guint param_id, @@ -65,7 +61,7 @@ enum { enum { PROP_ZERO, - PROP_STATE, + PROP_ACTIVE, PROP_RADIO }; @@ -104,7 +100,7 @@ gtk_cell_renderer_toggle_get_type (void) static void gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle) { - celltoggle->state = FALSE; + celltoggle->active = FALSE; celltoggle->radio = FALSE; GTK_CELL_RENDERER (celltoggle)->xpad = 2; GTK_CELL_RENDERER (celltoggle)->ypad = 2; @@ -124,10 +120,10 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class) cell_class->event = gtk_cell_renderer_toggle_event; g_object_class_install_property (object_class, - PROP_STATE, - g_param_spec_boolean ("state", + PROP_ACTIVE, + g_param_spec_boolean ("active", _("Toggle state"), - _("The toggle-state of the button."), + _("The toggle state of the button"), FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)); @@ -136,7 +132,7 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class) PROP_RADIO, g_param_spec_boolean ("radio", _("Radio state"), - _("Draw the toggle button as a radio button."), + _("Draw the toggle button as a radio button"), FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)); @@ -163,8 +159,8 @@ gtk_cell_renderer_toggle_get_property (GObject *object, switch (param_id) { - case PROP_STATE: - g_value_set_boolean (value, celltoggle->state); + case PROP_ACTIVE: + g_value_set_boolean (value, celltoggle->active); break; case PROP_RADIO: g_value_set_boolean (value, celltoggle->radio); @@ -187,8 +183,8 @@ gtk_cell_renderer_toggle_set_property (GObject *object, switch (param_id) { - case PROP_STATE: - celltoggle->state = g_value_get_boolean (value); + case PROP_ACTIVE: + gtk_cell_renderer_toggle_set_active (celltoggle, g_value_get_boolean (value)); break; case PROP_RADIO: celltoggle->radio = g_value_get_boolean (value); @@ -252,7 +248,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell, cell_area->x + real_xoffset, cell_area->y + real_yoffset, width, height); - if (celltoggle->state) + if (celltoggle->active) { gdk_draw_line (window, widget->style->black_gc, @@ -278,7 +274,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell, width, height, 0, 360*64); - if (celltoggle->state) + if (celltoggle->active) { gdk_draw_arc (window, widget->style->black_gc, @@ -317,3 +313,26 @@ gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle, toggle->radio = radio; } + +gboolean +gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle) +{ + g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE); + + return toggle->active; +} + +void +gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle, + gboolean setting) +{ + g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle)); + + setting = !! setting; + + if (toggle->active != setting) + { + toggle->active = setting; + g_object_notify (G_OBJECT (toggle), "active"); + } +} |