[meld] Remove icon-button API from MsgArea and adapt callers



commit ca8c8011f4f939e39db019d37d432adb65fbad09
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Sep 8 09:36:58 2013 +1000

    Remove icon-button API from MsgArea and adapt callers

 meld/dirdiff.py    |    3 +--
 meld/filediff.py   |   10 +++-------
 meld/ui/msgarea.py |   10 ----------
 3 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 3ae3190..6bd5725 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -783,8 +783,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
     def add_dismissable_msg(self, pane, icon, primary, secondary):
         msgarea = self.msgarea_mgr[pane].new_from_text_and_icon(
                         icon, primary, secondary)
-        button = msgarea.add_stock_button_with_text(_("Hi_de"),
-                        gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
+        msgarea.add_button(_("Hi_de"), gtk.RESPONSE_CLOSE)
         msgarea.connect("response",
                         lambda *args: self.msgarea_mgr[pane].clear())
         msgarea.show_all()
diff --git a/meld/filediff.py b/meld/filediff.py
index 8504b78..3b26b08 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1092,8 +1092,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         def add_dismissable_msg(pane, icon, primary, secondary):
             msgarea = self.msgarea_mgr[pane].new_from_text_and_icon(
                             icon, primary, secondary)
-            button = msgarea.add_stock_button_with_text(_("Hi_de"),
-                            gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
+            msgarea.add_button(_("Hi_de"), gtk.RESPONSE_CLOSE)
             msgarea.connect("response",
                             lambda *args: self.msgarea_mgr[pane].clear())
             msgarea.show_all()
@@ -1364,9 +1363,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                                                      _("Files are identical"),
                                                      secondary_text)
                 mgr.set_msg_id(FileDiff.MSG_SAME)
-                button = msgarea.add_stock_button_with_text(_("Hide"),
-                                                            gtk.STOCK_CLOSE,
-                                                            gtk.RESPONSE_CLOSE)
+                button = msgarea.add_button(_("Hide"), gtk.RESPONSE_CLOSE)
                 if index == 0:
                     button.props.label = _("Hi_de")
 
@@ -1398,8 +1395,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                   "large. You can force Meld to take longer to highlight "
                   "larger changes, though this may be slow."))
             mgr.set_msg_id(FileDiff.MSG_SLOW_HIGHLIGHT)
-            button = msgarea.add_stock_button_with_text(
-                _("Hide"), gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
+            button = msgarea.add_button(_("Hi_de"), gtk.RESPONSE_CLOSE)
             if index == 0:
                 button.props.label = _("Hi_de")
             button = msgarea.add_button(
diff --git a/meld/ui/msgarea.py b/meld/ui/msgarea.py
index 29d7409..3c461f2 100644
--- a/meld/ui/msgarea.py
+++ b/meld/ui/msgarea.py
@@ -29,16 +29,6 @@ from meld.ui.wraplabel import WrapLabel
 class MsgArea(gtk.InfoBar):
     __gtype_name__ = "MsgArea"
 
-    def add_stock_button_with_text(self, text, stockid, respid):
-        b = gtk.Button(label=text)
-        b.set_focus_on_click(False)
-        img = gtk.Image()
-        img.set_from_stock(stockid, gtk.ICON_SIZE_BUTTON)
-        b.set_image(img)
-        b.show_all()
-        self.add_action_widget(b, respid)
-        return b
-
     def set_text_and_icon(self, stockid, primary_text, secondary_text=None):
         hbox_content = gtk.HBox(False, 8)
         hbox_content.show()


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