]> Pileus Git - ~andy/gtk/blob - gtk/gtkcheckmenuitem.c
Move documentation to inline comments: GtkCheckMenuItem
[~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
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   menu_item_class->activate = gtk_check_menu_item_activate;
155   menu_item_class->hide_on_activate = FALSE;
156   menu_item_class->toggle_size_request = gtk_check_menu_item_toggle_size_request;
157   
158   klass->toggled = NULL;
159   klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
160
161   /**
162    * GtkCheckMenuItem::toggled:
163    * @checkmenuitem: the object which received the signal.
164    *
165    * This signal is emitted when the state of the check box is changed.
166    *
167    * A signal handler can use gtk_check_menu_item_get_active()
168    * to discover the new state.
169    */
170   check_menu_item_signals[TOGGLED] =
171     g_signal_new (I_("toggled"),
172                   G_OBJECT_CLASS_TYPE (gobject_class),
173                   G_SIGNAL_RUN_FIRST,
174                   G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled),
175                   NULL, NULL,
176                   _gtk_marshal_VOID__VOID,
177                   G_TYPE_NONE, 0);
178
179   g_type_class_add_private (klass, sizeof (GtkCheckMenuItemPrivate));
180 }
181
182 static void 
183 gtk_check_menu_item_activatable_interface_init (GtkActivatableIface  *iface)
184 {
185   parent_activatable_iface = g_type_interface_peek_parent (iface);
186   iface->update = gtk_check_menu_item_update;
187   iface->sync_action_properties = gtk_check_menu_item_sync_action_properties;
188 }
189
190 static void
191 gtk_check_menu_item_update (GtkActivatable *activatable,
192                             GtkAction      *action,
193                             const gchar    *property_name)
194 {
195   GtkCheckMenuItem *check_menu_item;
196
197   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
198
199   parent_activatable_iface->update (activatable, action, property_name);
200
201   if (strcmp (property_name, "active") == 0)
202     {
203       gtk_action_block_activate (action);
204       gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
205       gtk_action_unblock_activate (action);
206     }
207
208   if (!gtk_activatable_get_use_action_appearance (activatable))
209     return;
210
211   if (strcmp (property_name, "draw-as-radio") == 0)
212     gtk_check_menu_item_set_draw_as_radio (check_menu_item,
213                                            gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
214 }
215
216 static void
217 gtk_check_menu_item_sync_action_properties (GtkActivatable *activatable,
218                                             GtkAction      *action)
219 {
220   GtkCheckMenuItem *check_menu_item;
221
222   check_menu_item = GTK_CHECK_MENU_ITEM (activatable);
223
224   parent_activatable_iface->sync_action_properties (activatable, action);
225
226   if (!GTK_IS_TOGGLE_ACTION (action))
227     return;
228
229   gtk_action_block_activate (action);
230   gtk_check_menu_item_set_active (check_menu_item, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
231   gtk_action_unblock_activate (action);
232   
233   if (!gtk_activatable_get_use_action_appearance (activatable))
234     return;
235
236   gtk_check_menu_item_set_draw_as_radio (check_menu_item,
237                                          gtk_toggle_action_get_draw_as_radio (GTK_TOGGLE_ACTION (action)));
238 }
239
240 /**
241  * gtk_check_menu_item_new:
242  *
243  * Creates a new #GtkCheckMenuItem.
244  *
245  * Returns: a new #GtkCheckMenuItem.
246  */
247 GtkWidget*
248 gtk_check_menu_item_new (void)
249 {
250   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, NULL);
251 }
252
253 /**
254  * gtk_check_menu_item_new_with_label:
255  * @label: the string to use for the label.
256  *
257  * Creates a new #GtkCheckMenuItem with a label.
258  *
259  * Returns: a new #GtkCheckMenuItem.
260  */
261 GtkWidget*
262 gtk_check_menu_item_new_with_label (const gchar *label)
263 {
264   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
265                        "label", label,
266                        NULL);
267 }
268
269
270 /**
271  * gtk_check_menu_item_new_with_mnemonic:
272  * @label: The text of the button, with an underscore in front of the
273  *         mnemonic character
274  * @returns: a new #GtkCheckMenuItem
275  *
276  * Creates a new #GtkCheckMenuItem containing a label. The label
277  * will be created using gtk_label_new_with_mnemonic(), so underscores
278  * in @label indicate the mnemonic for the menu item.
279  **/
280 GtkWidget*
281 gtk_check_menu_item_new_with_mnemonic (const gchar *label)
282 {
283   return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, 
284                        "label", label,
285                        "use-underline", TRUE,
286                        NULL);
287 }
288
289 /**
290  * gtk_check_menu_item_set_active:
291  * @check_menu_item: a #GtkCheckMenuItem.
292  * @is_active: boolean value indicating whether the check box is active.
293  *
294  * Sets the active state of the menu item's check box.
295  */
296 void
297 gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
298                                 gboolean          is_active)
299 {
300   GtkCheckMenuItemPrivate *priv;
301
302   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
303
304   priv = check_menu_item->priv;
305
306   is_active = is_active != 0;
307
308   if (priv->active != is_active)
309     gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
310 }
311
312 /**
313  * gtk_check_menu_item_get_active:
314  * @check_menu_item: a #GtkCheckMenuItem
315  * 
316  * Returns whether the check menu item is active. See
317  * gtk_check_menu_item_set_active ().
318  * 
319  * Return value: %TRUE if the menu item is checked.
320  */
321 gboolean
322 gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
323 {
324   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
325
326   return check_menu_item->priv->active;
327 }
328
329 static void
330 gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
331                                          gint        *requisition)
332 {
333   guint toggle_spacing;
334   guint indicator_size;
335   
336   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
337   
338   gtk_widget_style_get (GTK_WIDGET (menu_item),
339                         "toggle-spacing", &toggle_spacing,
340                         "indicator-size", &indicator_size,
341                         NULL);
342
343   *requisition = indicator_size + toggle_spacing;
344 }
345
346 /**
347  * gtk_check_menu_item_toggled:
348  * @check_menu_item: a #GtkCheckMenuItem.
349  *
350  * Emits the #GtkCheckMenuItem::toggled signal.
351  */
352 void
353 gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
354 {
355   g_signal_emit (check_menu_item, check_menu_item_signals[TOGGLED], 0);
356 }
357
358 /**
359  * gtk_check_menu_item_set_inconsistent:
360  * @check_menu_item: a #GtkCheckMenuItem
361  * @setting: %TRUE to display an "inconsistent" third state check
362  *
363  * If the user has selected a range of elements (such as some text or
364  * spreadsheet cells) that are affected by a boolean setting, and the
365  * current values in that range are inconsistent, you may want to
366  * display the check in an "in between" state. This function turns on
367  * "in between" display.  Normally you would turn off the inconsistent
368  * state again if the user explicitly selects a setting. This has to be
369  * done manually, gtk_check_menu_item_set_inconsistent() only affects
370  * visual appearance, it doesn't affect the semantics of the widget.
371  * 
372  **/
373 void
374 gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
375                                       gboolean          setting)
376 {
377   GtkCheckMenuItemPrivate *priv;
378
379   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
380
381   priv = check_menu_item->priv;
382   
383   setting = setting != FALSE;
384
385   if (setting != priv->inconsistent)
386     {
387       priv->inconsistent = setting;
388       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
389       g_object_notify (G_OBJECT (check_menu_item), "inconsistent");
390     }
391 }
392
393 /**
394  * gtk_check_menu_item_get_inconsistent:
395  * @check_menu_item: a #GtkCheckMenuItem
396  * 
397  * Retrieves the value set by gtk_check_menu_item_set_inconsistent().
398  * 
399  * Return value: %TRUE if inconsistent
400  **/
401 gboolean
402 gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
403 {
404   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
405
406   return check_menu_item->priv->inconsistent;
407 }
408
409 /**
410  * gtk_check_menu_item_set_draw_as_radio:
411  * @check_menu_item: a #GtkCheckMenuItem
412  * @draw_as_radio: whether @check_menu_item is drawn like a #GtkRadioMenuItem
413  *
414  * Sets whether @check_menu_item is drawn like a #GtkRadioMenuItem
415  *
416  * Since: 2.4
417  **/
418 void
419 gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
420                                        gboolean          draw_as_radio)
421 {
422   GtkCheckMenuItemPrivate *priv;
423
424   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
425
426   priv = check_menu_item->priv;
427
428   draw_as_radio = draw_as_radio != FALSE;
429
430   if (draw_as_radio != priv->draw_as_radio)
431     {
432       priv->draw_as_radio = draw_as_radio;
433
434       gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
435
436       g_object_notify (G_OBJECT (check_menu_item), "draw-as-radio");
437     }
438 }
439
440 /**
441  * gtk_check_menu_item_get_draw_as_radio:
442  * @check_menu_item: a #GtkCheckMenuItem
443  * 
444  * Returns whether @check_menu_item looks like a #GtkRadioMenuItem
445  * 
446  * Return value: Whether @check_menu_item looks like a #GtkRadioMenuItem
447  * 
448  * Since: 2.4
449  **/
450 gboolean
451 gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
452 {
453   g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
454   
455   return check_menu_item->priv->draw_as_radio;
456 }
457
458 static void
459 gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
460 {
461   GtkCheckMenuItemPrivate *priv;
462
463   check_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (check_menu_item,
464                                                        GTK_TYPE_CHECK_MENU_ITEM,
465                                                        GtkCheckMenuItemPrivate);
466   priv = check_menu_item->priv; 
467
468   priv->active = FALSE;
469   priv->always_show_toggle = TRUE;
470 }
471
472 static gint
473 gtk_check_menu_item_draw (GtkWidget *widget,
474                           cairo_t   *cr)
475 {
476   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
477
478   if (GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw)
479     GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->draw (widget, cr);
480
481   if (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator)
482     GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator (check_menu_item, cr);
483
484   return FALSE;
485 }
486
487 static void
488 gtk_check_menu_item_activate (GtkMenuItem *menu_item)
489 {
490   GtkCheckMenuItemPrivate *priv;
491
492   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
493   priv = check_menu_item->priv;
494
495   priv->active = !priv->active;
496
497   gtk_check_menu_item_toggled (check_menu_item);
498   gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
499
500   GTK_MENU_ITEM_CLASS (gtk_check_menu_item_parent_class)->activate (menu_item);
501
502   g_object_notify (G_OBJECT (check_menu_item), "active");
503 }
504
505 static void
506 gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
507                                          cairo_t          *cr)
508 {
509   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
510   GtkWidget *widget;
511   gint x, y;
512
513   widget = GTK_WIDGET (check_menu_item);
514
515   if (gtk_widget_is_drawable (widget))
516     {
517       GtkAllocation allocation;
518       GtkStyleContext *context;
519       guint border_width;
520       guint offset;
521       guint toggle_size;
522       guint toggle_spacing;
523       guint horizontal_padding;
524       guint indicator_size;
525       GtkStateFlags state;
526       GtkBorder padding;
527
528       context = gtk_widget_get_style_context (widget);
529       state = gtk_widget_get_state_flags (widget);
530       gtk_style_context_get_padding (context, state, &padding);
531
532       gtk_widget_get_allocation (widget, &allocation);
533
534       gtk_widget_style_get (widget,
535                             "toggle-spacing", &toggle_spacing,
536                             "horizontal-padding", &horizontal_padding,
537                             "indicator-size", &indicator_size,
538                             NULL);
539
540       toggle_size = GTK_MENU_ITEM (check_menu_item)->priv->toggle_size;
541       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
542       offset = border_width + padding.left + 2;
543
544       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
545         {
546           x = offset + horizontal_padding +
547             (toggle_size - toggle_spacing - indicator_size) / 2;
548         }
549       else
550         {
551           x = allocation.width -
552             offset - horizontal_padding - toggle_size + toggle_spacing +
553             (toggle_size - toggle_spacing - indicator_size) / 2;
554         }
555
556       y = (allocation.height - indicator_size) / 2;
557
558       if (priv->active ||
559           priv->always_show_toggle ||
560           (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
561         {
562           gtk_style_context_save (context);
563
564           if (priv->inconsistent)
565             state |= GTK_STATE_FLAG_INCONSISTENT;
566           else if (priv->active)
567             state |= GTK_STATE_FLAG_ACTIVE;
568
569           if (!gtk_widget_is_sensitive (widget))
570             state |= GTK_STATE_FLAG_INSENSITIVE;
571
572           gtk_style_context_set_state (context, state);
573
574           if (priv->draw_as_radio)
575             {
576               gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
577               gtk_render_option (context, cr, x, y,
578                                  indicator_size, indicator_size);
579             }
580           else
581             {
582               gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
583               gtk_render_check (context, cr, x, y,
584                                 indicator_size, indicator_size);
585             }
586
587           gtk_style_context_restore (context);
588         }
589     }
590 }
591
592
593 static void
594 gtk_check_menu_item_get_property (GObject     *object,
595                                   guint        prop_id,
596                                   GValue      *value,
597                                   GParamSpec  *pspec)
598 {
599   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
600   GtkCheckMenuItemPrivate *priv = checkitem->priv;
601   
602   switch (prop_id)
603     {
604     case PROP_ACTIVE:
605       g_value_set_boolean (value, priv->active);
606       break;
607     case PROP_INCONSISTENT:
608       g_value_set_boolean (value, priv->inconsistent);
609       break;
610     case PROP_DRAW_AS_RADIO:
611       g_value_set_boolean (value, priv->draw_as_radio);
612       break;
613     default:
614       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
615       break;
616     }
617 }
618
619
620 static void
621 gtk_check_menu_item_set_property (GObject      *object,
622                                   guint         prop_id,
623                                   const GValue *value,
624                                   GParamSpec   *pspec)
625 {
626   GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
627   
628   switch (prop_id)
629     {
630     case PROP_ACTIVE:
631       gtk_check_menu_item_set_active (checkitem, g_value_get_boolean (value));
632       break;
633     case PROP_INCONSISTENT:
634       gtk_check_menu_item_set_inconsistent (checkitem, g_value_get_boolean (value));
635       break;
636     case PROP_DRAW_AS_RADIO:
637       gtk_check_menu_item_set_draw_as_radio (checkitem, g_value_get_boolean (value));
638       break;
639     default:
640       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
641       break;
642     }
643 }
644
645
646 /* Private */
647
648 /*
649  * _gtk_check_menu_item_set_active:
650  * @check_menu_item: a #GtkCheckMenuItem
651  * @is_active: whether the action is active or not
652  *
653  * Sets the #GtkCheckMenuItem:active property directly. This function does
654  * not emit signals or notifications: it is left to the caller to do so.
655  */
656 void
657 _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
658                                  gboolean          is_active)
659 {
660   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
661
662   priv->active = is_active;
663 }