[Proposal] Helper functions in GTK+ for showing help and URIs
- From: "Jaap A. Haitsma" <jaap haitsma org>
- To: gtk-devel-list gnome org
- Subject: [Proposal] Helper functions in GTK+ for showing help and URIs
- Date: Sun, 17 Feb 2008 14:00:18 +0100
Hi,
Currently applications need quite some code to show help or to show an
URI, if you don't want to depend on the deprecated libgnomeui and
gnome-vfs. My proposal is to add to function to gtk+: gtk_show_help
and gtk_show_uri
I attached gtk_show.c with these functions implemented.
Comments?
Jaap
#include <glib.h>
#include <gio/gio.h>
#include "gtkwidget.h"
gboolean
gtk_show_help (GtkWidget *parent, const char* application_name, const char* section, GError **error)
{
  char *uri;
  gboolean ret;
  if (section)
    uri = g_strdup_printf ("ghelp:%s?%s", application_name, section);
  else
    uri = g_strdup ("ghelp:%s", application_name);
  ret = gtk_show_uri (parent, uri, section, error);
  g_free (uri);
}
gboolean
gtk_show_uri (GtkWidget *parent, const char* uri, GError **error)
{
  GdkAppLaunchContext *context;
  GdkScreen *screen;
  context = gdk_app_launch_context_new ();
  screen = gtk_widget_get_screen (parent);
  gdk_app_launch_context_set_screen (context, screen);
  ret = g_app_info_launch_default_for_uri (uri, app_context, error);
  g_object_unref (context);
  return ret;
}
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]