Package: gtimelog
Version: 0.0+svn88-3
Severity: wishlist
Tags: patch

I think the time label next to the tray icon is useless and fails to
show correctly in awesome 3's status bar (possibly because it uses
eggtrayicon? [0]). I also don't find it particularly useful at all.

The attached patch allows one to hide the time label by editing one's
gtimelogrc.

Thanks,

0. http://julien.danjou.info/blog/index.php/post/2008/10/03/The-eggtray-problem

-- 
Jonny Lamb, UK                                          [EMAIL PROTECTED]
http://jonnylamb.com                                     GPG: 0x2E039402
diff -Nruad -Nraud gtimelog-0.0+svn88.orig/gtimelog.py 
gtimelog-0.0+svn88/gtimelog.py
--- gtimelog-0.0+svn88.orig/gtimelog.py 2008-10-15 16:24:33.000000000 +0100
+++ gtimelog-0.0+svn88/gtimelog.py      2008-10-15 16:50:54.000000000 +0100
@@ -663,6 +663,8 @@
 
     enable_gtk_completion = True  # False enables gvim-style completion
 
+    show_time_label = True
+
     hours = 8
     virtual_midnight = datetime.time(2, 0)
 
@@ -679,6 +681,8 @@
         config.set('gtimelog', 'spreadsheet', self.spreadsheet)
         config.set('gtimelog', 'gtk-completion',
                    str(self.enable_gtk_completion))
+        config.set('gtimelog', 'show-time-label',
+                   str(self.show_time_label))
         config.set('gtimelog', 'hours', str(self.hours))
         config.set('gtimelog', 'virtual_midnight',
                    self.virtual_midnight.strftime('%H:%M'))
@@ -696,6 +700,8 @@
         self.spreadsheet = config.get('gtimelog', 'spreadsheet')
         self.enable_gtk_completion = config.getboolean('gtimelog',
                                                        'gtk-completion')
+        self.show_time_label = config.getboolean('gtimelog',
+                                                  'show-time-label')
         self.hours = config.getfloat('gtimelog', 'hours')
         self.virtual_midnight = parse_time(config.get('gtimelog',
                                                       'virtual_midnight'))
@@ -729,8 +735,9 @@
         icon = gtk.Image()
         icon.set_from_file(icon_file)
         hbox.add(icon)
-        self.time_label = gtk.Label()
-        hbox.add(self.time_label)
+        if self.gtimelog_window.settings.show_time_label:
+            self.time_label = gtk.Label()
+            hbox.add(self.time_label)
         self.eventbox.add(hbox)
         self.trayicon = egg.trayicon.TrayIcon("GTimeLog")
         self.trayicon.add(self.eventbox)
@@ -777,10 +784,11 @@
         if now != self.last_tick or force_update: # Do not eat CPU too much
             self.last_tick = now
             last_time = self.timelog.window.last_time()
-            if last_time is None:
-                self.time_label.set_text(now.strftime("%H:%M"))
-            else:
-                self.time_label.set_text(format_duration_short(now - 
last_time))
+            if self.gtimelog_window.settings.show_time_label:
+                if last_time is None:
+                    self.time_label.set_text(now.strftime("%H:%M"))
+                else:
+                    self.time_label.set_text(format_duration_short(now - 
last_time))
         self.tooltips.set_tip(self.trayicon, self.tip())
         return True
 
diff -Nruad -Nraud gtimelog-0.0+svn88.orig/gtimelogrc.example 
gtimelog-0.0+svn88/gtimelogrc.example
--- gtimelog-0.0+svn88.orig/gtimelogrc.example  2008-10-15 16:24:33.000000000 
+0100
+++ gtimelog-0.0+svn88/gtimelogrc.example       2008-10-15 16:50:13.000000000 
+0100
@@ -28,3 +28,5 @@
 # When does one work end and another begin
 virtual_midnight = 02:00
 
+# Whether or not to show the time label in the tray icon
+show-time-label = True

Attachment: signature.asc
Description: Digital signature

Reply via email to