]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Dani Carbonell: rewrite team dialog. Add spacing between buttons in preferences and...
authorJordi Albornoz <jordi@src.gnome.org>
Tue, 7 Jan 2003 16:38:00 +0000 (16:38 +0000)
committerJordi Albornoz <jordi@src.gnome.org>
Tue, 7 Jan 2003 16:38:00 +0000 (16:38 +0000)
Jordi Mallach: supress compile warnings, update copyright notices.

17 files changed:
ChangeLog
src/client.c
src/commands.c
src/commands.h
src/config.c
src/config.h
src/dialogs.c
src/fields.c
src/gtetrinet.c
src/gtetrinet.h
src/keys.c
src/misc.c
src/partyline.c
src/sound.c
src/tetrinet.c
src/tetris.c
src/winlist.c

index 36beb4eff58d3d864b9b6ffef47c46d953420d05..8d746dc1e5f80ef3432d9d4750521fe9afe30cd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,32 @@
+2003-01-07  Jordi Mallach  <jordi@sindominio.net>
+
+       * src/client.c: supress compile warnings.
+       * src/commands.c: likewise.
+       * src/dialogs.c: likewise.
+       * src/fields.c: likewise.
+       * src/gtetrinet.c: likewise.
+       * src/misc.c: likewise.
+       * src/partyline.c: likewise.
+       * src/sound.c: likewise.
+       * src/tetrinet.c: likewise.
+       * src/tetris.c: likewise.
+
+       * src/*.c: update dates in copyright notices.
+
 2003-01-07  Dani Carbonell  <bocata@panete.net>
 
-       * dialogs.c: rewrite the team change dialog, using gtk_window_new and
-       making it HIG compliant.
+       * dialogs.c (teamdialog_new): complete rewrite of this dialog, so it
+       is now HIG compliant.
+       (prefdialog_new): added spacing between buttons.
+       (connectdialog_new): likewise.
+       (connectdialog_button): check if user has specified a servername, a
+       nickname and a spectator password before trying to connect.
+       (key_dialog_callback): converted the key stroke to upper case.
+
+       * tetrinet.c (tetrinet_key): now it converts all keystrokes to upper
+       case.
+
+       * config.c (config_loadconfig): likewise
 
 2003-01-06  Jordi Mallach  <jordi@sindominio.net>
 
index e2bf9d1ffe7afa082f48699092969751502104d1..3b598764a08973f1bbb266ca356562eca9ffd4a7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -140,8 +140,7 @@ struct outmsgt outmsgtable[] = {
     {0, 0}
 };
 
-static void client_inputfunc (gpointer data, gint source,
-                              GdkInputCondition condition);
+static void client_inputfunc (void);
 
 /* functions which set up the connection */
 static void client_process (void);
@@ -214,8 +213,7 @@ void client_destroy (void)
 }
 
 /* a function that reads stuff from the pipe */
