]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Port to GConf, sound fixed
authorDaniel Carbonell Fraj <bocata@src.gnome.org>
Sat, 1 Feb 2003 12:54:28 +0000 (12:54 +0000)
committerDaniel Carbonell Fraj <bocata@src.gnome.org>
Sat, 1 Feb 2003 12:54:28 +0000 (12:54 +0000)
.cvsignore
ChangeLog
TODO
gtetrinet.schemas.in [new file with mode: 0644]
src/config.c
src/config.h
src/dialogs.c
src/gtetrinet.c
src/sound.c
src/tetrinet.c
src/tetrinet.h

index ce3f79d3ebc75f6357846da922ab08aae00867a5..0c33b0fba1aad2e817b6fe7abc5f46a19332409d 100644 (file)
@@ -25,3 +25,5 @@ intltool-update
 missing
 mkinstalldirs
 stamp-h1
+stamp-h
+stamp-h.in
\ No newline at end of file
index fea216db862912cbd50dc4c6b3b47bfb9e60638d..aeb9a8831dcf06acf88270128d2607cdb45b445d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2003-02-01  Dani Carbonell  <bocata@panete.net>
+
+       * gtetrinet.schemas.in: first version of the .schemas file.
+       * config.h: a few prototype fixes, and add the handlers for the
+       GConf keys.
+       * config.c: ported to GConf, changed default keys to lowercase, and
+       a few function prototype fixes.
+       (config_loadtheme): prototype fix.
+       (config_loadconfig): ported to GConf.
+       (config_saveconfig): nuked, no longer needed.
+       (load_theme): new function, designed to load a theme "in the fly".
+       (sound_midi_player_changed): new function, it will handle the
+       changes made to the /apps/gtetrinet/sound/midi_player key.
+       (sound_enable_sound_changed): new function, it will handle the
+       changes made to the /apps/gtetrinet/sound/enable_sound key.
+       (sound_enable_midi_changed): new function, it will handle the
+       changes made to the /apps/gtetrinet/sound/enable_midi key.
+       (themes_theme_dir_changed): new function, it will handle the
+       changes made to the /apps/gtetrinet/themes/theme_dir key.
+       * dialogs.c: ported to GConf, and few UI improvements in the
+       dialogs.
+       (teamdialog_button): now it behaves as a gtk_dialog.
+       (teamdialog_new): changed to gtk_dialog.
+       (connectdialog_button): now it behaves as a gtk_dialog, it also
+       saves the server, nickname and team to GConf.
+       (connectdialog_new): changed to gtk_dialog.
+       (key_dialog): changed to gtk_dialog.
+       (key_dialog_callback): cleaned a bit.
+       (prefdialog_drawkeys): added a convenience array, it will make
+       easier the GConf operations later.
+       (prefdialog_clistupdate): now it saves the changes in GConf.
+       (prefdialog_restorekeys): it now operates directly into the main keys
+       array.
+       (prefdialog_changekeys): likewise.
+       (prefdialog_soundtoggle): now it instantly saves the change in
+       GConf.
+       (prefdialog_miditoggle): likewise.
+       (prefdialog_midichanged): likewise.
+       (prefdialog_restoremidi): likewise.
+       (prefdialog_themelistselect): likewise.
+       (prefdialog_themeselect): cleaned a bit.
+       (prefdialog_apply): nuked, no longer needed.
+       (prefdialog_ok): also nuked.
+       (prefdialog_response): new function, now prefdialog behave as a
+       gtk_dialog.
+       (prefdialog_new): changed to gtk_dialog, removed the OK and Apply
+       buttons, also nuked that ugly frame.
+       * gtetrinet.c: ported to GConf.
+       (main): initialize all the GConf stuff. Add notifications and so.
+       Also, it's no longer needed to save the configuration on quit.
+       * sound.c: now it works. Really. config.h was never included, so
+       HAVE_ESD was always undefined, so no sound. Cool.
+       (sound_cache): ported to the new gnome_sound* functions.
+       (sound_playsound): now it plays the sound from cache, a lot faster.
+
 2003-01-29  Jordi Mallach  <jordi@sindominio.net>
 
        * gtetrinet.desktop.in: adde StartupNotify support.
diff --git a/TODO b/TODO
index 30d0b958a2e4358e51ee66d65d106b041485ed13..89d46cb069468b02f1e1ffc2e7fe387bc2356150 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,7 +3,6 @@ GTetrinet's TODO list
 
 - Get server list from http://www.tetrinet.org/ip/
 - GNOME2 port issues:
-  + preferences dialog (gconf)
   + keybindings
   + port deprecated widgets (-DGTK_DISABLE_DEPRECATED)
   + detaching and reattaching the Menu Bar causes two Bonobo-CRITICAL
