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
=== modified file 'data/pantheon-mail.desktop.in'
--- data/pantheon-mail.desktop.in 2015-11-24 22:59:32 +0000
+++ data/pantheon-mail.desktop.in 2016-02-09 18:45:47 +0000
@@ -12,7 +12,11 @@
12Categories=GNOME;GTK;Network;Email;12Categories=GNOME;GTK;Network;Email;
13X-GNOME-Gettext-Domain=@GETTEXT_PACKAGE@13X-GNOME-Gettext-Domain=@GETTEXT_PACKAGE@
14X-GNOME-UsesNotifications=true14X-GNOME-UsesNotifications=true
15Actions=Compose;15Actions=AboutDialog;Compose;
16
17[Desktop Action AboutDialog]
18Name=About @APP_NAME@
19Exec=@EXEC_NAME@ --about
1620
17[Desktop Action Compose]21[Desktop Action Compose]
18Name=Compose Message22Name=Compose Message
1923
=== modified file 'data/ui/app_menu.interface'
--- data/ui/app_menu.interface 2016-01-19 02:16:54 +0000
+++ data/ui/app_menu.interface 2016-02-09 18:45:47 +0000
@@ -14,10 +14,6 @@
14 </section>14 </section>
15 <section>15 <section>
16 <item>16 <item>
17 <attribute name='label' translatable='yes'>_About</attribute>
18 <attribute name='action'>app.GearyAbout</attribute>
19 </item>
20 <item>
21 <attribute name='label' translatable='yes'>_Quit</attribute>17 <attribute name='label' translatable='yes'>_Quit</attribute>
22 <attribute name='action'>app.GearyQuit</attribute>18 <attribute name='action'>app.GearyQuit</attribute>
23 <attribute name='accel'>&lt;Primary&gt;Q</attribute>19 <attribute name='accel'>&lt;Primary&gt;Q</attribute>
2420
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2016-01-26 20:57:53 +0000
+++ src/CMakeLists.txt 2016-02-09 18:45:47 +0000
@@ -518,6 +518,7 @@
518set(TARGET_GLIB 2.34)518set(TARGET_GLIB 2.34)
519519
520pkg_check_modules(DEPS REQUIRED520pkg_check_modules(DEPS REQUIRED
521 granite
521 gthread-2.0522 gthread-2.0
522 glib-2.0>=${TARGET_GLIB}.0523 glib-2.0>=${TARGET_GLIB}.0
523 gio-2.0>=2.28.0524 gio-2.0>=2.28.0
@@ -535,17 +536,18 @@
535)536)
536537
537set(ENGINE_PACKAGES538set(ENGINE_PACKAGES
538 glib-2.0 gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0539 glib-2.0 granite gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0
539)540)
540541
541# webkitgtk-3.0 is listed as a custom VAPI (below) to ensure it's treated as a dependency and542# webkitgtk-3.0 is listed as a custom VAPI (below) to ensure it's treated as a dependency and
542# built before compilation543# built before compilation
543set(CLIENT_PACKAGES544set(CLIENT_PACKAGES
544 gtk+-3.0 libsecret-1 libsoup-2.4 libnotify libcanberra gcr-3 ${EXTRA_CLIENT_PACKAGES}545 gtk+-3.0 granite libsecret-1 libsoup-2.4 libnotify libcanberra gcr-3 ${EXTRA_CLIENT_PACKAGES}
545)546)
546547
547set(CONSOLE_PACKAGES548set(CONSOLE_PACKAGES
548 gtk+-3.0549 gtk+-3.0
550 granite
549)551)
550552
551set(GSETTINGS_DIR ${CMAKE_SOURCE_DIR}/data)553set(GSETTINGS_DIR ${CMAKE_SOURCE_DIR}/data)
552554
=== modified file 'src/client/application/geary-application.vala'
--- src/client/application/geary-application.vala 2016-02-06 02:37:42 +0000
+++ src/client/application/geary-application.vala 2016-02-09 18:45:47 +0000
@@ -15,11 +15,12 @@
15 public const string NAME = "Mail";15 public const string NAME = "Mail";
16 public const string PRGNAME = "geary";16 public const string PRGNAME = "geary";
17 public const string APP_ID = "org.pantheon.mail";17 public const string APP_ID = "org.pantheon.mail";
18 public const string DESCRIPTION = _("Mail Client");18 public const string COPYRIGHT = _("2011-2015 Yorba Foundation\n© 2016 elementary LLC.");
19 public const string COPYRIGHT = _("© 2011-2015 Yorba Foundation, © 2016 elementary LLC.");19 public const string WEBSITE = "https://elementary.io";
20 public const string WEBSITE = "https://www.elementary.io";
21 public const string WEBSITE_LABEL = _("Website");20 public const string WEBSITE_LABEL = _("Website");
22 public const string BUGREPORT = "https://bugs.launchpad.net/pantheon-mail/+filebug";21 public const string BUGREPORT = "https://bugs.launchpad.net/pantheon-mail/+filebug";
22 public const string HELP = "https://elementary.io/help/geary";
23 public const string TRANSLATE = "https://translations.launchpad.net/pantheon-mail";
2324
24 public const string CONTRACT_NAME = _("Send by Email");25 public const string CONTRACT_NAME = _("Send by Email");
25 public const string CONTRACT_DESCRIPTION = _("Send files using Mail");26 public const string CONTRACT_DESCRIPTION = _("Send files using Mail");
@@ -38,6 +39,12 @@
38 "Robert Schroll <rschroll@gmail.com>",39 "Robert Schroll <rschroll@gmail.com>",
39 null40 null
40 };41 };
42
43 public const string[] ARTISTS = {
44 "Daniel Foré <daniel@elementary.io>",
45 "Sam Hewitt <sam@elementary.io>",
46 null
47 };
41 48
42 private static const string ACTION_ENTRY_COMPOSE = "compose";49 private static const string ACTION_ENTRY_COMPOSE = "compose";
43 50
@@ -106,7 +113,9 @@
106 } catch (Error e) {113 } catch (Error e) {
107 error("Error registering GearyApplication: %s", e.message);114 error("Error registering GearyApplication: %s", e.message);
108 }115 }
109 116
117 startup();
118
110 if (!Args.parse(args)) {119 if (!Args.parse(args)) {
111 exit_status = 1;120 exit_status = 1;
112 return true;121 return true;
113122
=== modified file 'src/client/application/geary-args.vala'
--- src/client/application/geary-args.vala 2015-02-06 20:43:33 +0000
+++ src/client/application/geary-args.vala 2016-02-09 18:45:47 +0000
@@ -7,6 +7,7 @@
7namespace Args {7namespace Args {
88
9private const OptionEntry[] options = {9private const OptionEntry[] options = {
10 { "about", 'a', 0, OptionArg.NONE, ref show_about, N_("Show About dialog"), null },
10 { "hidden", 0, 0, OptionArg.NONE, ref hidden_startup, N_("Start Geary with hidden main window"), null },11 { "hidden", 0, 0, OptionArg.NONE, ref hidden_startup, N_("Start Geary with hidden main window"), null },
11 { "debug", 'd', 0, OptionArg.NONE, ref log_debug, N_("Output debugging information"), null },12 { "debug", 'd', 0, OptionArg.NONE, ref log_debug, N_("Output debugging information"), null },
12 { "log-conversations", 0, 0, OptionArg.NONE, ref log_conversations, N_("Log conversation monitoring"), null },13 { "log-conversations", 0, 0, OptionArg.NONE, ref log_conversations, N_("Log conversation monitoring"), null },
@@ -28,6 +29,7 @@
28 { null }29 { null }
29};30};
3031
32public bool show_about = false;
31public bool hidden_startup = false;33public bool hidden_startup = false;
32public bool log_debug = false;34public bool log_debug = false;
33public bool log_network = false;35public bool log_network = false;
@@ -73,7 +75,12 @@
73 return false;75 return false;
74 }76 }
75 }77 }
76 78
79 if (show_about) {
80 GearyController.on_about ();
81 Process.exit (0);
82 }
83
77 if (version) {84 if (version) {
78 stdout.printf("%s %s\n", GearyApplication.PRGNAME, GearyApplication.VERSION);85 stdout.printf("%s %s\n", GearyApplication.PRGNAME, GearyApplication.VERSION);
79 Process.exit(0);86 Process.exit(0);
8087
=== modified file 'src/client/application/geary-controller.vala'
--- src/client/application/geary-controller.vala 2016-01-29 06:23:48 +0000
+++ src/client/application/geary-controller.vala 2016-02-09 18:45:47 +0000
@@ -19,7 +19,6 @@
19 // Named actions.19 // Named actions.
20 //20 //
21 // NOTE: Some actions with accelerators need to also be added to ui/accelerators.ui21 // NOTE: Some actions with accelerators need to also be added to ui/accelerators.ui
22 public const string ACTION_ABOUT = "GearyAbout";
23 public const string ACTION_QUIT = "GearyQuit";22 public const string ACTION_QUIT = "GearyQuit";
24 public const string ACTION_NEW_MESSAGE = "GearyNewMessage";23 public const string ACTION_NEW_MESSAGE = "GearyNewMessage";
25 public const string ACTION_REPLY_TO_MESSAGE = "GearyReplyToMessage";24 public const string ACTION_REPLY_TO_MESSAGE = "GearyReplyToMessage";
@@ -375,10 +374,6 @@
375 prefs.label = _("_Preferences");374 prefs.label = _("_Preferences");
376 entries += prefs;375 entries += prefs;
377376
378 Gtk.ActionEntry about = { ACTION_ABOUT, Stock._ABOUT, TRANSLATABLE, null, null, on_about };
379 about.label = _("_About");
380 entries += about;
381
382 Gtk.ActionEntry quit = { ACTION_QUIT, Stock._QUIT, TRANSLATABLE, "<Ctrl>Q", null, on_quit };377 Gtk.ActionEntry quit = { ACTION_QUIT, Stock._QUIT, TRANSLATABLE, "<Ctrl>Q", null, on_quit };
383 quit.label = _("_Quit");378 quit.label = _("_Quit");
384 entries += quit;379 entries += quit;
@@ -548,7 +543,6 @@
548 const string[] exported_actions = {543 const string[] exported_actions = {
549 ACTION_ACCOUNTS,544 ACTION_ACCOUNTS,
550 ACTION_PREFERENCES,545 ACTION_PREFERENCES,
551 ACTION_ABOUT,
552 ACTION_QUIT,546 ACTION_QUIT,
553 };547 };
554548
@@ -1663,22 +1657,30 @@
1663 GearyApplication.instance.exit();1657 GearyApplication.instance.exit();
1664 }1658 }
16651659
1666 private void on_about() {1660 public static void on_about() {
1667 Gtk.show_about_dialog(main_window,1661 var dialog = create_about_dialog ();
1668 "program-name", GearyApplication.NAME,1662 dialog.run ();
1669 "comments", GearyApplication.DESCRIPTION,1663 dialog.destroy ();
1670 "authors", GearyApplication.AUTHORS,1664 }
1671 "copyright", GearyApplication.COPYRIGHT,1665
1672 "license-type", Gtk.License.LGPL_2_1,1666 public static Granite.Widgets.AboutDialog create_about_dialog () {
1673 "logo_icon_name", "internet-mail",1667 var about = new Granite.Widgets.AboutDialog ();
1674 "version", GearyApplication.VERSION,1668 about.program_name = GearyApplication.NAME;
1675 "website", GearyApplication.WEBSITE,1669 about.version = GearyApplication.VERSION;
1676 "website-label", GearyApplication.WEBSITE_LABEL,1670 about.logo_icon_name = "internet-mail";
1677 "title", _("About %s").printf(GearyApplication.NAME),1671 about.copyright = GearyApplication.COPYRIGHT;
1678 /// Translators: add your name and email address to receive credit in the About dialog1672 about.website = GearyApplication.WEBSITE;
1679 /// For example: Yamada Taro <yamada.taro@example.com>1673 about.website_label = GearyApplication.WEBSITE_LABEL;
1680 "translator-credits", _("translator-credits")1674 about.authors = GearyApplication.AUTHORS;
1681 );1675 about.artists = GearyApplication.ARTISTS;
1676 // Translators: add your name and email address to receive credit in the About dialog
1677 // For example: Yamada Taro <yamada.taro@example.com>
1678 about.translator_credits = _("translator-credits");
1679 about.license_type = Gtk.License.LGPL_2_1;
1680 about.help = GearyApplication.HELP;
1681 about.translate = GearyApplication.TRANSLATE;
1682 about.bug = GearyApplication.BUGREPORT;
1683 return about;
1682 }1684 }
16831685
1684 private void on_shift_key(bool pressed) {1686 private void on_shift_key(bool pressed) {

Subscribers

People subscribed via source and target branches