Merge lp:~elementary-pantheon/granite/about-icon-name into lp:~elementary-pantheon/granite/granite

Proposed by Daniel Fore
Status: Merged
Approved by: Corentin Noël
Approved revision: 951
Merged at revision: 952
Proposed branch: lp:~elementary-pantheon/granite/about-icon-name
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 42 lines (+8/-15)
1 file modified
lib/GtkPatch/AboutDialog.vala (+8/-15)
To merge this branch: bzr merge lp:~elementary-pantheon/granite/about-icon-name
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+298046@code.launchpad.net

Commit message

AboutDialog.vala:
* Set image from icon name when available
* Don't set the pixbuf or icon_name more than once

Description of the change

s

To post a comment you must log in.
Rico Tzschichholz (ricotz) wrote :

Do not set things multiple times. Once is (always) enough!

951. By Daniel Fore on 2016-06-21

don't set pixbuf when icon name available

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/GtkPatch/AboutDialog.vala'
2--- lib/GtkPatch/AboutDialog.vala 2015-12-11 16:58:25 +0000
3+++ lib/GtkPatch/AboutDialog.vala 2016-06-21 18:05:38 +0000
4@@ -282,7 +282,6 @@
5 // Adjust sizes
6 content_hbox.height_request = 160;
7 content_scrolled_vbox.width_request = 288;
8- logo_image.set_size_request(128, 128);
9
10 name_label = new Label("");
11 name_label.halign = Gtk.Align.START;
12@@ -402,22 +401,16 @@
13 return text;
14 }
15
16- private void update_logo_image()
17- {
18- try {
19- logo_image.set_from_pixbuf(IconTheme.get_default ().load_icon ("application-default-icon", 128, 0));
20- } catch (Error err) {
21- stderr.printf ("Unable to load terminal icon: %s", err.message);
22- }
23+ private void update_logo_image () {
24+ logo_image.pixel_size = 128;
25+
26 if (logo_icon_name != null && logo_icon_name != "") {
27- try {
28- logo_image.set_from_pixbuf(IconTheme.get_default ().load_icon (logo_icon_name, 128, 0));
29- } catch (Error err) {
30- stderr.printf ("Unable to load terminal icon: %s", err.message);
31- }
32+ logo_image.icon_name = logo_icon_name;
33+ } else if (logo != null) {
34+ logo_image.pixbuf = logo;
35+ } else {
36+ logo_image.icon_name = "application-default-icon";
37 }
38- else if (logo != null)
39- logo_image.set_from_pixbuf(logo);
40 }
41
42 private void update_license()

Subscribers

People subscribed via source and target branches