Merge lp:~artem-anufrij/granite/change-label-description-after-creating into lp:~elementary-pantheon/granite/granite

Proposed by Artem Anufrij
Status: Merged
Merged at revision: 850
Proposed branch: lp:~artem-anufrij/granite/change-label-description-after-creating
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 379 lines (+138/-51)
12 files modified
demo/GraniteDemo.vala (+8/-0)
lib/CMakeLists.txt (+1/-0)
lib/Widgets/Welcome.vala (+17/-39)
lib/Widgets/WelcomeButton.vala (+94/-0)
po/am.po (+2/-1)
po/cs.po (+3/-3)
po/de.po (+2/-1)
po/he.po (+2/-1)
po/pt_BR.po (+3/-3)
po/ru.po (+2/-1)
po/sl.po (+2/-1)
po/uk.po (+2/-1)
To merge this branch: bzr merge lp:~artem-anufrij/granite/change-label-description-after-creating
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Corentin Noël Pending
elementary Pantheon team abi-wise Pending
Review via email: mp+247961@code.launchpad.net

This proposal supersedes a proposal from 2014-12-30.

Description of the change

Functionality for changing label, description and icon of a welcome screen button after creating them.

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

I would prefer a :
    public Granite.Widgets.WelcomeButton get_button_from_index (int index)
in the Welcome widget.

And a :
   public string title { get {…}, set {…} }
   public string description { get {…}, set {…} }
   public Gtk.Image icon { get {…}, private set; }
in the WelcomeButton widget.

Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

Also please remove the
using Gtk;

Revision history for this message
Artem Anufrij (artem-anufrij) wrote : Posted in a previous version of this proposal
Revision history for this message
Artem Anufrij (artem-anufrij) wrote : Posted in a previous version of this proposal

Added a click event on welcome screen (DEMO):
https://launchpadlibrarian.net/193361508/Bildschirmfoto%20vom%202014-12-24%2014%3A21%3A54.png

The properties (title, description, icon) were moved on the top of the class.

Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

Now it's perfect!

review: Approve
Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

In the right request…
Now it's perfect!

review: Approve
Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

Can someone confirm that this won't break anything ABI-wise ?

829. By Fabio Zaramella

Wrap long Welcome subtitles and descriptions

830. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

831. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

832. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

833. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

834. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

835. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

836. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

837. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

838. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

839. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

840. By Corentin Noël

[CellRendererExpander] Gtk+ 3.14 now uses Gtk.StateFlags.CHECKED instead of Gtk.StateFlags.ACTIVE.

841. By Cody Garver

CMake: bump minimum version of Gtk to >= 3.14

842. By Corentin Noël

Adds the deprecation annotation to deprecate widgets officially.
[WrapLabel] No need for this widget when Gtk.Label provides wrapping label.
[PopOver] Replaced by Gtk.Popover.

Fixed some deprecations annotations as we deprecate widgets when they are available in Gtk.

843. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

844. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

845. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

846. By Launchpad Translations on behalf of elementary-pantheon

Launchpad automatic translations update.

847. By Victor Martinez

ContractorView: Fix error when building with vala 0.28

Revision history for this message
Victor Martinez (victored) wrote :

Looks good, I couldn't spot any API or ABI break. Make sure all the documentation items include "@since 0.3" at the bottom.

review: Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

@Victor: done

Revision history for this message
Victor Martinez (victored) wrote :

I could not find any problems. Since this is an API change it'd be good to have at least a second review or opinion.

review: Approve
Revision history for this message
Victor Martinez (victored) wrote :

btw the code from granite-demo seems to be using 8 spaces for indentation. Should be 4 :P

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

@Victor: done

848. By Artem Anufrij