-static void client_inputfunc (gpointer data, gint source,
-                              GdkInputCondition condition)
+static void client_inputfunc (void)
 {
     char buf[1024];
     char *token;
@@ -414,7 +412,8 @@ int client_connect (void)
         GString *s2 = g_string_sized_new(80);
         unsigned char ip[4];
         GString *iphashbuf = g_string_sized_new(11);
-        int i, l, len;
+        unsigned int i, len;
+        int l;
         
         /* construct message */
         if (gamemode == TETRIFAST)
index a8f2eac2157f76789ae5f449bd727fa99dc65383..6d4f69fdac4cc999f0b76aef018e880df202398a 100644 (file)
@@ -95,50 +95,50 @@ void make_menus (GnomeApp *app)
 
 /* callbacks */
 
-void connect_command (GtkWidget *widget, gpointer data)
+void connect_command (void)
 {
     connectdialog_new ();
 }
 
-void disconnect_command (GtkWidget *widget, gpointer data)
+void disconnect_command (void)
 {
     client_destroy ();
 }
 
-void team_command (GtkWidget *widget, gpointer data)
+void team_command (void)
 {
     teamdialog_new ();
 }
 
 #ifdef ENABLE_DETACH
-void detach_command (GtkWidget *widget, gpointer data)
+void detach_command (void)
 {
     move_current_page_to_window ();
 }
 #endif
 
-void start_command (GtkWidget *widget, gpointer data)
+void start_command (void)
 {
     char buf[22];
     g_snprintf (buf, sizeof(buf), "%i %i", 1, playernum);
     client_outmessage (OUT_STARTGAME, buf);
 }
 
-void end_command (GtkWidget *widget, gpointer data)
+void end_command (void)
 {
     char buf[22];
     g_snprintf (buf, sizeof(buf), "%i %i", 0, playernum);
     client_outmessage (OUT_STARTGAME, buf);
 }
 
-void pause_command (GtkWidget *widget, gpointer data)
+void pause_command (void)
 {
     char buf[22];
     g_snprintf (buf, sizeof(buf), "%i %i", paused?0:1, playernum);
     client_outmessage (OUT_PAUSE, buf);
 }
 
-void preferences_command (GtkWidget *widget, gpointer data)
+void preferences_command (void)
 {
     prefdialog_new ();
 }
@@ -217,7 +217,7 @@ void commands_checkstate ()
 
 /* about... */
 
-void about_command (GtkWidget *widget, gpointer data)
+void about_command (void)
 {
     GtkWidget *hbox;
     GdkPixbuf *logo;
index 870f40229bc10ae201d0496ddc6f705cce875c87..fcbf145c6f34380a750ac8fb28756d72d631d47b 100644 (file)
@@ -3,16 +3,16 @@ extern GnomeUIInfo toolbar[];
 
 void make_menus (GnomeApp *app);
 
-void connect_command (GtkWidget *widget, gpointer data);
-void disconnect_command (GtkWidget *widget, gpointer data);
-void team_command (GtkWidget *widget, gpointer data);
+void connect_command (void);
+void disconnect_command (void);
+void team_command (void);
 #ifdef ENABLE_DETACH
-void detach_command (GtkWidget *widget, gpointer data);
+void detach_command (void);
 #endif
-void start_command (GtkWidget *widget, gpointer data);
-void end_command (GtkWidget *widget, gpointer data);
-void pause_command (GtkWidget *widget, gpointer data);
-void preferences_command (GtkWidget *widget, gpointer data);
-void about_command (GtkWidget *widget, gpointer data);
+void start_command (void);
+void end_command (void);
+void pause_command (void);
+void preferences_command (void);
+void about_command (void);
 
 void commands_checkstate (void);
index 985a57261c36d3b6ceb515df8c3f82beff41b273..da7f726ca46b916b5dbfec61b380aa86d26ddbde 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -52,18 +52,18 @@ static char *soundkeys[S_NUM] = {
     "Sounds/GameStart",
 };
 
-gint defaultkeys[K_NUM] = {
+guint defaultkeys[K_NUM] = {
     GDK_Right,
     GDK_Left,
     GDK_Up,
     GDK_Control_R,
     GDK_Down,
     GDK_space,
-    GDK_d,
-    GDK_t
+    GDK_D,
+    GDK_T
 };
 
-gint keys[K_NUM];
+guint keys[K_NUM];
 
 /* themedir is assumed to have a trailing slash */
 void config_loadtheme (char *themedir)
@@ -195,21 +195,21 @@ void config_loadconfig (void)
     }
 
     k = gnome_config_get_int ("Keys/Right");
-    keys[K_RIGHT] = k ? k : defaultkeys[K_RIGHT];
+    keys[K_RIGHT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_RIGHT]);
     k = gnome_config_get_int ("Keys/Left");
-    keys[K_LEFT] = k ? k : defaultkeys[K_LEFT];
+    keys[K_LEFT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_LEFT]);
     k = gnome_config_get_int ("Keys/RotateRight");
-    keys[K_ROTRIGHT] = k ? k : defaultkeys[K_ROTRIGHT];
+    keys[K_ROTRIGHT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_ROTRIGHT]);
     k = gnome_config_get_int ("Keys/RotateLeft");
-    keys[K_ROTLEFT] = k ? k : defaultkeys[K_ROTLEFT];
+    keys[K_ROTLEFT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_ROTLEFT]);
     k = gnome_config_get_int ("Keys/Down");
