From b78ad60b436c272456dd01523071b2a00c8975b4 Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Sat, 29 May 2010 14:42:28 +0000 Subject: [PATCH] - Display --help output in a dialog on windows, a windows-application has no (easy) way to output on a console, even if it was started on one --- src/main.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 27bc1a2..9a86715 100644 --- a/src/main.c +++ b/src/main.c @@ -1826,10 +1826,36 @@ N_("\ndebug-level numbers are (bitwise OR to debug multiple sections):\n" static void usage() { +#ifdef WIN32 + GtkWidget *dialog, *content_area, *scrolled, *text_view; + + dialog = gtk_dialog_new_with_buttons(_("GKrellM"), NULL, GTK_DIALOG_MODAL, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + + scrolled = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_set_size_request(scrolled, 400, 300); + gtk_container_add(GTK_CONTAINER(content_area), scrolled); + + text_view = gtk_text_view_new(); + gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view), FALSE); + gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text_view), FALSE); + gtk_container_add(GTK_CONTAINER(scrolled), text_view); + + gkrellm_gtk_text_view_append_strings(text_view, usage_string, + sizeof(usage_string) / sizeof(gchar *)); + + gtk_widget_show_all(dialog); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +#else gint i; - for (i = 0; i < sizeof(usage_string) / sizeof(gchar *); ++i) + for (i = 0; i < (sizeof(usage_string) / sizeof(gchar *)); ++i) g_print(_(usage_string[i])); +#endif }