Example #1
0
/**
 * Open the help browser
 */
void
gul_gui_help (GtkWindow *parent, const char *file, const char *link_id)
{
	GError *error;
	GtkWidget *dialog;

	error = NULL;
	gnome_help_display (file, link_id, &error);

	if (error) 
	{
		dialog = hig_alert_new (parent,
					(GtkDialogFlags)0,
					HIG_ALERT_ERROR,
					_("Cannot display help."),
					NULL,
					GTK_STOCK_OK,
					GTK_RESPONSE_OK,
					NULL);
		hig_alert_set_secondary_printf (HIG_ALERT (dialog),
						"%s",
						error->message);
		g_signal_connect (G_OBJECT (dialog), "response",
				  G_CALLBACK (gtk_widget_destroy),
				  NULL);
		gtk_widget_show (dialog);
		g_error_free (error);
	}
}
Example #2
0
static void help_manual_cb(void)
{
	GError *error = NULL;
	gnome_help_display("pioneers", NULL, &error);
	if (error) {
		log_message(MSG_ERROR, "%s: %s\n", _("Show the manual"),
			    error->message);
		g_error_free(error);
	}
}
Example #3
0
/**
 * Show online help 
 */
void on_online_help_activate (GtkWidget *widget,
			      gpointer user_data)
{
  GError* error = NULL;
  
  if (!gnome_help_display ("gwp.xml", NULL, &error)) {
    /* report error */
    g_message ("HELP ERROR: %s", error->message);
    g_error_free (error);
  }
}
Example #4
0
/* callbacks */
static void
gmdb_prefs_help_cb(GtkWidget *w, gpointer data)
{
	GError *error = NULL;

	gnome_help_display("gmdb.xml", "gmdb-prefs", &error);
	if (error != NULL) {
		g_warning ("%s", error->message);
		g_error_free (error);
	}
}
Example #5
0
void show_help(const gchar *section)
{
#ifdef _WIN32
  // You may translate it as "%s\\help\\stardict-zh_CN.chm" when this file available.
  gchar *filename = g_strdup_printf(_("%s\\help\\stardict.chm"), gStarDictDataDir.c_str());
  ShellExecute((HWND)(GDK_WINDOW_HWND(gpAppFrame->window->window)), "OPEN", filename, NULL, NULL, SW_SHOWNORMAL);
  g_free(filename);
#elif defined(CONFIG_GNOME)
  gnome_help_display ("stardict.xml", section, NULL);
#endif
}
Example #6
0
void
gmdb_export_help_cb(GtkWidget *w, gpointer data)
{
	GError *error = NULL;

	gnome_help_display("gmdb.xml", "gmdb-table-export", &error);
	if (error != NULL) {
		g_warning (error->message);
		g_error_free (error);
	}
}
Example #7
0
void
gmdb_help_cb(GtkWidget *button, gpointer data)
{
	GError *error = NULL;

	gnome_help_display("gmdb.xml", NULL, &error);
	if (error != NULL) {
		g_warning ("%s", error->message);
		g_error_free (error);
	}

}
Example #8
0
static void
action_help (GtkAction *action, gpointer callback_data)
{
    GError *e = NULL;
    GtkamMain *m = GTKAM_MAIN (callback_data);
    GtkWidget *d;

    gnome_help_display ("gtkam.xml", NULL, &e);
    if (e) {
        d = gtkam_close_new (e->message);
        gtk_window_set_transient_for (GTK_WINDOW (d), GTK_WINDOW (m));
        gtk_widget_show (d);
        g_error_free (e);
    }
}
Example #9
0
static void
go_help_display (CBHelpPaths const *paths)
{
#ifdef GOFFICE_WITH_GNOME
	gnome_help_display (paths->app, paths->link, NULL);
#elif defined(G_OS_WIN32)
	static GHashTable* context_help_map = NULL;
	guint id;

	if (!context_help_map) {
		GsfInput *input;
		GsfInputTextline *textline;
		GError *err = NULL;
		gchar *mapfile = g_strconcat (paths->app, ".hhmap", NULL);
		gchar *path = g_build_filename (paths->data_dir, "doc", "C", mapfile, NULL);

		g_free (mapfile);

		if (!(input = gsf_input_stdio_new (path, &err)) ||
		    !(textline = (GsfInputTextline *) gsf_input_textline_new (input)))
			go_gtk_notice_dialog (NULL, GTK_MESSAGE_ERROR, "Cannot open '%s': %s",
					      path, err ? err->message :
							  "failed to create gsf-input-textline");
		else {
			gchar *line, *topic;
			gulong id, i = 1;
			context_help_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);

			while ((line = gsf_input_textline_utf8_gets (textline)) != NULL) {
				if (!(id = strtoul (line, &topic, 10))) {
					go_gtk_notice_dialog (NULL, GTK_MESSAGE_ERROR,
							      "Invalid topic id at line %lu in %s: '%s'",
							      i, path, line);
					continue;
				}
				for (; *topic == ' '; ++topic);
				g_hash_table_insert (context_help_map, g_strdup (topic),
					(gpointer)id);
			}
			g_object_unref (G_OBJECT (textline));
		}
		if (input)
			g_object_unref (G_OBJECT (input));
		g_free (path);
	}

	if (!(id = (guint) g_hash_table_lookup (context_help_map, paths->link)))
		go_gtk_notice_dialog (NULL, GTK_MESSAGE_ERROR, "Topic '%s' not found.",
				      paths->link);
	else {
		gchar *chmfile = g_strconcat (paths->app, ".chm", NULL);
		gchar *path = g_build_filename (paths->data_dir, "doc", "C", chmfile, NULL);

		g_free (chmfile);
		if (!HtmlHelp (GetDesktopWindow (), path, HH_HELP_CONTEXT, id))
			go_gtk_notice_dialog (NULL, GTK_MESSAGE_ERROR, "Failed to spawn HtmlHelp");
		g_free (path);
	}
#else
	go_gtk_notice_dialog (NULL, GTK_MESSAGE_ERROR,
			      "TODO : launch help browser for %s", paths->link);
#endif
}