-    keys[K_DOWN] = k ? k : defaultkeys[K_DOWN];
+    keys[K_DOWN] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DOWN]);
     k = gnome_config_get_int ("Keys/Drop");
-    keys[K_DROP] = k ? k : defaultkeys[K_DROP];
+    keys[K_DROP] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DROP]);
     k = gnome_config_get_int ("Keys/Discard");
-    keys[K_DISCARD] = k ? k : defaultkeys[K_DISCARD];
+    keys[K_DISCARD] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DISCARD]);
     k = gnome_config_get_int ("Keys/Message");
-    keys[K_GAMEMSG] = k ? k : defaultkeys[K_GAMEMSG];
+    keys[K_GAMEMSG] = gdk_keyval_to_upper (k ? k : defaultkeys[K_GAMEMSG]);
 
     gnome_config_pop_prefix ();
 
index c20f1894a8b7946011dabd3cc7121febb91db369..b8a2f90ad02ced3154798a5da75087cd2ea6f2fb 100644 (file)
@@ -1,8 +1,8 @@
 extern char blocksfile[1024];
 extern int bsize;
 extern char currenttheme[1024];
-extern gint keys[];
-extern gint defaultkeys[];
+extern guint keys[];
+extern guint defaultkeys[];
 
 extern void config_loadtheme (char *themedir);
 extern int config_getthemeinfo (char *themedir, char *name, char *author, char *desc);
index f7fdd38719a048ecc33149936c256059d9399968..1cbfba83a314c3a2e3661eda2dd8e41245cafb43 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -45,8 +45,9 @@ static gint timeouttag = 0;
 
 GtkWidget *team_dialog;
 
-void connectingdialog_button (GnomeDialog *dialog, gint button, gpointer data)
+void connectingdialog_button (GnomeDialog *dialog, gint button)
 {
+    dialog = dialog;
     switch (button) {
     case 0:
         gtk_timeout_remove (timeouttag);
@@ -59,12 +60,12 @@ void connectingdialog_button (GnomeDialog *dialog, gint button, gpointer data)
     }
 }
 
-gint connectingdialog_delete (GtkWidget *widget, gpointer data)
+gint connectingdialog_delete (void)
 {
     return TRUE; /* dont kill me */
 }
 
-gint connectingdialog_timeout (gpointer data)
+gint connectingdialog_timeout (void)
 {
     GtkAdjustment *adj;
     adj = GTK_PROGRESS(progressbar)->adjustment;
@@ -112,19 +113,22 @@ void connectingdialog_destroy (void)
 /*******************/
 /* the team dialog */
 /*******************/
-void teamdialog_destroy (GtkWidget *widget, gpointer data)
+void teamdialog_destroy (void)
 {
     gtk_widget_destroy (team_dialog);
     team_dialog = NULL;
 }
+
 void teamdialog_button (GtkWidget *button, gpointer data)
 {
-    GtkWidget *entry = GTK_WIDGET(data);
+    GtkEntry *entry = GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (data)));
     gchar *aux;
 
-    aux = g_locale_from_utf8 (gtk_entry_get_text(GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(entry)))), -1, NULL, NULL, NULL);
+    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);
-    teamdialog_destroy (NULL, NULL);
+    teamdialog_destroy ();
     g_free (aux);
 }
 
@@ -146,11 +150,13 @@ void teamdialog_new (void)
     gtk_window_set_resizable (GTK_WINDOW (team_dialog), FALSE);
     gtk_container_set_border_width (GTK_CONTAINER (team_dialog), 12);
 
-    vbox = gtk_vbox_new (FALSE, 6);
+    vbox = gtk_vbox_new (TRUE, 6);
     gtk_container_add (GTK_CONTAINER (team_dialog), vbox);
     
     /* button box*/
-    buttonbox = gtk_hbox_new (TRUE, 6);
+    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);
@@ -162,7 +168,7 @@ void teamdialog_new (void)
     widget = gtk_label_new (_("Team name:"));
     gtk_box_pack_start_defaults (GTK_BOX (hbox), widget);
     entry = gnome_entry_new ("Team");
