if (client==probe) {
network_stop();
/* Never destroy 'client' now - it has been destroyed by network_stop()! */
- if (network_notify_hostip)
- (*network_notify_hostip)(0);
}
else {
client_destroy(client);
client_touch(probe); /* timeout */
write_daemon_running(getpid());
+ if (network_notify_hostip)
+ (*network_notify_hostip)(0);
return TRUE;
}
}
if (daemon_pid==getpid()) {
sock_gsource_destroy();
- return TRUE;
+ goto ok;
}
errno=0;
kill(daemon_pid,SIGKILL);
(int)daemon_pid,strerror(errno_save)));
return FALSE;
}
+ok:
+ if (network_notify_hostip)
+ (*network_notify_hostip)(0);
return TRUE;
}
#include <libgnomeui/gnome-app-util.h>
#include "network.h"
+#include "packet.h"
/* Config: */
static GtkHBox *PortHBox;
static GnomeAppBar *AppBar;
static GtkEntry *PortEntry;
+static GtkEntry *HostIPEntry;
static void state_start_stop(void)
gtk_widget_destroy(GTK_WIDGET(App));
}
+static void ui_gnome_network_notify_hostip(guint32 hostip_guint32)
+{
+ if (!hostip_guint32) {
+ if (is_daemon_running()==(pid_t)-1)
+ gtk_entry_set_text(HostIPEntry,_("(unknown; Start the daemon)"));
+ else
+ gtk_entry_set_text(HostIPEntry,_("(unknown; detecting...)"));
+ }
+ else {
+ gtk_entry_set_text(HostIPEntry,HOSTIP_GUINT32_TO_STRING(hostip_guint32));
+ }
+}
+
static void ui_gnome_g_log_handler(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
{
GtkWidget *dialog;
PortHBox=GTK_HBOX(lookup_widget(GTK_WIDGET(App),"PortHBox"));
AppBar=GNOME_APPBAR(lookup_widget(GTK_WIDGET(App),"AppBar"));
PortEntry=GTK_ENTRY(lookup_widget(GTK_WIDGET(App),"PortEntry"));
+ HostIPEntry=GTK_ENTRY(lookup_widget(GTK_WIDGET(App),"HostIPEntry"));
/* ui_gnome_g_log_handler() needs 'App'. */
g_log_set_handler(
ui_gnome_g_log_handler, /* log_func */
NULL); /* user_data */
+ ui_gnome_network_notify_hostip(0);
+
gtk_widget_show_all(GTK_WIDGET(App));
g_timeout_add(
DAEMON_CHECK_INTERVAL_MS, /* interval */
daemon_check_timeout_func, /* function */
NULL); /* data; unused */
+
+ network_notify_hostip=ui_gnome_network_notify_hostip;
+
return TRUE;
}
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
- <property name="text" translatable="yes">123.456.789.123</property>
+ <property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>