void xfsm_dns_check (void) { GtkWidget *msgbox = NULL; gchar hostname[256]; gint response; while (!check_for_dns ()) { if (msgbox == NULL) { queryhostname (hostname, 256, TRUE); msgbox = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Could not look up internet address for %s.\n" "This will prevent Xfce from operating correctly.\n" "It may be possible to correct the problem by adding\n" "%s to the file /etc/hosts on your system."), hostname, hostname); gtk_dialog_add_buttons (GTK_DIALOG (msgbox), _("Continue anyway"), RESPONSE_LOG_IN, _("Try again"), RESPONSE_TRY_AGAIN, NULL); xfsm_window_add_border (GTK_WINDOW (msgbox)); xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (msgbox)); } gtk_dialog_set_default_response (GTK_DIALOG (msgbox), RESPONSE_TRY_AGAIN); response = xfsm_splash_screen_run (splash_screen, msgbox); if (response != RESPONSE_TRY_AGAIN) break; gtk_widget_hide (msgbox); } if (msgbox != NULL) gtk_widget_destroy (msgbox); }
int xfsm_splash_screen_choose (XfsmSplashScreen *splash, GList *sessions, const gchar *default_session, gchar **name_return) { GtkWidget *chooser; GtkWidget *label; GtkWidget *dialog; GtkWidget *entry; gchar title[256]; int result; g_assert (default_session != NULL); if (splash->engine.choose != NULL) { result = splash->engine.choose (&splash->engine, sessions, default_session, name_return); } else { again: xfsm_splash_screen_next (splash, _("Choose session")); chooser = g_object_new (XFSM_TYPE_CHOOSER, "screen", splash->engine.primary_screen, "type", GTK_WINDOW_POPUP, NULL); xfsm_window_add_border (GTK_WINDOW (chooser)); xfsm_chooser_set_sessions (XFSM_CHOOSER (chooser), sessions, default_session); result = xfsm_splash_screen_run (splash, chooser); if (result == XFSM_RESPONSE_LOAD) { if (name_return != NULL) *name_return = xfsm_chooser_get_session (XFSM_CHOOSER (chooser)); result = XFSM_CHOOSE_LOAD; } else if (result == XFSM_RESPONSE_NEW) { result = XFSM_CHOOSE_NEW; } else { result = XFSM_CHOOSE_LOGOUT; } gtk_widget_destroy (chooser); if (result == XFSM_CHOOSE_NEW) { xfsm_splash_screen_next (splash, _("Choose session name")); dialog = gtk_dialog_new_with_buttons (NULL, NULL, GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); g_snprintf (title, 256, "<big>%s</big>", _("Choose a name for the new session:")); label = gtk_label_new (title); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 6); gtk_widget_show (label); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, TRUE, TRUE, 6); gtk_widget_show (entry); xfsm_window_add_border (GTK_WINDOW (dialog)); again1: result = xfsm_splash_screen_run (splash, dialog); if (result != GTK_RESPONSE_OK) { gtk_widget_destroy (dialog); goto again; } if (name_return != NULL) { *name_return = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); if (strlen (*name_return) == 0) { g_free (*name_return); goto again1; } } gtk_widget_destroy (dialog); result = XFSM_CHOOSE_NEW; } } return result; }