diff --git a/gtetrinet.schemas.in b/gtetrinet.schemas.in
new file mode 100644 (file)
index 0000000..d279b32
--- /dev/null
@@ -0,0 +1,233 @@
+<gconfschemafile>
+  <schemalist>
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/themes/theme_dir</key>
+      <applyto>/apps/gtetrinet/themes/theme_dir</applyto>
+      <owner>gtetrinet</owner>
+      <type>string</type>
+      <default></default>
+      
+      <locale name="C">
+        <short>Theme directory, should end with a '/'</short>
+        <long>This is the current theme directory. It should contain a readable
+        "blocks.png" and a "theme.cfg".</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/sound/midi_player</key>
+      <applyto>/apps/gtetrinet/sound/midi_player</applyto>
+      <owner>gtetrinet</owner>
+      <type>string</type>
+      <default>while true; do playmidi $MIDIFILE; done</default>
+      
+      <locale name="C">
+        <short>Command to run then a midi file is to be played.</short>
+        <long>This command is run when a midi file is to be played. The name of
+        the midi file is placed in the environment variable MIDIFILE.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/sound/enable_sound</key>
+      <applyto>/apps/gtetrinet/sound/enable_sound</applyto>
+      <owner>gtetrinet</owner>
+      <type>bool</type>
+      <default>0</default>
+      
+      <locale name="C">
+        <short>Check this if you want sound.</short>
+        <long>If you want sound, check this option. Keep in mind that the theme
+        that you're using must provide sounds.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/sound/enable_midi</key>
+      <applyto>/apps/gtetrinet/sound/enable_midi</applyto>
+      <owner>gtetrinet</owner>
+      <type>bool</type>
+      <default>0</default>
+      
+      <locale name="C">
+        <short>Check if you want midi music.</short>
+        <long>If you want midi music, check this option. You'll need to enable
+        sound if you want music to work.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/sound/enable_midi</key>
+      <applyto>/apps/gtetrinet/sound/enable_midi</applyto>
+      <owner>gtetrinet</owner>
+      <type>bool</type>
+      <default>0</default>
+      
+      <locale name="C">
+        <short>Check if you want midi music.</short>
+        <long>If you want midi music, check this option. You'll need to enable
+        sound if you want music to work :)</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/player/nickname</key>
+      <applyto>/apps/gtetrinet/player/nickname</applyto>
+      <owner>gtetrinet</owner>
+      <type>string</type>
+      <default></default>
+      
+      <locale name="C">
+        <short>Your nickname.</short>
+        <long>This will be your nickname in the game. Choose it wisely.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/player/server</key>
+      <applyto>/apps/gtetrinet/player/server</applyto>
+      <owner>gtetrinet</owner>
+      <type>string</type>
+      <default>tetrinet.org</default>
+      
+      <locale name="C">
+        <short>Server where you want to play.</short>
+        <long>This will be the server where GTetrinet will try to connect.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/player/team</key>
+      <applyto>/apps/gtetrinet/player/team</applyto>
+      <owner>gtetrinet</owner>
+      <type>string</type>
+      <default></default>
+      
+      <locale name="C">
+        <short>Your team.</short>
+        <long>This will be the name of your team. Choose it wisely.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/right</key>
+      <applyto>/apps/gtetrinet/keys/right</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>65363</default>
+      
+      <locale name="C">
+        <short>Key to move right.</short>
+        <long>If you press this key, the current piece will move to the right. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/left</key>
+      <applyto>/apps/gtetrinet/keys/left</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>65361</default>
+      
+      <locale name="C">
+        <short>Key to move left.</short>
+        <long>If you press this key, the current piece will move to the left. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/rotate_right</key>
+      <applyto>/apps/gtetrinet/keys/rotate_right</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>65362</default>
+      
+      <locale name="C">
+        <short>Key to rotate clockwise.</short>
+        <long>If you press this key, the current piece will rotate clockwise. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/rotate_left</key>
+      <applyto>/apps/gtetrinet/keys/rotate_left</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>65508</default>
+      
+      <locale name="C">
+        <short>Key to rotate counterclockwise.</short>
+        <long>If you press this key, the current piece will rotate counterclockwise. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/down</key>
+      <applyto>/apps/gtetrinet/keys/down</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>65364</default>
+      
+      <locale name="C">
+        <short>Key to move down.</short>
+        <long>If you press this key, the current piece will move down. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/drop</key>
+      <applyto>/apps/gtetrinet/keys/drop</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>32</default>
+      
+      <locale name="C">
+        <short>Key to drop piece.</short>
+        <long>If you press this key, the current piece will drop to the ground. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/discard</key>
+      <applyto>/apps/gtetrinet/keys/discard</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>100</default>
+      
+      <locale name="C">
+        <short>Key to discard special.</short>
+        <long>If you press this key, the current special will be discarded. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+    
+    <schema>
+      <key>/schemas/apps/gtetrinet/keys/message</key>
+      <applyto>/apps/gtetrinet/keys/message</applyto>
+      <owner>gtetrinet</owner>
+      <type>int</type>
+      <default>116</default>
+      
+      <locale name="C">
+        <short>Key to open the message box.</short>
+        <long>If you press this key, the message box will be displayed. This is case insensitive.</long>
+      </locale>
+    </schema>
+    
+  </schemalist>
+</gconfschemafile>
index cbd98f56df51c5ec9f0c3f533702d980940559d4..c7b9c1f9b9b411f2edaafae44b02cd2b423554d8 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <gtk/gtk.h>
 #include <gnome.h>
+#include <gconf/gconf-client.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include "tetrinet.h"
 #include "sound.h"
 #include "misc.h"
+#include "tetris.h"
+#include "fields.h"
 
 char blocksfile[1024];
 int bsize;
 
 char currenttheme[1024];
 
