[gnome-games/sudoku-tube] Use glade to draw the offering-tube dialog



commit eef090592b70d33bca2b48d5c779d49db0e45239
Author: Zhang Sen <zh jesse gmail com>
Date:   Sun Aug 16 21:23:24 2009 +0800

    Use glade to draw the offering-tube dialog
    
    Also some change by glade 3.6.7 automatically (from 3.6.2)

 gnome-sudoku/data/Makefile.am                |    1 +
 gnome-sudoku/data/contact_selector_dialog.ui |    4 +-
 gnome-sudoku/data/network_game_offer.ui      |    4 +-
 gnome-sudoku/data/offering_tube.ui           |   58 ++++++++++++++++++++++++++
 gnome-sudoku/src/lib/main.py                 |   12 ++----
 gnome-sudoku/src/lib/tp_tube.py              |    1 +
 gnome-sudoku/src/lib/tube_handler.py         |    2 +-
 7 files changed, 69 insertions(+), 13 deletions(-)
---
diff --git a/gnome-sudoku/data/Makefile.am b/gnome-sudoku/data/Makefile.am
index 208b59d..6c9a84e 100644
--- a/gnome-sudoku/data/Makefile.am
+++ b/gnome-sudoku/data/Makefile.am
@@ -10,6 +10,7 @@ ui_DATA = \
 	contact_selector_dialog.ui \
 	main.ui		\
 	network_game_offer.ui	\
+	offering_tube.ui	\
 	print_games.ui \
 	puzzle_generator.ui \
 	select_game.ui \
diff --git a/gnome-sudoku/data/contact_selector_dialog.ui b/gnome-sudoku/data/contact_selector_dialog.ui
index dd60cc0..98989e9 100644
--- a/gnome-sudoku/data/contact_selector_dialog.ui
+++ b/gnome-sudoku/data/contact_selector_dialog.ui
@@ -33,7 +33,7 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="cancel_button">
-                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -47,7 +47,7 @@
             </child>
             <child>
               <object class="GtkButton" id="ok_button">
-                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
diff --git a/gnome-sudoku/data/network_game_offer.ui b/gnome-sudoku/data/network_game_offer.ui
index c020c59..593d801 100644
--- a/gnome-sudoku/data/network_game_offer.ui
+++ b/gnome-sudoku/data/network_game_offer.ui
@@ -46,7 +46,7 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="button2">
-                <property name="label" translatable="yes">gtk-no</property>
+                <property name="label">gtk-no</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -60,7 +60,7 @@
             </child>
             <child>
               <object class="GtkButton" id="button1">
-                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
diff --git a/gnome-sudoku/data/offering_tube.ui b/gnome-sudoku/data/offering_tube.ui
new file mode 100644
index 0000000..cb7c2ea
--- /dev/null
+++ b/gnome-sudoku/data/offering_tube.ui
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkDialog" id="dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Connecting</property>
+    <property name="type_hint">normal</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkLabel" id="label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Waiting for reply</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button1</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index c401628..fc33b82 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -458,14 +458,10 @@ class SudokuGame(gconf_wrapper.GConfWrapper):
             self._tube_offer = tp_tube.TubeOffer(
                     conn, handle, self._tube_service, puzzle, mode)
 
-            connecting_label = gtk.Label(_("Connecting..."))
-            self._wait_dialog = gtk.Dialog("Sending request...",
-                    self.w,
-                    gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
-                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
-            connecting_label.set_padding(12, 12)
-            connecting_label.show()
-            self._wait_dialog.vbox.pack_start(connecting_label)
+            builder = gtk.Builder()
+            builder.add_from_file(os.path.join(UI_DIR, "offering_tube.ui"))
+            self._wait_dialog = builder.get_object("dialog")
+            self._wait_dialog.set_transient_for(self.w)
             self._wait_dialog.connect("response", self._wait_dialog_response_cb)
 
             self._tube_offer.connect("offer-succeeded",
diff --git a/gnome-sudoku/src/lib/tp_tube.py b/gnome-sudoku/src/lib/tp_tube.py
index 57c1e30..c700de7 100644
--- a/gnome-sudoku/src/lib/tp_tube.py
+++ b/gnome-sudoku/src/lib/tp_tube.py
@@ -64,6 +64,7 @@ class TubeOffer(gobject.GObject):
 
     def cancel(self):
         if self._chan:
+            logger.debug("canceling request")
             self._closed_signal.remove()
             self._chan[CHANNEL_INTERFACE].Close()
 
diff --git a/gnome-sudoku/src/lib/tube_handler.py b/gnome-sudoku/src/lib/tube_handler.py
index 4c5ff69..fc4f6fc 100644
--- a/gnome-sudoku/src/lib/tube_handler.py
+++ b/gnome-sudoku/src/lib/tube_handler.py
@@ -123,7 +123,7 @@ class TubeHandler(dbus.service.Object):
 
         info = sudoku.SudokuRater(self._puzzle).difficulty()
         mode_str = _("Collaborative") if mode else _("Competitive")
-        text = info.to_string() + "\n" + _("Game mode: %s") % mode_str
+        text = info.to_string() + "\n\n" + _("Game mode: %s") % mode_str
         info_label = builder.get_object("info_label")
         info_label.set_text(text)
 



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