Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been searching how to make that happen but i can't find it anywhere. I even guessed how to enable/disable the quicklist item, so as how to add function invoked after the item is clicked, but that's all. Any ideas?

I want to make a quicklist for my app which will consist of checkboxes or radio buttons. I found info how to add items without associated action to the quicklist (tutorial) but that's all I found, there is no information how to add other types of items (checkboxes, radio buttons, horizontal dividers or item with associated action) which are mentioned there. I'm trying to get something like this.

share|improve this question
I could not understand the question properly. Can you please tell what you are trying to achieve(a GUI or a item within the program)? – ashutosh May 10 '12 at 19:47
By item i meant an entry displayed after right click on the unity launcher, so yes, it's GUI. – qba47 May 10 '12 at 19:52
up vote 5 down vote accepted

I'm not sure is it correct, but I'm using something like this:

  • checkbox:
def check_item_activated_callback (menuitem, a, b):
    if menuitem.property_get_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE) == Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED:
       menuitem.property_set_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED)
       menuitem.property_set_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED)

check1 = ()
check1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Checkbox")
check1.property_set (Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_CHECK)
check1.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
check1.connect (Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, check_item_activated_callback, None)
qucklist.child_append (check1)
  • radio buttons:
def radio_item_activated_callback (radioitem1, a, radioitem2):
    radioitem1.property_set_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED)
    radioitem2.property_set_int (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED)

radio1 = ()
radio1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Radio Button 1")
radio1.property_set (Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_RADIO)
radio1.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
quicklist.child_append (radio1)

radio2 =
radio2.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Radio Button 2")
radio2.property_set (Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_RADIO)
radio2.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
quicklist.child_append (radio2)

radio1.connect (Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, radio_item_activated_callback, radio2)
radio2.connect (Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, radio_item_activated_callback, radio1)
  • separator (aka "horizontal dividers"):
separator = ();
separator.property_set (Dbusmenu.MENUITEM_PROP_TYPE, Dbusmenu.CLIENT_TYPES_SEPARATOR)
separator.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
quicklist.child_append (separator)
  • enabled/disabled menu items:
item1 = ()
item1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item Enabled")
item1.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item1.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, True)
quicklist.child_append (item1)

item2 = ()
item2.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item Disabled")
item2.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item2.property_set_bool (Dbusmenu.MENUITEM_PROP_ENABLED, False)
quicklist.child_append (item2)
share|improve this answer

Here's an example of making a Checkbox type Quicklist menu item:

    # Create toggle-able menu item for urgency
    urgent_menu_item = ()

    # Set the tab's name as the menu item's name
    urgent_menu_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _('Urgent'))

    # Make the menu item toggle-able
    urgent_menu_item.property_set(Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_CHECK)
    urgent_menu_item.property_set_int(Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED)
    urgent_menu_item.connect('item_activated', self.urgent_menu_item_activated)

    # Make the menu item visible
    urgent_menu_item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)

    # Add the section's menu item to the Quicklist menu

And here is one for making a Radio type Quicklist menu item:

        # Create a new item for this section
        section_menu_item = ()

        # Set the tab's name as the menu item's name
        section_menu_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, tab_name)

        # Make the menu item toggle-able
        section_menu_item.property_set(Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_RADIO)

        # Make the menu item visible
        section_menu_item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)

        # When the menu item is clicked, make it call menu_item_activated
        # with the tab id, which is used to make that the active tab
        section_menu_item.connect('item_activated', self.section_menu_item_activated, tab_id)

        # Add the section's menu item to the Quicklist menu
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.