Label and Description label can be changed after creating them.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'demo/GraniteDemo.vala'
2--- demo/GraniteDemo.vala 2014-05-12 02:42:17 +0000
3+++ demo/GraniteDemo.vala 2015-03-25 22:33:58 +0000
4@@ -410,6 +410,14 @@
5 welcome.append_with_image (image, "Open", "Select a file.");
6 welcome.append ("document-save", "Save", "With a much longer description.");
7
8+ welcome.activated.connect ((index) => {
9+ var button = welcome.get_button_from_index (index);
10+
11+ button.title = "You clicked on the button: %d".printf(index);
12+ button.description = "This label, description and icon were changed after creating of this button.";
13+ button.icon.icon_name = "edit";
14+ });
15+
16 return welcome;
17 }
18
19
20=== modified file 'lib/CMakeLists.txt'
21--- lib/CMakeLists.txt 2014-09-04 12:39:00 +0000
22+++ lib/CMakeLists.txt 2015-03-25 22:33:58 +0000
23@@ -32,6 +32,7 @@
24 Widgets/CompositedWindow.vala
25 Widgets/AppMenu.vala
26 Widgets/Welcome.vala
27+ Widgets/WelcomeButton.vala
28 Widgets/ToolButtonWithMenu.vala
29 Widgets/PopOver.vala
30 Widgets/ContractorView.vala
31
32=== modified file 'lib/Widgets/Welcome.vala'
33--- lib/Widgets/Welcome.vala 2015-01-28 14:51:39 +0000
34+++ lib/Widgets/Welcome.vala 2015-03-25 22:33:58 +0000
35@@ -23,7 +23,7 @@
36 /**
37 * This class is for making a first-launch screen easily
38 *
39- * It can be used to create a list of one-time action items that need to be executed in order to setup the app.
40+ * It can be used to create a list of one-time action items that need to be executed in order to setup the app.
41 *
42 * {{../../doc/images/Welcome.png}}
43 */
44@@ -40,7 +40,7 @@
45 * Box for action items
46 */
47 protected Gtk.Box options;
48-
49+
50 /**
51 * This is the title of the welcome widget.
52 */
53@@ -187,43 +187,7 @@
54 */
55 public int append_with_image (Gtk.Image? image, string option_text, string description_text) {
56 // Option label
57- var label = new Gtk.Label (option_text);
58- label.get_style_context ().add_class ("h3");
59- label.halign = Gtk.Align.START;
60- label.valign = Gtk.Align.CENTER;
61-
62- // Description label
63- var description = new Gtk.Label (description_text);
64- description.halign = Gtk.Align.START;
65- description.valign = Gtk.Align.CENTER;
66- description.set_line_wrap (true);
67- description.set_line_wrap_mode (Pango.WrapMode.WORD);
68-
69- // Button
70- var button = new Gtk.Button ();
71- button.set_relief (Gtk.ReliefStyle.NONE);
72-
73- // Button contents wrapper
74- var button_contents = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 7);
75-
76- // Add left image
77- if (image != null) {
78- image.set_pixel_size (48);
79- button_contents.pack_start (image, false, true, 8);
80- }
81-
82- // Add right text wrapper
83- var text_wrapper = new Gtk.Box (Gtk.Orientation.VERTICAL, 3);
84- // top spacing
85- text_wrapper.pack_start (new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0), true, true, 0);
86- text_wrapper.pack_start (label, false, false, 0);
87- text_wrapper.pack_start (description, false, false, 0);
88- // bottom spacing
89- text_wrapper.pack_end (new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0), true, true, 0);
90-
91- button_contents.pack_start (text_wrapper, false, true, 8);
92-
93- button.add (button_contents);
94+ var button = new WelcomeButton (image, option_text, description_text);
95 children.append (button);
96 options.pack_start (button, false, false, 0);
97
98@@ -235,4 +199,18 @@
99
100 return this.children.index (button);
101 }
102+
103+ /**
104+ * Returns a welcome button by index
105+ *
106+ * @param index index of action item to be returned
107+ * @return welcome button at //index//, or //null// if //index// is invalid.
108+ * @since 0.3
109+ */
110+ public Granite.Widgets.WelcomeButton? get_button_from_index (int index) {
111+ if (index >= 0 && index < children.length ())
112+ return children.nth_data (index) as WelcomeButton;
113+
114+ return null;
115+ }
116 }
117
118=== added file 'lib/Widgets/WelcomeButton.vala'
119--- lib/Widgets/WelcomeButton.vala 1970-01-01 00:00:00 +0000
120+++ lib/Widgets/WelcomeButton.vala 2015-03-25 22:33:58 +0000
121@@ -0,0 +1,94 @@
122+/*
123+ * Copyright (C) 2014-2015 Granite Developers
124+ *
125+ * This program or library is free software; you can redistribute it
126+ * and/or modify it under the terms of the GNU Lesser General Public
127+ * License as published by the Free Software Foundation; either
128+ * version 3 of the License, or (at your option) any later version.
129+ *
130+ * This library is distributed in the hope that it will be useful,
131+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
132+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
133+ * Lesser General Public License for more details.
134+ *
135+ * You should have received a copy of the GNU Lesser General
136+ * Public License along with this library; if not, write to the
137+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
138+ * Boston, MA 02110-1301 USA.
139+ *
140+ * Authored by: Artem Anufrij <artem.anufrij@live.de>
141+ */
142+
143+public class Granite.Widgets.WelcomeButton : Gtk.Button {
144+
145+ Gtk.Label button_title;
146+ Gtk.Label button_description;
147+
148+ /**
149+ * Title property of the Welcome Button
150+ *
151+ * @since 0.3
152+ */
153+ public string title {
154+ get { return button_title.get_text (); }
155+ set { button_title.set_text (value); }
156+ }
157+
158+ /**
159+ * Description property of the Welcome Button
160+ *
161+ * @since 0.3
162+ */
163+ public string description {
164+ get { return button_description.get_text (); }
165+ set { button_description.set_text (value); }
166+ }
167+
168+ /**
169+ * Image of the Welcome Button
170+ *
171+ * @since 0.3
172+ */
173+ public Gtk.Image? icon { get; private set; }
174+
175+ public WelcomeButton (Gtk.Image? image, string option_text, string description_text) {
176+ icon = image;
177+
178+ // Title label
179+ button_title = new Gtk.Label (option_text);
180+ button_title.get_style_context ().add_class ("h3");
181+ button_title.halign = Gtk.Align.START;
182+ button_title.valign = Gtk.Align.CENTER;
183+
184+ // Description label
185+ button_description = new Gtk.Label (description_text);
186+ button_description.halign = Gtk.Align.START;
187+ button_description.valign = Gtk.Align.CENTER;
188+ button_description.set_line_wrap (true);
189+ button_description.set_line_wrap_mode (Pango.WrapMode.WORD);
190+
191+ this.set_relief (Gtk.ReliefStyle.NONE);
192+
193+ // Button contents wrapper
194+ var button_contents = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 7);
195+
196+ // Add left image
197+ if (icon != null) {
198+ icon.set_pixel_size (48);
199+ button_contents.pack_start (icon, false, true, 8);
200+ }
201+
202+ // Add right text wrapper
203+ var text_wrapper = new Gtk.Box (Gtk.Orientation.VERTICAL, 3);
204+ // top spacing
205+ text_wrapper.pack_start (new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0), true, true, 0);
206+ text_wrapper.pack_start (button_title, false, false, 0);
207+ text_wrapper.pack_start (button_description, false, false, 0);
208+ // bottom spacing
209+ text_wrapper.pack_end (new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0), true, true, 0);
210+
211+ button_contents.pack_start (text_wrapper, false, true, 8);
212+
213+ this.add (button_contents);
214+ }
215+}
216
217=== modified file 'po/am.po'
218--- po/am.po 2015-03-18 05:59:56 +0000
219+++ po/am.po 2015-03-25 22:33:58 +0000
220@@ -6,11 +6,12 @@
221 msgid ""
222 msgstr ""
223 "Project-Id-Version: granite\n"
224-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
225+"Report-Msgid-Bugs-To: \n"
226 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
227 "PO-Revision-Date: 2014-12-21 18:13+0000\n"
228 "Last-Translator: samson <Unknown>\n"
229 "Language-Team: Amharic <am@li.org>\n"
230+"Language: am\n"
231 "MIME-Version: 1.0\n"
232 "Content-Type: text/plain; charset=UTF-8\n"
233 "Content-Transfer-Encoding: 8bit\n"
234
235=== modified file 'po/cs.po'
236--- po/cs.po 2015-03-18 05:59:56 +0000
237+++ po/cs.po 2015-03-25 22:33:58 +0000
238@@ -6,11 +6,12 @@
239 msgid ""
240 msgstr ""
241 "Project-Id-Version: granite\n"
242-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
243+"Report-Msgid-Bugs-To: \n"
244 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
245 "PO-Revision-Date: 2014-12-24 11:55+0000\n"
246 "Last-Translator: Marek Doležel <marekdolezel@gmail.com>\n"
247 "Language-Team: Czech <cs@li.org>\n"
248+"Language: cs\n"
249 "MIME-Version: 1.0\n"
250 "Content-Type: text/plain; charset=UTF-8\n"
251 "Content-Transfer-Encoding: 8bit\n"
252@@ -127,8 +128,7 @@
253
254 #: /tmp/tmp.nk1L7TnOTp/granite/po/../lib//Widgets/ContractorView.vala:105
255 msgid "Could not contact Contractor. You may need to install it"
256-msgstr ""
257-"Nelze se spojit s programem Contractor. Možná jej musíte doinstalovat"
258+msgstr "Nelze se spojit s programem Contractor. Možná jej musíte doinstalovat"
259
260 #: /tmp/tmp.nk1L7TnOTp/granite/po/../lib//Widgets/ContractorView.vala:105
261 msgid "No action found for this file"
262
263=== modified file 'po/de.po'
264--- po/de.po 2015-03-18 05:59:56 +0000
265+++ po/de.po 2015-03-25 22:33:58 +0000
266@@ -6,11 +6,12 @@
267 msgid ""
268 msgstr ""
269 "Project-Id-Version: granite\n"
270-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
271+"Report-Msgid-Bugs-To: \n"
272 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
273 "PO-Revision-Date: 2015-01-08 16:50+0000\n"
274 "Last-Translator: Tobias Bannert <Unknown>\n"
275 "Language-Team: German <de@li.org>\n"
276+"Language: de\n"
277 "MIME-Version: 1.0\n"
278 "Content-Type: text/plain; charset=UTF-8\n"
279 "Content-Transfer-Encoding: 8bit\n"
280
281=== modified file 'po/he.po'
282--- po/he.po 2015-03-18 05:59:56 +0000
283+++ po/he.po 2015-03-25 22:33:58 +0000
284@@ -6,11 +6,12 @@
285 msgid ""
286 msgstr ""
287 "Project-Id-Version: granite\n"
288-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
289+"Report-Msgid-Bugs-To: \n"
290 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
291 "PO-Revision-Date: 2014-12-21 02:12+0000\n"
292 "Last-Translator: Dor <dor.gallego@gmail.com>\n"
293 "Language-Team: Hebrew <he@li.org>\n"
294+"Language: he\n"
295 "MIME-Version: 1.0\n"
296 "Content-Type: text/plain; charset=UTF-8\n"
297 "Content-Transfer-Encoding: 8bit\n"
298
299=== modified file 'po/pt_BR.po'
300--- po/pt_BR.po 2015-03-18 05:59:56 +0000
301+++ po/pt_BR.po 2015-03-25 22:33:58 +0000
302@@ -6,11 +6,12 @@
303 msgid ""
304 msgstr ""
305 "Project-Id-Version: granite\n"
306-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
307+"Report-Msgid-Bugs-To: \n"
308 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
309 "PO-Revision-Date: 2014-12-23 11:16+0000\n"
310 "Last-Translator: Murilo Venturoso <muriloventuroso@gmail.com>\n"
311 "Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"
312+"Language: pt_BR\n"
313 "MIME-Version: 1.0\n"
314 "Content-Type: text/plain; charset=UTF-8\n"
315 "Content-Transfer-Encoding: 8bit\n"
316@@ -49,8 +50,7 @@
317
318 #: /tmp/tmp.nk1L7TnOTp/granite/po/../lib//GtkPatch/AboutDialog.vala:456
319 msgid " license, it comes with ABSOLUTELY NO WARRANTY; for details, visit "
320-msgstr ""
321-" , ele vem com ABSOLUTAMENTE NENHUMA GARANTIA; para detalhes, visite "
322+msgstr " , ele vem com ABSOLUTAMENTE NENHUMA GARANTIA; para detalhes, visite "
323
324 #: /tmp/tmp.nk1L7TnOTp/granite/po/../lib//Application.vala:248
325 msgid "Developers"
326
327=== modified file 'po/ru.po'
328--- po/ru.po 2015-03-18 05:59:56 +0000
329+++ po/ru.po 2015-03-25 22:33:58 +0000
330@@ -6,11 +6,12 @@
331 msgid ""
332 msgstr ""
333 "Project-Id-Version: granite\n"
334-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
335+"Report-Msgid-Bugs-To: \n"
336 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
337 "PO-Revision-Date: 2014-12-20 17:05+0000\n"
338 "Last-Translator: Artem Anufrij <Unknown>\n"
339 "Language-Team: Russian <ru@li.org>\n"
340+"Language: ru\n"
341 "MIME-Version: 1.0\n"
342 "Content-Type: text/plain; charset=UTF-8\n"
343 "Content-Transfer-Encoding: 8bit\n"
344
345=== modified file 'po/sl.po'
346--- po/sl.po 2015-03-18 05:59:56 +0000
347+++ po/sl.po 2015-03-25 22:33:58 +0000
348@@ -6,11 +6,12 @@
349 msgid ""
350 msgstr ""
351 "Project-Id-Version: granite\n"
352-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
353+"Report-Msgid-Bugs-To: \n"
354 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
355 "PO-Revision-Date: 2014-12-27 09:41+0000\n"
356 "Last-Translator: Jernej Virag <Unknown>\n"
357 "Language-Team: Slovenian <sl@li.org>\n"
358+"Language: sl\n"
359 "MIME-Version: 1.0\n"
360 "Content-Type: text/plain; charset=UTF-8\n"
361 "Content-Transfer-Encoding: 8bit\n"
362
363=== modified file 'po/uk.po'
364--- po/uk.po 2015-03-22 05:19:00 +0000
365+++ po/uk.po 2015-03-25 22:33:58 +0000
366@@ -6,11 +6,12 @@
367 msgid ""
368 msgstr ""
369 "Project-Id-Version: granite\n"
370-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
371+"Report-Msgid-Bugs-To: \n"
372 "POT-Creation-Date: 2014-10-29 15:12-0500\n"
373 "PO-Revision-Date: 2015-03-21 21:16+0000\n"
374 "Last-Translator: PsyClip-R <Unknown>\n"
375 "Language-Team: Ukrainian <uk@li.org>\n"
376+"Language: uk\n"
377 "MIME-Version: 1.0\n"
378 "Content-Type: text/plain; charset=UTF-8\n"
379 "Content-Transfer-Encoding: 8bit\n"

Subscribers

People subscribed via source and target branches