Package: debgtd
Version: 1.2.1-1
Severity: wishlist
Tags: patch

Hi,

Please make the "X bugs (Y sleeping; Z ignored)" status text link to BTS
"Bugs submitted by.." page corresponding to the current user, eg:

  
http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=chris%40chris-lamb.co.uk

Although the linked URL would obviously not reflect the "sleeping" and
"ignored" states, it does contain the bugs in web form.

Patch attached. It was necessary to refactor the "display URL" functionality
such that it could be called by both gtk.link_button_set_uri_hook and
row_selected_cb.


Regards,

-- 
Chris Lamb, UK                                       [EMAIL PROTECTED]
                                                            GPG: 0x634F9A20
diff -urNad debgtd-1.2.1.orig/debgtd/gui.py debgtd-1.2.1/debgtd/gui.py
--- debgtd-1.2.1.orig/debgtd/gui.py     2008-08-04 06:00:14.000000000 +0100
+++ debgtd-1.2.1/debgtd/gui.py  2008-08-04 06:08:38.000000000 +0100
@@ -31,6 +31,8 @@
                except RuntimeError, e:
                        sys.exit('E: %s. Exiting.' % e)
 
+               gtk.link_button_set_uri_hook(self.display_url)
+
                if os.path.isfile("debgtd.glade"):
                        self.gladefile = "debgtd.glade"
                elif os.path.isfile("/usr/local/share/debgtd/debgtd.glade"):
@@ -62,9 +64,12 @@
                self.wTree.get_widget("ignore_menu_item").connect("activate",
                        self.ignore_cb)
 
+               self.wTree.get_widget("num_bugs_linkbutton").connect("enter",
+                       self.update_num_bugs_uri)
+
        def update_summary_label(self):
                model = self.controller.model
-               label = self.wTree.get_widget("num_bugs_label")
+               label = self.wTree.get_widget("num_bugs_linkbutton")
 
                total = len(filter(lambda bug: not bug.is_done(), 
model.bugs.values()))
                # XXX BUG there might be an intersection between these
@@ -73,9 +78,14 @@
                ignored = len(model.get_ignored_bugs())
                interested = total - sleeping - ignored
 
-               label.set_text("%d bugs (%d sleeping; %d ignored)" % \
+               label.set_label("%d bugs (%d sleeping; %d ignored)" % \
                        (interested,sleeping,ignored))
 
+       def update_num_bugs_uri(self, button):
+               user = self.wTree.get_widget("user_email").get_text()
+               url = 
'http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=%s' % user
+               button.set_uri(url)
+
        def populate_treeview(self):
                model = self.controller.model
                tree = self.tree
@@ -112,7 +122,7 @@
        def row_selected_cb(self,tree,path,column):
                treemodel = tree.get_model()
                row = treemodel[path[0]][0]
-               os.system("sensible-browser http://bugs.debian.org/%s &" % row)
+               self.display_url("http://bugs.debian.org/%s"; % row)
 
        def ignore_cb(self,button):
                offs,col = self.tree.get_cursor()
@@ -201,3 +211,10 @@
 
        def user_changed(self, user):
                self.wTree.get_widget("user_email").set_text(user)
+
+       def display_url(self, button, url=None):
+               if url is None:
+                       # gtk.link_button_set_uri_hook will pass the LinkButton 
first, so we
+                       # must re-arrange the arguments when used as a utility 
function
+                       url = button
+               os.system("sensible-browser %s &" % url)
diff -urNad debgtd-1.2.1.orig/debgtd.glade debgtd-1.2.1/debgtd.glade
--- debgtd-1.2.1.orig/debgtd.glade      2008-08-04 06:00:14.000000000 +0100
+++ debgtd-1.2.1/debgtd.glade   2008-08-04 06:10:13.000000000 +0100
@@ -152,8 +152,14 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="num_bugs_label">
+              <widget class="GtkLinkButton" id="num_bugs_linkbutton">
                 <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">0 bugs (0 sleeping; 
0 ignored)</property>
+                <property name="relief">GTK_RELIEF_NONE</property>
+                <property name="response_id">0</property>
+                <property name="uri">http://dummy.invalid/</property>
               </widget>
               <packing>
                 <property name="expand">False</property>

Attachment: signature.asc
Description: PGP signature

Reply via email to