[gnome-tweak-tool] Fix listing applications in “Sta rtup Applications” if an application lacks an icon



commit 8305832a3a88412a10e79572939f13efee21cc81
Author: Mike FABIAN <mfabian redhat com>
Date:   Fri Sep 27 11:01:52 2013 +0200

    Fix listing applications in “Startup Applications” if an application lacks an icon
    
    If only one application fails to specify an icon in its .desktop file,
    pressing the “+” button in “Startup Applications” fails.
    If the application at least specifies a name, continue to build
    the application list without an icon for that application.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708900

 gtweak/tweaks/tweak_group_startup.py |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
index d8c4bfd..96ab479 100644
--- a/gtweak/tweaks/tweak_group_startup.py
+++ b/gtweak/tweaks/tweak_group_startup.py
@@ -49,9 +49,10 @@ class _AppChooser(Gtk.Dialog):
                 w = self._build_widget(
                         a,
                         _("running") if running else "")
-                lb.add(w)
-                self._all[w] = a
-                self._running[w] = running
+                if w:
+                    lb.add(w)
+                    self._all[w] = a
+                    self._running[w] = running
 
         sw = Gtk.ScrolledWindow()
         sw.props.hscrollbar_policy = Gtk.PolicyType.NEVER
@@ -75,9 +76,15 @@ class _AppChooser(Gtk.Dialog):
     def _build_widget(self, a, extra):
         row = Gtk.ListBoxRow()
         g = Gtk.Grid()
-        img = Gtk.Image.new_from_gicon(a.get_icon(),Gtk.IconSize.DIALOG)
-        g.attach(img, 0, 0, 1, 1)
-        img.props.hexpand = False
+        if not a.get_name():
+            return None
+        icn = a.get_icon()
+        if icn:
+            img = Gtk.Image.new_from_gicon(a.get_icon(),Gtk.IconSize.DIALOG)
+            g.attach(img, 0, 0, 1, 1)
+            img.props.hexpand = False
+        else:
+             img = None #attach_next_to treats this correctly
         lbl = Gtk.Label(a.get_name(), xalign=0)
         g.attach_next_to(lbl,img,Gtk.PositionType.RIGHT,1,1)
         lbl.props.hexpand = True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]