+extern GConfClient *gconf_client;
+
 static char *soundkeys[S_NUM] = {
     "Sounds/Drop",
     "Sounds/Solidify",
@@ -59,14 +64,14 @@ guint defaultkeys[K_NUM] = {
     GDK_Control_R,
     GDK_Down,
     GDK_space,
-    GDK_D,
-    GDK_T
+    GDK_d,
+    GDK_t
 };
 
 guint keys[K_NUM];
 
 /* themedir is assumed to have a trailing slash */
-void config_loadtheme (char *themedir)
+void config_loadtheme (const gchar *themedir)
 {
     char buf[1024], *p;
     int i;
@@ -155,14 +160,18 @@ int config_getthemeinfo (char *themedir, char *name, char *author, char *desc)
 
 void config_loadconfig (void)
 {
-    char *p;
     unsigned int k;
     int l;
+    gchar *p;
     
-
-    gnome_config_push_prefix ("/"APPID"/");
-
-    p = gnome_config_get_string ("Themes/ThemeDir="DEFAULTTHEME);
+    /* get the current theme */
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/themes/theme_dir", NULL);
+    /* if there is no theme configured, then we fallback to DEFAULTTHEME */
+    if (strlen (p) == 0) 
+    {
+      g_free (p);
+      p = g_strdup (DEFAULTTHEME);
+    }
     GTET_O_STRCPY(currenttheme, p);
     g_free (p);
     /* add trailing slash if none exists */
@@ -171,76 +180,118 @@ void config_loadconfig (void)
       GTET_O_STRCAT(currenttheme, "/");
     }
 
-    p = gnome_config_get_string ("Sound/MidiPlayer="DEFAULTMIDICMD);
+    /* get the midi player */
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/sound/midi_player", NULL);
     GTET_O_STRCPY(midicmd, p);
     g_free (p);
 
-    soundenable = gnome_config_get_int ("Sound/EnableSound=1");
-    midienable = gnome_config_get_int ("Sound/EnableMidi=1");
+    /* get the other sound options */
+    soundenable = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/sound/enable_sound", NULL);
+    midienable  = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/sound/enable_midi",  NULL);
 
-    p = gnome_config_get_string ("Player/Nickname");
+    /* get the player nickname */
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/player/nickname", NULL);
     if (p) {
         GTET_O_STRCPY(nick, p);
         g_free(p);
     }
 
-    p = gnome_config_get_string ("Player/Server");
+    /* get the server name */
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/player/server", NULL);
     if (p) {
         GTET_O_STRCPY(server, p);
         g_free(p);
     }
 
-    p = gnome_config_get_string ("Player/Team");
+    /* get the team name */
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/player/team", NULL);
     if (p) {
         GTET_O_STRCPY(team, p);
         g_free(p);
     }
 
-    k = gnome_config_get_int ("Keys/Right");
+    /* get the keys */
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/right", NULL);
     keys[K_RIGHT] = gdk_keyval_to_lower (k ? k : defaultkeys[K_RIGHT]);
-    k = gnome_config_get_int ("Keys/Left");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/left", NULL);
     keys[K_LEFT] = gdk_keyval_to_lower (k ? k : defaultkeys[K_LEFT]);
-    k = gnome_config_get_int ("Keys/RotateRight");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/rotate_right", NULL);
     keys[K_ROTRIGHT] = gdk_keyval_to_lower (k ? k : defaultkeys[K_ROTRIGHT]);
-    k = gnome_config_get_int ("Keys/RotateLeft");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/rotate_left", NULL);
     keys[K_ROTLEFT] = gdk_keyval_to_lower (k ? k : defaultkeys[K_ROTLEFT]);
-    k = gnome_config_get_int ("Keys/Down");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/down", NULL);
     keys[K_DOWN] = gdk_keyval_to_lower (k ? k : defaultkeys[K_DOWN]);
-    k = gnome_config_get_int ("Keys/Drop");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/drop", NULL);
     keys[K_DROP] = gdk_keyval_to_lower (k ? k : defaultkeys[K_DROP]);
-    k = gnome_config_get_int ("Keys/Discard");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/discard", NULL);
     keys[K_DISCARD] = gdk_keyval_to_lower (k ? k : defaultkeys[K_DISCARD]);
-    k = gnome_config_get_int ("Keys/Message");
+    k = gconf_client_get_int (gconf_client, "/apps/gtetrinet/keys/message", NULL);
     keys[K_GAMEMSG] = gdk_keyval_to_lower (k ? k : defaultkeys[K_GAMEMSG]);
 
-    gnome_config_pop_prefix ();
-
     config_loadtheme (currenttheme);
 }
 
-void config_saveconfig (void)
+void load_theme (const gchar *theme_dir)
 {
-    gnome_config_push_prefix ("/"APPID"/");
-
-    gnome_config_set_string ("Themes/ThemeDir", currenttheme);
+  /* load the theme */
+  GTET_O_STRCPY (currenttheme, theme_dir);
+  config_loadtheme (theme_dir);
+
+  /* update the fields */
+  fields_page_destroy_contents ();
+  fields_cleanup ();
+  fields_init ();
+  fields_page_new ();
+  fieldslabelupdate();
+  if (ingame)
+  {
+    sound_stopmidi ();
+    sound_playmidi (midifile);
+    tetrinet_redrawfields ();
+  }
+}
 
-    gnome_config_set_string ("Sound/MidiPlayer", midicmd);
-    gnome_config_set_int ("Sound/EnableSound", soundenable);
-    gnome_config_set_int ("Sound/EnableMidi", midienable);
+void
+sound_midi_player_changed (GConfClient *client,
+                           guint cnxn_id,
+                           GConfEntry *entry,
+                           gpointer user_data)
+{
+  GTET_O_STRCPY (midicmd, gconf_value_get_string (gconf_entry_get_value (entry)));
+  if (ingame)
+  {
+    sound_stopmidi ();
+    sound_playmidi (midifile);
+  }
+}
 
-    gnome_config_set_string ("Player/Nickname", nick);
-    gnome_config_set_string ("Player/Server", server);
-    gnome_config_set_string ("Player/Team", team);
+void
+sound_enable_sound_changed (GConfClient *client,
+                            guint cnxn_id,
+                            GConfEntry *entry,
+                            gpointer user_data)
+{
+  soundenable = gconf_value_get_bool (gconf_entry_get_value (entry));
+  if (!soundenable)
+    gconf_client_set_bool (gconf_client, "/apps/gtetrinet/sound/enable_midi", FALSE, NULL);
+}
 
-    gnome_config_set_int ("Keys/Right", keys[K_RIGHT]);
-    gnome_config_set_int ("Keys/Left", keys[K_LEFT]);
-    gnome_config_set_int ("Keys/RotateRight", keys[K_ROTRIGHT]);
-    gnome_config_set_int ("Keys/RotateLeft", keys[K_ROTLEFT]);
-    gnome_config_set_int ("Keys/Down", keys[K_DOWN]);
-    gnome_config_set_int ("Keys/Drop", keys[K_DROP]);
-    gnome_config_set_int ("Keys/Discard", keys[K_DISCARD]);
-    gnome_config_set_int ("Keys/Message", keys[K_GAMEMSG]);
+void
+sound_enable_midi_changed (GConfClient *client,
+                           guint cnxn_id,
+                           GConfEntry *entry,
+                           gpointer user_data)
+{
+  midienable = gconf_value_get_bool (gconf_entry_get_value (entry));
+  if (!midienable)
+    sound_stopmidi ();
+}
 
-    gnome_config_pop_prefix ();
-    gnome_config_sync ();
+void
+themes_theme_dir_changed (GConfClient *client,
+                          guint cnxn_id,
+                          GConfEntry *entry,
+                          gpointer user_data)
+{
+  load_theme (gconf_value_get_string (gconf_entry_get_value (entry)));
 }
index b8a2f90ad02ced3154798a5da75087cd2ea6f2fb..2dfb2deebef59b1e44400697fda374a3c4e33dd7 100644 (file)
@@ -1,14 +1,40 @@
+#include <gconf/gconf-client.h>
+
 extern char blocksfile[1024];
 extern int bsize;
-extern char currenttheme[1024];
+extern gchar currenttheme[1024];
 extern guint keys[];
 extern guint defaultkeys[];
 
-extern void config_loadtheme (char *themedir);
+extern void config_loadtheme (const gchar *themedir);
 extern int config_getthemeinfo (char *themedir, char *name, char *author, char *desc);
 extern void config_loadconfig (void);
 extern void config_saveconfig (void);
 
+void
+sound_midi_player_changed (GConfClient *client,
+                           guint cnxn_id,
+                           GConfEntry *entry,
+                           gpointer user_data);
+
+void
+sound_enable_sound_changed (GConfClient *client,
+                            guint cnxn_id,
+                            GConfEntry *entry,
+                            gpointer user_data);
+
+void
+sound_enable_midi_changed (GConfClient *client,
+                           guint cnxn_id,
+                           GConfEntry *entry,
+                           gpointer user_data);
+
+void
+themes_theme_dir_changed (GConfClient *client,
+                          guint cnxn_id,
+                          GConfEntry *entry,
+                          gpointer user_data);
+
 #define GTETRINET_THEMES GTETRINET_DATA"/themes"
 #define DEFAULTTHEME GTETRINET_THEMES"/default/"
 
index c4ba5a28954dc6d941d1831e53215347a2f99458..a99b5006f5a4d6568c47c19a65cc33d35a94009e 100644 (file)
@@ -36,6 +36,8 @@
 #include "keys.h"
 #include "sound.h"
 
+extern GConfClient *gconf_client;
+
 /*****************************************************/
 /* connecting dialog - a dialog with a cancel button */
 /*****************************************************/
@@ -120,23 +122,29 @@ void teamdialog_destroy (void)
     team_dialog = NULL;
 }
 