-    gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(entry))),
+    gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))),
                         team_utf8);
     g_free (team_utf8);
     gtk_box_pack_start_defaults (GTK_BOX (hbox), entry);
@@ -190,20 +196,42 @@ static GtkWidget *originalradio, *tetrifastradio;
 static GSList *gametypegroup;
 static int oldgamemode;
 
-void connectdialog_button (GnomeDialog *dialog, gint button, gpointer data)
+void connectdialog_button (GnomeDialog *dialog, gint button)
 {
     gchar *team_utf8, *nick; /* intermediate buffer for recoding purposes */
+
     switch (button) {
     case 1:
         /* connect now */
+        if (strlen (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry))))) <= 0)
+        {
+          gnome_error_dialog_parented (_("You must specify a server name."), GTK_WINDOW (dialog));
+          return;
+        }
+    
         spectating = GTK_TOGGLE_BUTTON(spectatorcheck)->active ? TRUE : FALSE;
-        GTET_O_STRCPY (specpassword, gtk_entry_get_text (GTK_ENTRY(passwordentry)));
+        if (spectating)
+        {
+          GTET_O_STRCPY (specpassword, gtk_entry_get_text (GTK_ENTRY(passwordentry)));
+          if (strlen (specpassword) <= 0)
+          {
+            gnome_error_dialog_parented (_("Please specify a password to connect as spectator."), GTK_WINDOW (dialog));
+            return;
+          }
+        }
+        
         team_utf8 = g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(teamnameentry)))),
                                         -1, NULL, NULL, NULL);
         GTET_O_STRCPY (team, team_utf8);
-        nick =   g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (nicknameentry)))),
+        
+        nick =  g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (nicknameentry)))),
                                      -1, NULL, NULL, NULL);
-        client_init (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry)))), nick);
+        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);
+        else
+            gnome_error_dialog_parented (_("Please specify a valid nickname."), GTK_WINDOW (dialog));
+        
         g_free (team_utf8);
         g_free (nick);
         break;
@@ -214,7 +242,7 @@ void connectdialog_button (GnomeDialog *dialog, gint button, gpointer data)
     }
 }
 
-void connectdialog_spectoggle (GtkWidget *widget, gpointer data)
+void connectdialog_spectoggle (GtkWidget *widget)
 {
     if (GTK_TOGGLE_BUTTON(widget)->active) {
         gtk_widget_set_sensitive (passwordentry, TRUE);
@@ -230,14 +258,14 @@ void connectdialog_spectoggle (GtkWidget *widget, gpointer data)
     }
 }
 
-void connectdialog_originaltoggle (GtkWidget *widget, gpointer data)
+void connectdialog_originaltoggle (GtkWidget *widget)
 {
     if (GTK_TOGGLE_BUTTON(widget)-> active) {
         gamemode = ORIGINAL;
     }
 }
 
