Merge lp:~charlesk/libappindicator/fix-vala-examples into lp:libappindicator/0.5

Proposed by Charles Kerr
Status: Merged
Approved by: Charles Kerr
Approved revision: 237
Merge reported by: Charles Kerr
Merged at revision: not available
Proposed branch: lp:~charlesk/libappindicator/fix-vala-examples
Merge into: lp:libappindicator/0.5
Diff against target: 137 lines (+21/-21)
2 files modified
bindings/vala/examples/indicator-example.vala (+3/-3)
example/simple-client-vala.vala (+18/-18)
To merge this branch: bzr merge lp:~charlesk/libappindicator/fix-vala-examples
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Review via email: mp+98695@code.launchpad.net

Description of the change

The vala examples were written before GMenu, so add explict namespace use here to avoid valac errors caused by namespace ambiguity between glib and gtk (ie, use 'new Gtk.Menu' instead of 'new Menu')

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

I find it much better like this anyways.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bindings/vala/examples/indicator-example.vala'
2--- bindings/vala/examples/indicator-example.vala 2011-09-23 15:46:27 +0000
3+++ bindings/vala/examples/indicator-example.vala 2012-03-21 18:09:20 +0000
4@@ -39,16 +39,16 @@
5 indicator.set_status(IndicatorStatus.ACTIVE);
6 indicator.set_attention_icon("indicator-messages-new");
7
8- var menu = new Menu();
9+ var menu = new Gtk.Menu();
10
11- var item = new MenuItem.with_label("Foo");
12+ var item = new Gtk.MenuItem.with_label("Foo");
13 item.activate.connect(() => {
14 indicator.set_status(IndicatorStatus.ATTENTION);
15 });
16 item.show();
17 menu.append(item);
18
19- var bar = item = new MenuItem.with_label("Bar");
20+ var bar = item = new Gtk.MenuItem.with_label("Bar");
21 item.show();
22 item.activate.connect(() => {
23 indicator.set_status(IndicatorStatus.ACTIVE);
24
25=== modified file 'example/simple-client-vala.vala'
26--- example/simple-client-vala.vala 2012-01-29 03:38:55 +0000
27+++ example/simple-client-vala.vala 2012-03-21 18:09:20 +0000
28@@ -30,7 +30,7 @@
29 }
30
31 class SimpleClient {
32- Menu menu;
33+ Gtk.Menu menu;
34 Indicator ci;
35 int percentage;
36 bool active;
37@@ -56,24 +56,24 @@
38 widget.set_sensitive(!widget.is_sensitive());
39 }
40
41- private void append_submenu(MenuItem item) {
42- var menu = new Menu();
43- MenuItem mi;
44+ private void append_submenu(Gtk.MenuItem item) {
45+ var menu = new Gtk.Menu();
46+ Gtk.MenuItem mi;
47
48- mi = new MenuItem.with_label("Sub 1");
49+ mi = new Gtk.MenuItem.with_label("Sub 1");
50 menu.append(mi);
51 mi.activate.connect(() => { print("Sub1\n"); });
52
53- MenuItem prev_mi = mi;
54- mi = new MenuItem.with_label("Sub 2");
55+ Gtk.MenuItem prev_mi = mi;
56+ mi = new Gtk.MenuItem.with_label("Sub 2");
57 menu.append(mi);
58 mi.activate.connect(() => { toggle_sensitivity(prev_mi); });
59
60- mi = new MenuItem.with_label("Sub 3");
61+ mi = new Gtk.MenuItem.with_label("Sub 3");
62 menu.append(mi);
63 mi.activate.connect(() => { print("Sub3\n"); });
64
65- mi = new MenuItem.with_label("Toggle Attention");
66+ mi = new Gtk.MenuItem.with_label("Toggle Attention");
67 menu.append(mi);
68 mi.activate.connect(() => {
69 if (ci.get_status() == IndicatorStatus.ATTENTION)
70@@ -88,7 +88,7 @@
71 item.set_submenu(menu);
72 }
73
74- private void label_toggle(MenuItem item) {
75+ private void label_toggle(Gtk.MenuItem item) {
76 can_haz_label = !can_haz_label;
77
78 if (can_haz_label) {
79@@ -114,28 +114,28 @@
80 return true;
81 });
82
83- menu = new Menu();
84+ menu = new Gtk.Menu();
85 var chk = new CheckMenuItem.with_label("1");
86 chk.activate.connect(() => { print("1\n"); });
87 menu.append(chk);
88 chk.show();
89
90- var radio = new RadioMenuItem.with_label(new SList<RadioMenuItem>(), "2");
91+ var radio = new Gtk.RadioMenuItem.with_label(new SList<RadioMenuItem>(), "2");
92 radio.activate.connect(() => { print("2\n"); });
93 menu.append(radio);
94 radio.show();
95
96- var submenu = new MenuItem.with_label("3");
97+ var submenu = new Gtk.MenuItem.with_label("3");
98 menu.append(submenu);
99 append_submenu(submenu);
100 submenu.show();
101
102- var toggle_item = new MenuItem.with_label("Toggle 3");
103+ var toggle_item = new Gtk.MenuItem.with_label("Toggle 3");
104 toggle_item.activate.connect(() => { toggle_sensitivity(submenu); });
105 menu.append(toggle_item);
106 toggle_item.show();
107
108- var imgitem = new ImageMenuItem.from_stock(Stock.NEW, null);
109+ var imgitem = new Gtk.ImageMenuItem.from_stock(Stock.NEW, null);
110 imgitem.activate.connect(() => {
111 Image img = (Image) imgitem.get_image();
112 img.set_from_stock(Stock.OPEN, IconSize.MENU);
113@@ -143,7 +143,7 @@
114 menu.append(imgitem);
115 imgitem.show();
116
117- var att = new MenuItem.with_label("Get Attention");
118+ var att = new Gtk.MenuItem.with_label("Get Attention");
119 att.activate.connect(() => {
120 if (active) {
121 ci.set_status(IndicatorStatus.ATTENTION);
122@@ -158,13 +158,13 @@
123 menu.append(att);
124 att.show();
125
126- var show = new MenuItem.with_label("Show Label");
127+ var show = new Gtk.MenuItem.with_label("Show Label");
128 label_toggle(show);
129 show.activate.connect(() => { label_toggle(show); });
130 menu.append(show);
131 show.show();
132
133- var icon = new CheckMenuItem.with_label("Set Local Icon");
134+ var icon = new Gtk.CheckMenuItem.with_label("Set Local Icon");
135 icon.activate.connect(() => {
136 if (icon.get_active()) {
137 ci.set_icon("simple-client-test-icon.png");

Subscribers

People subscribed via source and target branches