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

« back to all changes in this revision

Viewing changes to debian/patches/04_app_indicator.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-28 14:11:49 UTC
  • mfrom: (1.3.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100128141149-snoxliun1ta8x8d2
Tags: 1.1.1-0ubuntu1
* New upstream version
* debian/control.in:
  - build-depends on cdbs to get strip-schema installed
  - updated cli build-depends for the new binary changes
* debian/rules:
  - set gettext domain in the desktop entry and run strip-schema on build

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Adds support for rendering menus in the application
 
2
 indicator.
 
3
 .
 
4
 This patch moves tomboy out of the notification area, and into
 
5
 the indicator-applet using libappindicator.
 
6
 
 
7
Forwarded: Not forwarded yet
 
8
Author: Jason Smith <jason.smith@canonical.com>
 
9
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/tomboy/+bug/497058
 
10
Last-Update: 2010-01-07
 
11
 
 
12
=== modified file 'Tomboy/Makefile.am'
 
13
--- old/Tomboy/Makefile.am      2010-01-07 16:43:35 +0000
 
14
+++ new/Tomboy/Makefile.am      2010-01-07 17:33:42 +0000
 
15
@@ -119,6 +119,7 @@
 
16
        $(srcdir)/Tag.cs                        \
 
17
        $(srcdir)/TagButton.cs                  \
 
18
        $(srcdir)/TagManager.cs                 \
 
19
+       $(srcdir)/TomboyIndicatorTray.cs        \
 
20
        $(srcdir)/Tray.cs                       \
 
21
        $(srcdir)/Trie.cs                       \
 
22
        $(srcdir)/Undo.cs                       \
 
23
@@ -144,6 +145,7 @@
 
24
 
 
25
 ASSEMBLIES =           \
 
26
        $(GTKSHARP_LIBS)        \
 
27
+       $(APPINDICATORSHARP_LIBS)       \
 
28
        $(GNOME_LIBS)   \
 
29
        -r:Mono.Posix   \
 
30
        $(DBUS_LIBS)    \
 
31
 
 
32
=== modified file 'Tomboy/RecentChanges.cs'
 
33
--- old/Tomboy/RecentChanges.cs 2010-01-07 16:43:35 +0000
 
34
+++ new/Tomboy/RecentChanges.cs 2010-01-07 20:31:00 +0000
 
35
@@ -222,7 +222,7 @@
 
36
                        am ["NewNotebookAction"].Activated += OnNewNotebook;
 
37
                        am ["DeleteNotebookAction"].Activated += OnDeleteNotebook;
 
38
                        am ["CloseWindowAction"].Activated += OnCloseWindow;
 
39
-                       if (Tomboy.TrayIconShowing == false)
 
40
+                       if (Tomboy.TrayIconShowing == false && !TomboyIndicatorTray.IndicatorTrayPresent)
 
41
                                am ["CloseWindowAction"].Visible = false;
 
42
 
 
43
                        // Allow Escape to close the window as well as <Control>W
 
44
@@ -995,7 +995,7 @@
 
45
                        Destroy ();
 
46
                        instance = null;
 
47
 #if !MAC
 
48
-                       if (Tomboy.TrayIconShowing == false)
 
49
+                       if (Tomboy.TrayIconShowing == false && !TomboyIndicatorTray.IndicatorTrayPresent)
 
50
                                Tomboy.ActionManager ["QuitTomboyAction"].Activate ();
 
51
 #endif
 
52
                }
 
53
 
 
54
=== modified file 'Tomboy/Tomboy.cs'
 
55
--- old/Tomboy/Tomboy.cs        2010-01-07 16:43:35 +0000
 
56
+++ new/Tomboy/Tomboy.cs        2010-01-07 20:48:10 +0000
 
57
@@ -163,17 +163,22 @@
 
58
 #endif
 
59
                }
 
60
 
 
61
+               static TomboyIndicatorTray indicator;
 
62
                static void StartTrayIcon ()
 
