From: Jordi Mallach Date: Fri, 3 Nov 2006 13:10:48 +0000 (+0000) Subject: Patch from Lucas Nussbaum to save the last game X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=e7944eec3f3682c7f16ffdbbeebf23bfaabd7515;p=gtetrinet Patch from Lucas Nussbaum to save the last game 2006-11-03 Jordi Mallach * src/config.c, src/dialogs.c, gtetrinet.schemas.in: Patch from Lucas Nussbaum to save the last game mode used in GConf. --- diff --git a/ChangeLog b/ChangeLog index 0232b39..106c958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2006-11-03 Loïc Minier +2006-11-03 Jordi Mallach + + * src/config.c, src/dialogs.c, gtetrinet.schemas.in: Patch from + Lucas Nussbaum to save the last + game mode used in GConf. + +2006-11-03 Loïc Minier * src/config.c: Fix a double free() which causes a crash on first start, when theme_dir isn't set. Fixes #114425. diff --git a/gtetrinet.schemas.in b/gtetrinet.schemas.in index 2c7e2a0..6d9e2ac 100644 --- a/gtetrinet.schemas.in +++ b/gtetrinet.schemas.in @@ -102,6 +102,19 @@ + + /schemas/apps/gtetrinet/player/gamemode + /apps/gtetrinet/player/gamemode + gtetrinet + bool + 0 + + + Tetrinet game mode + If set to true, the game mode will be set to Tetrifast. + If false, gtetrinet will use the original mode. + + /schemas/apps/gtetrinet/keys/right diff --git a/src/config.c b/src/config.c index e6e46c3..58abd28 100644 --- a/src/config.c +++ b/src/config.c @@ -236,6 +236,9 @@ void config_loadconfig (void) GTET_O_STRCPY(team, p); g_free(p); } + + /* get the game mode */ + gamemode = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/player/gamemode", NULL); /* get the keys */ p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/right", NULL); diff --git a/src/dialogs.c b/src/dialogs.c index bad7d8e..f42b0ff 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -189,7 +189,6 @@ static GtkWidget *serveraddressentry, *nicknameentry, *teamnameentry, *spectator static GtkWidget *passwordlabel, *teamnamelabel; static GtkWidget *originalradio, *tetrifastradio; static GSList *gametypegroup; -static int oldgamemode; void connectdialog_button (GtkDialog *dialog, gint button) { @@ -256,11 +255,11 @@ void connectdialog_button (GtkDialog *dialog, gint button) gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/team", gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(teamnameentry)))), NULL); + gconf_client_set_bool (gconf_client, "/apps/gtetrinet/player/gamemode", gamemode, NULL); g_free (nick); break; case GTK_RESPONSE_CANCEL: - gamemode = oldgamemode; gtk_widget_destroy (connectdialog); break; } @@ -317,9 +316,6 @@ void connectdialog_new (void) } connecting = TRUE; - /* save some stuff */ - oldgamemode = gamemode; - /* make dialog that asks for address/nickname */ connectdialog = gtk_dialog_new_with_buttons (_("Connect to server"), GTK_WINDOW (app),