[gnome-games] Use GtkInfoBar (Bug #612660)



commit 9b798efbf3b143498ba75e7a14cb87d1fe51a869
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon Apr 26 16:38:45 2010 +1000

    Use GtkInfoBar (Bug #612660)

 glchess/data/Makefile.am           |    1 -
 glchess/data/chess_view.ui         |  212 ------------------------------------
 glchess/data/load_game.ui          |   55 +---------
 glchess/data/network_game.ui       |   54 +---------
 glchess/data/new_game.ui           |   65 +----------
 glchess/data/save_game.ui          |   54 +---------
 glchess/src/lib/gtkui/chessview.py |   95 +++-------------
 glchess/src/lib/gtkui/dialogs.py   |   79 ++++++++++----
 glchess/src/lib/gtkui/gtkui.py     |   34 +------
 glchess/src/lib/gtkui/network.py   |   26 ++++-
 10 files changed, 106 insertions(+), 569 deletions(-)
---
diff --git a/glchess/data/Makefile.am b/glchess/data/Makefile.am
index e939459..37a4557 100644
--- a/glchess/data/Makefile.am
+++ b/glchess/data/Makefile.am
@@ -2,7 +2,6 @@ SUBDIRS = pieces textures
 
 uidir = $(datadir)/glchess
 ui_DATA = \
-	chess_view.ui \
 	glchess.ui \
 	load_game.ui \
 	log.ui \
diff --git a/glchess/data/load_game.ui b/glchess/data/load_game.ui
index 1d3b42b..0643963 100644
--- a/glchess/data/load_game.ui
+++ b/glchess/data/load_game.ui
@@ -14,60 +14,6 @@
         <property name="visible">True</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkTable" id="error_box">
-            <property name="border_width">6</property>
-            <property name="n_rows">2</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkImage" id="image1">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="icon_name">gtk-dialog-warning</property>
-                <property name="icon-size">6</property>
-              </object>
-              <packing>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="error_title_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label">&lt;big&gt;&lt;b&gt;Error Title&lt;/b&gt;&lt;/big&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="error_description_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="label">&lt;i&gt;Error Description&lt;/i&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkFileChooserWidget" id="filechooserwidget">
             <property name="width_request">600</property>
             <property name="height_request">400</property>
@@ -76,6 +22,7 @@
             <signal name="file_activated" handler="_on_file_activated"/>
           </object>
           <packing>
+            <property name="pack_type">end</property>
             <property name="position">2</property>
           </packing>
         </child>
diff --git a/glchess/data/network_game.ui b/glchess/data/network_game.ui
index 9385079..73f010b 100644
--- a/glchess/data/network_game.ui
+++ b/glchess/data/network_game.ui
@@ -14,59 +14,6 @@
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
         <child>
-          <object class="GtkTable" id="info_panel">
-            <property name="border_width">12</property>
-            <property name="n_rows">2</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkImage" id="image1">
-                <property name="visible">True</property>
-                <property name="yalign">0</property>
-                <property name="stock">gtk-dialog-info</property>
-                <property name="icon-size">6</property>
-              </object>
-              <packing>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="info_panel_title">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label">&lt;big&gt;&lt;b&gt;Error Title&lt;/b&gt;&lt;/big&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="info_panel_description">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="label">&lt;i&gt;Error description&lt;/i&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkVBox" id="vbox3">
             <property name="visible">True</property>
             <property name="border_width">5</property>
@@ -479,6 +426,7 @@
             </child>
           </object>
           <packing>
+            <property name="pack_type">end</property>
             <property name="position">2</property>
           </packing>
         </child>
diff --git a/glchess/data/new_game.ui b/glchess/data/new_game.ui
index 2142663..d90a35d 100644
--- a/glchess/data/new_game.ui
+++ b/glchess/data/new_game.ui
@@ -18,60 +18,6 @@
             <property name="border_width">5</property>
             <property name="spacing">18</property>
             <child>
-              <object class="GtkTable" id="info_box">
-                <property name="border_width">6</property>
-                <property name="n_rows">2</property>
-                <property name="n_columns">2</property>
-                <property name="column_spacing">6</property>
-                <property name="row_spacing">6</property>
-                <child>
-                  <object class="GtkImage" id="image4">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
-                    <property name="icon_name">gtk-dialog-info</property>
-                    <property name="icon-size">6</property>
-                  </object>
-                  <packing>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="info_title_label">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label">&lt;big&gt;&lt;b&gt;Title&lt;/b&gt;&lt;/big&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="info_description_label">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label">&lt;i&gt;Description&lt;/i&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkVBox" id="frame3">
                 <property name="visible">True</property>
                 <property name="spacing">6</property>
@@ -200,13 +146,14 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="position">1</property>
+                <property name="pack_type">end</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -299,7 +246,8 @@
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="position">2</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -392,7 +340,8 @@
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="position">3</property>
+                <property name="pack_type">end</property>
+                <property name="position">0</property>
               </packing>
             </child>
           </object>
diff --git a/glchess/data/save_game.ui b/glchess/data/save_game.ui
index 24e79ff..418dce6 100644
--- a/glchess/data/save_game.ui
+++ b/glchess/data/save_game.ui
@@ -14,65 +14,13 @@
         <property name="visible">True</property>
         <property name="spacing">24</property>
         <child>
-          <object class="GtkTable" id="error_box">
-            <property name="border_width">6</property>
-            <property name="n_rows">2</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkImage" id="image1">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="icon_name">gtk-dialog-warning</property>
-                <property name="icon-size">6</property>
-              </object>
-              <packing>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="error_title_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label">&lt;big&gt;&lt;b&gt;Error Title&lt;/b&gt;&lt;/big&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="error_description_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label">&lt;i&gt;Error description&lt;/i&gt;</property>
-                <property name="use_markup">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkFileChooserWidget" id="filechooser">
             <property name="visible">True</property>
             <property name="action">save</property>
             <signal name="file_activated" handler="_on_file_activated"/>
           </object>
           <packing>
+            <property name="pack_type">end</property>
             <property name="position">2</property>
           </packing>
         </child>
diff --git a/glchess/src/lib/gtkui/chessview.py b/glchess/src/lib/gtkui/chessview.py
index 35efb56..83e658c 100644
--- a/glchess/src/lib/gtkui/chessview.py
+++ b/glchess/src/lib/gtkui/chessview.py
@@ -258,14 +258,19 @@ class GtkView(glchess.ui.ViewController):
         self.needsSaving = False
         
         # The GTK+ elements
-        self.gui = gtkui.loadUIFile('chess_view.ui', 'chess_view')
-        self.gui.connect_signals(self)
-        self.widget = self.gui.get_object('chess_view')
+        self.widget = gtk.VBox()
+
+        self.infobar = gtk.VBox()
+        self.titleLabel = gtk.Label("")
+        self.infobar.pack_start(self.titleLabel, False, True, 0)
+        self.descriptionLabel = gtk.Label("")
+        self.infobar.pack_start(self.descriptionLabel, True, True, 0)
+        self.widget.pack_start(self.infobar, False, True, 0)
 
         self.viewWidget = GtkViewArea(self)
-        self.gui.get_object('view_container').add(self.viewWidget)
+        self.widget.pack_start(self.viewWidget, True, True, 0)
 
-        self.ui.setTooltipStyle(self.gui.get_object('info_panel'))
+        self.widget.show_all()
 
         # Make a model for navigation (move object, number, description) 
         model = gtk.ListStore(gobject.TYPE_PYOBJECT, int, str)
@@ -274,55 +279,24 @@ class GtkView(glchess.ui.ViewController):
         model.set(iter, 0, None, 1, 0, 2, _('Game Start'))
         self.moveModel = model
 
-        # Tabs are enabled to make editing the UI easier
-        self.gui.get_object('comment_notebook').set_show_tabs(False)
-        
-        self.updateInfoPanel()
+        self.updateInfoBar()
 
         self.widget.show()
         self.viewWidget.show_all()
         
         self.ui.updateTitle()
 
-    def updateInfoPanel(self):
+    def updateInfoBar(self):
         """
         """
-        showPanel = False
-        
-        panel = self.gui.get_object('info_panel')
-        titleLabel = self.gui.get_object('panel_title_label')
-        descriptionLabel = self.gui.get_object('panel_description_label')
-        
         move = self._getCurrentMove()
         if self.gameResult is not None:
             (title, description) = self.gameResult
-            titleLabel.set_markup('<big><b>%s</b></big>' % title)
-            descriptionLabel.set_markup('<i>%s</i>' % description)
-            showPanel = True
-
-        editToggle = self.gui.get_object('comment_edit_toggle')
-        if self.showComments:
-            # Show the comments
-            if move is None:
-                titleLabel.set_markup('<big><b>%s</b></big>' % _('Game Start'))
-            else:
-                titleLabel.set_markup('<big><b>%s</b></big>' % self.generateMoveString(move))
-            
-            # Translators: Comment text when move has no comment
-            comment = _('No comment')
-            if move is not None and len(move.comment) > 0:
-                comment = move.comment
-
-            descriptionLabel.set_markup('<i>%s</i>' % comment)
-            editToggle.show()
-            showPanel = True
-        else:
-            editToggle.hide()
-
-        if showPanel:
-            panel.show()
+            self.titleLabel.set_markup('<big><b>%s</b></big>' % title)
+            self.descriptionLabel.set_markup('<i>%s</i>' % description)
+            self.infobar.show()
         else:
-            panel.hide()
+            self.infobar.hide()            
 
     def setShowComments(self, showComments):
         """Enable comments on this view.
@@ -330,7 +304,7 @@ class GtkView(glchess.ui.ViewController):
         'showComments' is true when move comments are visible.
         """
         self.showComments = showComments
-        self.updateInfoPanel()
+        self.updateInfoBar()
 
     def setMoveFormat(self, format):
         """Set the format to display the moves in.
@@ -646,7 +620,7 @@ class GtkView(glchess.ui.ViewController):
             description = _('One of the players has died')
 
         self.gameResult = (title, description)
-        self.updateInfoPanel()
+        self.updateInfoBar()
         self.ui._updateViewButtons()
     
     def close(self):
@@ -677,35 +651,4 @@ class GtkView(glchess.ui.ViewController):
         self.selectedMove = moveNumber
         if self.feedback is not None:
             self.feedback.setMoveNumber(moveNumber)
-        self.updateInfoPanel()
-
-    # Callbacks
-    
-    def _on_comment_edit_button_toggled(self, widget):
-        """Gtk+ callback"""
-        label = self.gui.get_object('panel_description_label')
-        entry = self.gui.get_object('comment_text')
-        buffer = entry.get_buffer()
-        
-        move = self._getCurrentMove()
-        
-        # FIXME
-        if move is None:
-            return
-        
-        self.editingComment = widget.get_active()
-        if self.editingComment:
-            buffer.set_text(move.comment)
-            entry.grab_focus()
-            page = 1
-        else:
-            comment = buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
-            
-            # FIXME: This should be notified so the game is considered modified for saving purposes
-            # self.feedback.setComment(move, comment)
-
-            move.comment = comment
-            label.set_text(comment)
-            buffer.set_text('')
-            page = 0
-        self.gui.get_object('comment_notebook').set_current_page(page)
+        self.updateInfoBar()
diff --git a/glchess/src/lib/gtkui/dialogs.py b/glchess/src/lib/gtkui/dialogs.py
index d8ca8f1..0ba8189 100644
--- a/glchess/src/lib/gtkui/dialogs.py
+++ b/glchess/src/lib/gtkui/dialogs.py
@@ -91,14 +91,24 @@ class GtkNewGameDialog:
 
         # Load the UI
         self.__gui = gtkui.loadUIFile('new_game.ui')
-        self.__gui.connect_signals(self)
 
         self.window = self.__gui.get_object('new_game_dialog')
         self.window.set_transient_for(mainUI.mainWindow)
 
-        # Set style of error panel
-        mainUI.setTooltipStyle(self.__gui.get_object('info_box'))
-        
+        self.infobar = gtk.InfoBar()
+        self.window.get_content_area().pack_start(self.infobar, False, True, 0)
+        vbox = gtk.VBox()
+        self.infobar.add(vbox)
+        vbox.show()
+        self.infoTitleLabel = gtk.Label()
+        vbox.pack_start(self.infoTitleLabel, False, True, 0)
+        self.infoTitleLabel.show()
+        self.infoDescriptionLabel = gtk.Label()
+        vbox.pack_start(self.infoDescriptionLabel, False, True, 0);
+        self.infoDescriptionLabel.show()
+
+        self.__gui.connect_signals(self)
+
         # Make all the labels the same width
         group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
         i = 1
@@ -261,9 +271,9 @@ class GtkNewGameDialog:
         # Display warning if missing the AIs
         if len(errors) > 0:
             # Translators: New Game Dialog: Title of error box when loaded game had AI engines missing
-            self.__gui.get_object('info_title_label').set_markup('<big><b>%s</b></big>' % _('Game settings changed'))
-            self.__gui.get_object('info_description_label').set_markup('<i>%s</i>' % '\n'.join(errors))
-            self.__gui.get_object('info_box').show()
+            self.infoTitleLabel.set_markup('<big><b>%s</b></big>' % _('Game settings changed'))
+            self.infoDescriptionLabel.set_markup('<i>%s</i>' % '\n'.join(errors))
+            self.infobar.get_object('info_box').show()
 
         # Show the dialog
         self.window.present()
@@ -420,14 +430,24 @@ class GtkLoadGameDialog:
         
         # Load the UI
         self.__gui = gtkui.loadUIFile('load_game.ui')
-        self.__gui.connect_signals(self)
-        
+
         self.window = self.__gui.get_object('game_load_dialog')
         self.window.set_transient_for(mainUI.mainWindow)
-        
-        # Set style of error panel
-        mainUI.setTooltipStyle(self.__gui.get_object('error_box'))
-        
+
+        self.infobar = gtk.InfoBar()
+        self.window.get_content_area().pack_start(self.infobar, False, True, 0)
+        vbox = gtk.VBox()
+        self.infobar.add(vbox)
+        vbox.show()
+        self.infoTitleLabel = gtk.Label()
+        vbox.pack_start(self.infoTitleLabel, False, True, 0)
+        self.infoTitleLabel.show()
+        self.infoDescriptionLabel = gtk.Label()
+        vbox.pack_start(self.infoDescriptionLabel, False, True, 0);
+        self.infoDescriptionLabel.show()
+
+        self.__gui.connect_signals(self)
+
         fileChooser = self.__gui.get_object('filechooserwidget')
         
         try:
@@ -474,10 +494,11 @@ class GtkLoadGameDialog:
 
             if error is not None:
                 self.firstExpose = True
-                self.__gui.get_object('error_box').show()
+                self.infobar.set_message_type(gtk.MESSAGE_ERROR)
                 # Translators: Title of error box when unable to load game
-                self.__gui.get_object('error_title_label').set_markup('<big><b>%s</b></big>' % _('Unabled to load game'))
-                self.__gui.get_object('error_description_label').set_markup('<i>%s</i>' % error)
+                self.infoTitleLabel.set_markup('<big><b>%s</b></big>' % _('Unabled to load game'))
+                self.infoDescriptionLabel.set_markup('<i>%s</i>' % error)
+                self.infobar.show()
                 return
 
         dialog.destroy()
@@ -496,13 +517,24 @@ class GtkSaveGameDialog:
         
         # Load the UI
         self.__gui = gtkui.loadUIFile('save_game.ui')
-        self.__gui.connect_signals(self)
-        
-        # Set style of error panel
-        mainUI.setTooltipStyle(self.__gui.get_object('error_box'))
 
         self.window = self.__gui.get_object('save_dialog')
         self.window.set_transient_for(mainUI.mainWindow)
+        
+        self.infobar = gtk.InfoBar()
+        self.window.get_content_area().pack_start(self.infobar, False, True, 0)
+        vbox = gtk.VBox()
+        self.infobar.add(vbox)
+        vbox.show()
+        self.infoTitleLabel = gtk.Label()
+        vbox.pack_start(self.infoTitleLabel, False, True, 0)
+        self.infoTitleLabel.show()
+        self.infoDescriptionLabel = gtk.Label()
+        vbox.pack_start(self.infoDescriptionLabel, False, True, 0);
+        self.infoDescriptionLabel.show()
+
+        self.__gui.connect_signals(self)
+        
         chooser = self.__gui.get_object('filechooser')
         
         try:
@@ -536,9 +568,10 @@ class GtkSaveGameDialog:
         """
         """
         self.firstExpose = True
-        self.__gui.get_object('error_box').show()
-        self.__gui.get_object('error_title_label').set_markup('<big><b>%s</b></big>' % title)
-        self.__gui.get_object('error_description_label').set_markup('<i>%s</i>' % content)
+        self.infobar.set_message_type(gtk.MESSAGE_ERROR)
+        self.infoTitleLabel.set_markup('<big><b>%s</b></big>' % title)
+        self.infoDescriptionLabel.set_markup('<i>%s</i>' % content)
+        self.infobar.show()
         
     def _on_response(self, dialog, responseId):
         """Gtk+ callback"""
diff --git a/glchess/src/lib/gtkui/gtkui.py b/glchess/src/lib/gtkui/gtkui.py
index c57697f..ccc7ce7 100644
--- a/glchess/src/lib/gtkui/gtkui.py
+++ b/glchess/src/lib/gtkui/gtkui.py
@@ -183,16 +183,7 @@ class GtkUI(glchess.ui.UI):
         self.isMaximised        = False
     
         self.view               = None
-        
-        # Set the message panel to the tooltip style
-        # (copied from Gedit)
-        # In Gtk+ 2.11+ (I think) tip_window is now private so skip if it's not there (bug #459740)
-        w = gtk.Window(gtk.WINDOW_POPUP)
-        w.set_name('gtk-tooltip')
-        w.ensure_style()
-        self._tooltipStyle = w.get_style()
-        self._tooltipWidgetsDrawn = {}
-        
+
         self._gui = loadUIFile('glchess.ui')
         self._gui.connect_signals(self)
         
@@ -232,29 +223,6 @@ class GtkUI(glchess.ui.UI):
 
     # Public methods
     
-    def setTooltipStyle(self, widget):
-        """Set a widget to be in the tooltip style.
-        
-        'widget' is the widget to modify.
-        """
-        if self._tooltipStyle is None:
-            return
-        widget.set_style(self._tooltipStyle)
-        widget.connect("expose_event", self._on_tooltip_expose_event)
-        widget.queue_draw()
-
-    def _on_tooltip_expose_event(self, widget, event):
-        """Gtk+ callback"""
-        allocation = widget.allocation
-        widget.style.paint_flat_box(widget.window, gtk.STATE_NORMAL, gtk.SHADOW_OUT, None, widget, "tooltip",
-                                    allocation.x, allocation.y, allocation.width, allocation.height)
-                                    
-        # The first draw is corrupt for me so draw it twice.
-        # Bonus points to anyone who tracks down the problem and fixes it
-        if not self._tooltipWidgetsDrawn.has_key(widget):
-            self._tooltipWidgetsDrawn[widget] = True
-            widget.queue_draw()
-    
     def watchFileDescriptor(self, fd):
         """Extends ui.UI"""
         self._watches[fd] = gobject.io_add_watch(fd, gobject.IO_IN | gobject.IO_PRI | gobject.IO_HUP | gobject.IO_ERR, self.__readData)
diff --git a/glchess/src/lib/gtkui/network.py b/glchess/src/lib/gtkui/network.py
index cbf3381..db6c26d 100644
--- a/glchess/src/lib/gtkui/network.py
+++ b/glchess/src/lib/gtkui/network.py
@@ -107,6 +107,20 @@ class GtkNetworkGameDialog(glchess.ui.NetworkController):
 
         # Load the UI
         self.__gui = gtkui.loadUIFile('network_game.ui')
+
+        self.infobar = gtk.InfoBar()
+        vbox = gtk.VBox()
+        self.infobar.add(vbox)
+        vbox.show()
+        self.infoTitleLabel = gtk.Label()
+        vbox.pack_start(self.infoTitleLabel, False, True, 0)
+        self.infoTitleLabel.show()
+        self.infoDescriptionLabel = gtk.Label()
+        vbox.pack_start(self.infoDescriptionLabel, False, True, 0);
+        self.infoDescriptionLabel.show()
+
+        self.__gui.get_object('network_game_dialog').get_content_area().pack_start(self.infobar, False, False, 0)
+
         self.__gui.connect_signals(self)
         
         # Selected profile
@@ -217,7 +231,6 @@ class GtkNetworkGameDialog(glchess.ui.NetworkController):
         #buffer.create_tag('error', family='Monospace', foreground = 'red')
         buffer.create_mark('end', buffer.get_end_iter())
         
-        mainUI.setTooltipStyle(self.__gui.get_object('info_panel'))
         self.__addProfileDialog = GtkNetworkAddDialog(self, self.__gui.get_object('network_game_dialog'))
 
     # Extended methods
@@ -242,12 +255,13 @@ class GtkNetworkGameDialog(glchess.ui.NetworkController):
         widget.set_sensitive(isSensitive)
 
     def setError(self, title, description):
-        self.__gui.get_object('info_panel_title').set_markup('<big><b>%s</b></big>' % title)
-        self.__gui.get_object('info_panel_description').set_markup('<i>%s</i>' % description)
-        self.__gui.get_object('info_panel').show()
-        
+        self.infobar.set_message_type(gtk.MESSAGE_ERROR);
+        self.infoTitleLabel.set_markup('<big><b>%s</b></big>' % title)
+        self.infoDescriptionLabel.set_markup('<i>%s</i>' % description)
+        self.infobar.show()
+
     def clearError(self):
-        self.__gui.get_object('info_panel').hide()
+        self.infobar.hide()
 
     def addProfile(self, profile, name, useNow = False):
         """Called by glchess.ui.UIController"""



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