Re: [Proposal] Helper functions in GTK+ for showing help and URIs



On Sun, 2008-02-17 at 14:00 +0100, Jaap A. Haitsma wrote:
> 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?

you probably want to add g_return_if_fail() in both functions.

in gtk_show_help():

  if (section)
    uri = g_strdup_printf ("ghelp:%s?%s", application_name, section);
  else
    uri = g_strdup ("ghelp:%s", application_name);

I'd use g_strconcat():

  if (section && *section != '\0')
    uri = g_strconcat ("ghelp:",
                       application_name,
                       "?",
                       section,
                       NULL);
  else
    uri = g_strconcat ("ghelp:", application_name, NULL);

in gtk_show_uri():

  context = gdk_app_launch_context_new ();
  screen = gtk_widget_get_screen (parent);

should be:

  context = gdk_app_launch_context_new ();
  if (parent)
    screen = gtk_widget_get_screen (parent);

  if (!screen)
    screen = gdk_screen_get_default ();

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]