From 264f675335931a0e1f1464a2d852de4446a01711 Mon Sep 17 00:00:00 2001 From: Jordi Albornoz Date: Sun, 5 Jan 2003 19:10:21 +0000 Subject: [PATCH] From James Antill: fix segfault when opening about twice. Autofocus text entry box when switching to partyline. --- ChangeLog | 10 +++++++++- src/commands.c | 6 ++++-- src/gtetrinet.c | 8 ++++---- src/gtetrinet.h | 2 -- src/partyline.c | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2805a3f..f0e9be5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ -2003-01-05 Dani Carbonell +2003-01-05 Jordi Mallach + + * src/commands.c (about_command): fix segfault when calling two about + dialogs. Patch from James Antill. + + * src/gtetrinet.c (main): autofocus the text box when switching from + some notetab to partyline. Patch from James Antill. + +2003-01-05 Dani Carbonell * TODO: updated. diff --git a/src/commands.c b/src/commands.c index 25d6621..b116af6 100644 --- a/src/commands.c +++ b/src/commands.c @@ -34,8 +34,6 @@ #include "commands.h" #include "dialogs.h" -extern GtkWidget *about; - GnomeUIInfo gamemenu[] = { GNOMEUIINFO_ITEM(N_("_Connect to server..."), NULL, connect_command, NULL), GNOMEUIINFO_ITEM(N_("_Disconnect from server"), NULL, disconnect_command, NULL), @@ -223,6 +221,7 @@ void about_command (GtkWidget *widget, gpointer data) { GtkWidget *hbox; GdkPixbuf *logo; + static GtkWidget *about = NULL; if (!GTK_IS_WINDOW (about)) { @@ -258,6 +257,9 @@ void about_command (GtkWidget *widget, gpointer data) hbox, TRUE, FALSE, 0); gtk_widget_show_all (hbox); + g_signal_connect(G_OBJECT(about), "destroy", + G_CALLBACK(gtk_widget_destroyed), &about); + gtk_widget_show (about); } else diff --git a/src/gtetrinet.c b/src/gtetrinet.c index 798a9d3..f0343a9 100644 --- a/src/gtetrinet.c +++ b/src/gtetrinet.c @@ -216,9 +216,9 @@ int main (int argc, char *argv[]) gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pwinlist, label); /* add signal to focus the text entry when switching to the partyline page*/ - g_signal_connect (G_OBJECT (notebook), "switch_page", - GTK_SIGNAL_FUNC (partyline_switch_entryfocus), - NULL); + g_signal_connect_after(G_OBJECT (notebook), "switch_page", + GTK_SIGNAL_FUNC (partyline_switch_entryfocus), + NULL); gtk_widget_show (notebook); gtk_widget_show (app); @@ -396,7 +396,7 @@ static int gtetrinet_key (int keyval, int mod) case GDK_1: gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 0); break; case GDK_2: gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 1); - partyline_entryfocus(); + /* partyline_entryfocus(); */ break; case GDK_3: gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 2); break; default: diff --git a/src/gtetrinet.h b/src/gtetrinet.h index 1b4fe27..05d5d45 100644 --- a/src/gtetrinet.h +++ b/src/gtetrinet.h @@ -7,8 +7,6 @@ extern int gamemode; -GtkWidget *about; - extern void destroymain (GtkWidget *widget, gpointer data); extern gint keypress (GtkWidget *widget, GdkEventKey *key); extern gint keyrelease (GtkWidget *widget, GdkEventKey *key); diff --git a/src/partyline.c b/src/partyline.c index 129bab7..00d266f 100644 --- a/src/partyline.c +++ b/src/partyline.c @@ -255,7 +255,7 @@ void partyline_entryfocus (void) } void partyline_switch_entryfocus (void) -{ +{ /* FIXME: should only grab when in right notebook */ if (connected) gtk_widget_grab_focus (entrybox); } -- 2.50.1