~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

« back to all changes in this revision

Viewing changes to Tomboy/Tray.cs

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2009-03-17 00:25:21 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090317002521-xexuaqvlekudx6e2
Tags: upstream-0.14.0
ImportĀ upstreamĀ versionĀ 0.14.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
        {
137
137
                TomboyTray tray;
138
138
                TomboyPrefsKeybinder keybinder;
 
139
                Gtk.Menu context_menu;
139
140
 
140
141
                public TomboyTrayIcon (NoteManager manager)
141
142
                {
167
168
                protected override void OnPopupMenu (uint button, uint activate_time)
168
169
                {
169
170
                        if (button == 3)
170
 
                                GuiUtils.PopupMenu (MakeRightClickMenu (),
 
171
                                GuiUtils.PopupMenu (GetRightClickMenu (),
171
172
                                                    null, 
172
173
                                                    new Gtk.MenuPositionFunc (GetTrayMenuPosition));
173
174
                                
175
176
                
176
177
                public void ShowMenu (bool select_first_item)
177
178
                {
 
179
                        if (context_menu != null)
 
180
                                context_menu.Hide ();
 
181
 
178
182
                        TomboyTrayUtils.UpdateTomboyTrayMenu (tray, null);
179
183
                        if (select_first_item)
180
184
                                tray.TomboyTrayMenu.SelectFirst (false);
219
223
                        }
220
224
                }
221
225
                
222
 
                Gtk.Menu MakeRightClickMenu ()
 
226
                Gtk.Menu GetRightClickMenu ()
223
227
                {
224
 
                        Gtk.Menu menu = new Gtk.Menu ();
 
228
                        if (tray.TomboyTrayMenu != null)
 
229
                                tray.TomboyTrayMenu.Hide ();
 
230
 
 
231
                        if (context_menu != null) {
 
232
                                context_menu.Hide ();
 
233
                                return context_menu;
 
234
                        }
 
235
 
 
236
                        context_menu = new Gtk.Menu ();
225
237
 
226
238
                        Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
227
 
                        menu.AccelGroup = accel_group;
 
239
                        context_menu.AccelGroup = accel_group;
228
240
 
229
241
                        Gtk.ImageMenuItem item;
230
242
 
231
243
                        item = new Gtk.ImageMenuItem (Catalog.GetString ("_Preferences"));
232
244
                        item.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Menu);
233
245
                        item.Activated += ShowPreferences;
234
 
                        menu.Append (item);
 
246
                        context_menu.Append (item);
235
247
 
236
248
                        item = new Gtk.ImageMenuItem (Catalog.GetString ("_Help"));
237
249
                        item.Image = new Gtk.Image (Gtk.Stock.Help, Gtk.IconSize.Menu);
238
250
                        item.Activated += ShowHelpContents;
239
 
                        menu.Append (item);
 
251
                        context_menu.Append (item);
240
252
 
241
253
                        item = new Gtk.ImageMenuItem (Catalog.GetString ("_About Tomboy"));
242
254
                        item.Image = new Gtk.Image (Gtk.Stock.About, Gtk.IconSize.Menu);
243
255
                        item.Activated += ShowAbout;
244
 
                        menu.Append (item);
 
256
                        context_menu.Append (item);
245
257
 
246
 
                        menu.Append (new Gtk.SeparatorMenuItem ());
 
258
                        context_menu.Append (new Gtk.SeparatorMenuItem ());
247
259
 
248
260
                        item = new Gtk.ImageMenuItem (Catalog.GetString ("_Quit"));
249
261
                        item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
250
262
                        item.Activated += Quit;
251
 
                        menu.Append (item);
 
263
                        context_menu.Append (item);
252
264
 
253
 
                        menu.ShowAll ();
254
 
                        return menu;
 
265
                        context_menu.ShowAll ();
 
266
                        return context_menu;
255
267
                }
256
268
 
257
269
                void ShowPreferences (object sender, EventArgs args)