[Freeciv-Dev] (PR#10182) LAN refresh bug
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#10182) LAN refresh bug |
From: |
"Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx> |
Date: |
Sat, 18 Sep 2004 17:58:49 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10182 >
There is a bug with the connect dialog LAN refresh functionality. If
you press refresh and then the connect dialog closes before the timeout
expires, you get this:
(civclient:16365): Gtk-CRITICAL **: file gtkliststore.c: line 1362
(gtk_list_store_clear): assertion `GTK_IS_LIST_STORE (list_store)' failed
Repeated several times. Patch attached. It also does some minor cleanups.
Index: client/gui-gtk-2.0/connectdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/connectdlg.c,v
retrieving revision 1.47
diff -u -r1.47 connectdlg.c
--- client/gui-gtk-2.0/connectdlg.c 19 Sep 2004 00:22:11 -0000 1.47
+++ client/gui-gtk-2.0/connectdlg.c 19 Sep 2004 00:54:38 -0000
@@ -96,6 +96,7 @@
static void lan_list_callback(GtkTreeSelection *select, GtkTreeModel *model);
static int get_lanservers(gpointer data);
+static guint lan_timer;
static int num_lanservers_timer = 0;
/**************************************************************************
@@ -248,7 +249,7 @@
/**************************************************************************
This function updates the list of LAN servers every 100 ms for 5 seconds.
**************************************************************************/
-static int get_lanservers(gpointer data)
+static gboolean get_lanservers(gpointer data)
{
struct server_list *server_list = get_lan_server_list();
gchar *row[6];
@@ -277,9 +278,10 @@
if (num_lanservers_timer == 50) {
finish_lanserver_scan();
num_lanservers_timer = 0;
- return 0;
+ lan_timer = 0;
+ return FALSE;
}
- return 1;
+ return TRUE;
}
/**************************************************************************
@@ -287,13 +289,11 @@
**************************************************************************/
static void lan_update_callback(GtkWidget *w, gpointer data)
{
- int get_lanservers_timer = 0;
-
if (num_lanservers_timer == 0) {
gtk_list_store_clear(storelan);
if (begin_lanserver_scan()) {
- get_lanservers_timer = gtk_timeout_add(100, get_lanservers, NULL);
+ lan_timer = g_timeout_add(100, get_lanservers, NULL);
}
}
}
@@ -369,21 +369,23 @@
/**************************************************************************
...
***************************************************************************/
-static gboolean meta_click_callback(GtkWidget *w, GdkEventButton *event,
gpointer data)
+static void meta_click_callback(GtkTreeView *treeview,
+ GtkTreePath *arg1,
+ GtkTreeViewColumn *arg2,
+ gpointer data)
{
- if (event->type==GDK_2BUTTON_PRESS) connect_callback(w, data);
- return FALSE;
+ connect_callback(NULL, data);
}
/**************************************************************************
...
***************************************************************************/
-static gboolean lan_click_callback(GtkWidget *w, GdkEventButton *event,
gpointer data)
+static void lan_click_callback(GtkTreeView *treeview,
+ GtkTreePath *arg1,
+ GtkTreeViewColumn *arg2,
+ gpointer data)
{
- if (event->type == GDK_2BUTTON_PRESS) {
- connect_callback(w, data);
- }
- return FALSE;
+ connect_callback(NULL, data);
}
/**************************************************************************
@@ -391,8 +393,11 @@
**************************************************************************/
static void connect_destroy_callback(GtkWidget *w, gpointer data)
{
+ if (lan_timer != 0) {
+ g_source_remove(lan_timer);
+ }
+
dialog = NULL;
- gtk_widget_set_sensitive(top_vbox, TRUE);
}
#define MIN_DIMENSION 5
@@ -767,6 +772,8 @@
#endif
dialog_config = LOGIN_TYPE;
+ lan_timer = 0;
+
dialog = gtk_dialog_new_with_buttons(NULL,
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1099,14 +1106,14 @@
g_signal_connect(selectionsaved, "changed",
G_CALLBACK(saved_list_callback), NULL);
- g_signal_connect(listmeta, "button_press_event",
+ g_signal_connect(listmeta, "row_activated",
G_CALLBACK(meta_click_callback), NULL);
g_signal_connect(selectionmeta, "changed",
G_CALLBACK(meta_list_callback), NULL);
g_signal_connect(updatemeta, "clicked",
G_CALLBACK(meta_update_callback), NULL);
- g_signal_connect(listlan, "button_press_event",
+ g_signal_connect(listlan, "row_activated",
G_CALLBACK(lan_click_callback), NULL);
g_signal_connect(selectionlan, "changed",
G_CALLBACK(lan_list_callback), NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#10182) LAN refresh bug,
Vasco Alexandre da Silva Costa <=
|
|