]> Pileus Git - ~andy/gtk/blob - gtk/gtkcheckmenuitem.c
Merge bgo593793-filechooser-recent-folders-master branch.
[~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 #include "a11y/gtkchecksubmenuitemaccessible.h"
38
39 /**
40  * SECTION:gtkcheckmenuitem
41  * @Short_description: A menu item with a check box
42  * @Title: GtkCheckMenuItem
43  *
44  * A #GtkCheckMenuItem is a menu item that maintains the state of a boolean
45  * value in addition to a #GtkMenuItem usual role in activating application
46  * code.
47  *
48  * A check box indicating the state of the boolean value is displayed
49  * at the left side of the #GtkMenuItem.  Activating the #GtkMenuItem
50  * toggles the value.
51  */
52
53
54 #define INDICATOR_SIZE 16
55
56 struct _GtkCheckMenuItemPrivate
57 {
58   guint active             : 1;
59   guint always_show_toggle : 1;
60   guint draw_as_radio      : 1;
61   guint inconsistent       : 1;
62 };
63
64 enum {
65   TOGGLED,
66   LAST_SIGNAL
67 };
68
69 enum {
70   PROP_0,
71   PROP_ACTIVE,
72   PROP_INCONSISTENT,
73   PROP_DRAW_AS_RADIO
74 };
75
76 static gint gtk_check_menu_item_draw                 (GtkWidget             *widget,
77                                                       cairo_t               *cr);
78 static void gtk_check_menu_item_activate             (GtkMenuItem           *menu_item);
79 static void gtk_check_menu_item_toggle_size_request  (GtkMenuItem           *menu_item,
80                                                       gint                  *requisition);
81 static void gtk_real_check_menu_item_draw_indicator  (GtkCheckMenuItem      *check_menu_item,
82                                                       cairo_t               *cr);
83 static void gtk_check_menu_item_set_property         (GObject               *object,
84                                                       guint                  prop_id,
85                                                       const GValue          *value,
86                                                       GParamSpec            *pspec);
87 static void gtk_check_menu_item_get_property         (GObject               *object,
88                                                       guint                  prop_id,
89                                                       GValue                *value,
90                                                       GParamSpec            *pspec);
91
92 static void gtk_check_menu_item_activatable_interface_init (GtkActivatableIface  *iface);
93 static void gtk_check_menu_item_update                     (GtkActivatable       *activatable,
94                                                             GtkAction            *action,
95                                                             const gchar          *property_name);
96 static void gtk_check_menu_item_sync_action_properties     (GtkActivatable       *activatable,
97                                                             GtkAction            *action);
98
99 static GtkActivatableIface *parent_activatable_iface;
100 static guint                check_menu_item_signals[LAST_SIGNAL] = { 0 };
101
102 G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_ITEM,
103                          G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
104                                                 gtk_check_menu_item_activatable_interface_init))
105
106 static void
107 gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
108 {
109   GObjectClass *gobject_class;
110   GtkWidgetClass *widget_class;
111   GtkMenuItemClass *menu_item_class;
112   
113   gobject_class = G_OBJECT_CLASS (klass);
114   widget_class = (GtkWidgetClass*) klass;
115   menu_item_class = (GtkMenuItemClass*) klass;
116   
117   gobject_class->set_property = gtk_check_menu_item_set_property;
118   gobject_class->get_property = gtk_check_menu_item_get_property;
119
120   g_object_class_install_property (gobject_class,
121                                    PROP_ACTIVE,
122                                    g_param_spec_boolean ("active",
123                                                          P_("Active"),
124                                                          P_("Whether the menu item is checked"),
125                                                          FALSE,
126                                                          GTK_PARAM_READWRITE));
127   
128   g_object_class_install_property (gobject_class,
129                                    PROP_INCONSISTENT,
130                                    g_param_spec_boolean ("inconsistent",
131                                                          P_("Inconsistent"),
132                                                          P_("Whether to display an \"inconsistent\" state"),
133                                                          FALSE,
134                                                          GTK_PARAM_READWRITE));
135   
136   g_object_class_install_property (gobject_class,
137                                    PROP_DRAW_AS_RADIO,
138                                    g_param_spec_boolean ("draw-as-radio",
139                                                          P_("Draw as radio menu item"),
140                                                          P_("Whether the menu item looks like a radio menu item"),
141                                                          FALSE,
142                                                          GTK_PARAM_READWRITE));
143   
144   gtk_widget_class_install_style_property (widget_class,
145                                            g_param_spec_int ("indicator-size",
146                                                              P_("Indicator Size"),
147                                                              P_("Size of check or radio indicator"),
148                                                              0,
149                                                              G_MAXINT,
150                                                              INDICATOR_SIZE,
151                                                              GTK_PARAM_READABLE));
152
153   widget_class->draw = gtk_check_menu_item_draw;
154
155   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CHECK_SUBMENU_ITEM_ACCESSIBLE);
156
157   menu_item_class->activate = gtk_check_menu_item_activate;
158   menu_item_class->hide_on_activate = FALSE;
159   menu_item_class->toggle_size_request = gtk_check_menu_item_toggle_size_request;
160   
161   klass->toggled = NULL;
162   klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
163
164   /**
165    * GtkCheckMenuItem::toggled:
166    * @checkmenuitem: the object which received the signal.
167    *
168    * This signal is emitted when the state of the check box is changed.
169    *
170    * A signal handler can use gtk_check_menu_item_get_active()
171    * to discover the new state.
172    */
173   check_menu_item_signals[TOGGLED] =
174     g_signal_new (I_("toggled"),
175                   G_OBJECT_CLASS_TYPE (gobject_class),
176                   G_SIGNAL_RUN_FIRST,
177                   G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled),
178                   NULL, NULL,
179                   _gtk_marshal_VOID__VOID,
180                   G_TYPE_NONE, 0);
181
182   g_type_class_add_private (klass, sizeof (GtkCheckMenuItemPrivate));
183 }
184
185 static void 
186 gtk_check_menu_item_activatable_interface_init (GtkActivatableIface  *iface)
187 {
188   parent_activatable_iface = g_type_interface_peek_parent (iface);
189   iface->update = gtk_check_menu_item_update;
190   iface->sync_action_properties = gtk_check_menu_item_sync_action_properties;
191 }
192
193 static void
194 gtk_check_menu_item_update (GtkActivatable *activatable,
195                             GtkAction      *action,
196                             const gchar    *property_name)
197 {
198   GtkCheckMenuItem *check_menu_item;
199
200   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
201
202   parent_activatable_iface->update (activatable, action, property_name);
203
204   if (strcmp (property_name, "active") == 0)
205     {
206       gtk_action_block_activate (action);
207       gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
208       gtk_action_unblock_activate (action);
209     }
210
211   if (!gtk_activatable_get_use_action_appearance (activatable))
212     return;
213
214   if (strcmp (property_name, "draw-as-radio") == 0)
215     gtk_check_menu_item_set_draw_as_radio (check_menu_item,
216                                            gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
217 }
218
219 static void
220 gtk_check_menu_item_sync_action_properties (GtkActivatable *activatable,
221                                             GtkAction      *action)
222 {
223   GtkCheckMenuItem *check_menu_item;
224
225   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
226
227   parent_activatable_iface->sync_action_properties (activatable, action);
228
229   if (!GTK_IS_TOGGLE_ACTION (action))
230     return;
231
232   gtk_action_block_activate (action);
233   gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
234   gtk_action_unblock_activate (action);
235   
236   if (!gtk_activatable_get_use_action_appearance (activatable))
237     return;
238
239   gtk_check_menu_item_set_draw_as_radio (check_menu_item,
240                                          gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
241 }
242
243 /**
244  * gtk_check_menu_item_new:
245  *
246  * Creates a new #GtkCheckMenuItem.
247  *
248  * Returns: a new #GtkCheckMenuItem.
249  */
250 GtkWidget*
251 gtk_check_menu_item_new (void)
252 {
253   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, NULL);
254 }
255
256 /**
257  * gtk_check_menu_item_new_with_label:
258  * @label: the string to use for the label.
259  *
260  * Creates a new #GtkCheckMenuItem with a label.
261  *
262  * Returns: a new #GtkCheckMenuItem.
263  */
264 GtkWidget*
265 gtk_check_menu_item_new_with_label (const gchar *label)
266 {
267   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
268                        "label", label,
269                        NULL);
270 }
271
272
273 /**
274  * gtk_check_menu_item_new_with_mnemonic:
275  * @label: The text of the button, with an underscore in front of the
276  *         mnemonic character
277  * @returns: a new #GtkCheckMenuItem
278  *
279  * Creates a new #GtkCheckMenuItem containing a label. The label
280  * will be created using gtk_label_new_with_mnemonic(), so underscores
281  * in @label indicate the mnemonic for the menu item.
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 }