-void teamdialog_button (GtkWidget *button, gpointer data)
+void teamdialog_button (GtkWidget *button, gint response, gpointer data)
 {
     GtkEntry *entry = GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (data)));
     gchar *aux;
 
     button = button; /* so we get no unused parameter warning */
   
-    aux = g_locale_from_utf8 (gtk_entry_get_text (entry), -1, NULL, NULL, NULL);
-    tetrinet_changeteam (aux);
+    switch (response)
+    {
+      case GTK_RESPONSE_OK :
+      {
+        aux = g_locale_from_utf8 (gtk_entry_get_text (entry), -1, NULL, NULL, NULL);
+        tetrinet_changeteam (aux);
+        g_free (aux);
+      }; break;
+    }
+    
     teamdialog_destroy ();
-    g_free (aux);
 }
 
 void teamdialog_new (void)
 {
-    GtkWidget *hbox, *vbox, *buttonbox, *widget, *entry,
-              *ok_button, *cancel_button;
+    GtkWidget *hbox, *buttonbox, *widget, *entry;
     gchar *team_utf8 = g_locale_to_utf8 (team, -1, NULL, NULL, NULL);
   
     if (team_dialog != NULL)
@@ -145,27 +153,18 @@ void teamdialog_new (void)
       return;
     }
   
-    team_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    gtk_window_set_title (GTK_WINDOW (team_dialog), _("Change team"));
+    team_dialog = gtk_dialog_new_with_buttons (_("Change team"),
+                                               0,
+                                               GTK_DIALOG_NO_SEPARATOR,
+                                               GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE,
+                                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                                               NULL);
+    gtk_dialog_set_default_response (GTK_DIALOG (team_dialog), GTK_RESPONSE_OK);    
     gtk_window_set_position (GTK_WINDOW (team_dialog), GTK_WIN_POS_MOUSE);
     gtk_window_set_resizable (GTK_WINDOW (team_dialog), FALSE);
-    gtk_container_set_border_width (GTK_CONTAINER (team_dialog), 12);
 
-    vbox = gtk_vbox_new (TRUE, 6);
-    gtk_container_add (GTK_CONTAINER (team_dialog), vbox);
-    
-    /* button box*/
-    buttonbox = gtk_hbutton_box_new ();
-    gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonbox), GTK_BUTTONBOX_END);
-    gtk_box_set_spacing (GTK_BOX (buttonbox), 6);
-    cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-    gtk_box_pack_start_defaults (GTK_BOX (buttonbox), cancel_button);
-    ok_button = gtk_button_new_from_stock (GTK_STOCK_OK);
-    gtk_box_pack_start_defaults (GTK_BOX (buttonbox), ok_button);
-    gtk_box_pack_end_defaults (GTK_BOX (vbox), buttonbox);
-    
     /* entry and label */
-    hbox = gtk_hbox_new (FALSE, 6);
+    hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
     widget = gtk_label_new (_("Team name:"));
     gtk_box_pack_start_defaults (GTK_BOX (hbox), widget);
     entry = gnome_entry_new ("Team");
@@ -173,17 +172,14 @@ void teamdialog_new (void)
                         team_utf8);
     g_free (team_utf8);
     gtk_box_pack_start_defaults (GTK_BOX (hbox), entry);
-    gtk_box_pack_end_defaults (GTK_BOX (vbox), hbox);
+    gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
+    gtk_box_pack_end_defaults (GTK_BOX (GTK_DIALOG (team_dialog)->vbox), hbox);
     
     /* pass the entry in the data pointer */
