Re: Open a url in webbrowser ?



On Fri, 2009-04-17 at 03:51 -0700, parthiv wrote:
> Thanks for the solution........eagerly searching for it... finally it
> worked ............ GError *error = NULL; GdkScreen *gscreen=NULL;
> gtk_show_uri(&gscreen,"http://google.com",10,&error); 

that's utterly wrong. you should read the documentation on
library.gnome.org instead of using random stuff as arguments.

the correct call is:

  GError *error;

  error = NULL;
  gtk_show_uri (gdk_screen_get_default (),
                "http://google.com";,
                gtk_get_current_event_time (),
                &error);

but it's better to have a GtkWidget to get the correct screen and the
event time:

  GdkScreen *screen;
  GError *error;

  if (gtk_widget_has_screen (widget))
    screen = gtk_widget_get_screen (widget);
  else
    screen = gdk_screen_get_default ();

  error = NULL;
  gtk_show_uri (screen, "http://google.com";,
                gtk_get_current_event_time (),
                &error);

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi



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