ibus-ui-gtk3: Add quit item in menu.

This commit is contained in:
Peng Huang 2012-01-27 09:51:26 -05:00
Родитель ff9556cc21
Коммит 30d217ac85
2 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -94,22 +94,21 @@ int get_set_engine(string[] argv) {
return -1;
print("%s\n", desc.get_name());
return 0;
} else {
if(!bus.set_global_engine(engine))
return -1;
var desc = bus.get_global_engine();
if (desc == null)
return -1;
string cmdline = "setxkbmap %s".printf(desc.get_layout());
try {
if (!GLib.Process.spawn_command_line_sync(cmdline)) {
warning("Switch xkb layout to %s failed.",
desc.get_layout());
}
} catch (GLib.SpawnError e) {
warning("execute setxkblayout failed");
}
if(!bus.set_global_engine(engine))
return -1;
var desc = bus.get_global_engine();
if (desc == null)
return -1;
string cmdline = "setxkbmap %s".printf(desc.get_layout());
try {
if (!GLib.Process.spawn_command_line_sync(cmdline)) {
warning("Switch xkb layout to %s failed.",
desc.get_layout());
}
return 0;
} catch (GLib.SpawnError e) {
warning("execute setxkblayout failed");
}
return 0;
}
@ -140,10 +139,10 @@ struct CommandEntry {
public int main(string[] argv) {
const CommandEntry commands[] = {
{ "engine", get_set_engine },
{ "exit", exit_daemon },
{ "list-engine", list_engine },
{ "watch", message_watch },
{ "restart", restart_daemon },
{ "exit", exit_daemon }
{ "restart", restart_daemon }
};
if (argv.length >= 2) {

Просмотреть файл

@ -293,11 +293,15 @@ class Panel : IBus.PanelService {
m_sys_menu.append(new SeparatorMenuItem());
item = new Gtk.ImageMenuItem.from_stock(Gtk.Stock.QUIT, null);
item = new Gtk.ImageMenuItem.from_stock(Gtk.Stock.REFRESH, null);
item.set_label(_("Restart"));
item.activate.connect((i) => m_bus.exit(true));
m_sys_menu.append(item);
item = new Gtk.ImageMenuItem.from_stock(Gtk.Stock.QUIT, null);
item.activate.connect((i) => m_bus.exit(false));
m_sys_menu.append(item);
m_sys_menu.show_all();
}