help.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *            help.c
00003  *
00004  *  Sun Sep  2 18:16:30 2007
00005  *  Copyright  2007  Neil Williams
00006  *  <linux@codehelp.co.uk>
00007  ****************************************************************************/
00012 /*
00013     This package is free software; you can redistribute it and/or modify
00014     it under the terms of the GNU General Public License as published by
00015     the Free Software Foundation; either version 3 of the License, or
00016     (at your option) any later version.
00017 
00018     This program is distributed in the hope that it will be useful,
00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021     GNU General Public License for more details.
00022 
00023     You should have received a copy of the GNU General Public License
00024     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025 */
00026 
00027 #include "config.h"
00028 #include <glib.h>
00029 #include <gtk/gtk.h>
00030 #include <glib/gi18n.h>
00031 #include <gtkextra/gtksheet.h>
00032 #include "types.h"
00033 #include "dialog_initial.h"
00034 #include "main.h"
00035 #include "quicklist.xpm"
00036 #include "help.h"
00037 
00038 void
00039 qlhelp_credits (GtkAction G_GNUC_UNUSED * w, gpointer G_GNUC_UNUSED data)
00040 {
00041     GtkWidget *aboutdialog;
00042     const gchar *authors[] = {
00043         "Neil Williams <linux@codehelp.co.uk>",
00044         "Jay MacDonald <jay@aztech-cs.com>",
00045         "Sam Phillips <sam@usaworks.com>",
00046         "Keith Wesolowski <theman@cs.unr.edu>",
00047         NULL
00048     };
00049     /* TRANSLATORS: Replace this string with your names, one name per line. */
00050     gchar *translators = _("translator-credits");
00051     GdkPixbuf *aboutdialog_logo_pixbuf;
00052 
00053     aboutdialog = gtk_about_dialog_new ();
00054     gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (aboutdialog), VERSION);
00055     gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (aboutdialog),
00056         "Copyright 2006 Neil Williams <linux@codehelp.co.uk>\n"
00057             "1999 the QuickList team:");
00058     gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (aboutdialog),
00059         _("GTK2 utility for making lists of things."));
00060     gtk_about_dialog_set_license (GTK_ABOUT_DIALOG (aboutdialog),
00061         "This package is free software; you can redistribute it and/or modify\n"
00062         "it under the terms of the GNU General Public License as published by\n"
00063         "the Free Software Foundation; either version 3 of the License, or\n"
00064         "(at your option) any later version.\n\n"
00065         "This program is distributed in the hope that it will be useful,\n"
00066         "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
00067         "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
00068         "GNU General Public License for more details.\n\n"
00069         "You should have received a copy of the GNU General Public License \n"
00070         "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");
00071     /* this doesn't give a button unless we make quicklist a gnome app */
00072     gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (aboutdialog),
00073         "http://quicklist.sourceforge.net/");
00074     gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (aboutdialog),
00075         _("Homepage:"));
00076     gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (aboutdialog), authors);
00077     gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG
00078         (aboutdialog), translators);
00079     aboutdialog_logo_pixbuf =
00080         gdk_pixbuf_new_from_xpm_data ((const gchar **)&quicklist_xpm);
00081     gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (aboutdialog),
00082         aboutdialog_logo_pixbuf);
00083     gtk_dialog_run (GTK_DIALOG(aboutdialog));
00084     gtk_widget_destroy (aboutdialog);
00085 }
00086 
00094 void
00095 qlhelp_manual (GtkAction G_GNUC_UNUSED * w, gpointer data)
00096 {
00097     gchar * cmd;
00098     GError * err;
00099 
00100     err = NULL;
00101     if (g_file_test ("/usr/bin/yelp", G_FILE_TEST_EXISTS))
00102         cmd = g_strconcat ("/usr/bin/yelp ", HELPDIR, "/quicklist.xml", NULL);
00103     else if (g_file_test ("/usr/bin/dwww", G_FILE_TEST_EXISTS))
00104         cmd = g_strconcat ("/usr/bin/www-browser ", PACKAGE, NULL);
00105     else if (g_file_test ("/usr/bin/x-www-browser", G_FILE_TEST_EXISTS))
00106         cmd = g_strconcat ("/usr/bin/x-www-browser ", DOCDIR, "/index.html", NULL);
00107     else if (g_file_test ("/usr/bin/www-browser", G_FILE_TEST_EXISTS))
00108         cmd = g_strconcat ("/usr/bin/www-browser ", DOCDIR, "/index.html", NULL);
00109     else
00110     {
00111         QlContext * qlc;
00112         GtkWidget * dlg;
00113         qlc = ql_get_context (GTK_WIDGET(data));
00114         dlg = gtk_message_dialog_new (GTK_WINDOW(qlc->parent), 
00115             GTK_DIALOG_DESTROY_WITH_PARENT,
00116             GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
00117             "%s", "No help viewer found, please install yelp.");
00118         g_signal_connect (GTK_OBJECT (dlg), "response", 
00119             G_CALLBACK (gtk_widget_destroy), dlg);
00120         gtk_dialog_run (GTK_DIALOG (dlg));
00121         gtk_widget_destroy (dlg);
00122         g_warning ("Cannot load quicklist manual, install yelp.");
00123         return;
00124     }
00125     g_spawn_command_line_async (cmd, &err);
00126     g_free (cmd);
00127     if (err)
00128         g_warning (err->message);
00129     g_clear_error (&err);
00130 }

Generated on Mon Jan 28 22:02:10 2008 for quicklist by  doxygen 1.5.4