[meld] Remove libglade-style "Custom" creation from UI files and widgets



commit ae3c46b08efcb09ad1fdb2193106469701f50b26
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Sep 5 08:11:58 2010 +1000

    Remove libglade-style "Custom" creation from UI files and widgets
    
    data/ui/dirdiff.ui
    data/ui/filediff.ui
    data/ui/meldapp.ui
    data/ui/vcview.ui: Remove libglade-style custom creation
    
    meld/filediff.py: Manually construct FindBar, as it's not a real widget
    
    meld/ui/findbar.py
    meld/ui/historyentry.py
    meld/ui/msgarea.py: Remove custom creation

 data/ui/dirdiff.ui      |   21 +++++++----------
 data/ui/filediff.ui     |   41 +++++++++--------------------------
 data/ui/meldapp.ui      |   54 +++++++++++++++++++---------------------------
 data/ui/vcview.ui       |   12 ++++------
 meld/filediff.py        |    4 ++-
 meld/ui/findbar.py      |    3 --
 meld/ui/historyentry.py |   10 --------
 meld/ui/msgarea.py      |    4 ---
 8 files changed, 50 insertions(+), 99 deletions(-)
---
diff --git a/data/ui/dirdiff.ui b/data/ui/dirdiff.ui
index 9317179..4a32ba5 100644
--- a/data/ui/dirdiff.ui
+++ b/data/ui/dirdiff.ui
@@ -101,11 +101,10 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="fileentry0">
+              <object class="HistoryFileEntry" id="fileentry0">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">direntry</property>
-                <property name="int1">1</property>
+                <property name="history-id">direntry</property>
+                <property name="directory-entry">True</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -117,11 +116,10 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="fileentry1">
+              <object class="HistoryFileEntry" id="fileentry1">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">direntry</property>
-                <property name="int1">1</property>
+                <property name="history-id">direntry</property>
+                <property name="directory-entry">True</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -133,11 +131,10 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="fileentry2">
+              <object class="HistoryFileEntry" id="fileentry2">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">direntry</property>
-                <property name="int1">1</property>
+                <property name="history-id">direntry</property>
+                <property name="directory-entry">True</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 2c9a37e..59d486b 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -17,10 +17,9 @@
               <placeholder/>
             </child>
             <child>
-              <object class="Custom" id="fileentry2">
+              <object class="HistoryFileEntry" id="fileentry2">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">fileentry</property>
+                <property name="history-id">fileentry</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -31,10 +30,9 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="fileentry1">
+              <object class="HistoryFileEntry" id="fileentry1">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">fileentry</property>
+                <property name="history-id">fileentry</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -45,10 +43,9 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="fileentry0">
+              <object class="HistoryFileEntry" id="fileentry0">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">fileentry</property>
+                <property name="history-id">fileentry</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -62,9 +59,8 @@
               <object class="GtkVBox" id="vbox0">
                 <property name="visible">True</property>
                 <child>
-                  <object class="Custom" id="msgarea_mgr0">
+                  <object class="MsgAreaController" id="msgarea_mgr0">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -141,9 +137,8 @@
               <object class="GtkVBox" id="vbox2">
                 <property name="visible">True</property>
                 <child>
-                  <object class="Custom" id="msgarea_mgr2">
+                  <object class="MsgAreaController" id="msgarea_mgr2">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -178,9 +173,8 @@
               <object class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
                 <child>
-                  <object class="Custom" id="msgarea_mgr1">
+                  <object class="MsgAreaController" id="msgarea_mgr1">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -212,9 +206,8 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="diffmap1">
+              <object class="DiffMap" id="diffmap1">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.diffmap.create_diffmap</property>
               </object>
               <packing>
                 <property name="left_attach">6</property>
@@ -249,9 +242,8 @@
               </packing>
             </child>
             <child>
-              <object class="Custom" id="diffmap0">
+              <object class="DiffMap" id="diffmap0">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.diffmap.create_diffmap</property>
               </object>
               <packing>
                 <property name="top_attach">1</property>
@@ -284,17 +276,6 @@
             </child>
           </object>
         </child>
-        <child>
-          <object class="Custom" id="findbar">
-            <property name="height_request">12</property>
-            <property name="visible">True</property>
-            <property name="creation_function">meld.ui.findbar.findbar_create</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
       </object>
     </child>
   </object>
