예제 #1
0
def init():
   item = gtk.MenuItem(_("Pastie"))
   glipper.add_menu_item(item)
   menu = gtk.Menu()
   global languageList   
   for lang in languageList:
      subitem = gtk.MenuItem(glipper.format_item(lang))
      subitem.connect('activate', on_activate, lang)
      menu.append(subitem)
   
   menu.show_all()
   item.set_submenu(menu)
예제 #2
0
def update_menu():
	max_length = glipper.GCONF_CLIENT.get_int(glipper.GCONF_MAX_ITEM_LENGTH)
	global menu
	menu.destroy()
	menu = gtk.Menu()
	
	if len(snippets) == 0:
		menu.append(gtk.MenuItem(_("No snippets available")))
	else:
		for snippet in snippets:
			item = gtk.MenuItem(glipper.format_item(snippet))
			if len(snippet) > max_length:
				item.set_tooltip_text(snippet)
			item.connect('activate', on_activate, snippet)
			menu.append(item)
	
	menu.show_all()
	menu_item.set_submenu(menu)
예제 #3
0
def update_menu():
    max_length = glipper.GSETTINGS.get_int(glipper.GSETTINGS_MAX_ITEM_LENGTH)
    global menu
    menu.destroy()
    menu = Gtk.Menu()

    if len(snippets) == 0:
        menu.append(Gtk.MenuItem(_("No snippets available")))
    else:
        for snippet in snippets:
            item = Gtk.MenuItem(glipper.format_item(snippet))
            if len(snippet) > max_length:
                item.set_tooltip_text(snippet)
            item.connect('activate', on_activate, snippet)
            menu.append(item)

    menu.show_all()
    menu_item.set_submenu(menu)