-    g_signal_connect (G_OBJECT(ok_button), "clicked",
+    g_signal_connect (G_OBJECT(team_dialog), "response",
                         GTK_SIGNAL_FUNC(teamdialog_button), (gpointer)entry);
-    g_signal_connect (G_OBJECT(cancel_button), "clicked",
-                        GTK_SIGNAL_FUNC(teamdialog_destroy), NULL);
     g_signal_connect (G_OBJECT(team_dialog), "destroy",
                         GTK_SIGNAL_FUNC(teamdialog_destroy), NULL);
-    GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
-    gtk_widget_grab_default (ok_button);
     gtk_widget_show_all (team_dialog);
 }
 
@@ -200,11 +196,13 @@ static int oldgamemode;
 void connectdialog_button (GnomeDialog *dialog, gint button)
 {
     gchar *team_utf8, *nick; /* intermediate buffer for recoding purposes */
+    const gchar *server1;
 
     switch (button) {
-    case 1:
+    case GTK_RESPONSE_OK:
         /* connect now */
-        if (strlen (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry))))) <= 0)
+        server1 = gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry))));
+        if (strlen (server1) <= 0)
         {
           gnome_error_dialog_parented (_("You must specify a server name."), GTK_WINDOW (dialog));
           return;
@@ -229,14 +227,17 @@ void connectdialog_button (GnomeDialog *dialog, gint button)
                                      -1, NULL, NULL, NULL);
         g_strstrip (nick); /* we remove leading and trailing whitespaces */
         if (strlen (nick) > 0)
-            client_init (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry)))), nick);
+            client_init (server1, nick);
         else
             gnome_error_dialog_parented (_("Please specify a valid nickname."), GTK_WINDOW (dialog));
         
+        gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/server", server1, NULL);
+        gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/nickname", nick, NULL);
+        gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/team", team_utf8, NULL);
         g_free (team_utf8);
         g_free (nick);
         break;
-    case 0:
+    case GTK_RESPONSE_CLOSE:
         gamemode = oldgamemode;
         gtk_widget_destroy (connectdialog);
         break;
@@ -299,12 +300,14 @@ void connectdialog_new (void)
     oldgamemode = gamemode;
 
     /* make dialog that asks for address/nickname */
-    connectdialog = gnome_dialog_new (_("Connect to server"),
-                                      GNOME_STOCK_BUTTON_CANCEL,
-                                      GNOME_STOCK_BUTTON_OK,
-                                      NULL);
-    gnome_dialog_set_default (GNOME_DIALOG(connectdialog), 1);
-    g_signal_connect (G_OBJECT(connectdialog), "clicked",
+    connectdialog = gtk_dialog_new_with_buttons (_("Connect to server"),
+                                                 NULL,
+                                                 GTK_DIALOG_NO_SEPARATOR,
+                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE,
+                                                 GTK_STOCK_OK, GTK_RESPONSE_OK,
+                                                 NULL);
+    gtk_dialog_set_default_response (GTK_DIALOG (connectdialog), GTK_RESPONSE_OK);
+    g_signal_connect (G_OBJECT(connectdialog), "response",
                         GTK_SIGNAL_FUNC(connectdialog_button), NULL);
 
     /* main table */
@@ -420,10 +423,10 @@ void connectdialog_new (void)
 
     gtk_widget_show (table1);
 
-    gtk_box_pack_start (GTK_BOX(GNOME_DIALOG(connectdialog)->vbox),
+    gtk_container_set_border_width (GTK_CONTAINER (table1), GNOME_PAD_SMALL);
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG(connectdialog)->vbox),
                         table1, TRUE, TRUE, 0);
 
-    gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (connectdialog)->action_area), 6);
     gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(spectatorcheck), spectating);
     connectdialog_spectoggle (spectatorcheck);
     g_signal_connect (G_OBJECT(connectdialog), "destroy",
@@ -437,39 +440,43 @@ void connectdialog_new (void)
     gtk_widget_show (connectdialog);
 }
 
+GtkWidget *prefdialog;
+
 /*************************/
 /* the change key dialog */
 /*************************/
-gint keydialog_key;
 
 void key_dialog_callback (GtkWidget *widget, GdkEventKey *key)
 {
-    keydialog_key = gdk_keyval_to_lower(key->keyval);
-    gnome_dialog_close (GNOME_DIALOG(widget));
+    gtk_dialog_response (GTK_DIALOG (widget), gdk_keyval_to_lower(key->keyval));
 }
 
 gint key_dialog (char *msg)
 {
     GtkWidget *dialog, *label;
+    gint keydialog_key;
 
-    dialog = gnome_dialog_new (_("Change Key"), GNOME_STOCK_BUTTON_CANCEL, NULL);
+    dialog = gtk_dialog_new_with_buttons (_("Change Key"), NULL,
+                                          GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
+                                          GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE,
+                                          NULL);
     label = gtk_label_new (msg);
     gtk_widget_show (label);
-    gtk_box_pack_start (GTK_BOX(GNOME_DIALOG(dialog)->vbox),
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                         label, TRUE, TRUE, GNOME_PAD_SMALL);
-    gnome_dialog_set_close (GNOME_DIALOG(dialog), TRUE);
-    g_signal_connect (G_OBJECT(dialog), "key-press-event",
-                        GTK_SIGNAL_FUNC(key_dialog_callback), NULL);
+    g_signal_connect (G_OBJECT (dialog), "key-press-event",
+                        GTK_SIGNAL_FUNC (key_dialog_callback), NULL);
     gtk_widget_set_events (dialog, GDK_KEY_PRESS_MASK);
-    keydialog_key = 0;
-    gnome_dialog_run (GNOME_DIALOG(dialog));
+    keydialog_key = gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_hide (dialog);
+    gtk_widget_destroy (dialog);
     return keydialog_key;
 }
 
 /**************************/
 /* the preferences dialog */
 /**************************/
-GtkWidget *prefdialog, *themelist, *keyclist;
+GtkWidget *themelist, *keyclist;
 GtkWidget *midientry, *miditable, *midicheck, *soundcheck;
 GtkWidget *namelabel, *authlabel, *desclabel;
 
