Merge lp:~elementary-apps/pantheon-mail/granite-about into lp:~elementary-apps/pantheon-mail/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Danielle Foré
Approved revision: 1973
Merged at revision: 1965
Proposed branch: lp:~elementary-apps/pantheon-mail/granite-about
Merge into: lp:~elementary-apps/pantheon-mail/trunk
Diff against target: 220 lines (+54/-34)
6 files modified
data/pantheon-mail.desktop.in (+5/-1)
data/ui/app_menu.interface (+0/-4)
src/CMakeLists.txt (+4/-2)
src/client/application/geary-application.vala (+13/-4)
src/client/application/geary-args.vala (+8/-1)
src/client/application/geary-controller.vala (+24/-22)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-mail/granite-about
Reviewer Review Type Date Requested Status
Mike Seese (community) code Approve
Danielle Foré Abstain
Review via email: mp+285299@code.launchpad.net

Commit message

Use Granite About

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Little stuck here, it seems to work fine from the menu but not from command line arg. Would love if someone could point out what I'm doing wrong.

review: Needs Fixing
1971. By Danielle Foré

blank line

Revision history for this message
Danielle Foré (danrabbit) :
review: Abstain
Revision history for this message
Ralph Plawetzki (purejava) wrote :

Compiling on Freya does show the Granite.Widgets.AboutDialog when invoked with -a from the cli.

You are on Loki, right?
For testing reasons I could download the iso this evening and see if this makes a difference (right now I have a limited bandwidth).

Revision history for this message
Ralph Plawetzki (purejava) wrote :

Did not see your talk about this issue on slack before I wrote the comment above.
Removed startup(); in line 117 of geary-application.vala and compiled again. The AboutDialog is still shown - no crash here.

Revision history for this message
Ralph Plawetzki (purejava) wrote :

Please ignore the last two comments.
I did not capture all parts of the talk about this issue on slack.

1972. By Danielle Foré

fix website lable, copyright elementary in newline

1973. By Danielle Foré

merge trunk

Revision history for this message
Mike Seese (seesemichaelj) wrote :

Below is concerning the startup() call at line 117 in geary-application.vala proposed in revision 1969.

Technically, you only need to do a Gdk.init(). Gtk.init() calls Gdk.init() and Gtk.Application.startup() calls Gtk.init() and GearyApplication.startup() calls Gtk.Application.startup().

We just need to enforce that gdk gets initialized.