-void connectdialog_tetrifasttoggle (GtkWidget *widget, gpointer data)
+void connectdialog_tetrifasttoggle (GtkWidget *widget)
 {
     if (GTK_TOGGLE_BUTTON(widget)-> active) {
         gamemode = TETRIFAST;
@@ -249,7 +277,7 @@ void connectdialog_connected (void)
     gtk_widget_destroy (connectdialog);
 }
 
-void connectdialog_destroy (GtkWidget *widget, gpointer data)
+void connectdialog_destroy (void)
 {
     connecting = FALSE;
 }
@@ -394,8 +422,9 @@ void connectdialog_new (void)
     gtk_box_pack_start (GTK_BOX(GNOME_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, NULL);
+    connectdialog_spectoggle (spectatorcheck);
     g_signal_connect (G_OBJECT(connectdialog), "destroy",
                         GTK_SIGNAL_FUNC(connectdialog_destroy), NULL);
     g_signal_connect (G_OBJECT(spectatorcheck), "toggled",
@@ -414,7 +443,7 @@ gint keydialog_key;
 
 void key_dialog_callback (GtkWidget *widget, GdkEventKey *key)
 {
-    keydialog_key = key->keyval;
+    keydialog_key = gdk_keyval_to_upper (key->keyval);
     gnome_dialog_close (GNOME_DIALOG(widget));
 }
 
@@ -457,7 +486,7 @@ int actionid[K_NUM] = {
     K_GAMEMSG
 };
 
-gint newkeys[K_NUM];
+guint newkeys[K_NUM];
 
 struct themelistentry {
     char dir[1024];
@@ -467,7 +496,7 @@ struct themelistentry {
 int themecount;
 int theme_select;
 
-void prefdialog_destroy (GtkWidget *widget, gpointer data)
+void prefdialog_destroy (void)
 {
     gtk_widget_destroy (prefdialog);
     prefdialog = NULL;
@@ -516,7 +545,7 @@ void prefdialog_clistupdate ()
     }
 }
 
-void prefdialog_restorekeys (GtkWidget *widget, gpointer data)
+void prefdialog_restorekeys (void)
 {
     int i;
 
@@ -525,7 +554,7 @@ void prefdialog_restorekeys (GtkWidget *widget, gpointer data)
     gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
 }
 
-void prefdialog_changekey (GtkWidget *widget, gpointer data)
+void prefdialog_changekey (void)
 {
     gchar buf[256], *key;
     gint k, row = 0;
@@ -570,7 +599,7 @@ void prefdialog_soundoff ()
     prefdialog_midioff ();
 }
 
-void prefdialog_soundtoggle (GtkWidget *widget, gpointer data)
+void prefdialog_soundtoggle (GtkWidget *widget)
 {
     if (GTK_TOGGLE_BUTTON(widget)->active) {
         prefdialog_soundon ();
@@ -581,7 +610,7 @@ void prefdialog_soundtoggle (GtkWidget *widget, gpointer data)
     gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
 }
 
-void prefdialog_miditoggle (GtkWidget *widget, gpointer data)
+void prefdialog_miditoggle (GtkWidget *widget)
 {
     if (GTK_TOGGLE_BUTTON(widget)->active) {
         prefdialog_midion ();
@@ -594,13 +623,13 @@ void prefdialog_miditoggle (GtkWidget *widget, gpointer data)
 }
 
 
-void prefdialog_midichanged (GtkWidget *widget, gpointer data)
+void prefdialog_midichanged (void)
 {
     midichanged = TRUE;
     gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
 }
 
-void prefdialog_restoremidi (GtkWidget *widget, gpointer data)
+void prefdialog_restoremidi (void)
 {
     gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(midientry))),
                         DEFAULTMIDICMD);
@@ -617,8 +646,7 @@ void prefdialog_themelistselect (int n)
     leftlabel_set (desclabel, desc);
 }
 
-void prefdialog_themeselect (GtkTreeSelection *treeselection,
-                             gpointer data)
+void prefdialog_themeselect (GtkTreeSelection *treeselection)
 {
     GtkListStore *model;
     GtkTreeIter iter;
@@ -711,7 +739,9 @@ 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];
@@ -749,7 +779,7 @@ void prefdialog_apply (GnomePropertyBox *dialog, gint pagenum)
     }
 }
 
-void prefdialog_ok (GtkWidget *widget, gpointer data)
+void prefdialog_ok (void)
 {
     prefdialog_apply (NULL, -1);
     gtk_widget_destroy (prefdialog);
@@ -763,7 +793,7 @@ void prefdialog_new (void)
     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);
     GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
-    GtkTreeSelection *theme_selection, *keys_selection;
+    GtkTreeSelection *theme_selection;
     int i;
   
     if (prefdialog != NULL)
@@ -987,6 +1017,8 @@ void prefdialog_new (void)
 #endif
 
     themechanged = midichanged = FALSE;
+    
+    gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (prefdialog)->action_area), 6);
 
     g_signal_connect (G_OBJECT(soundcheck), "toggled",
                       GTK_SIGNAL_FUNC(prefdialog_soundtoggle), NULL);
index 002a44616cf57de6b17df31a27369d05bc9aa52e..a2308c2ef271e076100f062ab97fb26d6797c48e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -42,13 +42,13 @@ static GtkWidget *fieldwidgets[6], *nextpiecewidget, *fieldlabels[6][6],
 static GtkWidget *fields_page_contents (void);
 
 static gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field);