@@ -487,8 +494,6 @@ int actionid[K_NUM] = {
     K_GAMEMSG
 };
 
-guint newkeys[K_NUM];
-
 struct themelistentry {
     char dir[1024];
     char name[1024];
@@ -506,6 +511,7 @@ void prefdialog_destroy (void)
 void prefdialog_drawkeys (void)
 {
     char *array[2];
+    gchar *gconf_keys[K_NUM];
     int i;
     GtkTreeIter iter;
     GtkListStore *keys_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (keyclist)));
@@ -518,16 +524,28 @@ void prefdialog_drawkeys (void)
     actions[5] = _("Drop piece");
     actions[6] = _("Discard special");
     actions[7] = _("Send message");
+  
+    gconf_keys[0] = g_strdup ("/apps/gtetrinet/keys/right");
+    gconf_keys[1] = g_strdup ("/apps/gtetrinet/keys/left");
+    gconf_keys[2] = g_strdup ("/apps/gtetrinet/keys/down");
+    gconf_keys[3] = g_strdup ("/apps/gtetrinet/keys/rotate_right");
+    gconf_keys[4] = g_strdup ("/apps/gtetrinet/keys/rotate_left");
+    gconf_keys[5] = g_strdup ("/apps/gtetrinet/keys/drop");
+    gconf_keys[6] = g_strdup ("/apps/gtetrinet/keys/discard");
+    gconf_keys[7] = g_strdup ("/apps/gtetrinet/keys/message");
 
     for (i = 0; i < K_NUM; i ++) {
         array[0] = actions[i];
-        array[1] = keystr (newkeys[actionid[i]]);
+        array[1] = keystr (keys[actionid[i]]);
         gtk_list_store_append (keys_store, &iter);
         gtk_list_store_set (keys_store, &iter,
                             0, actions[i],
-                            1, keystr (newkeys[actionid[i]]),
-                            2, i, -1);
+                            1, keystr (keys[actionid[i]]),
+                            2, i,
+                            3, gconf_keys[i], -1);
     }
+    
+    for (i = 0; i < K_NUM; i++) g_free (gconf_keys[i]);
 }
 
 void prefdialog_clistupdate ()
@@ -535,12 +553,15 @@ void prefdialog_clistupdate ()
     GtkTreeIter iter;
     GtkListStore *keys_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (keyclist)));
     gboolean valid;
+    gchar *key;
     gint row = 0;
     
     valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (keys_store), &iter);
     while (valid)
     {
-        gtk_list_store_set (keys_store, &iter, 1, keystr (newkeys[actionid[row]]), -1);
+        gtk_tree_model_get (GTK_TREE_MODEL (keys_store), &iter, 3, &key, -1);
+        gtk_list_store_set (keys_store, &iter, 1, keystr (keys[actionid[row]]), -1);
+        gconf_client_set_int (gconf_client, key, keys[actionid[row]], NULL);
         valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (keys_store), &iter);
         row ++;
     }
@@ -550,9 +571,8 @@ void prefdialog_restorekeys (void)
 {
     int i;
 
-    for (i = 0; i < K_NUM; i ++) newkeys[i] = defaultkeys[i];
+    for (i = 0; i < K_NUM; i ++) keys[i] = defaultkeys[i];
     prefdialog_clistupdate ();
-    gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
 }
 
 void prefdialog_changekey (void)
@@ -570,9 +590,8 @@ void prefdialog_changekey (void)
     g_snprintf (buf, sizeof(buf), _("Press new key for \"%s\""), key);
     k = key_dialog (buf);
     if (k) {
-        newkeys[actionid[row]] = k;
+        keys[actionid[row]] = k;
         prefdialog_clistupdate ();
-        gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
     }
 }
 
@@ -608,7 +627,8 @@ void prefdialog_soundtoggle (GtkWidget *widget)
     else {
         prefdialog_soundoff ();
     }
-    gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
+    gconf_client_set_bool (gconf_client, "/apps/gtetrinet/sound/enable_sound",
+                           GTK_TOGGLE_BUTTON (widget)->active, NULL);
 }
 
 void prefdialog_miditoggle (GtkWidget *widget)
@@ -620,31 +640,39 @@ void prefdialog_miditoggle (GtkWidget *widget)
         prefdialog_midioff ();
     }
     midichanged = TRUE;
-    gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
+    gconf_client_set_bool (gconf_client, "/apps/gtetrinet/sound/enable_midi",
+                           GTK_TOGGLE_BUTTON (widget)->active, NULL);
 }
 
 
 void prefdialog_midichanged (void)
 {
     midichanged = TRUE;
-    gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
+    gconf_client_set_string (gconf_client, "/apps/gtetrinet/sound/midi_player",
+                             gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (midientry)))),
+                             NULL);
 }
 
 void prefdialog_restoremidi (void)
 {
     gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(midientry))),
                         DEFAULTMIDICMD);
-    gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
+    gconf_client_set_string (gconf_client, "/apps/gtetrinet/sound/midi_player",
+                             gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (midientry)))),
+                             NULL);
 }
 
 void prefdialog_themelistselect (int n)
 {
     char author[1024], desc[1024];
 
+    /* update theme description */
     config_getthemeinfo (themes[n].dir, NULL, author, desc);
     leftlabel_set (namelabel, themes[n].name);
     leftlabel_set (authlabel, author);
     leftlabel_set (desclabel, desc);
+  
+    gconf_client_set_string (gconf_client, "/apps/gtetrinet/themes/theme_dir", themes[n].dir, NULL);
 }
 
 void prefdialog_themeselect (GtkTreeSelection *treeselection)
@@ -657,10 +685,7 @@ void prefdialog_themeselect (GtkTreeSelection *treeselection)
     {
       model = GTK_LIST_STORE (gtk_tree_view_get_model (gtk_tree_selection_get_tree_view (treeselection)));
       gtk_tree_model_get (GTK_TREE_MODEL(model), &iter, 1, &row, -1);
-      theme_select = row;
-      themechanged = TRUE;
       prefdialog_themelistselect (row);
-      gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
     }
 }
 