diff --git a/data/ui/meldapp.ui b/data/ui/meldapp.ui
index 89170b8..60062ae 100644
--- a/data/ui/meldapp.ui
+++ b/data/ui/meldapp.ui
@@ -137,11 +137,10 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="fileentry2">
+                  <object class="HistoryFileEntry" id="fileentry2">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">file_comparison</property>
-                    <property name="string2">My File</property>
+                    <property name="history-id">file_comparison</property>
+                    <property name="directory-entry">False</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -153,11 +152,10 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="fileentry1">
+                  <object class="HistoryFileEntry" id="fileentry1">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">file_comparison</property>
-                    <property name="string2">Original File</property>
+                    <property name="history-id">file_comparison</property>
+                    <property name="directory-entry">False</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -169,12 +167,11 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="fileentry0">
+                  <object class="HistoryFileEntry" id="fileentry0">
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">file_comparison</property>
-                    <property name="string2">Other File</property>
+                    <property name="history-id">file_comparison</property>
+                    <property name="directory-entry">False</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -273,12 +270,10 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="direntry2">
+                  <object class="HistoryFileEntry" id="direntry2">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">dir_comparison</property>
-                    <property name="string2">My Directory</property>
-                    <property name="int1">1</property>
+                    <property name="history-id">dir_comparison</property>
+                    <property name="directory-entry">True</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -290,12 +285,10 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="direntry1">
+                  <object class="HistoryFileEntry" id="direntry1">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">dir_comparison</property>
-                    <property name="string2">Original Directory</property>
-                    <property name="int1">1</property>
+                    <property name="history-id">dir_comparison</property>
+                    <property name="directory-entry">True</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -307,13 +300,11 @@ Adam Weinberger (en_CA)</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="Custom" id="direntry0">
+                  <object class="HistoryFileEntry" id="direntry0">
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">dir_comparison</property>
-                    <property name="string2">Other Directory</property>
-                    <property name="int1">1</property>
+                    <property name="history-id">dir_comparison</property>
+                    <property name="directory-entry">True</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
@@ -393,12 +384,11 @@ Adam Weinberger (en_CA)</property>
                 <property name="column_spacing">10</property>
                 <property name="row_spacing">10</property>
                 <child>
-                  <object class="Custom" id="vcentry0">
+                  <object class="HistoryFileEntry" id="vcentry0">
                     <property name="visible">True</property>
-                    <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                    <property name="string1">vc_directory</property>
-                    <property name="string2">VC Directory</property>
-                    <property name="int1">1</property>
+                    <property name="history-id">vc_directory</property>
+                    <property name="dialog-title" translatable="yes">Select VC Directory</property>
+                    <property name="directory-entry">True</property>
                     <signal handler="on_entry_activate" name="activate"/>
                   </object>
                   <packing>
diff --git a/data/ui/vcview.ui b/data/ui/vcview.ui
index d753eda..0cd9d75 100644
--- a/data/ui/vcview.ui
+++ b/data/ui/vcview.ui
@@ -27,11 +27,10 @@
             <property name="homogeneous">False</property>
             <property name="spacing">6</property>
             <child>
-              <object class="Custom" id="fileentry">
+              <object class="HistoryFileEntry" id="fileentry">
                 <property name="visible">True</property>
-                <property name="creation_function">meld.ui.historyentry.create_fileentry</property>
-                <property name="string1">direntry</property>
-                <property name="int1">1</property>
+                <property name="history-id">direntry</property>
+                <property name="directory-entry">True</property>
                 <signal handler="on_fileentry_activate" name="activate"/>
               </object>
               <packing>
@@ -409,11 +408,10 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="Custom" id="previousentry">
+                          <object class="HistoryEntry" id="previousentry">
                             <property name="border_width">5</property>
                             <property name="visible">True</property>
-                            <property name="string1">previousentry</property>
-                            <property name="creation_function">meld.ui.historyentry.create_entry</property>
+                            <property name="history-id">previousentry</property>
                             <signal handler="on_previousentry_activate" name="changed"/>
                           </object>
                           <packing>
diff --git a/meld/filediff.py b/meld/filediff.py
index 027e08b..8ec350d 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -29,6 +29,7 @@ import gtk
 import gtk.keysyms
 
 import diffutil
+from ui import findbar
 from ui import gnomeglade
 import misc
 import melddoc
@@ -196,7 +197,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.set_num_panes(num_panes)
         gobject.idle_add( lambda *args: self.load_font()) # hack around Bug 316730
         gnomeglade.connect_signal_handlers(self)
-        self.findbar = self.findbar.get_data("pyobject")
+        self.findbar = findbar.FindBar()
+        self.filediff.pack_end(self.findbar.widget, False)
         self.cursor = CursorDetails()
         self.connect("current-diff-changed", self.on_current_diff_changed)
         for t in self.textview:
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index b4e8ba1..a1be259 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -139,6 +139,3 @@ class FindBar(gnomeglade.Component):
             else:
                 buf.place_cursor( buf.get_iter_at_mark(buf.get_insert()) )
                 self.find_entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#ffdddd"))
-
-def findbar_create(str1, str2, int1, int2):
-    return FindBar().widget
diff --git a/meld/ui/historyentry.py b/meld/ui/historyentry.py
index 278d1d4..c167193 100644
--- a/meld/ui/historyentry.py
+++ b/meld/ui/historyentry.py
@@ -467,13 +467,3 @@ try:
 except ImportError:
     do_nothing = lambda *args: None
     setattr(HistoryFileEntry, '_setup_dnd', do_nothing)
-
-def create_fileentry( history_id, dialog_title, is_directory_entry, int2):
-    w = HistoryFileEntry(history_id, dialog_title)
-    w.props.directory_entry = is_directory_entry
-    return w
-
-def create_entry( history_id, str2, int1, int2):
-    w = HistoryEntry(history_id)
-    return w
-
diff --git a/meld/ui/msgarea.py b/meld/ui/msgarea.py
index f077ee7..35c3300 100644
--- a/meld/ui/msgarea.py
+++ b/meld/ui/msgarea.py
@@ -249,7 +249,3 @@ class MsgAreaController(gtk.HBox):
         msgarea.set_text_and_icon(stockid, primary, secondary)
         self.pack_start(msgarea, expand=True)
         return msgarea
-
-def msgarea_mgr_create(str1, str2, int1, int2):
-    return MsgAreaController()
-



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