+2003-06-06 Jordi Mallach <jordi@sindominio.net>
+
+ * src/config.c (config_loadconfig): load values for new keys.
+ Add notify functions for new gconf keys.
+ * src/config.h: Add new declarations and key defines.
+ * src/dialogs.c (prefdialog_drawkeys): Add new actions to treeview.
+ * src/gtetrinet (main): Notify gconf of changes to new keys.
+ * src/tetrinet.c (tetrinet_key): Handle new special keys. Closes
+ Bugzilla Bug#105117.
+
+ * gtetrinet.schemas.in: Add schemas for new configurable game keys.
+
2003-06-05 Jordi Mallach <jordi@sindominio.net>
* NEWS: Update for 0.7.2.
<default></default>
<locale name="C">
- <short>Theme directory, should end with a '/'.</short>
+ <short>Theme directory, should end with a '/'</short>
<long>The current theme directory. It should contain a readable
"blocks.png" and a "theme.cfg".</long>
</locale>
<default>while true; do playmidi $MIDIFILE; done</default>
<locale name="C">
- <short>Command to run to play midi files.</short>
+ <short>Command to run to play midi files</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>
<default>0</default>
<locale name="C">
- <short>Enable/disable sound.</short>
+ <short>Enable/disable sound</short>
<long>Enables/Disables sound. Keep in mind that the theme
that you're using must provide sounds.</long>
</locale>
<default>0</default>
<locale name="C">
- <short>Enable/disable midi music.</short>
+ <short>Enable/disable midi music</short>
<long>Enables/disables midi music. You'll need to enable
sound if you want music to work.</long>
</locale>
<default></default>
<locale name="C">
- <short>Your nickname.</short>
+ <short>Your nickname</short>
<long>This will be your nickname in the game.</long>
</locale>
</schema>
<default>tetrinet.org</default>
<locale name="C">
- <short>Server where you want to play.</short>
+ <short>Server where you want to play</short>
<long>This is the server where GTetrinet will try to connect.</long>
</locale>
</schema>
<default></default>
<locale name="C">
- <short>Your team.</short>
+ <short>Your team</short>
<long>This will be the name of your team.</long>
</locale>
</schema>
<default>Right</default>
<locale name="C">
- <short>Key to move right.</short>
+ <short>Key to move right</short>
<long>This key moves the block to the right. This is case insensitive.</long>
</locale>
</schema>
<default>Left</default>
<locale name="C">
- <short>Key to move left.</short>
+ <short>Key to move left</short>
<long>This key moves the block to the left. This is case insensitive.</long>
</locale>
</schema>
<default>Up</default>
<locale name="C">
- <short>Key to rotate clockwise.</short>
+ <short>Key to rotate clockwise</short>
<long>This key rotates the block clockwise. This is case insensitive.</long>
</locale>
</schema>
<default>Control_R</default>
<locale name="C">
- <short>Key to rotate counterclockwise.</short>
+ <short>Key to rotate counterclockwise</short>
<long>This key rotates the block counterclockwise. This is case insensitive.</long>
</locale>
</schema>
<default>Down</default>
<locale name="C">
- <short>Key to move down.</short>
+ <short>Key to move down</short>
<long>This key moves the block down. This is case insensitive.</long>
</locale>
</schema>
<default>space</default>
<locale name="C">
- <short>Key to drop piece.</short>
+ <short>Key to drop piece</short>
<long>This key drops the block to the ground. 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>string</type>
+ <default>t</default>
+
+ <locale name="C">
+ <short>Key to open the fields' message dialog</short>
+ <long>This key displays the fields' message dialog. This is case insensitive.</long>
+ </locale>
+ </schema>
+
+
<schema>
<key>/schemas/apps/gtetrinet/keys/discard</key>
<applyto>/apps/gtetrinet/keys/discard</applyto>
<default>d</default>
<locale name="C">
- <short>Key to discard special.</short>
+ <short>Key to discard special</short>
<long>This key discards the current special. This is case insensitive.</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/gtetrinet/keys/message</key>
- <applyto>/apps/gtetrinet/keys/message</applyto>
+ <key>/schemas/apps/gtetrinet/keys/special1</key>
+ <applyto>/apps/gtetrinet/keys/special1</applyto>
<owner>gtetrinet</owner>
<type>string</type>
- <default>t</default>
+ <default>1</default>
<locale name="C">
- <short>Key to open the fields' message dialog.</short>
- <long>This key displays the fields' message dialog. This is case insensitive.</long>
+ <short>Key to use the current special on field 1</short>
+ <long>This key uses the current special on Player 1's game field.</long>
+ </locale>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/keys/special2</key>
+ <applyto>/apps/gtetrinet/keys/special2</applyto>
+ <owner>gtetrinet</owner>
+ <type>string</type>
+ <default>2</default>
+
+ <locale name="C">
+ <short>Key to use the current special on field 2</short>
+ <long>This key uses the current special on Player 2's game field.</long>
+ </locale>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/keys/special3</key>
+ <applyto>/apps/gtetrinet/keys/special3</applyto>
+ <owner>gtetrinet</owner>
+ <type>string</type>
+ <default>3</default>
+
+ <locale name="C">
+ <short>Key to use the current special on field 3</short>
+ <long>This key uses the current special on Player 3's game field.</long>
+ </locale>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/keys/special4</key>
+ <applyto>/apps/gtetrinet/keys/special4</applyto>
+ <owner>gtetrinet</owner>
+ <type>string</type>
+ <default>4</default>
+
+ <locale name="C">
+ <short>Key to use the current special on field 4</short>
+ <long>This key uses the current special on Player 4's game field.</long>
+ </locale>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/keys/special5</key>
+ <applyto>/apps/gtetrinet/keys/special5</applyto>
+ <owner>gtetrinet</owner>
+ <type>string</type>
+ <default>5</default>
+
+ <locale name="C">
+ <short>Key to use the current special on field 5</short>
+ <long>This key uses the current special on Player 5's game field.</long>
+ </locale>
+ </schema>
+
+
+ <schema>
+ <key>/schemas/apps/gtetrinet/keys/special6</key>
+ <applyto>/apps/gtetrinet/keys/special6</applyto>
+ <owner>gtetrinet</owner>
+ <type>string</type>
+ <default>6</default>
+
+ <locale name="C">
+ <short>Key to use the current special on field 6</short>
+ <long>This key uses the current special on Player 6's game field.</long>
</locale>
</schema>
else
keys[K_GAMEMSG] = defaultkeys[K_GAMEMSG];
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special1", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL1] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL1] = defaultkeys[K_SPECIAL1];
+
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special2", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL2] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL2] = defaultkeys[K_SPECIAL2];
+
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special3", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL3] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL3] = defaultkeys[K_SPECIAL3];
+
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special4", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL4] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL4] = defaultkeys[K_SPECIAL4];
+
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special5", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL5] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL5] = defaultkeys[K_SPECIAL5];
+
+ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special6", NULL);
+ if (p)
+ {
+ keys[K_SPECIAL6] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+ g_free (p);
+ }
+ else
+ keys[K_SPECIAL6] = defaultkeys[K_SPECIAL6];
+
+
/* Get the timestamp option. */
timestampsenable = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", NULL);
keys[K_DISCARD] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
}
+void
+keys_special1_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL1] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
+void
+keys_special2_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL2] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
+void
+keys_special3_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL3] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
+void
+keys_special4_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL4] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
+void
+keys_special5_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL5] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
+void
+keys_special6_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+
+ client = client;
+ cnxn_id = cnxn_id;
+
+ keys[K_SPECIAL6] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
void
partyline_enable_timestamps_changed (GConfClient *client,
guint cnxn_id,
guint cnxn_id,
GConfEntry *entry);
+void
+keys_special1_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+keys_special2_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+keys_special3_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+keys_special4_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+keys_special5_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+void
+keys_special6_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
void
partyline_enable_timestamps_changed (GConfClient *client,
guint cnxn_id,
#define K_DROP 5
#define K_DISCARD 6
#define K_GAMEMSG 7
+#define K_SPECIAL1 8
+#define K_SPECIAL2 9
+#define K_SPECIAL3 10
+#define K_SPECIAL4 11
+#define K_SPECIAL5 12
+#define K_SPECIAL6 13
/* not a key but the number of configurable keys */
-#define K_NUM 8
+#define K_NUM 14
actions[K_DROP] = _("Drop piece");
actions[K_DISCARD] = _("Discard special");
actions[K_GAMEMSG] = _("Send message");
+ actions[K_SPECIAL1] = _("Special to field 1");
+ actions[K_SPECIAL2] = _("Special to field 2");
+ actions[K_SPECIAL3] = _("Special to field 3");
+ actions[K_SPECIAL4] = _("Special to field 4");
+ actions[K_SPECIAL5] = _("Special to field 5");
+ actions[K_SPECIAL6] = _("Special to field 6");
gconf_keys[K_RIGHT] = g_strdup ("/apps/gtetrinet/keys/right");
gconf_keys[K_LEFT] = g_strdup ("/apps/gtetrinet/keys/left");
gconf_keys[K_DROP] = g_strdup ("/apps/gtetrinet/keys/drop");
gconf_keys[K_DISCARD] = g_strdup ("/apps/gtetrinet/keys/discard");
gconf_keys[K_GAMEMSG] = g_strdup ("/apps/gtetrinet/keys/message");
+ gconf_keys[K_SPECIAL1] = g_strdup ("/apps/gtetrinet/keys/special1");
+ gconf_keys[K_SPECIAL2] = g_strdup ("/apps/gtetrinet/keys/special2");
+ gconf_keys[K_SPECIAL3] = g_strdup ("/apps/gtetrinet/keys/special3");
+ gconf_keys[K_SPECIAL4] = g_strdup ("/apps/gtetrinet/keys/special4");
+ gconf_keys[K_SPECIAL5] = g_strdup ("/apps/gtetrinet/keys/special5");
+ gconf_keys[K_SPECIAL6] = g_strdup ("/apps/gtetrinet/keys/special6");
for (i = 0; i < K_NUM; i ++) {
gtk_list_store_append (keys_store, &iter);
(GConfClientNotifyFunc) keys_drop_changed, NULL,
NULL, NULL);
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/message",
+ (GConfClientNotifyFunc) keys_message_changed,
+ NULL, NULL, NULL);
+
gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/discard",
- (GConfClientNotifyFunc) keys_discard_changed,
+ (GConfClientNotifyFunc) keys_discard_changed,
NULL, NULL, NULL);
- gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/message",
- (GConfClientNotifyFunc) keys_message_changed,
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special1",
+ (GConfClientNotifyFunc) keys_special1_changed,
+ NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special2",
+ (GConfClientNotifyFunc) keys_special2_changed,
+ NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special3",
+ (GConfClientNotifyFunc) keys_special3_changed,
+ NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special4",
+ (GConfClientNotifyFunc) keys_special4_changed,
+ NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special5",
+ (GConfClientNotifyFunc) keys_special5_changed,
+ NULL, NULL, NULL);
+
+ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special6",
+ (GConfClientNotifyFunc) keys_special6_changed,
NULL, NULL, NULL);
gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
else if (gdk_keyval_to_lower (keyval) == keys[K_DISCARD]) {
tetrinet_specialkey(-1);
}
- else switch (keyval) {
- case GDK_1: tetrinet_specialkey(1); break;
- case GDK_2: tetrinet_specialkey(2); break;
- case GDK_3: tetrinet_specialkey(3); break;
- case GDK_4: tetrinet_specialkey(4); break;
- case GDK_5: tetrinet_specialkey(5); break;
- case GDK_6: tetrinet_specialkey(6); break;
- default:
- return FALSE;
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL1]) {
+ tetrinet_specialkey(1);
+ }
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL2]) {
+ tetrinet_specialkey(2);
+ }
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL3]) {
+ tetrinet_specialkey(3);
+ }
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL4]) {
+ tetrinet_specialkey(4);
+ }
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL5]) {
+ tetrinet_specialkey(5);
+ }
+ else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL6]) {
+ tetrinet_specialkey(6);
}
tetris_drawcurrentblock ();
return TRUE;