1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2005 Francisco Moraes
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include "planner-util.h"
void
planner_util_show_url (GtkWindow *parent,
const gchar *url)
{
GtkWidget *dialog;
int res;
res = (int) ShellExecute (NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
if (res <= 32) {
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("Unable to open '%s'"), url);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
}
void
planner_util_show_help (GtkWindow *parent)
{
GtkWidget *dialog;
int res;
gchar *path;
gchar *file;
// should use HtmlHelp but it is not part of MingW yet
path = g_win32_get_package_installation_subdirectory (NULL, NULL, ".");
file = g_build_filename (path, "planner.chm", NULL);
res = (int) ShellExecute (NULL, "open", file, NULL, NULL, SW_SHOWNORMAL);
g_free (file);
g_free (path);
if (res <= 32) {
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("Unable to open help file"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
}
|