]> Pileus Git - ~andy/gtk/blob - gtk/gtkcheckmenuitem.c
a11y: Remove gtkcheckmneuitemaccessible.[ch]
[~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/gtkchecksubmenuitemaccessible.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_SUBMENU_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  *         mnemonic character
276  * @returns: a new #GtkCheckMenuItem
277  *
278  * Creates a new #GtkCheckMenuItem containing a label. The label
279  * will be created using gtk_label_new_with_mnemonic(), so underscores
280  * in @label indicate the mnemonic for the menu item.
281  **/
282 GtkWidget*
283 gtk_check_menu_item_new_with_mnemonic (const gchar *label)
284 {
285   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
286                        "label", label,
287                        "use-underline", TRUE,
288                        NULL);
289 }
290
291 /**
292  * gtk_check_menu_item_set_active:
293  * @check_menu_item: a #GtkCheckMenuItem.
294  * @is_active: boolean value indicating whether the check box is active.
295  *
296  * Sets the active state of the menu item's check box.
297  */
298 void
299 gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
300                                 gboolean          is_active)
301 {
302   GtkCheckMenuItemPrivate *priv;
303
304   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
305
306   priv = check_menu_item->priv;
307
308   is_active = is_active != 0;
309
310   if (priv->active != is_active)
311     gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
312 }
313
314 /**
315  * gtk_check_menu_item_get_active:
316  * @check_menu_item: a #GtkCheckMenuItem
317  * 
318  * Returns whether the check menu item is active. See
319  * gtk_check_menu_item_set_active ().
320  * 
321  * Return value: %TRUE if the menu item is checked.
322  */
323 gboolean
324 gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
325 {
326   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
327
328   return check_menu_item->priv->active;
329 }
330
331 static void
332 gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
333                                          gint        *requisition)
334 {
335   guint toggle_spacing;
336   guint indicator_size;
337   
338   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
339   
340   gtk_widget_style_get (GTK_WIDGET (menu_item),
341                         "toggle-spacing", &toggle_spacing,
342                         "indicator-size", &indicator_size,
343                         NULL);
344
345   *requisition = indicator_size + toggle_spacing;
346 }
347
348 /**
349  * gtk_check_menu_item_toggled:
350  * @check_menu_item: a #GtkCheckMenuItem.
351  *
352  * Emits the #GtkCheckMenuItem::toggled signal.
353  */
354 void
355 gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
356 {
357   g_signal_emit (check_menu_item, check_menu_item_signals[TOGGLED], 0);
358 }
359
360 /**
361  * gtk_check_menu_item_set_inconsistent:
362  * @check_menu_item: a #GtkCheckMenuItem
363  * @setting: %TRUE to display an "inconsistent" third state check
364  *
365  * If the user has selected a range of elements (such as some text or
366  * spreadsheet cells) that are affected by a boolean setting, and the
367  * current values in that range are inconsistent, you may want to
368  * display the check in an "in between" state. This function turns on
369  * "in between" display.  Normally you would turn off the inconsistent
370  * state again if the user explicitly selects a setting. This has to be
371  * done manually, gtk_check_menu_item_set_inconsistent() only affects
372  * visual appearance, it doesn't affect the semantics of the widget.
373  * 
374  **/
375 void
376 gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
377                                       gboolean          setting)
378 {
379   GtkCheckMenuItemPrivate *priv;
380
381   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
382
383   priv = check_menu_item->priv;
384   
385   setting = setting != FALSE;
386
387   if (setting != priv->inconsistent)
388     {
389       priv->inconsistent = setting;
390       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
391       g_object_notify (G_OBJECT (check_menu_item), "inconsistent");
392     }
393 }
394
395 /**
396  * gtk_check_menu_item_get_inconsistent:
397  * @check_menu_item: a #GtkCheckMenuItem
398  * 
399  * Retrieves the value set by gtk_check_menu_item_set_inconsistent().
400  * 
401  * Return value: %TRUE if inconsistent
402  **/
403 gboolean
404 gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
405 {
406   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
407
408   return check_menu_item->priv->inconsistent;
409 }
410
411 /**
412  * gtk_check_menu_item_set_draw_as_radio:
413  * @check_menu_item: a #GtkCheckMenuItem
414  * @draw_as_radio: whether @check_menu_item is drawn like a #GtkRadioMenuItem
415  *
416  * Sets whether @check_menu_item is drawn like a #GtkRadioMenuItem
417  *
418  * Since: 2.4
419  **/
420 void
421 gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
422                                        gboolean          draw_as_radio)
423 {
424   GtkCheckMenuItemPrivate *priv;
425
426   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
427
428   priv = check_menu_item->priv;
429
430   draw_as_radio = draw_as_radio != FALSE;
431
432   if (draw_as_radio != priv->draw_as_radio)
433     {
434       priv->draw_as_radio = draw_as_radio;
435
436       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
437
438       g_object_notify (G_OBJECT (check_menu_item), "draw-as-radio");
439     }
440 }
441
442 /**
443  * gtk_check_menu_item_get_draw_as_radio:
444  * @check_menu_item: a #GtkCheckMenuItem
445  * 
446  * Returns whether @check_menu_item looks like a #GtkRadioMenuItem
447  * 
448  * Return value: Whether @check_menu_item looks like a #GtkRadioMenuItem
449  * 
450  * Since: 2.4
451  **/
452 gboolean
453 gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
454 {
455   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
456   
457   return check_menu_item->priv->draw_as_radio;
458 }
459
460 static void
461 gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
462 {
463   GtkCheckMenuItemPrivate *priv;
464
465   check_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (check_menu_item,
466                                                        GTK_TYPE_CHECK_MENU_ITEM,
467                                                        GtkCheckMenuItemPrivate);
468   priv = check_menu_item->priv; 
469
470   priv->active = FALSE;
471   priv->always_show_toggle = TRUE;
472 }
473
474 static gint
475 gtk_check_menu_item_draw (GtkWidget *widget,
476                           cairo_t   *cr)
477 {
478   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
479
480   if (GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw)
481     GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw (widget, cr);
482
483   if (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator)
484     GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator (check_menu_item, cr);
485
486   return FALSE;
487 }
488
489 static void
490 gtk_check_menu_item_activate (GtkMenuItem *menu_item)
491 {
492   GtkCheckMenuItemPrivate *priv;
493
494   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
495   priv = check_menu_item->priv;
496
497   priv->active = !priv->active;
498
499   gtk_check_menu_item_toggled (check_menu_item);
500   gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
501
502   GTK_MENU_ITEM_CLASS (gtk_check_menu_item_parent_class)->activate (menu_item);
503
504   g_object_notify (G_OBJECT (check_menu_item), "active");
505 }
506
507 static void
508 gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
509                                          cairo_t          *cr)
510 {
511   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
512   GtkWidget *widget;
513   gint x, y;
514
515   widget = GTK_WIDGET (check_menu_item);
516
517   if (gtk_widget_is_drawable (widget))
518     {
519       GtkAllocation allocation;
520       GtkStyleContext *context;
521       guint border_width;
522       guint offset;
523       guint toggle_size;
524       guint toggle_spacing;
525       guint horizontal_padding;
526       guint indicator_size;
527       GtkStateFlags state;
528       GtkBorder padding;
529
530       context = gtk_widget_get_style_context (widget);
531       state = gtk_widget_get_state_flags (widget);
532       gtk_style_context_get_padding (context, state, &padding);
533
534       gtk_widget_get_allocation (widget, &allocation);
535
536       gtk_widget_style_get (widget,
537                             "toggle-spacing", &toggle_spacing,
538                             "horizontal-padding", &horizontal_padding,
539                             "indicator-size", &indicator_size,
540                             NULL);
541
542       toggle_size = GTK_MENU_ITEM (check_menu_item)->priv->toggle_size;
543       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
544       offset = border_width + padding.left + 2;
545
546       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
547         {
548           x = offset + horizontal_padding +
549             (toggle_size - toggle_spacing - indicator_size) / 2;
550         }
551       else
552         {
553           x = allocation.width -
554             offset - horizontal_padding - toggle_size + toggle_spacing +
555             (toggle_size - toggle_spacing - indicator_size) / 2;
556         }
557
558       y = (allocation.height - indicator_size) / 2;
559
560       if (priv->active ||
561           priv->always_show_toggle ||
562           (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
563         {
564           gtk_style_context_save (context);
565
566           if (priv->inconsistent)
567             state |= GTK_STATE_FLAG_INCONSISTENT;
568           else if (priv->active)
569             state |= GTK_STATE_FLAG_ACTIVE;
570
571           if (!gtk_widget_is_sensitive (widget))
572             state |= GTK_STATE_FLAG_INSENSITIVE;
573
574           gtk_style_context_set_state (context, state);
575
576           if (priv->draw_as_radio)
577             {
578               gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
579               gtk_render_option (context, cr, x, y,
580                                  indicator_size, indicator_size);
581             }
582           else
583             {
584               gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
585               gtk_render_check (context, cr, x, y,
586                                 indicator_size, indicator_size);
587             }
588
589           gtk_style_context_restore (context);
590         }
591     }
592 }
593
594
595 static void
596 gtk_check_menu_item_get_property (GObject     *object,
597                                   guint        prop_id,
598                                   GValue      *value,
599                                   GParamSpec  *pspec)
600 {
601   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
602   GtkCheckMenuItemPrivate *priv = checkitem->priv;
603   
604   switch (prop_id)
605     {
606     case PROP_ACTIVE:
607       g_value_set_boolean (value, priv->active);
608       break;
609     case PROP_INCONSISTENT:
610       g_value_set_boolean (value, priv->inconsistent);
611       break;
612     case PROP_DRAW_AS_RADIO:
613       g_value_set_boolean (value, priv->draw_as_radio);
614       break;
615     default:
616       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
617       break;
618     }
619 }
620
621
622 static void
623 gtk_check_menu_item_set_property (GObject      *object,
624                                   guint         prop_id,
625                                   const GValue *value,
626                                   GParamSpec   *pspec)
627 {
628   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
629   
630   switch (prop_id)
631     {
632     case PROP_ACTIVE:
633       gtk_check_menu_item_set_active (checkitem, g_value_get_boolean (value));
634       break;
635     case PROP_INCONSISTENT:
636       gtk_check_menu_item_set_inconsistent (checkitem, g_value_get_boolean (value));
637       break;
638     case PROP_DRAW_AS_RADIO:
639       gtk_check_menu_item_set_draw_as_radio (checkitem, g_value_get_boolean (value));
640       break;
641     default:
642       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
643       break;
644     }
645 }
646
647
648 /* Private */
649
650 /*
651  * _gtk_check_menu_item_set_active:
652  * @check_menu_item: a #GtkCheckMenuItem
653  * @is_active: whether the action is active or not
654  *
655  * Sets the #GtkCheckMenuItem:active property directly. This function does
656  * not emit signals or notifications: it is left to the caller to do so.
657  */
658 void
659 _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
660                                  gboolean          is_active)
661 {
662   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
663
664   priv->active = is_active;
665 }