[gnome-shell] test-gapplication: update for latest gapplication changes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] test-gapplication: update for latest gapplication changes
- Date: Tue, 20 Dec 2011 22:37:48 +0000 (UTC)
commit e53e3cbb09f5fe03ba4a9f428f72dc302384390e
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Dec 2 22:15:14 2011 +0100
test-gapplication: update for latest gapplication changes
g_application_set_action_group is deprecated, we should use
GActionMap. Also, GSimpleActions can now be constructed as normal
GObjects.
src/test-gapplication.js | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/src/test-gapplication.js b/src/test-gapplication.js
index 5f58b2d..7d10103 100755
--- a/src/test-gapplication.js
+++ b/src/test-gapplication.js
@@ -30,35 +30,31 @@ function main() {
print ("Activated");
});
- let group = new Gio.SimpleActionGroup();
-
- let action = Gio.SimpleAction.new('one', null);
+ let action = new Gio.SimpleAction({ name: 'one' });
action.connect('activate', do_action);
- group.insert(action);
+ app.add_action(action);
- let action = Gio.SimpleAction.new('two', null);
+ let action = new Gio.SimpleAction({ name: 'two' });
action.connect('activate', do_action);
- group.insert(action);
+ app.add_action(action);
- let action = Gio.SimpleAction.new_stateful('toggle', null, GLib.Variant.new('b', false));
+ let action = new Gio.SimpleAction({ name: 'toggle', state: GLib.Variant.new('b', false) });
action.connect('activate', do_action_toggle);
action.connect('notify::state', do_action_state_change);
- group.insert(action);
+ app.add_action(action);
- let action = Gio.SimpleAction.new('disable', null);
+ let action = new Gio.SimpleAction({ name: 'disable', enabled: false });
action.set_enabled(false);
action.connect('activate', do_action);
- group.insert(action);
+ app.add_action(action);
- let action = Gio.SimpleAction.new('parameter-int', GLib.VariantType.new('u'));
+ let action = new Gio.SimpleAction({ name: 'parameter-int', parameter_type: GLib.VariantType.new('u') });
action.connect('activate', do_action_param);
- group.insert(action);
+ app.add_action(action);
- let action = Gio.SimpleAction.new('parameter-string', GLib.VariantType.new('s'));
+ let action = new Gio.SimpleAction({ name: 'parameter-string', parameter_type: GLib.VariantType.new('s') });
action.connect('activate', do_action_param);
- group.insert(action);
-
- app.action_group = group;
+ app.add_action(action);
let menu = new Gio.Menu();
menu.append('An action', 'one');
@@ -91,10 +87,13 @@ function main() {
item.set_action_and_target_value('parameter-int', GLib.Variant.new('u', 43));
menu.append_item(item);
- app.menu = menu;
+ app.set_app_menu(menu);
+
+ let window = null;
- app.connect('startup', function(app) {
- let window = new Gtk.Window({ title: "Test Application", application: app });
+ app.connect('activate', function(app) {
+ if (!window)
+ window = new Gtk.Window({ title: "Test Application", application: app });
window.present();
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]