[monkey-bubble: 744/753] migrate libglade to GtkBuilder
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 744/753] migrate libglade to GtkBuilder
- Date: Wed, 14 Jul 2010 22:58:14 +0000 (UTC)
commit f7cc88ef256c26a4766039c747ea9815462993f6
Author: Sven Herzberg <herzi gnome-de org>
Date: Wed Jul 14 20:25:24 2010 +0200
migrate libglade to GtkBuilder
This migration is required in order to start GTK+ 3.0 compatibility
work.
* configure.in: update the dependencies
* data/Makefile.am,
* data/keybinding.glade -> data/keybinding.ui,
* data/monkey-bubble.glade -> data/monkey-bubble.ui,
* data/netgame.glade -> data/netgame.ui,
* data/netserver.glade -> data/netserver.ui: converted with
gtk-builder-convert
* src/ui/keyboard-properties.c,
* src/ui/ui-main.c,
* src/ui/ui-network-client.c,
* src/ui/ui-network-server.c: required code updates
configure.in | 9 +-
data/Makefile.am | 5 +-
data/keybinding.glade | 119 -----------
data/keybinding.ui | 111 ++++++++++
data/monkey-bubble.glade | 90 ---------
data/monkey-bubble.ui | 85 ++++++++
data/{netgame.glade => netgame.ui} | 154 +++++++-------
data/netserver.glade | 389 ------------------------------------
data/netserver.ui | 379 +++++++++++++++++++++++++++++++++++
src/ui/keyboard-properties.c | 124 ++++++------
src/ui/ui-main.c | 52 +++--
src/ui/ui-network-client.c | 369 +++++++++++++++++-----------------
src/ui/ui-network-server.c | 250 +++++++++++-------------
13 files changed, 1054 insertions(+), 1082 deletions(-)
---
diff --git a/configure.in b/configure.in
index d0aa780..81762ee 100644
--- a/configure.in
+++ b/configure.in
@@ -79,7 +79,8 @@ dnl | library dependencies |--------------------------------------------------
dnl ----------------------
dnl Versions shared with the (upcoming) .spec file.
-GTK_REQUIRED=2.0.0
+dnl GTK+ 2.12 comes with GtkBuilder support
+GTK_REQUIRED=2.12.0
G_THREAD_REQUIRED=2.0.0
AC_SUBST(GTK_REQUIRED)
@@ -134,13 +135,13 @@ AC_SUBST(MONKEY_SRV_LIBS)
PKG_CHECK_MODULES(UI,[
- gtk+-2.0 >= 2.10
+ gconf-2.0
+ gtk+-2.0 >= $GTK_REQUIRED
gthread-2.0
librsvg-2.0
libcanberra
libcanberra-gtk
- gconf-2.0
- libglade-2.0
+ libxml-2.0
])
AC_SUBST(UI_CFLAGS)
AC_SUBST(UI_LIBS)
diff --git a/data/Makefile.am b/data/Makefile.am
index 8fd2425..c74473b 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -15,9 +15,8 @@ $(dbus_DATA): $(dbus_in_files) Makefile
sed 's# BINDIR@#$(bindir)#' $< > $@
endif
-gladexmldir = $(datadir)/monkey-bubble/glade
-gladexml_DATA = \
- monkey-bubble.glade keybinding.glade netgame.glade netserver.glade
+uidir=$(pkgdatadir)/glade
+dist_ui_DATA=monkey-bubble.ui keybinding.ui netgame.ui netserver.ui
schemasdir = $(GCONF_SCHEMA_FILE_DIR)
schemas_in_files = monkey-bubble.schemas.in
diff --git a/data/keybinding.ui b/data/keybinding.ui
new file mode 100644
index 0000000..dbb6502
--- /dev/null
+++ b/data/keybinding.ui
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkDialog" id="keybindings-dialog">
+ <property name="title" translatable="yes">Keyboard Shortcuts</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="close_button1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table32">
+ <property name="border_width">8</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">1</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">4</property>
+ <property name="column_spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="label59">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Shortcut Keys:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">accelerators-treeview</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <child>
+ <object class="GtkTreeView" id="accelerators-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-7">close_button1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/data/monkey-bubble.ui b/data/monkey-bubble.ui
new file mode 100644
index 0000000..0793e67
--- /dev/null
+++ b/data/monkey-bubble.ui
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkDialog" id="create_server_warning">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Warning</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">True</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">True</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="okbutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-dialog-warning</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal handler="gtk_widget_destroy" last_modification_time="Wed, 16 Jun 2004 21:46:55 GMT" name="activate" object="create_server_warning"/>
+ <signal handler="gtk_widget_destroy" last_modification_time="Thu, 17 Jun 2004 08:42:40 GMT" name="clicked" object="create_server_warning"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><markup>
+<span weight="bold" size="large"
+style="oblique">
+Can't create server !
+</span>
+</markup></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">20</property>
+ <property name="ypad">20</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-7">okbutton1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/data/netgame.glade b/data/netgame.ui
similarity index 79%
rename from data/netgame.glade
rename to data/netgame.ui
index af293a5..7bf032f 100644
--- a/data/netgame.glade
+++ b/data/netgame.ui
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<glade-interface>
+<interface>
<!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy toplevel-contextual -->
- <widget class="GtkWindow" id="network_window">
+ <object class="GtkWindow" id="network_window">
<property name="visible">True</property>
<property name="title" translatable="yes">Network game</property>
<property name="resizable">False</property>
@@ -10,22 +10,22 @@
<property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
<child>
- <widget class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <widget class="GtkHBox" id="connect_hbox">
+ <object class="GtkHBox" id="connect_hbox">
<property name="visible">True</property>
<property name="border_width">10</property>
<property name="spacing">5</property>
<child>
- <widget class="GtkLabel" id="label5">
+ <object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xpad">12</property>
<property name="label" translatable="yes">_Server</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">server_name_entry</property>
- </widget>
+ <property name="mnemonic_widget">comboboxentry1</property>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -33,32 +33,32 @@
</packing>
</child>
<child>
- <widget class="GtkComboBoxEntry" id="comboboxentry1">
+ <object class="GtkComboBoxEntry" id="comboboxentry1">
<property name="visible">True</property>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="go_button">
+ <object class="GtkButton" id="go_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
- <widget class="GtkAlignment" id="alignment4">
+ <object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
- <widget class="GtkHBox" id="hbox7">
+ <object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkImage" id="image4">
+ <object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -66,29 +66,29 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label6">
+ <object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">_Go</property>
<property name="use_underline">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -96,9 +96,9 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="connection_state_label">
+ <object class="GtkLabel" id="connection_state_label">
<property name="visible">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -106,7 +106,7 @@
</packing>
</child>
<child>
- <widget class="GtkTable" id="table1">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="border_width">8</property>
<property name="n_rows">2</property>
@@ -114,108 +114,108 @@
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child>
- <widget class="GtkLabel" id="label7">
+ <object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Number of players :</property>
- </widget>
+ </object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label8">
+ <object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Number of games :</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="number_of_players">
+ <object class="GtkLabel" id="number_of_players">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="number_of_games">
+ <object class="GtkLabel" id="number_of_games">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
- </widget>
+ </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>
+ <property name="y_options"/>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="connected_game_hbox">
+ <object class="GtkVBox" id="connected_game_hbox">
<property name="visible">True</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="height_request">298</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
- <widget class="GtkTreeView" id="players_treeview">
+ <object class="GtkTreeView" id="players_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="enable_search">False</property>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="game_hbox">
+ <object class="GtkHBox" id="game_hbox">
<property name="visible">True</property>
<property name="border_width">7</property>
<property name="homogeneous">True</property>
<child>
- <widget class="GtkButton" id="quit_button">
+ <object class="GtkButton" id="quit_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
- <widget class="GtkAlignment" id="alignment3">
+ <object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
- <widget class="GtkHBox" id="hbox5">
+ <object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkImage" id="image3">
+ <object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -223,22 +223,22 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label4">
+ <object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">Quit game</property>
<property name="use_underline">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -246,24 +246,24 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="close_button">
+ <object class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
- <widget class="GtkAlignment" id="alignment9">
+ <object class="GtkAlignment" id="alignment9">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
- <widget class="GtkHBox" id="hbox1">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkImage" id="image9">
+ <object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -271,22 +271,22 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label9">
+ <object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">Close</property>
<property name="use_underline">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -294,24 +294,24 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="ready_button">
+ <object class="GtkButton" id="ready_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
- <widget class="GtkHBox" id="hbox3">
+ <object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkImage" id="image1">
+ <object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-apply</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -319,41 +319,41 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label2">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Ready</property>
<property name="use_underline">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">3</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
-</glade-interface>
+ </object>
+</interface>
diff --git a/data/netserver.ui b/data/netserver.ui
new file mode 100644
index 0000000..f2beadf
--- /dev/null
+++ b/data/netserver.ui
@@ -0,0 +1,379 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">10</property>
+ <property name="lower">2</property>
+ <property name="page_increment">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_size">10</property>
+ <property name="value">2</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="lower">3</property>
+ <property name="page_increment">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_size">10</property>
+ <property name="value">10</property>
+ </object>
+ <object class="GtkWindow" id="network_window">
+ <property name="height_request">320</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Network game</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="modal">True</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="border_width">10</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">7</property>
+ <property name="column_spacing">25</property>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Number of game</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="number_of_players">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">adjustment1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="number_of_games">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">adjustment2</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="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Number of players</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTreeView" id="players_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">False</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="border_width">7</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <property name="spacing">0</property>
+ <child>
+ <object class="GtkButton" id="quit_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-quit</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Quit game</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ready_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Ready</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="start_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-goto-last</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Start Game</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/src/ui/keyboard-properties.c b/src/ui/keyboard-properties.c
index ef49850..2cd16ba 100644
--- a/src/ui/keyboard-properties.c
+++ b/src/ui/keyboard-properties.c
@@ -20,7 +20,6 @@
#include <config.h>
#include <string.h>
-#include <glade/glade.h>
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include "keyboard-properties.h"
@@ -132,12 +131,13 @@ enum
};
-struct KeyboardPropertiesPrivate {
- GtkWidget * dialog;
- GladeXML * glade_xml;
- GConfClient * gconf_client;
- GtkAccelGroup * hack_group;
- GtkTreeModel *model;
+struct KeyboardPropertiesPrivate
+{
+ GtkWidget * dialog;
+ GtkBuilder * builder;
+ GConfClient * gconf_client;
+ GtkAccelGroup* hack_group;
+ GtkTreeModel * model;
};
G_DEFINE_TYPE (KeyboardProperties, keyboard_properties, G_TYPE_OBJECT);
@@ -196,24 +196,22 @@ static KeyboardProperties* keyboard_properties_new(void) {
return keyboard_properties;
}
+static void
+keyboard_properties_finalize (GObject* object)
+{
+ KeyboardProperties* kp = KEYBOARD_PROPERTIES(object);
+ gtk_widget_destroy (PRIVATE (kp)->dialog);
+ g_object_unref (PRIVATE (kp)->builder);
+ g_object_unref (PRIVATE (kp)->gconf_client);
+ g_free (kp->private);
-
-static void keyboard_properties_finalize(GObject* object) {
- KeyboardProperties* kp = KEYBOARD_PROPERTIES(object);
-
- gtk_widget_destroy( PRIVATE(kp)->dialog);
-
- g_object_unref( PRIVATE(kp)->glade_xml);
- g_object_unref( PRIVATE(kp)->gconf_client);
-
- g_free( kp->private);
- if (G_OBJECT_CLASS (parent_class)->finalize) {
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ {
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-
}
static void keyboard_properties_class_init (KeyboardPropertiesClass *klass) {
@@ -1018,27 +1016,35 @@ start_editing_cb (GtkTreeView *tree_view,
}
GtkWidget*
-edit_keys_dialog_new (KeyboardProperties *kp,
- GtkWindow *transient_parent)
+edit_keys_dialog_new (KeyboardProperties* kp,
+ GtkWindow * transient_parent)
{
- GladeXML *xml;
GtkWidget *w;
- GtkCellRenderer *cell_renderer;
+ GtkCellRenderer* cell_renderer;
int i;
GtkTreeModel *sort_model;
GtkTreeStore *tree;
GtkTreeViewColumn *column;
GtkTreeIter parent_iter;
+ GtkBuilder * builder;
+ GError * error = NULL;
+ gchar * objects[] =
+ {
+ "keybindings-dialog",
+ NULL
+ };
- xml = glade_xml_new(DATADIR"/monkey-bubble/glade/keybinding.glade",
- "keybindings-dialog",
- NULL);
- if (xml == NULL)
- return NULL;
-
+ builder = gtk_builder_new ();
+ if (0 == gtk_builder_add_objects_from_file (builder, DATADIR "/monkey-bubble/glade/keybinding.ui", objects, &error))
+ {
+ g_warning ("error loading keybinding dialog%c %s",
+ error ? ':' : '\0',
+ error ? error->message : "");
+ g_error_free (error);
+ return NULL;
+ }
-
- w = glade_xml_get_widget (xml, "accelerators-treeview");
+ w = GTK_WIDGET (gtk_builder_get_object (builder, "accelerators-treeview"));
living_treeviews = g_slist_prepend (living_treeviews, w);
@@ -1049,26 +1055,26 @@ edit_keys_dialog_new (KeyboardProperties *kp,
&living_treeviews);
tree = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
-
+
/* Column 1 */
cell_renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("_Action"),
- cell_renderer,
- "text", ACTION_COLUMN,
- NULL);
+ cell_renderer,
+ "text", ACTION_COLUMN,
+ NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (w), column);
gtk_tree_view_column_set_sort_column_id (column, ACTION_COLUMN);
/* Column 2 */
cell_renderer = gtk_cell_renderer_accel_new();
g_object_set(cell_renderer,
- "editable", TRUE,
- "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_OTHER,
- NULL);
+ "editable", TRUE,
+ "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_OTHER,
+ NULL);
g_signal_connect (G_OBJECT (cell_renderer), "accel-edited",
G_CALLBACK (accel_edited_callback),
kp);
-
+
PRIVATE(kp)->model = GTK_TREE_MODEL( tree );
g_object_set (G_OBJECT (cell_renderer),
@@ -1089,23 +1095,23 @@ edit_keys_dialog_new (KeyboardProperties *kp,
int j;
gtk_tree_store_append (tree, &parent_iter, NULL);
gtk_tree_store_set (tree, &parent_iter,
- ACTION_COLUMN, _(all_entries[i].user_visible_name),
- -1);
+ ACTION_COLUMN, _(all_entries[i].user_visible_name),
+ -1);
j = 0;
while (j < all_entries[i].n_elements)
- {
- GtkTreeIter iter;
- KeyEntry *key_entry;
-
- key_entry = &(all_entries[i].key_entry[j]);
- gtk_tree_store_append (tree, &iter, &parent_iter);
- gtk_tree_store_set (tree, &iter,
- ACTION_COLUMN, _(key_entry->user_visible_name),
- KEYVAL_COLUMN, key_entry,
- -1);
- ++j;
- }
+ {
+ GtkTreeIter iter;
+ KeyEntry *key_entry;
+
+ key_entry = &(all_entries[i].key_entry[j]);
+ gtk_tree_store_append (tree, &iter, &parent_iter);
+ gtk_tree_store_set (tree, &iter,
+ ACTION_COLUMN, _(key_entry->user_visible_name),
+ KEYVAL_COLUMN, key_entry,
+ -1);
+ ++j;
+ }
++i;
}
@@ -1118,8 +1124,8 @@ edit_keys_dialog_new (KeyboardProperties *kp,
gtk_tree_view_expand_all (GTK_TREE_VIEW (w));
g_object_unref (G_OBJECT (tree));
-
- w = glade_xml_get_widget (xml, "keybindings-dialog");
+
+ w = GTK_WIDGET (gtk_builder_get_object (builder, "keybindings-dialog"));
g_signal_connect (G_OBJECT (w), "response",
G_CALLBACK (gtk_widget_destroy),
@@ -1129,8 +1135,8 @@ edit_keys_dialog_new (KeyboardProperties *kp,
-1, 350);
- g_object_unref (G_OBJECT (xml));
-
+ g_object_unref (builder);
+
return w;
}
@@ -1166,3 +1172,5 @@ update_menu_accel_state (void)
"gnome-terminal");
}
}
+
+/* vim:set et sw=2 cino=t0,f0,(0,{s,>2s,n-1s,^-1s,e2s: */
diff --git a/src/ui/ui-main.c b/src/ui/ui-main.c
index 9ba1eb3..f634114 100644
--- a/src/ui/ui-main.c
+++ b/src/ui/ui-main.c
@@ -42,7 +42,6 @@
#include <libgnome/gnome-help.h>
#endif
#include <gdk/gdkkeysyms.h>
-#include <glade/glade.h>
#include <glib/gi18n.h>
#include <string.h>
@@ -687,26 +686,41 @@ new_network_game(GtkAction* action,
#ifdef GNOME
static void
new_network_server (GtkAction* action,
- UiMain * ui_main)
+ UiMain * ui_main)
{
- UiNetworkServer * ngl;
- NetworkSimpleServer * server;
-
- server = network_simple_server_new();
+ NetworkSimpleServer* server;
+ UiNetworkServer * ngl;
+
+ server = network_simple_server_new ();
+
+ if(network_simple_server_start (server) == TRUE)
+ {
+ ngl = ui_network_server_new (server);
+ }
+ else
+ {
+ GtkBuilder* builder = gtk_builder_new ();
+ GError * error = NULL;
+ gchar * objects[] =
+ {
+ "create_server_warning",
+ NULL
+ };
- if( network_simple_server_start( server ) == TRUE) {
- ngl = ui_network_server_new(server);
- } else {
- GladeXML * gx;
-
- g_object_unref(server);
- gx = glade_xml_new(DATADIR"/monkey-bubble/glade/monkey-bubble.glade",
- "create_server_warning",
- NULL);
- glade_xml_signal_autoconnect(gx);
- gtk_widget_show( glade_xml_get_widget(gx,"create_server_warning"));
- g_object_unref(gx);
+ if (0 == gtk_builder_add_objects_from_file (builder, DATADIR "/monkey-bubble/glade/monkey-bubble.ui", objects, &error))
+ {
+ g_warning ("error loading UI elements%c %s",
+ error ? ':' : '\0',
+ error ? error->message : "");
+ g_error_free (error);
}
+
+ gtk_builder_connect_signals (builder, NULL);
+ gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder, "create_server_warning")));
+ g_object_unref (builder);
+
+ g_object_unref(server);
+ }
}
static void
@@ -844,3 +858,5 @@ static void window_state_event (GtkWindow *window,
}
}
#endif
+
+/* vim:set et sw=2 cino=t0,f0,(0,{s,>2s,n-1s,^-1s,e2s: */
diff --git a/src/ui/ui-network-client.c b/src/ui/ui-network-client.c
index 07df216..f641f78 100644
--- a/src/ui/ui-network-client.c
+++ b/src/ui/ui-network-client.c
@@ -32,7 +32,6 @@
#include <time.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <glib/gi18n.h>
#include "message-handler.h"
@@ -42,19 +41,17 @@
#include "ui-main.h"
#include "game-manager-proxy.h"
-
-
-struct UiNetworkClientPrivate {
- GladeXML * glade_xml;
- GtkWidget * window;
- gchar * server_name;
- NetworkMessageHandler * handler;
- int client_id;
- gboolean ready;
- GtkLabel * connection_label;
- GtkListStore * players_list;
- NetGameManagerProxy * manager_proxy;
-
+struct UiNetworkClientPrivate
+{
+ GtkBuilder * builder;
+ GtkWidget * window;
+ gchar * server_name;
+ NetworkMessageHandler* handler;
+ int client_id;
+ gboolean ready; /* FIXME: check whether this can be removed */
+ GtkLabel * connection_label;
+ GtkListStore * players_list;
+ NetGameManagerProxy * manager_proxy;
};
#define PRIVATE( UiNetworkClient ) (UiNetworkClient->private)
@@ -116,115 +113,132 @@ static gboolean close_signal(gpointer callback_data,
}
void connected_set_sensitive(UiNetworkClient * ngl, gboolean sensitive) {
- set_sensitive( glade_xml_get_widget( PRIVATE(ngl)->glade_xml
- ,"scrolledwindow2"), sensitive);
- set_sensitive( glade_xml_get_widget( PRIVATE(ngl)->glade_xml
- ,"quit_button"), sensitive);
- set_sensitive( glade_xml_get_widget( PRIVATE(ngl)->glade_xml
- ,"ready_button"), sensitive);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "scrolledwindow2")), sensitive);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder ,"quit_button")), sensitive);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder ,"ready_button")), sensitive);
}
#endif
-UiNetworkClient *ui_network_client_new() {
+UiNetworkClient*
+ui_network_client_new (void)
+{
+ GtkTreeViewColumn* column;
+ UiNetworkClient * ngl;
+ GtkListStore * list;
+ GtkWidget * item;
#ifdef MAEMO
- GtkWidget * container;
+ GtkWidget * container;
#endif
- UiNetworkClient * ngl;
- GtkWidget * item;
-
- GtkTreeViewColumn * column;
- GtkListStore * list;
+ GError * error = NULL;
+ gchar * objects[] =
+ {
+ NULL, NULL
+ };
- ngl =
- UI_NETWORK_CLIENT(g_object_new(TYPE_UI_NETWORK_CLIENT
- , NULL));
+ ngl = UI_NETWORK_CLIENT(g_object_new(TYPE_UI_NETWORK_CLIENT , NULL));
- PRIVATE(ngl)->server_name = NULL;
+ PRIVATE(ngl)->server_name = NULL;
- PRIVATE(ngl)->ready = FALSE;
+ PRIVATE(ngl)->ready = FALSE;
+ PRIVATE (ngl)->builder = gtk_builder_new ();
#ifdef GNOME
- PRIVATE(ngl)->glade_xml = glade_xml_new(DATADIR"/monkey-bubble/glade/netgame.glade","network_window",NULL);
-
- PRIVATE(ngl)->window = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "network_window");
- gtk_widget_hide (glade_xml_get_widget (PRIVATE(ngl)->glade_xml, "close_button"));
+ objects[0] = "network_window";
+ if (0 == gtk_builder_add_objects_from_file (PRIVATE (ngl)->builder, DATADIR "/monkey-bubble/glade/netgame.ui", objects, &error))
+ {
+ g_warning ("error loading network game UI%c %s",
+ error ? ':' : '\0',
+ error ? error->message : "");
+ g_error_free (error);
+ g_object_unref (ngl);
+ return NULL;
+ }
+
+ PRIVATE(ngl)->window = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "network_window"));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "close_button")));
#endif
#ifdef MAEMO
- PRIVATE(ngl)->glade_xml = glade_xml_new(DATADIR"/monkey-bubble/glade/netgame.glade","vbox1",NULL);
-
- PRIVATE(ngl)->window = gtk_dialog_new();
- gtk_window_set_title(GTK_WINDOW(PRIVATE(ngl)->window), _("Network game"));
- container = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "vbox1");
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(PRIVATE(ngl)->window)->vbox), container);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "close_button");
- g_signal_connect_swapped (item, "clicked",
- G_CALLBACK (close_signal), ngl);
- gtk_widget_set_size_request (glade_xml_get_widget (PRIVATE(ngl)->glade_xml, "scrolledwindow2"), -1, 298); // FIXME: check if necessary
+ objects[0] = "vbox1";
+ if (0 == gtk_builder_add_objects_from_file (PRIVATE (ngl)->builder, DATADIR "/monkey-bubble/glade/netgame.ui", objects, &error))
+ {
+ g_warning ("error loading network game UI%c %s",
+ error ? ':' : '\0',
+ error ? error->message : "");
+ g_error_free (error);
+ g_object_unref (ngl);
+ return NULL;
+ }
+
+ PRIVATE(ngl)->window = gtk_dialog_new();
+ gtk_window_set_title(GTK_WINDOW(PRIVATE(ngl)->window), _("Network game"));
+ container = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "vbox1"));
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(PRIVATE(ngl)->window)->vbox), container);
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "close_button"));
+ g_signal_connect_swapped (item, "clicked",
+ G_CALLBACK (close_signal), ngl);
+ gtk_widget_set_size_request (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "scrolledwindow2")),
+ -1, 298); // FIXME: check if necessary
#endif
-
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "go_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(connect_server_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "go_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(connect_server_signal),ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "quit_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(quit_server_signal),ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "network_window");
- g_signal_connect_swapped( item,"delete_event",GTK_SIGNAL_FUNC(quit_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "quit_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(quit_server_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "network_window"));
+ g_signal_connect_swapped( item,"delete_event",GTK_SIGNAL_FUNC(quit_signal),ngl);
+
+
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "ready_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(ready_signal),ngl);
+
+ PRIVATE(ngl)->connection_label = GTK_LABEL (gtk_builder_get_object (PRIVATE (ngl)->builder, "connection_state_label"));
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "ready_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(ready_signal),ngl);
-
- PRIVATE(ngl)->connection_label = GTK_LABEL(glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "connection_state_label"));
-
#ifdef GNOME
- gtk_widget_set_sensitive( glade_xml_get_widget( PRIVATE(ngl)->glade_xml
- , "connected_game_hbox"),
- FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "connected_game_hbox")),
+ FALSE);
#endif
#ifdef MAEMO
- connected_set_sensitive(ngl, FALSE);
+ connected_set_sensitive(ngl, FALSE);
#endif
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "players_treeview"));
+ list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_BOOLEAN);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml,"players_treeview");
- list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_BOOLEAN);
+ column = gtk_tree_view_column_new_with_attributes(_("_Player name"),gtk_cell_renderer_text_new(),
+ "text",0, (char *)NULL);
- column = gtk_tree_view_column_new_with_attributes(_("_Player name"),gtk_cell_renderer_text_new(),
- "text",0, (char *)NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ column = gtk_tree_view_column_new();
- column = gtk_tree_view_column_new();
+ column = gtk_tree_view_column_new_with_attributes(_("_Owner"),gtk_cell_renderer_toggle_new(),
+ "active",1, (char *)NULL);
- column = gtk_tree_view_column_new_with_attributes(_("_Owner"),gtk_cell_renderer_toggle_new(),
- "active",1, (char *)NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ column = gtk_tree_view_column_new();
- column = gtk_tree_view_column_new();
+ column = gtk_tree_view_column_new_with_attributes(_("_Ready"),gtk_cell_renderer_toggle_new(),
+ "active",2, (char *)NULL);
- column = gtk_tree_view_column_new_with_attributes(_("_Ready"),gtk_cell_renderer_toggle_new(),
- "active",2, (char *)NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ gtk_tree_view_set_model( GTK_TREE_VIEW(item), GTK_TREE_MODEL(list));
- gtk_tree_view_set_model( GTK_TREE_VIEW(item), GTK_TREE_MODEL(list));
-
- PRIVATE(ngl)->players_list = list;
+ PRIVATE(ngl)->players_list = list;
#ifdef MAEMO
- gtk_widget_show_all(GTK_WIDGET(PRIVATE(ngl)->window));
+ gtk_widget_show_all(GTK_WIDGET(PRIVATE(ngl)->window));
#endif
-
- return ngl;
-
-}
+ return ngl;
+}
struct StatusJob {
UiNetworkClient * self;
@@ -266,18 +280,20 @@ connect_server_signal (gpointer callback_data,
GtkWidget* widget)
{
UiNetworkClient* self = UI_NETWORK_CLIENT (callback_data);
- GtkWidget * combo = glade_xml_get_widget (PRIVATE (self)->glade_xml, "comboboxentry1");
+ GtkWidget * combo = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "comboboxentry1"));
- g_free(PRIVATE (self)->server_name);
+ g_free (PRIVATE (self)->server_name);
PRIVATE(self)->server_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
+ /* FIXME: check for leak */
set_status_message (self, g_strdup_printf("Connecting to %s...", PRIVATE (self)->server_name));
- set_sensitive (glade_xml_get_widget (PRIVATE(self)->glade_xml, "connect_hbox"),FALSE);
- if(!connect_server(self))
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connect_hbox")), FALSE);
+ if (!connect_server(self))
{
- set_status_message(self, g_strdup_printf ("Can't connect to %s.", PRIVATE (self)->server_name));
- set_sensitive (glade_xml_get_widget (PRIVATE (self)->glade_xml, "connect_hbox"),TRUE);
+ /* FIXME: check for leak */
+ set_status_message (self, g_strdup_printf ("Can't connect to %s.", PRIVATE (self)->server_name));
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connect_hbox")), TRUE);
}
}
@@ -299,26 +315,22 @@ static void send_disconnect(UiNetworkClient * self) {
}
-static void disconnected(UiNetworkClient * self) {
- g_object_unref( PRIVATE(self)->manager_proxy);
-
- PRIVATE(self)->manager_proxy = NULL;
-
- update_players_list(self);
+static void
+disconnected (UiNetworkClient* self)
+{
+ g_object_unref (PRIVATE (self)->manager_proxy);
+ PRIVATE (self)->manager_proxy = NULL;
+
+ update_players_list (self);
#ifdef GNOME
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connected_game_hbox"),FALSE);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connected_game_hbox")), FALSE);
#endif
#ifdef MAEMO
- connected_set_sensitive(self, FALSE);
+ connected_set_sensitive(self, FALSE);
#endif
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connect_hbox"),TRUE);
-
-}
-
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE(self)->builder, "connect_hbox")), TRUE);
+}
static gboolean quit_signal(gpointer callback_data,
guint callback_action,
@@ -354,81 +366,61 @@ static gboolean quit_signal(gpointer callback_data,
}
-static gboolean quit_server_signal(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget) {
+static gboolean
+quit_server_signal (gpointer callback_data,
+ guint callback_action,
+ GtkWidget* widget)
+{
+ UiNetworkClient * self = UI_NETWORK_CLIENT(callback_data);
- UiNetworkClient * self;
+ if (PRIVATE (self)->manager_proxy)
+ {
+ g_object_unref (PRIVATE (self)->manager_proxy);
+ PRIVATE (self)->manager_proxy = NULL;
+ }
- self = UI_NETWORK_CLIENT(callback_data);
- if( PRIVATE(self)->manager_proxy != NULL) {
- g_object_unref( PRIVATE(self)->manager_proxy);
-
- PRIVATE(self)->manager_proxy = NULL;
- }
-
+ if (PRIVATE (self)->handler)
+ {
+ send_disconnect (self);
- if( PRIVATE(self)->handler != NULL) {
- send_disconnect(self);
-
- network_message_handler_disconnect(PRIVATE(self)->handler);
-
-
- g_object_unref( PRIVATE(self)->handler);
- PRIVATE(self)->handler = NULL;
-
- }
-
+ network_message_handler_disconnect (PRIVATE (self)->handler);
- update_players_list(self);
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connect_hbox"),TRUE);
+ g_object_unref (PRIVATE (self)->handler);
+ PRIVATE (self)->handler = NULL;
+ }
+
+ update_players_list(self);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connect_hbox")), TRUE);
#ifdef GNOME
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connected_game_hbox"),FALSE);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connected_game_hbox")), FALSE);
#endif
#ifdef MAEMO
- connected_set_sensitive(self, FALSE);
+ connected_set_sensitive(self, FALSE);
#endif
-
- return FALSE;
-}
-
-
-
-static void ready_signal(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget) {
-
-
- UiNetworkClient * self;
- GtkWidget * item;
-
- self = UI_NETWORK_CLIENT(callback_data);
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "ready_button");
+ return FALSE;
+}
- if( ! PRIVATE(self)->ready ) {
- net_game_manager_proxy_send_ready_state(PRIVATE(self)->manager_proxy,
- TRUE);
- PRIVATE(self)->ready = TRUE;
- } else {
+static void
+ready_signal (gpointer callback_data,
+ guint callback_action,
+ GtkWidget* widget)
+{
+ UiNetworkClient* self = UI_NETWORK_CLIENT (callback_data);
+ GtkWidget * item;
+ gboolean ready;
- net_game_manager_proxy_send_ready_state(PRIVATE(self)->manager_proxy,
- FALSE);
-
- PRIVATE(self)->ready = FALSE;
-
- }
- net_game_manager_proxy_send_start( PRIVATE(self)->manager_proxy);
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "ready_button"));
+ ready = PRIVATE(self)->ready;
+ net_game_manager_proxy_send_ready_state (PRIVATE (self)->manager_proxy, !ready);
+ PRIVATE (self)->ready = !ready;
+ net_game_manager_proxy_send_start( PRIVATE(self)->manager_proxy);
}
-
void send_init(UiNetworkClient * self) {
xmlDoc * doc;
xmlNode * current, * root;
@@ -551,16 +543,18 @@ game_created(NetGameManagerProxy * proxy,
static gboolean
-update_number_of_players_idle(gpointer data)
+update_number_of_players_idle (gpointer data)
{
- UiNetworkClient * self;
- GtkWidget * item;
+ UiNetworkClient* self = UI_NETWORK_CLIENT(data);
+ GtkWidget * item;
+ gchar * label;
- self = UI_NETWORK_CLIENT(data);
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "number_of_players");
- gtk_label_set_label(GTK_LABEL(item),g_strdup_printf("%d", net_game_manager_proxy_get_number_of_players(PRIVATE(self)->manager_proxy)));
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "number_of_players"));
+ label = g_strdup_printf("%d", net_game_manager_proxy_get_number_of_players (PRIVATE (self)->manager_proxy));
+ gtk_label_set_label (GTK_LABEL(item), label);
+ g_free (label);
- return FALSE;
+ return FALSE;
}
static void
@@ -580,16 +574,18 @@ number_of_players_changed(NetGameManagerProxy * proxy,
static gboolean
-update_number_of_games_idle(gpointer data)
+update_number_of_games_idle (gpointer data)
{
- UiNetworkClient * self;
- GtkWidget * item;
+ UiNetworkClient* self = UI_NETWORK_CLIENT(data);
+ GtkWidget * item;
+ gchar * label;
- self = UI_NETWORK_CLIENT(data);
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "number_of_games");
- gtk_label_set_label(GTK_LABEL(item),g_strdup_printf("%d", net_game_manager_proxy_get_number_of_games(PRIVATE(self)->manager_proxy)));
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "number_of_games"));
+ label = g_strdup_printf("%d", net_game_manager_proxy_get_number_of_games(PRIVATE(self)->manager_proxy));
+ gtk_label_set_label (GTK_LABEL (item), label);
+ g_free (label);
- return FALSE;
+ return FALSE;
}
static void
@@ -669,10 +665,9 @@ void recv_network_xml_message(NetworkMessageHandler * mmh,
} else {
g_print("init not ok!!");
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connect_hbox"),TRUE);
-
+
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connect_hbox")),
+ TRUE);
set_status_message(self,"Not ok");
}
} else if(g_str_equal(message_name,"game_joined")) {
@@ -683,11 +678,11 @@ void recv_network_xml_message(NetworkMessageHandler * mmh,
sscanf((gchar*)root->children->content,"%d",&game_id);
g_print("game id : %d\n",game_id);
#ifdef GNOME
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- ,"connected_game_hbox"),TRUE);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connected_game_hbox")),
+ TRUE);
#endif
#ifdef MAEMO
- connected_set_sensitive(self, TRUE);
+ connected_set_sensitive(self, TRUE);
#endif
sscanf((gchar*)root->children->content,"%d",&game_id);
@@ -705,15 +700,11 @@ void recv_network_xml_message(NetworkMessageHandler * mmh,
} else if( g_str_equal( message_name,"cant_join_game")) {
set_status_message(self, "Can't join the game");
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "connect_hbox"),TRUE);
-
-
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "connect_hbox")),
+ TRUE);
}
-
xmlFree(message_name);
-
}
gboolean set_sensitive_true_idle(gpointer data) {
diff --git a/src/ui/ui-network-server.c b/src/ui/ui-network-server.c
index 0edb0d6..b5e1f18 100644
--- a/src/ui/ui-network-server.c
+++ b/src/ui/ui-network-server.c
@@ -32,7 +32,6 @@
#include <time.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <glib/gi18n.h>
#include "message-handler.h"
@@ -43,23 +42,22 @@
#include "ui-main.h"
#include "game-manager-proxy.h"
-struct UiNetworkServerPrivate {
- GladeXML * glade_xml;
- GtkWidget * window;
- gchar * server_name;
- NetworkMessageHandler * handler;
- int client_id;
- gboolean ready;
- GtkLabel * connection_label;
- GtkListStore * players_list;
- NetworkSimpleServer * manager;
- NetGameManagerProxy * manager_proxy;
- gboolean np_from_server;
- gboolean ng_from_server;
+struct UiNetworkServerPrivate
+{
+ GtkBuilder * builder;
+ GtkWidget * window;
+ gchar * server_name;
+ NetworkMessageHandler* handler;
+ int client_id;
+ gboolean ready;
+ GtkLabel * connection_label;
+ GtkListStore * players_list;
+ NetworkSimpleServer * manager;
+ NetGameManagerProxy * manager_proxy;
+ gboolean np_from_server;
+ gboolean ng_from_server;
};
-
-
#define PRIVATE( UiNetworkServer ) (UiNetworkServer->private)
static GObjectClass* parent_class = NULL;
@@ -117,87 +115,93 @@ static void set_number_of_players(UiNetworkServer * self,
G_DEFINE_TYPE (UiNetworkServer, ui_network_server, G_TYPE_OBJECT);
UiNetworkServer*
-ui_network_server_new(NetworkSimpleServer * server)
+ui_network_server_new (NetworkSimpleServer* server)
{
- UiNetworkServer * ngl;
- GtkWidget * item;
+ GtkTreeViewColumn* column;
+ UiNetworkServer * ngl;
+ GtkListStore * list;
+ GtkWidget * item;
+ GError * error = NULL;
+ gchar * objects[] =
+ {
+ "network_window",
+ NULL
+ };
- GtkTreeViewColumn * column;
- GtkListStore * list;
+ ngl = UI_NETWORK_SERVER(g_object_new(TYPE_UI_NETWORK_SERVER,
+ NULL));
- ngl = UI_NETWORK_SERVER(g_object_new(TYPE_UI_NETWORK_SERVER,
- NULL));
+ PRIVATE(ngl)->manager = server;
+ PRIVATE(ngl)->server_name = NULL;
- PRIVATE(ngl)->manager = server;
- PRIVATE(ngl)->server_name = NULL;
+ PRIVATE(ngl)->ready = FALSE;
- PRIVATE(ngl)->ready = FALSE;
+ PRIVATE(ngl)->builder = gtk_builder_new ();
+ if (0 == gtk_builder_add_objects_from_file (PRIVATE (ngl)->builder, DATADIR "/monkey-bubble/glade/netserver.ui", objects, &error))
+ {
+ g_warning ("error loading UI for network game server%c %s",
+ error ? ':' : '\0',
+ error ? error->message : "");
+ g_error_free (error);
+ g_object_unref (ngl);
- PRIVATE(ngl)->glade_xml = glade_xml_new(DATADIR"/monkey-bubble/glade/netserver.glade","network_window",NULL);
-
- PRIVATE(ngl)->window = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "network_window");
+ return NULL;
+ }
-
+ PRIVATE (ngl)->window = GTK_WIDGET (gtk_builder_get_object (PRIVATE (ngl)->builder, "network_window"));
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder, "quit_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(quit_server_signal),ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "quit_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(quit_server_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder, "network_window"));
+ g_signal_connect_swapped( item,"delete-event",GTK_SIGNAL_FUNC(quit_signal),ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "network_window");
- g_signal_connect_swapped( item,"delete-event",GTK_SIGNAL_FUNC(quit_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder, "ready_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(ready_signal),ngl);
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder, "start_button"));
+ g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(start_signal),ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "ready_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(ready_signal),ngl);
-
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml, "start_button");
- g_signal_connect_swapped( item,"clicked",GTK_SIGNAL_FUNC(start_signal),ngl);
-
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder,"players_treeview"));
+ list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_BOOLEAN);
+ column = gtk_tree_view_column_new_with_attributes(_("_Player name"),gtk_cell_renderer_text_new(),
+ "text",0, (char *)NULL);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml,"players_treeview");
- list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_BOOLEAN);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- column = gtk_tree_view_column_new_with_attributes(_("_Player name"),gtk_cell_renderer_text_new(),
- "text",0, (char *)NULL);
+ column = gtk_tree_view_column_new();
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ column = gtk_tree_view_column_new_with_attributes(_("_Owner"),gtk_cell_renderer_toggle_new(),
+ "active",1, (char *)NULL);
- column = gtk_tree_view_column_new();
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- column = gtk_tree_view_column_new_with_attributes(_("_Owner"),gtk_cell_renderer_toggle_new(),
- "active",1, (char *)NULL);
+ column = gtk_tree_view_column_new();
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ column = gtk_tree_view_column_new_with_attributes(_("_Ready"),gtk_cell_renderer_toggle_new(),
+ "active",2, (char *)NULL);
- column = gtk_tree_view_column_new();
+ gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
- column = gtk_tree_view_column_new_with_attributes(_("_Ready"),gtk_cell_renderer_toggle_new(),
- "active",2, (char *)NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (item), column);
+ gtk_tree_view_set_model( GTK_TREE_VIEW(item), GTK_TREE_MODEL(list));
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder,"number_of_players"));
+ g_signal_connect_swapped( item, "value_changed", GTK_SIGNAL_FUNC(number_of_players_changed),
+ ngl);
- gtk_tree_view_set_model( GTK_TREE_VIEW(item), GTK_TREE_MODEL(list));
+ item = GTK_WIDGET (gtk_builder_get_object ( PRIVATE(ngl)->builder,"number_of_games"));
+ g_signal_connect_swapped( item, "value_changed", GTK_SIGNAL_FUNC(number_of_games_changed),
+ ngl);
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml,"number_of_players");
- g_signal_connect_swapped( item, "value_changed", GTK_SIGNAL_FUNC(number_of_players_changed),
- ngl);
+ PRIVATE(ngl)->players_list = list;
+ PRIVATE(ngl)->server_name = "localhost";
- item = glade_xml_get_widget( PRIVATE(ngl)->glade_xml,"number_of_games");
- g_signal_connect_swapped( item, "value_changed", GTK_SIGNAL_FUNC(number_of_games_changed),
- ngl);
-
- PRIVATE(ngl)->players_list = list;
-
- PRIVATE(ngl)->server_name = "localhost";
-
-
- connect_server(ngl);
+ connect_server(ngl);
- return ngl;
-
+ return ngl;
}
@@ -303,56 +307,31 @@ static void quit_signal(gpointer callback_data,
}
+static void
+ready_signal (gpointer callback_data,
+ guint callback_action,
+ GtkWidget* widget)
+{
+ UiNetworkServer * self = UI_NETWORK_SERVER(callback_data);
+ gboolean ready = PRIVATE (self)->ready;
-static void ready_signal(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget) {
-
-
- UiNetworkServer * self;
- GtkWidget * item;
-
- self = UI_NETWORK_SERVER(callback_data);
-
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "ready_button");
-
- if( ! PRIVATE(self)->ready ) {
- net_game_manager_proxy_send_ready_state(PRIVATE(self)->manager_proxy,
- TRUE);
- PRIVATE(self)->ready = TRUE;
- } else {
-
- net_game_manager_proxy_send_ready_state(PRIVATE(self)->manager_proxy,
- FALSE);
-
- PRIVATE(self)->ready = FALSE;
-
- }
+ net_game_manager_proxy_send_ready_state(PRIVATE(self)->manager_proxy,
+ !ready);
+ PRIVATE (self)->ready = !ready;
}
+static void start_signal(gpointer callback_data,
+ guint callback_action,
+ GtkWidget* widget)
+{
+ UiNetworkServer * self = UI_NETWORK_SERVER(callback_data);
+ net_game_manager_proxy_send_start( PRIVATE(self)->manager_proxy);
-static void start_signal(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget) {
-
-
- UiNetworkServer * self;
-
- self = UI_NETWORK_SERVER(callback_data);
-
- net_game_manager_proxy_send_start( PRIVATE(self)->manager_proxy);
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "start_button"),FALSE);
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "quit_button"),FALSE);
-
- set_sensitive( glade_xml_get_widget( PRIVATE(self)->glade_xml
- , "ready_button"),FALSE);
-
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "start_button")), FALSE);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "quit_button")), FALSE);
+ set_sensitive (GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "ready_button")), FALSE);
}
@@ -466,19 +445,20 @@ players_list_updated(NetGameManagerProxy * proxy,
static gboolean
-update_number_of_players_idle(gpointer data)
+update_number_of_players_idle (gpointer data)
{
- UiNetworkServer * self;
- GtkWidget * item;
+ UiNetworkServer* self = UI_NETWORK_SERVER(data);
+ GtkWidget * item;
- self = UI_NETWORK_SERVER(data);
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "number_of_players");
- PRIVATE(self)->np_from_server = TRUE;
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON(item),
- net_game_manager_proxy_get_number_of_players(PRIVATE(self)->manager_proxy));
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "number_of_players"));
- PRIVATE(self)->np_from_server = FALSE;
- return FALSE;
+ /* FIXME: this looks like a replacement for g_signal_handler_block() */
+ PRIVATE (self)->np_from_server = TRUE;
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (item),
+ net_game_manager_proxy_get_number_of_players (PRIVATE (self)->manager_proxy));
+
+ PRIVATE (self)->np_from_server = FALSE;
+ return FALSE;
}
static void
@@ -497,19 +477,18 @@ net_number_of_players_changed(NetGameManagerProxy * proxy,
static gboolean
-update_number_of_games_idle(gpointer data)
+update_number_of_games_idle (gpointer data)
{
- UiNetworkServer * self;
- GtkWidget * item;
-
- self = UI_NETWORK_SERVER(data);
- item = glade_xml_get_widget( PRIVATE(self)->glade_xml, "number_of_games");
- PRIVATE(self)->ng_from_server = TRUE;
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON(item),
- net_game_manager_proxy_get_number_of_games(PRIVATE(self)->manager_proxy));
-
- PRIVATE(self)->ng_from_server = FALSE;
- return FALSE;
+ UiNetworkServer* self = UI_NETWORK_SERVER(data);
+ GtkWidget * item;
+
+ item = GTK_WIDGET (gtk_builder_get_object (PRIVATE (self)->builder, "number_of_games"));
+ /* FIXME: this looks like a replacement for g_signal_handler_block() */
+ PRIVATE (self)->ng_from_server = TRUE;
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (item),
+ net_game_manager_proxy_get_number_of_games (PRIVATE (self)->manager_proxy));
+ PRIVATE (self)->ng_from_server = FALSE;
+ return FALSE;
}
static void
@@ -731,3 +710,4 @@ static void ui_network_server_class_init (UiNetworkServerClass *klass) {
object_class->finalize = ui_network_server_finalize;
}
+/* vim:set et sw=2 cino=t0,f0,(0,{s,>2s,n-1s,^-1s,e2s: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]