@@ -737,62 +762,21 @@ void prefdialog_themelist ()
     }
 }
 
-void prefdialog_apply (GnomePropertyBox *dialog, gint pagenum)
-{
-    int i;
-
-    dialog = dialog;
-
-    if (pagenum == -1) {
-        for (i = 0; i < K_NUM; i ++) {
-            keys[i] = newkeys[i];
-        }
-
-        soundenable = GTK_TOGGLE_BUTTON(soundcheck)->active ? 1 : 0;
-        midienable = GTK_TOGGLE_BUTTON(midicheck)->active ? 1 : 0;
-        if (!soundenable && midienable) {
-            midienable = 0;
-            midichanged = TRUE;
-        }
-
-        if (themechanged) {
-            GTET_O_STRCPY (currenttheme, themes[theme_select].dir);
-            config_loadtheme (currenttheme);
-
-            fields_page_destroy_contents ();
-            fields_cleanup ();
-            fields_init ();
-            fields_page_new ();
-            if (ingame) tetrinet_redrawfields ();
-        }
-
-        if (midichanged) {
-            const char *midi = gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(midientry))));
-            GTET_O_STRCPY (midicmd, midi);
-        }
-
-        if ((themechanged || midichanged) && ingame) {
-            sound_stopmidi ();
-            sound_playmidi (midifile);
-        }
-
-        themechanged = midichanged = FALSE;
-    }
-}
-
-void prefdialog_ok (void)
+void prefdialog_response (GtkDialog *dialog,
+                          gint arg1)
 {
-    prefdialog_apply (NULL, -1);
-    gtk_widget_destroy (prefdialog);
-    prefdialog = NULL;
+  switch (arg1)
+  {
+    case GTK_RESPONSE_CLOSE: prefdialog_destroy (); break;
+    case GTK_RESPONSE_HELP:  /* here we should open yelp */ break;
+  }
 }
 
-
 void prefdialog_new (void)
 {
-    GtkWidget *label, *table, *frame, *button, *button1, *widget, *table1, *divider;
+    GtkWidget *label, *table, *frame, *button, *button1, *widget, *table1, *divider, *notebook;
     GtkListStore *theme_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
-    GtkListStore *keys_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
+    GtkListStore *keys_store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
     GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
     GtkTreeSelection *theme_selection;
     int i;
@@ -803,9 +787,14 @@ void prefdialog_new (void)
       return;
     }
 
-    prefdialog = gnome_property_box_new();
-
-    gtk_window_set_title(GTK_WINDOW(prefdialog), _("GTetrinet Preferences"));
+    prefdialog = gtk_dialog_new_with_buttons (_("GTetrinet Preferences"),
+                                              NULL,
+                                              GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                              GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+                                              GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+                                              NULL);
+    gtk_dialog_set_default_response (GTK_DIALOG (prefdialog), GTK_RESPONSE_CLOSE);
+    notebook = gtk_notebook_new ();
 
     /* themes */
     themelist = gtk_tree_view_new_with_model (GTK_TREE_MODEL (theme_store));
@@ -869,14 +858,9 @@ void prefdialog_new (void)
                       GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
     gtk_widget_show (table);
 
-    frame = gtk_frame_new (NULL);
-    gtk_container_set_border_width (GTK_CONTAINER(frame), GNOME_PAD);
-    gtk_container_add (GTK_CONTAINER(frame), table);
-    gtk_widget_show (frame);
     label = gtk_label_new (_("Themes"));
     gtk_widget_show (label);
-    gnome_property_box_append_page (GNOME_PROPERTY_BOX(prefdialog),
-                                    frame, label);
+    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
 
     /* keyboard */
     keyclist = GTK_WIDGET (gtk_tree_view_new_with_model (GTK_TREE_MODEL(keys_store)));
@@ -920,14 +904,9 @@ void prefdialog_new (void)
                       GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
     gtk_widget_show (table);
 
-    frame = gtk_frame_new (NULL);
-    gtk_container_set_border_width (GTK_CONTAINER(frame), GNOME_PAD);
-    gtk_container_add (GTK_CONTAINER(frame), table);
-    gtk_widget_show (frame);
     label = gtk_label_new (_("Keyboard"));
     gtk_widget_show (label);
-    gnome_property_box_append_page (GNOME_PROPERTY_BOX(prefdialog),
-                                    frame, label);
+    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
 
     /* sound */
     soundcheck = gtk_check_button_new_with_label (_("Enable Sound"));
@@ -987,21 +966,15 @@ void prefdialog_new (void)
                       GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
     gtk_widget_show (table);
 
-    frame = gtk_frame_new (NULL);
-    gtk_container_set_border_width (GTK_CONTAINER(frame), GNOME_PAD);
-    gtk_container_add (GTK_CONTAINER(frame), table);
-    gtk_widget_show (frame);
     label = gtk_label_new (_("Sound"));
     gtk_widget_show (label);
-    gnome_property_box_append_page (GNOME_PROPERTY_BOX(prefdialog),
-                                    frame, label);
+    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
 
     /* init stuff */
     prefdialog_themelist ();
 
     gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(midientry))), midicmd);
 
-    for (i = 0; i < K_NUM; i ++) newkeys[i] = keys[i];
     prefdialog_drawkeys ();
 
     gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(soundcheck), soundenable);
@@ -1016,10 +989,9 @@ void prefdialog_new (void)
     prefdialog_soundoff ();
     gtk_widget_set_sensitive (soundcheck, FALSE);
 #endif
-
-    themechanged = midichanged = FALSE;
     
-    gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (prefdialog)->action_area), 6);
+//    gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (prefdialog)->action_area), 6);
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (prefdialog)->vbox), notebook, FALSE, FALSE, 0);
 
     g_signal_connect (G_OBJECT(soundcheck), "toggled",
                       GTK_SIGNAL_FUNC(prefdialog_soundtoggle), NULL);