-static gint fields_nextpiece_expose (GtkWidget *widget, GdkEventExpose *event);
-static gint fields_specials_expose (GtkWidget *widget, GdkEventExpose *event);
+static gint fields_nextpiece_expose (void);
+static gint fields_specials_expose (void);
 
 static void fields_refreshfield (int field);
 static void fields_drawblock (int field, int x, int y, char block);
 
-static gint fields_eatkey (GtkWidget *widget, GdkEventKey *key);
+static gint fields_eatkey (GtkWidget *widget);
 
 static GdkPixmap *blockpix;
 
@@ -332,6 +332,8 @@ GtkWidget *fields_page_contents (void)
 
 gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field)
 {
+    widget = widget;
+    event = event;
     fields_refreshfield (field);
 
     return FALSE;
@@ -445,13 +447,13 @@ void fields_setspeciallabel (char *label)
     }
 }
 
-gint fields_nextpiece_expose (GtkWidget *widget, GdkEventExpose *event)
+gint fields_nextpiece_expose (void)
 {
     fields_drawnextblock (NULL);
     return FALSE;
 }
 
-gint fields_specials_expose (GtkWidget *widget, GdkEventExpose *event)
+gint fields_specials_expose (void)
 {
     fields_drawspecials ();
     return FALSE;
@@ -616,7 +618,7 @@ const char *fields_gmsginputtext (void)
     return gtk_entry_get_text (GTK_ENTRY(gmsginput));
 }
 
-gint fields_eatkey (GtkWidget *widget, GdkEventKey *key)
+gint fields_eatkey (GtkWidget *widget)
 {
     gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key-press-event");
     return TRUE;
index 099611fed5d5b70f1e3096af31e892f4d006551a..93466b3909b6b4e28b17a9759ec8cf76acdc1f9e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -47,8 +47,8 @@
 
 static GtkWidget *pixmapdata_label (char **d, char *str);
 static int gtetrinet_key (int keyval, int mod);
-gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data);
-gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data);
+gint keypress (GtkWidget *widget, GdkEventKey *key);
+gint keyrelease (GtkWidget *widget, GdkEventKey *key);
 
 static GtkWidget *app, *pfields, *pparty, *pwinlist;
 static GtkWidget *winlistwidget, *partywidget, *fieldswidget;
@@ -73,8 +73,8 @@ static const struct poptOption options[] = {
 
 int main (int argc, char *argv[])
 {
-    GtkWidget *page, *label, *box;
-    char buf[1024], *logo;
+    GtkWidget *label;
+    char buf[1024];
     GdkPixbuf *icon_pixbuf;
 
     GTET_STRCPY(buf, "", 4);
@@ -277,7 +277,7 @@ GtkWidget *pixmapdata_label (char **d, char *str)
 }
 
 /* called when the main window is destroyed */
-void destroymain (GtkWidget *widget, gpointer data)
+void destroymain (void)
 {
     gtk_main_quit ();
 }
@@ -303,12 +303,13 @@ gint keytimeoutid = 0;
 
 gint keytimeout (gpointer data)
 {
+    data = data; /* to get rid of the warning */
     tetrinet_upkey (k.keyval);
     keytimeoutid = 0;
     return FALSE;
 }
 
-gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data)
+gint keypress (GtkWidget *widget, GdkEventKey *key)
 {
     int game_area;
 
@@ -352,7 +353,7 @@ gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data)
     return FALSE;
 }
 
-gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data)
+gint keyrelease (GtkWidget *widget, GdkEventKey *key)
 {
     int game_area;
 
@@ -417,6 +418,7 @@ typedef struct {
 void destroy_page_window (GtkWidget *window, gpointer data)
 {
     WidgetPageData *pageData = (WidgetPageData *)data;
+    window = window;
 
     /* Put widget back into a page */
     gtk_widget_reparent (pageData->widget, pageData->parent);
index bf031dc92f62f5f896042989d4502e113a62653a..2da97ec4773ad67c366b089eaa025e8efa897c26 100644 (file)
@@ -7,9 +7,9 @@
 
 extern int gamemode;
 
-extern void destroymain (GtkWidget *widget, gpointer data);
-extern gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data);
-extern gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data);
+extern void destroymain (void);
+extern gint keypress (GtkWidget *widget, GdkEventKey *key);
+extern gint keyrelease (GtkWidget *widget, GdkEventKey *key);
 extern void move_current_page_to_window (void);
 extern void show_fields_page (void);
 extern void show_partyline_page (void);
index 4ccb8e35daa0b11bb23c9f54cc4327ed63344cfa..635874c356874638c36e47791d23a8c5f2d73998 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
index fb5e43be14155b7ab5b6e45656769588c21a04d0..dd5917b73c0f3660b8913abdda251deea11ea15e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -134,7 +134,6 @@ void textbox_setup (void)
 void textbox_addtext (GtkTextView *textbox, unsigned char *text)
 {
     GtkTextTag *color, *lastcolor;
-    int attr; /* bits are used as flags: bold, italic */
     int i;
     /* int bottom; */
     char last = 0;
@@ -252,6 +251,8 @@ static gboolean cb_adjust_bottom(gpointer data)
 {
   GList *scan = adj_list;
 
+  data = data; /* to get rid of the warning */
+  
   while (scan)
   {
     GtkTextView *tv = scan->data;
index 4d9fbf1498427c505c2ac532155e1fdf2b1bd3d0..79e33d12c1bfa7c579e95537812eb549231b43c0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ char plhistory[PLHSIZE][256];
 int plh_start = 0, plh_end = 0, plh_cur = 0;
 
 /* function prototypes for callbacks */
-static void textentry (GtkWidget *widget, gpointer data);
+static void textentry (GtkWidget *widget);
 static gint entrykey (GtkWidget *widget, GdkEventKey *key);
 
 GtkWidget *partyline_page_new (void)
@@ -54,7 +54,6 @@ GtkWidget *partyline_page_new (void)
     GtkWidget *widget, *box; /* generic temp variables */
     GtkListStore *playerlist_model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
     GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
-    char *listtitles[3];
 
     /* left box */
     leftbox = gtk_vbox_new (FALSE, 4);
@@ -207,7 +206,6 @@ void partyline_playerlist (int *numbers, char **names, char **teams, int n, char
 {
     int i;
     char buf0[16], buf1[128], buf2[128];
-    char *item[3] = {buf0, buf1, buf2};
     GtkListStore *playerlist_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (playerlist)));
     GtkTreeIter iter;
     gchar *aux1, *aux2; /* for recoding purposes */
@@ -259,7 +257,7 @@ void partyline_switch_entryfocus (void)
     if (connected) gtk_widget_grab_focus (entrybox);
 }
 
-void textentry (GtkWidget *widget, gpointer data)
+void textentry (GtkWidget *widget)
 {
     const char *text;
     gchar *iso_text;
index ea327d5ac95d00c55df66c99301558e68ba75424..316835079008879f1ad9a2df43f87db9f541b5d5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -99,8 +99,8 @@ void sound_stopmidi (void)
 
 /* stubs */
 void sound_cache (void) {}
-void sound_playsound (int id) {}
-void sound_playmidi (char *file) {}
+void sound_playsound (int id) {id = id;}
+void sound_playmidi (char *file) {file = file;}
 void sound_stopmidi (void) {}
 
 #endif
index 15840ef3c1ec4b2c6c5c8359395c01b776fee0f5..17922a227821de50b18700424596c42da04e7b34 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -1220,12 +1220,12 @@ static int tetrinet_timeoutduration (void)
 /* tetrisy stuff */
 /*****************/
 static void tetrinet_settimeout (int duration);
-static gint tetrinet_timeout (gpointer data);
+static gint tetrinet_timeout (void);
 static void tetrinet_solidify (void);
 static void tetrinet_nextblock (void);
-static gint tetrinet_nextblocktimeout (gpointer data);
+static gint tetrinet_nextblocktimeout (void);
 static int tetrinet_removelines (void);
-static gint tetrinet_removelinestimeout (gpointer data);
+static gint tetrinet_removelinestimeout (void);
 
 TETRISBLOCK blankblock =
 { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
@@ -1370,7 +1370,7 @@ void tetrinet_removetimeout (void)
     movedowntimeout = 0;
 }
 
-gint tetrinet_timeout (gpointer data)
+gint tetrinet_timeout (void)
 {
     if (paused) return TRUE;
     if (!playing) return FALSE;
@@ -1409,7 +1409,7 @@ void tetrinet_nextblock (void)
                          NULL);
 }
 
-gint tetrinet_nextblocktimeout (gpointer data)
+gint tetrinet_nextblocktimeout (void)
 {
     if (paused) return TRUE; /* come back later */
     if (!playing) return FALSE;
@@ -1485,7 +1485,7 @@ int tetrinet_removelines ()
     return sound;
 }
 
-gint tetrinet_removelinestimeout (gpointer data)
+gint tetrinet_removelinestimeout (void)
 {
     tetris_drawcurrentblock ();
     return FALSE;
@@ -1555,37 +1555,37 @@ notfieldkey:
         }
         return TRUE;
     }
-    if (keyval == keys[K_GAMEMSG]) {
+    if (gdk_keyval_to_upper (keyval) == keys[K_GAMEMSG]) {
         fields_gmsginput (TRUE);
         gmsgstate = 1;
         return TRUE;
     }
     if (paused || !playing) return FALSE;
     /* game keys */
-    if (keyval == keys[K_ROTRIGHT]) {
+    if (gdk_keyval_to_upper (keyval) == keys[K_ROTRIGHT]) {
         if (!nextblocktimeout)
             sound_playsound (S_ROTATE);
         tetris_blockrotate (1);
     }
-    else if (keyval == keys[K_ROTLEFT]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_ROTLEFT]) {
         if (!nextblocktimeout)
             sound_playsound (S_ROTATE);
         tetris_blockrotate (-1);
     }
-    else if (keyval == keys[K_RIGHT]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_RIGHT]) {
         tetris_blockmove (1);
     }
-    else if (keyval == keys[K_LEFT]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_LEFT]) {
         tetris_blockmove (-1);
     }
-    else if (keyval == keys[K_DOWN]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_DOWN]) {
         if (!downpressed) {
-            tetrinet_timeout (NULL);
+            tetrinet_timeout ();
             downpressed = 1;
             tetrinet_settimeout (DOWNDELAY);
         }
     }
