~ubuntu-branches/ubuntu/wily/gnome-do/wily

« back to all changes in this revision

Viewing changes to Do/src/Do.UI/MainMenu.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2008-09-14 10:09:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080914100940-aakng2140941ze9f
Tags: 0.6.0.0-0ubuntu1
* New upstream version, packaging based on the soon-to-be uploaded Debian
  package in pkg-cli-apps svn.  FFe is LP: #267020
* New upstream version fixes erratic positioning bug (LP: #204372)
* debian/control
  + Update build-depends for new version
  + Update standards version to 3.8.0, adding README.Source
* debian/gnome-do-autostart.desktop
* debian/gnome-do.install
  + Delete our desktop file, install upstream's translated desktop file
    to /etc/xdg/autostart instead.
* debian/gnome-do.preinst
  + Remove old autostart file on upgrade (if unmodified).  Otherwise 
    GNOME Do will appear twice in the autostart list.
* debian/gnome-do.1
  + Manpage updated for new version
* debian/rules:
  + Fix get-orig-source target to run properly from any directory; now should
  be policy compliant.
* debian/copyright:
  + Refresh for new upstream version
  + Update to more recent CopyrightFormat proposal

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
using System;
21
 
using System.Reflection;
22
21
using Gtk;
23
22
using Mono.Unix;
24
23
 
25
24
using Do;
 
25
using Do.Core;
26
26
 
27
27
namespace Do.UI
28
28
{
29
 
        public class MainMenu
 
29
        public class MainMenu : Gtk.Menu
30
30
        {
31
31
                static MainMenu instance;
32
32
 
33
 
                static MainMenu ()
34
 
                {
35
 
                        instance = new MainMenu ();
36
 
                }
37
 
 
38
 
                public static MainMenu Instance
39
 
                {
40
 
                        get { return instance; }
41
 
                }
42
 
 
43
 
                Menu menu;
44
 
                AboutDialog about;
 
33
                public static MainMenu Instance {
 
34
                        get {
 
35
                                return instance ??
 
36
                                        instance = new MainMenu ();
 
37
                        }
 
38
                }
 
39
 
45
40
                int mainMenuX, mainMenuY;
46
41
 
47
42
                public MainMenu ()
48
43
                {
49
44
                        MenuItem item;
50
 
 
51
 
                        about = null;
52
 
                        menu = new Menu();
53
 
 
54
 
                        // Preferences menu item
55
 
                        item = new ImageMenuItem  ("_Preferences");
56
 
                        (item as ImageMenuItem).Image = new Image (Stock.Preferences, IconSize.Menu);
57
 
                        // menu.Add (item);
58
 
                        item.CanFocus = false;
59
 
                        item.Sensitive = false;
60
 
 
61
 
                        // Refresh catalog menu item
62
 
                        item = new ImageMenuItem ("_Refresh Catalog");
63
 
                        (item as ImageMenuItem).Image = new Image (Stock.Refresh, IconSize.Menu);
64
 
                        // menu.Add (item);
65
 
                        item.Activated += OnMainMenuRefreshCatalogClicked;
66
 
 
67
 
                        // Separator
68
 
                        // menu.Add (new SeparatorMenuItem ());
69
 
 
70
45
                        // About menu item
71
 
                        item = new ImageMenuItem  (Catalog.GetString ("_About Do"));
 
46
                        item = new ImageMenuItem (Catalog.GetString ("_About Do"));
72
47
                        (item as ImageMenuItem).Image = new Image (Stock.About, IconSize.Menu);
73
 
                        menu.Add (item);
 
48
                        Add (item);
74
49
                        item.CanFocus = false;
75
50
                        item.Activated += OnMainMenuAboutClicked;
76
 
 
77
 
                        // Open plugin folder
78
 
                        item = new ImageMenuItem  (Catalog.GetString ("_Open Plugins Folder"));
79
 
                        (item as ImageMenuItem).Image = new Image (Stock.Open, IconSize.Menu);
80
 
                        menu.Add (item);
 
51
                        
 
52
                        // Preferences menu item
 
53
                        item = new ImageMenuItem (Catalog.GetString ("_Preferences"));
 
54
                        (item as ImageMenuItem).Image = new Image (Stock.Preferences, IconSize.Menu);
 
55
                        Add (item);
81
56
                        item.CanFocus = false;
82
 
                        item.Activated += OnMainMenuOpenPluginFolderClicked;
83
 
 
 
57
                        item.Activated += OnMainMenuPreferencesClicked;
 
58
                        
84
59
                        // Quit menu item
85
60
                        item = new ImageMenuItem (Catalog.GetString ("_Quit"));
86
61
                        (item as ImageMenuItem).Image = new Image (Stock.Quit, IconSize.Menu);
87
 
                        menu.Add (item);
 
62
                        Add (item);
88
63
                        item.Activated += OnMainMenuQuitClicked;
89
64
 
90
 
                        menu.ShowAll();
91
 
                }
92
 
 
93
 
                public AboutDialog AboutDialog
94
 
                {
95
 
                        get { return about; }
 
65
                        ShowAll ();
96
66
                }
97
67
 
98
68
                protected void OnMainMenuQuitClicked (object o, EventArgs args)
100
70
                        Do.Controller.Vanish ();
101
71
                        Application.Quit ();
102
72
                }
103
 
 
104
 
                protected void OnMainMenuRefreshCatalogClicked (object o, EventArgs args)
105
 
                {
106
 
                }
107
 
 
108
 
                protected void OnMainMenuOpenPluginFolderClicked (object o, EventArgs args)
109
 
                {
110
 
                        Do.Controller.Vanish ();
111
 
                        Util.Environment.Open (Paths.UserPlugins);
 
73
                
 
74
                protected void OnMainMenuPreferencesClicked (object o, EventArgs args)
 
75
                {
 
76
                        Do.Controller.ShowPreferences ();
112
77
                }
113
78
 
114
79
                protected void OnMainMenuAboutClicked (object o, EventArgs args)
115
80
                {
116
 
                        string[] authors;
117
 
                        string[] logos;
118
 
                        string logo;
119
 
 
120
 
                        Do.Controller.Vanish ();
121
 
 
122
 
                        authors = new string[] {
123
 
                                "Chris Halse Rogers <chalserogers@gmail.com>",
124
 
                                "David Siegel <djsiegel@gmail.com>",
125
 
                                "DR Colkitt <douglas.colkitt@gmail.com>",
126
 
                                "James Walker",
127
 
                                "Jason Smith",
128
 
                                "Miguel de Icaza",
129
 
                                "Rick Harding",
130
 
                                "Thomsen Anders",
131
 
                                "Volker Braun"
132
 
                        };
133
 
 
134
 
                        about = new AboutDialog ();
135
 
                        about.Name = "GNOME Do";
136
 
 
137
 
                        try {
138
 
                                AssemblyName name = Assembly.GetEntryAssembly ().GetName ();
139
 
                                about.Version = String.Format ("{0}.{1}.{2}.{3}",
140
 
                                                                                        name.Version.Major,
141
 
                                                                                        name.Version.Minor,
142
 
                                                                                        name.Version.Build,
143
 
                                                                                        name.Version.Revision);
144
 
                        } catch {
145
 
                                about.Version = Catalog.GetString ("Unknown");
146
 
                        }
147
 
                        
148
 
                        logos = new string[] {
149
 
                                "/usr/share/icons/gnome/scalable/actions/search.svg",
150
 
                        };
151
 
 
152
 
                        logo = "gnome-run";
153
 
                        foreach (string l in logos) {
154
 
                                if (!System.IO.File.Exists (l)) continue;
155
 
                                logo = l;
156
 
                        }
157
 
 
158
 
                        about.Logo = UI.IconProvider.PixbufFromIconName (logo, 140);
159
 
                        about.Copyright = "Copyright \xa9 2008 GNOME Do Developers";
160
 
                        about.Comments = "Do things as quickly as possible\n" +
161
 
                                "(but no quicker) with your files, bookmarks,\n" +
162
 
                                "applications, music, contacts, and more!";
163
 
                        about.Website = "http://do.davebsd.com/";
164
 
                        about.WebsiteLabel = "Visit Homepage";
165
 
                        about.Authors = authors;
166
 
                        about.IconName = "gnome-run";
167
 
 
168
 
                        if (null != about.Screen.RgbaColormap) {
169
 
                                Gtk.Widget.DefaultColormap = about.Screen.RgbaColormap;
170
 
                        }
171
 
 
172
 
                        about.Run ();
173
 
                        about.Destroy ();
174
 
                        about = null;
 
81
                        Do.Controller.ShowAbout ();
175
82
                }
176
83
 
177
84
                public void PopupAtPosition (int x, int y)
178
85
                {
179
86
                        mainMenuX = x;
180
87
                        mainMenuY = y;  
181
 
                        menu.Popup (null, null, PositionMainMenu, 3, Gtk.Global.CurrentEventTime);
 
88
                        Popup (null, null, PositionMainMenu, 3, Gtk.Global.CurrentEventTime);
182
89
                }
183
90
 
184
91
                private void PositionMainMenu (Menu menu, out int x, out int y, out bool push_in)
188
95
                        push_in = true;
189
96
                }
190
97
        }
191
 
}
 
98
}
 
 
b'\\ No newline at end of file'