Fixed race on shutting down the Gnome UI.
Improved startup "inconsistent"/"sensitive" behavior.
Implemented crossplatform automatic startup management.
#include "network.h"
#include "packet.h"
#include "network.h"
#include "packet.h"
+#include "static-startup.h"
if (!App) /* Quitting? */
return FALSE; /* stop running */
if (!App) /* Quitting? */
return FALSE; /* stop running */
- if (startup_query(&state_startup_is_on))
+ if (static_startup_query(&state_startup_is_on))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(AutostartCheckButton),state_startup_is_on);
return TRUE; /* continue running */
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(AutostartCheckButton),state_startup_is_on);
return TRUE; /* continue running */
}
+static void buttonstart(void)
+{
+ if (!optarg_port_set_string(gtk_entry_get_text(PortEntry)))
+ return;
+ network_start(optarg_port);
+}
+
void on_PortButtonRandom_clicked(GtkButton *button,gpointer user_data)
{
g_return_if_fail(GTK_IS_BUTTON(button));
void on_PortButtonRandom_clicked(GtkButton *button,gpointer user_data)
{
g_return_if_fail(GTK_IS_BUTTON(button));
return;
gtk_entry_set_text(PortEntry,
udpgate_printf_alloca("%d",(int)g_random_int_range(PORT_RANGE_BEGIN,PORT_RANGE_END)));
return;
gtk_entry_set_text(PortEntry,
udpgate_printf_alloca("%d",(int)g_random_int_range(PORT_RANGE_BEGIN,PORT_RANGE_END)));
}
void on_AutostartCheckButton_toggled(GtkToggleButton *togglebutton,gpointer user_data)
}
void on_AutostartCheckButton_toggled(GtkToggleButton *togglebutton,gpointer user_data)
inside++;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(AutostartCheckButton)))
inside++;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(AutostartCheckButton)))
external_startup_check_timeout_func(NULL); /* data; unused */
g_assert(inside==1);
external_startup_check_timeout_func(NULL); /* data; unused */
g_assert(inside==1);
{
g_return_if_fail(GTK_IS_BUTTON(button));
{
g_return_if_fail(GTK_IS_BUTTON(button));
- if (!optarg_port_set_string(gtk_entry_get_text(PortEntry)))
- return;
- network_start(optarg_port);
}
void on_ButtonStop_clicked(GtkButton *button,gpointer user_data)
}
void on_ButtonStop_clicked(GtkButton *button,gpointer user_data)
void on_ButtonHide_clicked(GtkButton *button,gpointer user_data)
{
void on_ButtonHide_clicked(GtkButton *button,gpointer user_data)
{
g_return_if_fail(GTK_IS_BUTTON(button));
/* update config file */
g_return_if_fail(GTK_IS_BUTTON(button));
/* update config file */
/* Do not: gtk_main_quit();
* as 'App' widget will quit our gtk_main() automatically.
*/
/* Do not: gtk_main_quit();
* as 'App' widget will quit our gtk_main() automatically.
*/
- gtk_widget_destroy(GTK_WIDGET(App));
+ /* Do not: gtk_widget_destroy(App); App=NULL;
+ * as it would race with g_timeout_add()ed function which check
+ * 'if (!App)' first and expect there fully valid tree afterwards.
+ */
+ App_local=App;
+ gtk_widget_destroy(GTK_WIDGET(App));
}
static void ui_gnome_network_notify_hostip(guint32 hostip_guint32)
}
static void ui_gnome_network_notify_hostip(guint32 hostip_guint32)
ui_gnome_network_notify_hostip(0);
gtk_entry_set_text(PortEntry,udpgate_printf_alloca("%d",(int)optarg_port));
ui_gnome_network_notify_hostip(0);
gtk_entry_set_text(PortEntry,udpgate_printf_alloca("%d",(int)optarg_port));
- if (!startup_init()) {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(AutostartCheckButton),TRUE);
+ if (!static_startup_supported()) {
gtk_widget_set_sensitive(GTK_WIDGET(AutostartLabel),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(AutostartCheckButton),FALSE);
}
gtk_widget_set_sensitive(GTK_WIDGET(AutostartLabel),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(AutostartCheckButton),FALSE);
}
+ if (!static_startup_query(NULL))
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(AutostartCheckButton),TRUE);
daemon_check_timeout_func(NULL); /* data; unused */
external_startup_check_timeout_func(NULL); /* data; unused */
daemon_check_timeout_func(NULL); /* data; unused */
external_startup_check_timeout_func(NULL); /* data; unused */