]> Pileus Git - ~andy/gtk/blob - gtk/gtkcheckmenuitem.c
Documentation fixes
[~andy/gtk] / gtk / gtkcheckmenuitem.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2001.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #include "config.h"
28 #include "gtkcheckmenuitem.h"
29 #include "gtkmenuitemprivate.h"
30 #include "gtkaccellabel.h"
31 #include "gtkactivatable.h"
32 #include "gtktoggleaction.h"
33 #include "gtkmarshalers.h"
34 #include "gtkprivate.h"
35 #include "gtkintl.h"
36 #include "a11y/gtkcheckmenuitemaccessible.h"
37
38 /**
39  * SECTION:gtkcheckmenuitem
40  * @Short_description: A menu item with a check box
41  * @Title: GtkCheckMenuItem
42  *
43  * A #GtkCheckMenuItem is a menu item that maintains the state of a boolean
44  * value in addition to a #GtkMenuItem usual role in activating application
45  * code.
46  *
47  * A check box indicating the state of the boolean value is displayed
48  * at the left side of the #GtkMenuItem.  Activating the #GtkMenuItem
49  * toggles the value.
50  */
51
52
53 #define INDICATOR_SIZE 16
54
55 struct _GtkCheckMenuItemPrivate
56 {
57   guint active             : 1;
58   guint always_show_toggle : 1;
59   guint draw_as_radio      : 1;
60   guint inconsistent       : 1;
61 };
62
63 enum {
64   TOGGLED,
65   LAST_SIGNAL
66 };
67
68 enum {
69   PROP_0,
70   PROP_ACTIVE,
71   PROP_INCONSISTENT,
72   PROP_DRAW_AS_RADIO
73 };
74
75 static gint gtk_check_menu_item_draw                 (GtkWidget             *widget,
76                                                       cairo_t               *cr);
77 static void gtk_check_menu_item_activate             (GtkMenuItem           *menu_item);
78 static void gtk_check_menu_item_toggle_size_request  (GtkMenuItem           *menu_item,
79                                                       gint                  *requisition);
80 static void gtk_real_check_menu_item_draw_indicator  (GtkCheckMenuItem      *check_menu_item,
81                                                       cairo_t               *cr);
82 static void gtk_check_menu_item_set_property         (GObject               *object,
83                                                       guint                  prop_id,
84                                                       const GValue          *value,
85                                                       GParamSpec            *pspec);
86 static void gtk_check_menu_item_get_property         (GObject               *object,
87                                                       guint                  prop_id,
88                                                       GValue                *value,
89                                                       GParamSpec            *pspec);
90
91 static void gtk_check_menu_item_activatable_interface_init (GtkActivatableIface  *iface);
92 static void gtk_check_menu_item_update                     (GtkActivatable       *activatable,
93                                                             GtkAction            *action,
94                                                             const gchar          *property_name);
95 static void gtk_check_menu_item_sync_action_properties     (GtkActivatable       *activatable,
96                                                             GtkAction            *action);
97
98 static GtkActivatableIface *parent_activatable_iface;
99 static guint                check_menu_item_signals[LAST_SIGNAL] = { 0 };
100
101 G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_ITEM,
102                          G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
103                                                 gtk_check_menu_item_activatable_interface_init))
104
105 static void
106 gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
107 {
108   GObjectClass *gobject_class;
109   GtkWidgetClass *widget_class;
110   GtkMenuItemClass *menu_item_class;
111   
112   gobject_class = G_OBJECT_CLASS (klass);
113   widget_class = (GtkWidgetClass*) klass;
114   menu_item_class = (GtkMenuItemClass*) klass;
115   
116   gobject_class->set_property = gtk_check_menu_item_set_property;
117   gobject_class->get_property = gtk_check_menu_item_get_property;
118
119   g_object_class_install_property (gobject_class,
120                                    PROP_ACTIVE,
121                                    g_param_spec_boolean ("active",
122                                                          P_("Active"),
123                                                          P_("Whether the menu item is checked"),
124                                                          FALSE,
125                                                          GTK_PARAM_READWRITE));
126   
127   g_object_class_install_property (gobject_class,
128                                    PROP_INCONSISTENT,
129                                    g_param_spec_boolean ("inconsistent",
130                                                          P_("Inconsistent"),
131                                                          P_("Whether to display an \"inconsistent\" state"),
132                                                          FALSE,
133                                                          GTK_PARAM_READWRITE));
134   
135   g_object_class_install_property (gobject_class,
136                                    PROP_DRAW_AS_RADIO,
137                                    g_param_spec_boolean ("draw-as-radio",
138                                                          P_("Draw as radio menu item"),
139                                                          P_("Whether the menu item looks like a radio menu item"),
140                                                          FALSE,
141                                                          GTK_PARAM_READWRITE));
142   
143   gtk_widget_class_install_style_property (widget_class,
144                                            g_param_spec_int ("indicator-size",
145                                                              P_("Indicator Size"),
146                                                              P_("Size of check or radio indicator"),
147                                                              0,
148                                                              G_MAXINT,
149                                                              INDICATOR_SIZE,
150                                                              GTK_PARAM_READABLE));
151
152   widget_class->draw = gtk_check_menu_item_draw;
153
154   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CHECK_MENU_ITEM_ACCESSIBLE);
155
156   menu_item_class->activate = gtk_check_menu_item_activate;
157   menu_item_class->hide_on_activate = FALSE;
158   menu_item_class->toggle_size_request = gtk_check_menu_item_toggle_size_request;
159   
160   klass->toggled = NULL;
161   klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
162
163   /**
164    * GtkCheckMenuItem::toggled:
165    * @checkmenuitem: the object which received the signal.
166    *
167    * This signal is emitted when the state of the check box is changed.
168    *
169    * A signal handler can use gtk_check_menu_item_get_active()
170    * to discover the new state.
171    */
172   check_menu_item_signals[TOGGLED] =
173     g_signal_new (I_("toggled"),
174                   G_OBJECT_CLASS_TYPE (gobject_class),
175                   G_SIGNAL_RUN_FIRST,
176                   G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled),
177                   NULL, NULL,
178                   _gtk_marshal_VOID__VOID,
179                   G_TYPE_NONE, 0);
180
181   g_type_class_add_private (klass, sizeof (GtkCheckMenuItemPrivate));
182 }
183
184 static void 
185 gtk_check_menu_item_activatable_interface_init (GtkActivatableIface  *iface)
186 {
187   parent_activatable_iface = g_type_interface_peek_parent (iface);
188   iface->update = gtk_check_menu_item_update;
189   iface->sync_action_properties = gtk_check_menu_item_sync_action_properties;
190 }
191
192 static void
193 gtk_check_menu_item_update (GtkActivatable *activatable,
194                             GtkAction      *action,
195                             const gchar    *property_name)
196 {
197   GtkCheckMenuItem *check_menu_item;
198
199   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
200
201   parent_activatable_iface->update (activatable, action, property_name);
202
203   if (strcmp (property_name, "active") == 0)
204     {
205       gtk_action_block_activate (action);
206       gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
207       gtk_action_unblock_activate (action);
208     }
209
210   if (!gtk_activatable_get_use_action_appearance (activatable))
211     return;
212
213   if (strcmp (property_name, "draw-as-radio") == 0)
214     gtk_check_menu_item_set_draw_as_radio (check_menu_item,
215                                            gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
216 }
217
218 static void
219 gtk_check_menu_item_sync_action_properties (GtkActivatable *activatable,
220                                             GtkAction      *action)
221 {
222   GtkCheckMenuItem *check_menu_item;
223
224   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
225
226   parent_activatable_iface->sync_action_properties (activatable, action);
227
228   if (!GTK_IS_TOGGLE_ACTION (action))
229     return;
230
231   gtk_action_block_activate (action);
232   gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
233   gtk_action_unblock_activate (action);
234   
235   if (!gtk_activatable_get_use_action_appearance (activatable))
236     return;
237
238   gtk_check_menu_item_set_draw_as_radio (check_menu_item,
239                                          gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
240 }
241
242 /**
243  * gtk_check_menu_item_new:
244  *
245  * Creates a new #GtkCheckMenuItem.
246  *
247  * Returns: a new #GtkCheckMenuItem.
248  */
249 GtkWidget*
250 gtk_check_menu_item_new (void)
251 {
252   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, NULL);
253 }
254
255 /**
256  * gtk_check_menu_item_new_with_label:
257  * @label: the string to use for the label.
258  *
259  * Creates a new #GtkCheckMenuItem with a label.
260  *
261  * Returns: a new #GtkCheckMenuItem.
262  */
263 GtkWidget*
264 gtk_check_menu_item_new_with_label (const gchar *label)
265 {
266   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
267                        "label", label,
268                        NULL);
269 }
270
271
272 /**
273  * gtk_check_menu_item_new_with_mnemonic:
274  * @label: The text of the button, with an underscore in front of the
275  *     character
276  *
277  * Creates a new #GtkCheckMenuItem containing a label. The label
278  * will be created using gtk_label_new_with_mnemonic(), so underscores
279  * in @label indicate the mnemonic for the menu item.
280  *
281  * Returns: a new #GtkCheckMenuItem
282  */
283 GtkWidget*
284 gtk_check_menu_item_new_with_mnemonic (const gchar *label)
285 {
286   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
287                        "label", label,
288                        "use-underline", TRUE,
289                        NULL);
290 }
291
292 /**
293  * gtk_check_menu_item_set_active:
294  * @check_menu_item: a #GtkCheckMenuItem.
295  * @is_active: boolean value indicating whether the check box is active.
296  *
297  * Sets the active state of the menu item's check box.
298  */
299 void
300 gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
301                                 gboolean          is_active)
302 {
303   GtkCheckMenuItemPrivate *priv;
304
305   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
306
307   priv = check_menu_item->priv;
308
309   is_active = is_active != 0;
310
311   if (priv->active != is_active)
312     gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
313 }
314
315 /**
316  * gtk_check_menu_item_get_active:
317  * @check_menu_item: a #GtkCheckMenuItem
318  * 
319  * Returns whether the check menu item is active. See
320  * gtk_check_menu_item_set_active ().
321  * 
322  * Return value: %TRUE if the menu item is checked.
323  */
324 gboolean
325 gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
326 {
327   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
328
329   return check_menu_item->priv->active;
330 }
331
332 static void
333 gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
334                                          gint        *requisition)
335 {
336   guint toggle_spacing;
337   guint indicator_size;
338   
339   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
340   
341   gtk_widget_style_get (GTK_WIDGET (menu_item),
342                         "toggle-spacing", &toggle_spacing,
343                         "indicator-size", &indicator_size,
344                         NULL);
345
346   *requisition = indicator_size + toggle_spacing;
347 }
348
349 /**
350  * gtk_check_menu_item_toggled:
351  * @check_menu_item: a #GtkCheckMenuItem.
352  *
353  * Emits the #GtkCheckMenuItem::toggled signal.
354  */
355 void
356 gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
357 {
358   g_signal_emit (check_menu_item, check_menu_item_signals[TOGGLED], 0);
359 }
360
361 /**
362  * gtk_check_menu_item_set_inconsistent:
363  * @check_menu_item: a #GtkCheckMenuItem
364  * @setting: %TRUE to display an "inconsistent" third state check
365  *
366  * If the user has selected a range of elements (such as some text or
367  * spreadsheet cells) that are affected by a boolean setting, and the
368  * current values in that range are inconsistent, you may want to
369  * display the check in an "in between" state. This function turns on
370  * "in between" display.  Normally you would turn off the inconsistent
371  * state again if the user explicitly selects a setting. This has to be
372  * done manually, gtk_check_menu_item_set_inconsistent() only affects
373  * visual appearance, it doesn't affect the semantics of the widget.
374  * 
375  **/
376 void
377 gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
378                                       gboolean          setting)
379 {
380   GtkCheckMenuItemPrivate *priv;
381
382   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
383
384   priv = check_menu_item->priv;
385   
386   setting = setting != FALSE;
387
388   if (setting != priv->inconsistent)
389     {
390       priv->inconsistent = setting;
391       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
392       g_object_notify (G_OBJECT (check_menu_item), "inconsistent");
393     }
394 }
395
396 /**
397  * gtk_check_menu_item_get_inconsistent:
398  * @check_menu_item: a #GtkCheckMenuItem
399  * 
400  * Retrieves the value set by gtk_check_menu_item_set_inconsistent().
401  * 
402  * Return value: %TRUE if inconsistent
403  **/
404 gboolean
405 gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
406 {
407   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
408
409   return check_menu_item->priv->inconsistent;
410 }
411
412 /**
413  * gtk_check_menu_item_set_draw_as_radio:
414  * @check_menu_item: a #GtkCheckMenuItem
415  * @draw_as_radio: whether @check_menu_item is drawn like a #GtkRadioMenuItem
416  *
417  * Sets whether @check_menu_item is drawn like a #GtkRadioMenuItem
418  *
419  * Since: 2.4
420  **/
421 void
422 gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
423                                        gboolean          draw_as_radio)
424 {
425   GtkCheckMenuItemPrivate *priv;
426
427   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
428
429   priv = check_menu_item->priv;
430
431   draw_as_radio = draw_as_radio != FALSE;
432
433   if (draw_as_radio != priv->draw_as_radio)
434     {
435       priv->draw_as_radio = draw_as_radio;
436
437       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
438
439       g_object_notify (G_OBJECT (check_menu_item), "draw-as-radio");
440     }
441 }
442
443 /**
444  * gtk_check_menu_item_get_draw_as_radio:
445  * @check_menu_item: a #GtkCheckMenuItem
446  * 
447  * Returns whether @check_menu_item looks like a #GtkRadioMenuItem
448  * 
449  * Return value: Whether @check_menu_item looks like a #GtkRadioMenuItem
450  * 
451  * Since: 2.4
452  **/
453 gboolean
454 gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
455 {
456   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
457   
458   return check_menu_item->priv->draw_as_radio;
459 }
460
461 static void
462 gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
463 {
464   GtkCheckMenuItemPrivate *priv;
465
466   check_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (check_menu_item,
467                                                        GTK_TYPE_CHECK_MENU_ITEM,
468                                                        GtkCheckMenuItemPrivate);
469   priv = check_menu_item->priv; 
470
471   priv->active = FALSE;
472   priv->always_show_toggle = TRUE;
473 }
474
475 static gint
476 gtk_check_menu_item_draw (GtkWidget *widget,
477                           cairo_t   *cr)
478 {
479   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
480
481   if (GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw)
482     GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw (widget, cr);
483
484   if (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator)
485     GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator (check_menu_item, cr);
486
487   return FALSE;
488 }
489
490 static void
491 gtk_check_menu_item_activate (GtkMenuItem *menu_item)
492 {
493   GtkCheckMenuItemPrivate *priv;
494
495   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
496   priv = check_menu_item->priv;
497
498   priv->active = !priv->active;
499
500   gtk_check_menu_item_toggled (check_menu_item);
501   gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
502
503   GTK_MENU_ITEM_CLASS (gtk_check_menu_item_parent_class)->activate (menu_item);
504
505   g_object_notify (G_OBJECT (check_menu_item), "active");
506 }
507
508 static void
509 gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
510                                          cairo_t          *cr)
511 {
512   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
513   GtkWidget *widget;
514   gint x, y;
515
516   widget = GTK_WIDGET (check_menu_item);
517
518   if (gtk_widget_is_drawable (widget))
519     {
520       GtkAllocation allocation;
521       GtkStyleContext *context;
522       guint border_width;
523       guint offset;
524       guint toggle_size;
525       guint toggle_spacing;
526       guint horizontal_padding;
527       guint indicator_size;
528       GtkStateFlags state;
529       GtkBorder padding;
530
531       context = gtk_widget_get_style_context (widget);
532       state = gtk_widget_get_state_flags (widget);
533       gtk_style_context_get_padding (context, state, &padding);
534
535       gtk_widget_get_allocation (widget, &allocation);
536
537       gtk_widget_style_get (widget,
538                             "toggle-spacing", &toggle_spacing,
539                             "horizontal-padding", &horizontal_padding,
540                             "indicator-size", &indicator_size,
541                             NULL);
542
543       toggle_size = GTK_MENU_ITEM (check_menu_item)->priv->toggle_size;
544       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
545       offset = border_width + padding.left + 2;
546
547       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
548         {
549           x = offset + horizontal_padding +
550             (toggle_size - toggle_spacing - indicator_size) / 2;
551         }
552       else
553         {
554           x = allocation.width -
555             offset - horizontal_padding - toggle_size + toggle_spacing +
556             (toggle_size - toggle_spacing - indicator_size) / 2;
557         }
558
559       y = (allocation.height - indicator_size) / 2;
560
561       if (priv->active ||
562           priv->always_show_toggle ||
563           (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
564         {
565           gtk_style_context_save (context);
566
567           if (priv->inconsistent)
568             state |= GTK_STATE_FLAG_INCONSISTENT;
569           else if (priv->active)
570             state |= GTK_STATE_FLAG_ACTIVE;
571
572           if (!gtk_widget_is_sensitive (widget))
573             state |= GTK_STATE_FLAG_INSENSITIVE;
574
575           gtk_style_context_set_state (context, state);
576
577           if (priv->draw_as_radio)
578             {
579               gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
580               gtk_render_option (context, cr, x, y,
581                                  indicator_size, indicator_size);
582             }
583           else
584             {
585               gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
586               gtk_render_check (context, cr, x, y,
587                                 indicator_size, indicator_size);
588             }
589
590           gtk_style_context_restore (context);
591         }
592     }
593 }
594
595
596 static void
597 gtk_check_menu_item_get_property (GObject     *object,
598                                   guint        prop_id,
599                                   GValue      *value,
600                                   GParamSpec  *pspec)
601 {
602   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
603   GtkCheckMenuItemPrivate *priv = checkitem->priv;
604   
605   switch (prop_id)
606     {
607     case PROP_ACTIVE:
608       g_value_set_boolean (value, priv->active);
609       break;
610     case PROP_INCONSISTENT:
611       g_value_set_boolean (value, priv->inconsistent);
612       break;
613     case PROP_DRAW_AS_RADIO:
614       g_value_set_boolean (value, priv->draw_as_radio);
615       break;
616     default:
617       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
618       break;
619     }
620 }
621
622
623 static void
624 gtk_check_menu_item_set_property (GObject      *object,
625                                   guint         prop_id,
626                                   const GValue *value,
627                                   GParamSpec   *pspec)
628 {
629   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
630   
631   switch (prop_id)
632     {
633     case PROP_ACTIVE:
634       gtk_check_menu_item_set_active (checkitem, g_value_get_boolean (value));
635       break;
636     case PROP_INCONSISTENT:
637       gtk_check_menu_item_set_inconsistent (checkitem, g_value_get_boolean (value));
638       break;
639     case PROP_DRAW_AS_RADIO:
640       gtk_check_menu_item_set_draw_as_radio (checkitem, g_value_get_boolean (value));
641       break;
642     default:
643       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
644       break;
645     }
646 }
647
648
649 /* Private */
650
651 /*
652  * _gtk_check_menu_item_set_active:
653  * @check_menu_item: a #GtkCheckMenuItem
654  * @is_active: whether the action is active or not
655  *
656  * Sets the #GtkCheckMenuItem:active property directly. This function does
657  * not emit signals or notifications: it is left to the caller to do so.
658  */
659 void
660 _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
661                                  gboolean          is_active)
662 {
663   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
664
665   priv->active = is_active;
666 }