@@ -1029,13 +1001,9 @@ void prefdialog_new (void)
                       "changed", GTK_SIGNAL_FUNC(prefdialog_midichanged), NULL);
     g_signal_connect (G_OBJECT(theme_selection), "changed",
                       GTK_SIGNAL_FUNC (prefdialog_themeselect), NULL);
-    g_signal_connect (G_OBJECT(prefdialog), "apply",
-                      GTK_SIGNAL_FUNC(prefdialog_apply), NULL);
     g_signal_connect (G_OBJECT(prefdialog), "destroy",
                       GTK_SIGNAL_FUNC(prefdialog_destroy), NULL);
-    g_signal_connect (G_OBJECT(GNOME_PROPERTY_BOX(prefdialog)->ok_button), "clicked",
-                      GTK_SIGNAL_FUNC(prefdialog_ok), NULL);
-    g_signal_connect (G_OBJECT(GNOME_PROPERTY_BOX(prefdialog)->cancel_button), "clicked",
-                      GTK_SIGNAL_FUNC(prefdialog_destroy), NULL);
-    gtk_widget_show (prefdialog);
+    g_signal_connect (G_OBJECT(prefdialog), "response",
+                      GTK_SIGNAL_FUNC(prefdialog_response), NULL);
+    gtk_widget_show_all (prefdialog);
 }
index 47ec6e128118983061e423c46ddfeab5b0e88229..adec1fa7f7ace7fd02b8cec484b47ace40e32e14 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/poll.h>
 #include <sys/types.h>
 #include <signal.h>
+#include <gconf/gconf-client.h>
 
 #include "gtetrinet.h"
 #include "config.h"
@@ -68,6 +69,8 @@ int fields_width, fields_height;
 
 gulong keypress_signal;
 
+GConfClient *gconf_client;
+
 static const struct poptOption options[] = {
     {"connect", 'c', POPT_ARG_STRING, &option_connect, 0, N_("Connect to server"), N_("SERVER")},
     {"nickname", 'n', POPT_ARG_STRING, &option_nick, 0, N_("Set nickname to use"), N_("NICKNAME")},
@@ -96,6 +99,7 @@ int main (int argc, char *argv[])
     GtkWidget *label;
     char buf[1024];
     GdkPixbuf *icon_pixbuf;
+    GError *err = NULL;
 
     GTET_STRCPY(buf, "", 4);
     g_assert(strlen(buf) == 0);
@@ -160,6 +164,37 @@ int main (int argc, char *argv[])
 
     textbox_setup (); /* needs to be done before text boxes are created */
     
+    /* Initialize the GConf library */
+    if (!gconf_init (argc, argv, &err))
+    {
+      fprintf (stderr, _("Failed to init GConf: %s\n"), err->message);
+      g_error_free (err); 
+      err = NULL;
+    }
+  
+    /* Start a GConf client */
+    gconf_client = gconf_client_get_default ();
+  
+    /* Add the GTetrinet directories to the list of directories that GConf client must watch */
+    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/sound",
+                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+    
+    gconf_client_add_dir (gconf_client, "/apps/gtetrinet/themes",
+                          GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+  
+    /* Request notification of change for these gconf keys */
+    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/midi_player",
+                             sound_midi_player_changed, NULL, NULL, NULL);
+                             
+    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_sound",
+                             sound_enable_sound_changed, NULL, NULL, NULL);
+                             
+    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_midi",
+                             sound_enable_midi_changed, NULL, NULL, NULL);
+                             
+    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/themes/theme_dir",
+                             themes_theme_dir_changed, NULL, NULL, NULL);
+
     /* load settings */
     config_loadconfig ();
 
@@ -280,9 +315,6 @@ int main (int argc, char *argv[])
     client_connectcancel (); /* kills the client process */
     sound_stopmidi ();
 
-    /* save settings */
-    config_saveconfig ();
-
     return 0;
 }
 
index 316835079008879f1ad9a2df43f87db9f541b5d5..8c2c00d51d9dd6bf30d9729a76c7328030654554 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
 #include <gtk/gtk.h>
 #include <gnome.h>
 #include <sys/types.h>
@@ -35,6 +39,7 @@ char midicmd[1024];
 #ifdef HAVE_ESD
 
 #include <esd.h>
+#include <libgnome/gnome-sound.h>
 
 static int soundsamples[S_NUM];
 static int midipid = 0;
@@ -45,7 +50,7 @@ void sound_cache (void)
     if (!soundenable) return;
     for (i = 0; i < S_NUM; i ++) {
         if (soundsamples[i])
-            esd_sample_free (gnome_sound_connection, soundsamples[i]);
+            esd_sample_free (gnome_sound_connection_get (), soundsamples[i]);
         if (soundfiles[i][0])
             soundsamples[i] = gnome_sound_sample_load (soundfiles[i], soundfiles[i]);
         else
@@ -56,8 +61,8 @@ void sound_cache (void)
 void sound_playsound (int id)
 {
     if (!soundenable) return;
-    if (soundfiles[id][0])
-        esd_play_file ("gtetrinet", soundfiles[id], -1);
+    if (soundsamples[id] > 0)
+      esd_sample_play (gnome_sound_connection_get (), soundsamples[id]);
 }
 
 void sound_playmidi (char *file)
index 3c160ee0d388bfa3e0701e1d7469ee18b27f7c15..e59cb364d63f9669b2c01e2a7e4f6dcba956cea1 100644 (file)
@@ -143,7 +143,6 @@ static void partylineupdate_join (char *name);
 static void partylineupdate_team (char *name, char *team);
 static void partylineupdate_leave (char *name);
 static void playerlistupdate (void);
-static void fieldslabelupdate (void);
 static void plinemsg (const char *name, const char *text);
 static void plineact (const char *name, const char *text);
 static void plinesmsg (const char *name, const char *text);
index e93844f985c0a79a82f48a01249f457fad9fc33f..a7d8d6e8a877158d47b7e6daa02e234504cee3bd 100644 (file)
@@ -31,3 +31,5 @@ extern void tetrinet_playerlost (void);
 extern void tetrinet_endgame (void);
 
 extern int playerfield (int p);
+
+extern void fieldslabelupdate (void);