63
                {
 
64
-                       // Create the tray icon and run the main loop
 
65
-                       tray_icon = new TomboyTrayIcon (manager);
 
66
-                       tray = tray_icon.Tray;
 
67
-
 
68
-                       // Give the TrayIcon 2 seconds to appear.  If it
 
69
-                       // doesn't by then, open the SearchAllNotes window.
 
70
-                       tray_icon_showing = tray_icon.IsEmbedded && tray_icon.Visible;
 
71
-                       if (!tray_icon_showing)
 
72
-                               GLib.Timeout.Add (2000, CheckTrayIconShowing);
 
73
+                       if (TomboyIndicatorTray.IndicatorTrayPresent) {
 
74
+                               indicator = new TomboyIndicatorTray (manager);
 
75
+                       } else {
 
76
+                               // Create the tray icon and run the main loop
 
77
+                               tray_icon = new TomboyTrayIcon (manager);
 
78
+                               tray = tray_icon.Tray;
 
79
+                               
 
80
+                               // Give the TrayIcon 2 seconds to appear.  If it
 
81
+                               // doesn't by then, open the SearchAllNotes window.
 
82
+                               tray_icon_showing = tray_icon.IsEmbedded && tray_icon.Visible;
 
83
+                               if (!tray_icon_showing)
 
84
+                                       GLib.Timeout.Add (2000, CheckTrayIconShowing);
 
85
+                       }
 
86
 
 
87
                        StartMainLoop ();
 
88
                }
 
89
@@ -187,7 +192,7 @@
 
90
                        // instead, launch the Search All Notes window so the user can
 
91
                        // can still use Tomboy.
 
92
 #if !MAC
 
93
-                       if (tray_icon_showing == false)
 
94
+                       if (tray_icon_showing == false && indicator != null)
 
95
                                ActionManager ["ShowSearchAllNotesAction"].Activate ();
 
96
 #endif
 
97
                        
 
98
 
 
99
=== added file 'Tomboy/TomboyIndicatorTray.cs'
 
100
--- old/Tomboy/TomboyIndicatorTray.cs   1970-01-01 00:00:00 +0000
 
101
+++ new/Tomboy/TomboyIndicatorTray.cs   2010-01-07 17:33:42 +0000
 
102
@@ -0,0 +1,129 @@
 
103
+//  
 
104
+//  Copyright (C) 2009 GNOME Do
 
105
+// 
 
106
+//  This program is free software: you can redistribute it and/or modify
 
107
+//  it under the terms of the GNU General Public License as published by
 
108
+//  the Free Software Foundation, either version 3 of the License, or
 
109
+//  (at your option) any later version.
 
110
+// 
 
111
+//  This program is distributed in the hope that it will be useful,
 
112
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
113
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
114
+//  GNU General Public License for more details.
 
115
+// 
 
116
+//  You should have received a copy of the GNU General Public License
 
117
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
118
+// 
 
119
+
 
120
+using System;
 
121
+using System.Collections.Generic;
 
122
+using System.Linq;
 
123
+
 
124
+using Mono.Unix;
 
125
+
 
126
+using AppIndicator;
 
127
+
 
128
+namespace Tomboy
 