Gtk.Application.startup() only gets called if there is no other instance of the application. The startup signal is sent during register(). If a primary instance already exists, register() returns true but does not perform any work (see http://www.valadoc.org/#!api=gio-2.0/GLib.Application.register).
I have verified this by putting breakpoints in geary-application.vala lines 117 and 135. If register() called startup(), line 135 would be executed first, otherwise 117 would be. 117 was executed first.

Anyway, going back to the question at hand: is calling "startup()" okay even though another instance exists? I'm unsure of the other functions in GearyApplication.startup(), but they do not seem to be detrimental if called an extra time. Thus I approve the code, but we should keep this in the back our mind if future issues exist concerning starting Mail while Mail is already running (i.e. geary --about or just geary).

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/pantheon-mail.desktop.in'
2--- data/pantheon-mail.desktop.in 2015-11-24 22:59:32 +0000
3+++ data/pantheon-mail.desktop.in 2016-02-09 18:45:47 +0000
4@@ -12,7 +12,11 @@
5 Categories=GNOME;GTK;Network;Email;
6 X-GNOME-Gettext-Domain=@GETTEXT_PACKAGE@
7 X-GNOME-UsesNotifications=true
8-Actions=Compose;
9+Actions=AboutDialog;Compose;
10+
11+[Desktop Action AboutDialog]
12+Name=About @APP_NAME@
13+Exec=@EXEC_NAME@ --about
14
15 [Desktop Action Compose]
16 Name=Compose Message
17
18=== modified file 'data/ui/app_menu.interface'
19--- data/ui/app_menu.interface 2016-01-19 02:16:54 +0000
20+++ data/ui/app_menu.interface 2016-02-09 18:45:47 +0000
21@@ -14,10 +14,6 @@
22 </section>
23 <section>
24 <item>
25- <attribute name='label' translatable='yes'>_About</attribute>
26- <attribute name='action'>app.GearyAbout</attribute>
27- </item>
28- <item>
29 <attribute name='label' translatable='yes'>_Quit</attribute>
30 <attribute name='action'>app.GearyQuit</attribute>
31 <attribute name='accel'>&lt;Primary&gt;Q</attribute>
32
33=== modified file 'src/CMakeLists.txt'
34--- src/CMakeLists.txt 2016-01-26 20:57:53 +0000
35+++ src/CMakeLists.txt 2016-02-09 18:45:47 +0000
36@@ -518,6 +518,7 @@
37 set(TARGET_GLIB 2.34)
38
39 pkg_check_modules(DEPS REQUIRED
40+ granite
41 gthread-2.0
42 glib-2.0>=${TARGET_GLIB}.0
43 gio-2.0>=2.28.0
44@@ -535,17 +536,18 @@
45 )
46
47 set(ENGINE_PACKAGES
48- glib-2.0 gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0
49+ glib-2.0 granite gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0
50 )
51
52 # webkitgtk-3.0 is listed as a custom VAPI (below) to ensure it's treated as a dependency and
53 # built before compilation
54 set(CLIENT_PACKAGES
55- gtk+-3.0 libsecret-1 libsoup-2.4 libnotify libcanberra gcr-3 ${EXTRA_CLIENT_PACKAGES}
56+ gtk+-3.0 granite libsecret-1 libsoup-2.4 libnotify libcanberra gcr-3 ${EXTRA_CLIENT_PACKAGES}
57 )
58
59 set(CONSOLE_PACKAGES
60 gtk+-3.0
61+ granite
62 )
63
64 set(GSETTINGS_DIR ${CMAKE_SOURCE_DIR}/data)
65
66=== modified file 'src/client/application/geary-application.vala'
67--- src/client/application/geary-application.vala 2016-02-06 02:37:42 +0000
68+++ src/client/application/geary-application.vala 2016-02-09 18:45:47 +0000
69@@ -15,11 +15,12 @@
70 public const string NAME = "Mail";
71 public const string PRGNAME = "geary";
72 public const string APP_ID = "org.pantheon.mail";
73- public const string DESCRIPTION = _("Mail Client");
74- public const string COPYRIGHT = _("© 2011-2015 Yorba Foundation, © 2016 elementary LLC.");
75- public const string WEBSITE = "https://www.elementary.io";
76+ public const string COPYRIGHT = _("2011-2015 Yorba Foundation\n© 2016 elementary LLC.");
77+ public const string WEBSITE = "https://elementary.io";
78 public const string WEBSITE_LABEL = _("Website");
79 public const string BUGREPORT = "https://bugs.launchpad.net/pantheon-mail/+filebug";
80+ public const string HELP = "https://elementary.io/help/geary";
81+ public const string TRANSLATE = "https://translations.launchpad.net/pantheon-mail";
82
83 public const string CONTRACT_NAME = _("Send by Email");
84 public const string CONTRACT_DESCRIPTION = _("Send files using Mail");
85@@ -38,6 +39,12 @@
86 "Robert Schroll <rschroll@gmail.com>",
87 null
88 };
89+
90+ public const string[] ARTISTS = {
91+ "Daniel Foré <daniel@elementary.io>",
92+ "Sam Hewitt <sam@elementary.io>",
93+ null
94+ };
95
96 private static const string ACTION_ENTRY_COMPOSE = "compose";
97
98@@ -106,7 +113,9 @@
99 } catch (Error e) {
100 error("Error registering GearyApplication: %s", e.message);
101 }
102-
103+
104+ startup();
105+
106 if (!Args.parse(args)) {
107 exit_status = 1;
108 return true;
109
110=== modified file 'src/client/application/geary-args.vala'
111--- src/client/application/geary-args.vala 2015-02-06 20:43:33 +0000
112+++ src/client/application/geary-args.vala 2016-02-09 18:45:47 +0000
113@@ -7,6 +7,7 @@
114 namespace Args {
115
116 private const OptionEntry[] options = {
117+ { "about", 'a', 0, OptionArg.NONE, ref show_about, N_("Show About dialog"), null },
118 { "hidden", 0, 0, OptionArg.NONE, ref hidden_startup, N_("Start Geary with hidden main window"), null },
119 { "debug", 'd', 0, OptionArg.NONE, ref log_debug, N_("Output debugging information"), null },
120 { "log-conversations", 0, 0, OptionArg.NONE, ref log_conversations, N_("Log conversation monitoring"), null },
121@@ -28,6 +29,7 @@
122 { null }
123 };
124
125+public bool show_about = false;
126 public bool hidden_startup = false;
127 public bool log_debug = false;
128 public bool log_network = false;
129@@ -73,7 +75,12 @@
130 return false;
131 }
132 }
133-
134+
135+ if (show_about) {
136+ GearyController.on_about ();
137+ Process.exit (0);
138+ }
139+
140 if (version) {
141 stdout.printf("%s %s\n", GearyApplication.PRGNAME, GearyApplication.VERSION);
142 Process.exit(0);
143
144=== modified file 'src/client/application/geary-controller.vala'
145--- src/client/application/geary-controller.vala 2016-01-29 06:23:48 +0000
146+++ src/client/application/geary-controller.vala 2016-02-09 18:45:47 +0000
147@@ -19,7 +19,6 @@
148 // Named actions.
149 //
150 // NOTE: Some actions with accelerators need to also be added to ui/accelerators.ui
151- public const string ACTION_ABOUT = "GearyAbout";
152 public const string ACTION_QUIT = "GearyQuit";
153 public const string ACTION_NEW_MESSAGE = "GearyNewMessage";
154 public const string ACTION_REPLY_TO_MESSAGE = "GearyReplyToMessage";
155@@ -375,10 +374,6 @@
156 prefs.label = _("_Preferences");
157 entries += prefs;
158
159- Gtk.ActionEntry about = { ACTION_ABOUT, Stock._ABOUT, TRANSLATABLE, null, null, on_about };
160- about.label = _("_About");
161- entries += about;
162-
163 Gtk.ActionEntry quit = { ACTION_QUIT, Stock._QUIT, TRANSLATABLE, "<Ctrl>Q", null, on_quit };
164 quit.label = _("_Quit");
165 entries += quit;
166@@ -548,7 +543,6 @@
167 const string[] exported_actions = {
168 ACTION_ACCOUNTS,
169 ACTION_PREFERENCES,
170- ACTION_ABOUT,
171 ACTION_QUIT,
172 };
173
174@@ -1663,22 +1657,30 @@
175 GearyApplication.instance.exit();
176 }
177
178- private void on_about() {
179- Gtk.show_about_dialog(main_window,
180- "program-name", GearyApplication.NAME,
181- "comments", GearyApplication.DESCRIPTION,
182- "authors", GearyApplication.AUTHORS,
183- "copyright", GearyApplication.COPYRIGHT,
184- "license-type", Gtk.License.LGPL_2_1,
185- "logo_icon_name", "internet-mail",
186- "version", GearyApplication.VERSION,
187- "website", GearyApplication.WEBSITE,
188- "website-label", GearyApplication.WEBSITE_LABEL,
189- "title", _("About %s").printf(GearyApplication.NAME),
190- /// Translators: add your name and email address to receive credit in the About dialog
191- /// For example: Yamada Taro <yamada.taro@example.com>
192- "translator-credits", _("translator-credits")
193- );
194+ public static void on_about() {
195+ var dialog = create_about_dialog ();
196+ dialog.run ();
197+ dialog.destroy ();
198+ }
199+
200+ public static Granite.Widgets.AboutDialog create_about_dialog () {
201+ var about = new Granite.Widgets.AboutDialog ();
202+ about.program_name = GearyApplication.NAME;
203+ about.version = GearyApplication.VERSION;
204+ about.logo_icon_name = "internet-mail";
205+ about.copyright = GearyApplication.COPYRIGHT;
206+ about.website = GearyApplication.WEBSITE;
207+ about.website_label = GearyApplication.WEBSITE_LABEL;
208+ about.authors = GearyApplication.AUTHORS;
209+ about.artists = GearyApplication.ARTISTS;
210+ // Translators: add your name and email address to receive credit in the About dialog
211+ // For example: Yamada Taro <yamada.taro@example.com>
212+ about.translator_credits = _("translator-credits");
213+ about.license_type = Gtk.License.LGPL_2_1;
214+ about.help = GearyApplication.HELP;
215+ about.translate = GearyApplication.TRANSLATE;
216+ about.bug = GearyApplication.BUGREPORT;
217+ return about;
218 }
219
220 private void on_shift_key(bool pressed) {

Subscribers

People subscribed via source and target branches