From cbe255727385b4b86a3d328c8c7479a8cacbf305 Mon Sep 17 00:00:00 2001
From: streetturtle <streetturtle@gmail.com>
Date: Thu, 3 Sep 2020 21:28:01 -0400
Subject: [jira] refactoring

---
 jira-widget/jira.lua | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

(limited to 'jira-widget')

diff --git a/jira-widget/jira.lua b/jira-widget/jira.lua
index 15bce19..af85cf2 100644
--- a/jira-widget/jira.lua
+++ b/jira-widget/jira.lua
@@ -65,18 +65,18 @@ local jira_widget = wibox.widget {
         self.txt.text = new_value
     end,
     set_icon = function(self, path)
-        self.a.b.c.image = path
+        self:get_children_by_id('c')[1]:set_image(path)
     end,
     is_everything_ok = function(self, is_ok)
         if is_ok then
-            self.a.b.d:set_visible(false)
-            self.a.b.c:set_opacity(1)
-            self.a.b.c:emit_signal('widget:redraw_needed')
+            self:get_children_by_id('d')[1]:set_visible(false)
+            self:get_children_by_id('c')[1]:set_opacity(1)
+            self:get_children_by_id('c')[1]:emit_signal('widget:redraw_needed')
         else
             self.txt:set_text('')
-            self.a.b.d:set_visible(true)
-            self.a.b.c:set_opacity(0.2)
-            self.a.b.c:emit_signal('widget:redraw_needed')
+            self:get_children_by_id('d')[1]:set_visible(true)
+            self:get_children_by_id('c')[1]:set_opacity(0.2)
+            self:get_children_by_id('c')[1]:emit_signal('widget:redraw_needed')
         end
     end
 }
@@ -92,7 +92,6 @@ local popup = awful.popup{
     widget = {}
 }
 
-
 local number_of_issues
 
 local warning_shown = false
@@ -117,7 +116,7 @@ local function worker(args)
                 show_warning(stderr)
                 warning_shown = true
                 widget:is_everything_ok(false)
-                tooltip:add_to_object(jira_widget)
+                tooltip:add_to_object(widget)
 
                 widget:connect_signal('mouse::enter', function()
                     tooltip.text = stderr
@@ -127,7 +126,7 @@ local function worker(args)
         end
 
         warning_shown = false
-        tooltip:remove_from_object(jira_widget)
+        tooltip:remove_from_object(widget)
         widget:is_everything_ok(true)
 
         local result = json.decode(stdout)
-- 
cgit v1.2.3