129
+{
 
130
+
 
131
+
 
132
+       public class TomboyIndicatorTray
 
133
+       {
 
134
+               public static bool IndicatorTrayPresent {
 
135
+                       get {
 
136
+                               return true;
 
137
+                       }
 
138
+               }
 
139
+               
 
140
+               ApplicationIndicator indicator;
 
141
+               NoteManager manager;
 
142
+               Gtk.Menu menu;
 
143
+
 
144
+               public TomboyIndicatorTray (NoteManager manager)
 
145
+               {
 
146
+                       this.manager = manager;
 
147
+                       indicator = new ApplicationIndicator ("tomboy-notes", "tomboy", Category.ApplicationStatus);
 
148
+                       
 
149
+                       SetMenuItems ();
 
150
+                       indicator.Status = Status.Active;
 
151
+               }
 
152
+               
 
153
+               void SetMenuItems ()
 
154
+               {
 
155
+                       if (menu != null) {
 
156
+                               foreach (Gtk.Widget widget in menu.Children) {
 
157
+                                       menu.Remove (widget);
 
158
+                                       widget.Destroy ();
 
159
+                               }
 
160
+                       }
 
161
+                       
 
162
+                       menu = new Gtk.Menu ();
 
163
+                       
 
164
+                       foreach (Gtk.MenuItem item in CurrentMenuItems ())
 
165
+                               menu.Append (item);
 
166
+                       
 
167
+                       indicator.Menu = menu;
 
168
+               }
 
169
+               
 
170
+               IEnumerable<Gtk.MenuItem> CurrentMenuItems ()
 
171
+               {
 
172
+                       Gtk.ImageMenuItem item;
 
173
+                       
 
174
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_Create New Note"));
 
175
+                       item.Image = new Gtk.Image (Gtk.Stock.New, Gtk.IconSize.Menu);
 
176
+                       item.Activated += (o, a) => Tomboy.ActionManager["NewNoteAction"].Activate ();
 
177
+                       item.Activated += (o, a) => SetMenuItems ();
 
178
+                       yield return item;
 
179
+                       
 
180
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_Search All Notes"));
 
181
+                       item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu);
 
182
+                       item.Activated += (o, a) => Tomboy.ActionManager["ShowSearchAllNotesAction"].Activate ();
 
183
+                       yield return item;
 
184
+                       
 
185
+                       yield return new Gtk.SeparatorMenuItem ();
 
186
+                       
 
187
+                       var menuItems = manager.Notes
 
188
+                               .Where (n => !n.IsSpecial)
 
189
+                               .OrderByDescending (n => n.ChangeDate)
 
190
+                               .Take (10)
 
191
+                               .Select (n => new NoteMenuItem (n, n.IsPinned))
 
192
+                               .ToArray ();
 
193
+                       // avoid lazy eval for menu item construction
 
194
+                       
 
195
+                       foreach (Gtk.MenuItem mi in menuItems) {
 
196
+                               mi.Activated += (o, a) => SetMenuItems ();
 
197
+                               yield return mi;
 
198
+                       }
 
199
+                       
 
200
+                       yield return new Gtk.SeparatorMenuItem ();
 
201
+                       
 
202
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("S_ynchronize Notes"));
 
203
+                       // setting this changes the menu text to "Convert"
 
204
+                       // item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
 
205
+                       item.Activated += (o, a) => Tomboy.ActionManager["NoteSynchronizationAction"].Activate ();
 
206
+                       yield return item;
 
207
+                       
 
208
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_Preferences"));
 
209
+                       item.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Menu);
 
210
+                       item.Activated += (o, a) => Tomboy.ActionManager["ShowPreferencesAction"].Activate ();
 
211
+                       yield return item;
 
212
+                       
 
213
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_Help"));
 
214
+                       item.Image = new Gtk.Image (Gtk.Stock.Help, Gtk.IconSize.Menu);
 
215
+                       item.Activated += (o, a) => Tomboy.ActionManager["ShowHelpAction"].Activate ();
 
216
+                       yield return item;
 
217
+                       
 
218
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_About Tomboy"));
 
219
+                       item.Image = new Gtk.Image (Gtk.Stock.About, Gtk.IconSize.Menu);
 
220
+                       item.Activated += (o, a) => Tomboy.ActionManager["ShowAboutAction"].Activate ();
 
221
+                       yield return item;
 
222
+                       
 
223
+                       yield return new Gtk.SeparatorMenuItem ();
 
224
+                       
 
225
+                       item = new Gtk.ImageMenuItem (Catalog.GetString ("_Quit"));
 
226
+                       item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
 
227
+                       item.Activated += (o, a) => Tomboy.ActionManager["QuitTomboyAction"].Activate ();
 
228
+                       yield return item;
 
229
+               }
 
230
+       }
 
231
+}
 
232
 
 
233
=== modified file 'configure.in'
 
234
--- old/configure.in    2010-01-07 16:43:35 +0000
 
235
+++ new/configure.in    2010-01-07 17:33:42 +0000
 
236
@@ -200,6 +200,10 @@
 
237
                  gtk-sharp-2.0 >= $GTKSHARP2_MINIMUM_VERSION)
 
238
 AC_SUBST(GTKSHARP_LIBS)
 
239
 
 
240
+APPINDICATOR_MINIMUM_VERSION=0.0.5
 
241
+PKG_CHECK_MODULES(APPINDICATORSHARP,
 
242
+                 appindicator-sharp-0.1 >= $APPINDICATOR_MINIMUM_VERSION)
 
243
+AC_SUBST(APPINDICATORSHARP_LIBS)
 
244
 #
 
245
 # Printing at least needs Mono.Cairo
 
246
 #
 
247