-    else if (keyval == keys[K_DROP]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_DROP]) {
         int sound;
         if (!nextblocktimeout) {
             tetris_blockdrop ();
@@ -1597,7 +1597,7 @@ notfieldkey:
             tetrinet_sendfield (0);
         }
     }
-    else if (keyval == keys[K_DISCARD]) {
+    else if (gdk_keyval_to_upper (keyval) == keys[K_DISCARD]) {
         tetrinet_specialkey(-1);
     }
     else switch (keyval) {
@@ -1617,9 +1617,9 @@ notfieldkey:
 void tetrinet_upkey (int keyval)
 {
     if (!playing) return;
-    if (keyval == keys[K_DOWN]) {
+    if (gdk_keyval_to_upper (keyval) == keys[K_DOWN]) {
          /* if it is a quick press, nudge it down one more step */
-        if (downpressed == 1) tetrinet_timeout (NULL);
+        if (downpressed == 1) tetrinet_timeout ();
         downpressed = 0;
         tetrinet_settimeout (tetrinet_timeoutduration());
     }
index bab69d05a149dbfe1103c2e9dad7cc82aa0d83e5..04be999898b4742e49252f833b386b7f5d0b0b57 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ void tetris_blockdrop (void)
 
 void tetris_addlines (int count, int type)
 {
-    int x, y, n, i;
+    int x, y, i;
     FIELD field;
     copyfield (field, fields[playernum]);
     for (i = 0; i < count; i ++) {
index e1e582a5d275931b5dbb72a5c946f7b215bb6054..3e5cd0043fe4d38de9ede5501e4c819367b28c52 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GTetrinet
- *  Copyright (C) 1999, 2000  Ka-shu Wong (kswong@zip.com.au)
+ *  Copyright (C) 1999, 2000, 2001, 2002, 2003  Ka-shu Wong (kswong@zip.com.au)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by