Merge lp:~vikoadi/pantheon-photos/fix-dialog-button-order into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Danielle Foré
Approved revision: 2729
Merged at revision: 2731
Proposed branch: lp:~vikoadi/pantheon-photos/fix-dialog-button-order
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 121 lines (+48/-8)
4 files modified
src/AppWindow.vala (+40/-1)
src/Dialogs.vala (+1/-1)
src/direct/DirectPhotoPage.vala (+5/-4)
src/library/LibraryWindow.vala (+2/-2)
To merge this branch: bzr merge lp:~vikoadi/pantheon-photos/fix-dialog-button-order
Reviewer Review Type Date Requested Status
Photos Devs Pending
Review via email: mp+249654@code.launchpad.net

Commit message

arrange Dialog response button to conform elementary HIG

Description of the change

arrange Dialog response button to conform elementary HIG

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/AppWindow.vala'
2--- src/AppWindow.vala 2014-09-27 09:20:58 +0000
3+++ src/AppWindow.vala 2015-02-13 14:22:48 +0000
4@@ -633,6 +633,27 @@
5 return (Gtk.ResponseType) response;
6 }
7
8+ public static Gtk.ResponseType affirm_cancel_negate_question (string message,
9+ string affirmative, string negative,
10+ string? title = null, Gtk.Window? parent = null) {
11+ Gtk.MessageDialog dialog = new Gtk.MessageDialog.with_markup ((parent != null) ? parent : get_instance (),
12+ Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "%s", build_alert_body_text (title, message));
13+
14+ dialog.add_buttons (affirmative, Gtk.ResponseType.YES,
15+ _ ("_Cancel"), Gtk.ResponseType.CANCEL,
16+ negative, Gtk.ResponseType.NO);
17+
18+ // Occasionally, with_markup doesn't actually enable markup, but set_markup always works.
19+ dialog.set_markup (build_alert_body_text (title, message));
20+ dialog.use_markup = true;
21+
22+ int response = dialog.run ();
23+
24+ dialog.destroy ();
25+
26+ return (Gtk.ResponseType) response;
27+ }
28+
29 public static Gtk.ResponseType affirm_cancel_question (string message, string affirmative,
30 string? title = null, Gtk.Window? parent = null) {
31 Gtk.MessageDialog dialog = new Gtk.MessageDialog.with_markup ((parent != null) ? parent : get_instance (),
32@@ -651,6 +672,24 @@
33 return (Gtk.ResponseType) response;
34 }
35
36+ public static Gtk.ResponseType cancel_affirm_question (string message, string affirmative,
37+ string? title = null, Gtk.Window? parent = null) {
38+ Gtk.MessageDialog dialog = new Gtk.MessageDialog.with_markup ((parent != null) ? parent : get_instance (),
39+ Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "%s", message);
40+ // Occasionally, with_markup doesn't actually enable markup...? Force the issue.
41+ dialog.set_markup (message);
42+ dialog.use_markup = true;
43+ dialog.title = (title != null) ? title : _ (Resources.APP_TITLE);
44+ dialog.add_buttons (_("_Cancel"), Gtk.ResponseType.CANCEL,
45+ affirmative, Gtk.ResponseType.YES);
46+
47+ int response = dialog.run ();
48+
49+ dialog.destroy ();
50+
51+ return (Gtk.ResponseType) response;
52+ }
53+
54 public static Gtk.ResponseType negate_affirm_all_cancel_question (string message,
55 string negative, string affirmative, string affirmative_all, string? title = null,
56 Gtk.Window? parent = null) {
57@@ -925,4 +964,4 @@
58 return base.configure_event (event);
59 }
60
61-}
62\ No newline at end of file
63+}
64
65=== modified file 'src/Dialogs.vala'
66--- src/Dialogs.vala 2015-01-18 18:50:45 +0000
67+++ src/Dialogs.vala 2015-02-13 14:22:48 +0000
68@@ -128,7 +128,7 @@
69
70 if (photos_remaining) {
71 message += _ ("\n\nWould you like to continue exporting?");
72- response = AppWindow.affirm_cancel_question (message, _ ("Con_tinue"));
73+ response = AppWindow.cancel_affirm_question (message, _ ("Con_tinue"));
74 } else {
75 AppWindow.error_message (message);
76 }
77
78=== modified file 'src/direct/DirectPhotoPage.vala'
79--- src/direct/DirectPhotoPage.vala 2014-09-13 03:34:09 +0000
80+++ src/direct/DirectPhotoPage.vala 2015-02-13 14:22:48 +0000
81@@ -405,9 +405,10 @@
82 bool is_writeable = get_photo ().get_file_format ().can_write ();
83 string save_option = is_writeable ? _ ("_Save") : _ ("_Save a Copy");
84
85- Gtk.ResponseType response = AppWindow.negate_affirm_cancel_question (
86- _ ("Lose changes to %s?").printf (photo.get_basename ()), save_option,
87- _ ("Close _without Saving"));
88+ Gtk.ResponseType response = AppWindow.affirm_cancel_negate_question (
89+ _("Lose changes to %s?").printf (photo.get_basename ()),
90+ _("Close _without Saving"),
91+ save_option);
92
93 if (response == Gtk.ResponseType.YES)
94 photo.remove_all_transformations ();
95@@ -557,4 +558,4 @@
96 // direct.ui.
97 ui_filenames.add ("direct_context.ui");
98 }
99-}
100\ No newline at end of file
101+}
102
103=== modified file 'src/library/LibraryWindow.vala'
104--- src/library/LibraryWindow.vala 2014-12-14 14:53:26 +0000
105+++ src/library/LibraryWindow.vala 2015-02-13 14:22:48 +0000
106@@ -848,7 +848,7 @@
107
108 private void dispatch_import_jobs (GLib.SList<string> uris, string job_name, bool copy_to_library) {
109 if (AppDirs.get_import_dir ().get_path () == Environment.get_home_dir () && notify_library_is_home_dir) {
110- Gtk.ResponseType response = AppWindow.affirm_cancel_question (
111+ Gtk.ResponseType response = AppWindow.cancel_affirm_question (
112 _ ("Shotwell is configured to import photos to your home directory.\n" +
113 "We recommend changing this in <span weight=\"bold\">Edit %s Preferences</span>.\n" +
114 "Do you want to continue importing photos?").printf ("▸"),
115@@ -1559,4 +1559,4 @@
116
117 return false;
118 }
119-}
120\ No newline at end of file
121+}

Subscribers

People subscribed via source and target branches