- Show message dialog when initial connect to server fails in client-mode, instead of only printing a line on stdout which is invisible on most windowing-systems anyway
This commit is contained in:
parent
1f28fe7a74
commit
6a6925312a
18
src/client.c
18
src/client.c
|
@ -1862,13 +1862,21 @@ gboolean
|
|||
gkrellm_client_mode_connect(void)
|
||||
{
|
||||
gchar buf[128];
|
||||
GtkWidget* dlg;
|
||||
|
||||
if (_GK.server_port == 0)
|
||||
_GK.server_port = GKRELLMD_SERVER_PORT;
|
||||
|
||||
client_fd = gkrellm_connect_to(_GK.server, _GK.server_port);
|
||||
if (client_fd < 0) {
|
||||
printf("%s\n", _("Unable to connect."));
|
||||
g_warning("%s\n", _("Unable to connect."));
|
||||
|
||||
dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
|
||||
"Unable to connect to server '%s:%d'",
|
||||
_GK.server, _GK.server_port);
|
||||
gtk_dialog_run(GTK_DIALOG(dlg));
|
||||
gtk_widget_destroy(dlg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1880,7 +1888,15 @@ gkrellm_client_mode_connect(void)
|
|||
/* Initial setup lines from server are read in blocking mode.
|
||||
*/
|
||||
if(!read_server_setup(client_fd)){
|
||||
|
||||
close(client_fd);
|
||||
|
||||
dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
|
||||
"Initial setup with server '%s:%d' failed.",
|
||||
_GK.server, _GK.server_port);
|
||||
gtk_dialog_run(GTK_DIALOG(dlg));
|
||||
gtk_widget_destroy(dlg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
12
src/main.c
12
src/main.c
|
@ -2169,16 +2169,20 @@ main(gint argc, gchar **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (_GK.debug_level > 0)
|
||||
g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
|
||||
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
|
||||
|
||||
gkrellm_sys_main_init(); //FIXME: call this later or earlier?
|
||||
|
||||
_GK.w_display = gdk_screen_get_width(gdk_screen_get_default());
|
||||
_GK.h_display = gdk_screen_get_height(gdk_screen_get_default());
|
||||
|
||||
if (_GK.debug_level > 0)
|
||||
g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
|
||||
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
|
||||
if (_GK.server && !gkrellm_client_mode_connect())
|
||||
exit(0);
|
||||
{
|
||||
gkrellm_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
check_gkrellm_directories();
|
||||
gkrellm_load_user_config(NULL, FALSE);
|
||||
|
|
Loading…
Reference in New Issue