GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 18, 2014 8:05 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: How to display an html page in gtk
PostPosted: Wed Jun 28, 2006 5:13 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi all
I am a novice programmer in GTK.

Can anyone tell how to display an html page in GTK. I have tried GTKHtml and there few dependancy issues.

Any suggestions will help me.

Iswaria.


Top
 Profile  
 
 Post subject: Launch browser window when selecting list box entry.
PostPosted: Thu Jun 29, 2006 6:01 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi

Now I am able to launch browser window when I click the GNOME href new button. But I want to launch the browser when I select something in the GTK list box.

Code for GNOME href button
----------------------------------------------------------------------------------------------------------
#include <gnome.h>
GtkWidget * href1, *fixed1;

href1 = gnome_href_new ("http://www.ifpindia.org/", _("Visit IFP"));
gtk_widget_show (href1);
gtk_fixed_put (GTK_FIXED (fixed1), href1, 56, 152);
gtk_widget_set_size_request (href1, 216, 32);
-------------------------------------------------------------------------------------------------------
Suggestions will be very helpful.

Thanks
Iswaria.


Top
 Profile  
 
 Post subject: Gtkmozembed widget
PostPosted: Fri Jun 30, 2006 5:46 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi all
Gtkmozembed widget helps to embed browser in GTK.

Have anyone worked with gtkmozembed widget?

If so, please give the sample code.

Thanks
Iswaria.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 02, 2006 10:01 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
As for GtkMozEmbed, i couldn't find and RPM and don't want to take the time to figure it out just right now, however, the API documentation is here: http://www.mozilla.org/unix/gtk-embedding.html

I was able to use gtkhtml3. I first had to install the development libraries which I did using yum:
Code:
yum install gtkhtml3-devel


And then there is a tutorial on using the GtkHTML library here: http://primates.ximian.com/~rodo/programing_with_gtkhtml_tutorial/guadec.html

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 6:30 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi
when I use the following code it is working fine.

Code for GNOME href button
----------------------------------------------------------------------------------------------------------
#include <gnome.h>
GtkWidget * href1, *fixed1;

href1 = gnome_href_new ("http://www.ifpindia.org/", _("Visit IFP"));
gtk_widget_show (href1);
gtk_fixed_put (GTK_FIXED (fixed1), href1, 56, 152);
gtk_widget_set_size_request (href1, 216, 32);
----------------------------------------------------------------------------------------------------------

When I change the website address to local address "file:///home/OscarDesktop/Images/especes/b/brare/brare.html" the following error occurs:

An error has occurred while trying to launch the default web browser.
Please check your settings in the 'Preferred Applications' preference
tool.
Please suggest.

Thanks
Iswaria.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 3:16 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
It looks as though it's not using the file:/// to mean web browser. Perhaps you can use a call to something like system("firefox file:///blablabla") or perhaps there is a way to get the default web browser and then call it using system or one of the exec functions?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 3:27 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Better yet, use GConf to add a handler for "file:". You can copy the one for http and just replace the http: with file:
Code:
/desktop/gnome/url-handlers/http:
   needs_terminal = false
   command = firefox %s
   enabled = true


See http://www.gnome.org/projects/gconf/ for information on GConf. The API library for GConf is at http://developer.gnome.org/doc/API/2.0/gconf/index.html

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject: System command is working
PostPosted: Wed Jul 05, 2006 4:07 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi Micah Carrick
Thanks a lot.

System command is working to launch the browser.

system ("firefox file:///home/OscarDesktop/Images/especes/b/brare/brare.html");

Thanks
Iswaria.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 5:11 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Great... the only problem is that your users will have to have firefox in order for that to work. But if you're just using it for yourself... that'll work just fine.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject: System command and browser
PostPosted: Thu Jul 06, 2006 5:16 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi
Is it possible to say the default browser in the user computer instead of specifying firefox? We can't assume all the users will have firefox.

Thanks
Iswaria.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:23 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
If it's a gnome application, then you can use GConf to determine which is application "handles" firefox. I don't know how it would work with KDE or other environments. You may also want to have a preferences dialog in you application in which the user specifies their browser... or programatically check for several of the more well known browsers.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group