Merge lp:~xapantu/granite/fix-956544 into lp:~elementary-pantheon/granite/granite

Proposed by xapantu
Status: Merged
Approved by: Victor Martinez
Approved revision: 204
Merged at revision: 204
Proposed branch: lp:~xapantu/granite/fix-956544
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 51 lines (+22/-5)
1 file modified
lib/Widgets/DynamicNotebook.vala (+22/-5)
To merge this branch: bzr merge lp:~xapantu/granite/fix-956544
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Review via email: mp+98269@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Victor Martinez (victored) wrote :

It looks fine to me Lucas. Have you considered using GLib.Icon for the fallbacks?

Revision history for this message
xapantu (xapantu) wrote :

Ah, yes, we can use gtk_icon_theme_choose_icon, I didn't know this function. I updated the branch.

lp:~xapantu/granite/fix-956544 updated
204. By xapantu

Avoid a few lines of cose using choose_icon directly from gtk

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

I didn't know about that function either :P

Looks perfect Lucas.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/Widgets/DynamicNotebook.vala'
--- lib/Widgets/DynamicNotebook.vala 2012-03-19 18:39:32 +0000
+++ lib/Widgets/DynamicNotebook.vala 2012-03-20 18:16:21 +0000
@@ -158,6 +158,27 @@
158 public signal void switch_page (Tab tab);158 public signal void switch_page (Tab tab);
159 public signal void page_removed (Tab tab);159 public signal void page_removed (Tab tab);
160160
161 // FIXME: probably needs to be moved somewhere with a public API
162 Gdk.Pixbuf load_pixbuf_with_fallbacks (string[] icons_name, int icon_size) {
163 Gdk.Pixbuf pixbuf = null;
164 try {
165 var icon_info = Gtk.IconTheme.get_default ().choose_icon (icons_name, icon_size, 0);
166 if (icon_info != null) {
167 pixbuf = icon_info.load_symbolic_for_context (button_context, null);
168 }
169 }
170 catch (Error e) {
171 try {
172 pixbuf = Gtk.IconTheme.get_default ().load_icon ("gtk-missing-image", icon_size, 0);
173 }
174 catch (Error e) {
175 error ("gtk-missing-image not found");
176 }
177 }
178 return pixbuf;
179 }
180
181
161 public Tabs () {182 public Tabs () {
162 tabs = new Gee.ArrayList<Tab>();183 tabs = new Gee.ArrayList<Tab>();
163 184
@@ -175,11 +196,6 @@
175 }196 }
176 }197 }
177198
178 try {
179 close_pixbuf = Gtk.IconTheme.get_default ().load_icon ("gtk-close", close_size, 0);
180 }
181 catch (Error e) {
182 }
183199
184 height_request = 35;200 height_request = 35;
185 width_request = (int)(2*max_width);201 width_request = (int)(2*max_width);
@@ -229,6 +245,7 @@
229 }245 }
230 return true;246 return true;
231 });247 });
248 close_pixbuf = load_pixbuf_with_fallbacks ( {"window-close-symbolic", "window-close", "gtk-close"}, close_size);
232 }249 }
233250
234 public void add_tab (Tab tab) {251 public void add_tab (Tab tab) {

Subscribers

People subscribed via source and target branches