Fremantle: Opening URLs and local files
Fremantle: Opening URLs and local files
Re: Fremantle: Opening URLs and local files
2009-09-17 10:45 UTC
El jue, 17-09-2009 a las 12:15 +0200, Thomas Perl escribió:
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
gtk_show_uri() should work in theory, but I don't know if it does in
practice.
Claudio
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
gtk_show_uri() should work in theory, but I don't know if it does in
practice.
Claudio
Re: Fremantle: Opening URLs and local files
2009-09-17 11:00 UTC
From: Claudio Saavedra <csaavedra@igalia.com>
> El jue, 17-09-2009 a las 12:15 +0200, Thomas Perl escribió:
> > Hello!
> >
> > What is the canonical way of opening a browser and the media player
> > (or more general: opening a URL and opening a local file) from code
> > on Fremantle?
In Fremantle you usually use the library hildonmime, and probably you
are asking about this function:
/**
* hildon_mime_open_file:
* @con: The D-BUS connection to use.
* @file: A %const @gchar pointer URI to be opened (UTF-8).
*
* This function opens a file in the application that has
* registered as the handler for the mime type of the @file.
...
This allows you to ask to open a file, and libhildonmime will take
care of use the correct application (the applications register itself
using this library, something like "hey, I can open this mime file").
In the same case, AFAIK, you can use hildonmime to ask which
applications or actions, you can use with a uri (local file and so
on). This could be useful if you want, for example, open the typical
"open with..." pop up. Check hildon_uri_get_actions for this.
I hope this helps.
> gtk_show_uri() should work in theory, but I don't know if it does in
> practice.
As far as I know, most of the Fremantle apps are not using that
(although a good question would be "why not?").
BR
===
API (apinheiro@igalia.com)
> El jue, 17-09-2009 a las 12:15 +0200, Thomas Perl escribió:
> > Hello!
> >
> > What is the canonical way of opening a browser and the media player
> > (or more general: opening a URL and opening a local file) from code
> > on Fremantle?
In Fremantle you usually use the library hildonmime, and probably you
are asking about this function:
/**
* hildon_mime_open_file:
* @con: The D-BUS connection to use.
* @file: A %const @gchar pointer URI to be opened (UTF-8).
*
* This function opens a file in the application that has
* registered as the handler for the mime type of the @file.
...
This allows you to ask to open a file, and libhildonmime will take
care of use the correct application (the applications register itself
using this library, something like "hey, I can open this mime file").
In the same case, AFAIK, you can use hildonmime to ask which
applications or actions, you can use with a uri (local file and so
on). This could be useful if you want, for example, open the typical
"open with..." pop up. Check hildon_uri_get_actions for this.
I hope this helps.
> gtk_show_uri() should work in theory, but I don't know if it does in
> practice.
As far as I know, most of the Fremantle apps are not using that
(although a good question would be "why not?").
BR
===
API (apinheiro@igalia.com)
Re: Fremantle: Opening URLs and local files
2009-09-17 11:02 UTC
Hi,
here is an example for a d-bus call to open the browser:
dbus-send --system --type=method_call --dest="com.nokia.osso_browser"
--print-reply /com/nokia/osso_browser/request
com.nokia.osso_browser.load_url string:"http://www.google.com"
To use the mediaplayer you could have a look into the Media Application
Framework (MAFW) API [1] and documentation [2]. Another option, which
might be easier in your case. is to open the file by its MIME type. In
the header (hildon-mime.h) you will find a function called
hildon_mime_open_file, which should do the thing you want.
[1] http://maemo.org/api_refs/5.0/beta/mafw-shared/
[2]
http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Multimedia_Components/Media_Application_Framework_(MAFW)
Cheers Daniel
ext Thomas Perl wrote:
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
>
> Thanks,
> Thomas
here is an example for a d-bus call to open the browser:
dbus-send --system --type=method_call --dest="com.nokia.osso_browser"
--print-reply /com/nokia/osso_browser/request
com.nokia.osso_browser.load_url string:"http://www.google.com"
To use the mediaplayer you could have a look into the Media Application
Framework (MAFW) API [1] and documentation [2]. Another option, which
might be easier in your case. is to open the file by its MIME type. In
the header (hildon-mime.h) you will find a function called
hildon_mime_open_file, which should do the thing you want.
[1] http://maemo.org/api_refs/5.0/beta/mafw-shared/
[2]
http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Multimedia_Components/Media_Application_Framework_(MAFW)
Cheers Daniel
ext Thomas Perl wrote:
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
>
> Thanks,
> Thomas
Re: Fremantle: Opening URLs and local files
2009-09-17 11:07 UTC
Thomas Perl wrote:
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
Try this
http://blogs.gnome.org/tthurman/2009/09/03/writing-apps-for-the-n900-part-1/
This came up a few days back; subject: Proper Way To Call Browser (Fremantle)
there's a bit more in that thread
David
--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
> Hello!
>
> What is the canonical way of opening a browser and the media player
> (or more general: opening a URL and opening a local file) from code
> on Fremantle?
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
Try this
http://blogs.gnome.org/tthurman/2009/09/03/writing-apps-for-the-n900-part-1/
This came up a few days back; subject: Proper Way To Call Browser (Fremantle)
there's a bit more in that thread
David
--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
Re: Fremantle: Opening URLs and local files
2009-09-17 16:02 UTC
Hi,
I'm a libosso whore so this is how I do it:
#include <libosso.h>
osso_context_t* osso_context;
osso_rpc_t* osso_retval = { 0 };
char *open = "http://www.google.com";
osso_context = osso_initialize ("com.what.ever", "0.9.9", FALSE, NULL);
osso_rpc_run(osso_context, "com.nokia.osso_browser",
"/com/nokia/osso_browser", "com.nokia.osso_browser",
"open_new_window", osso_retval, DBUS_TYPE_STRING, open,
DBUS_TYPE_INVALID);
osso_deinitialize(osso_context);
"open_new_window" does what it says on the tin: a new window is opened
with the URL supplied. You can also substitute that for "load_url"
which will, depending if a window is already open, a) load the link
given into a browser that is already open OR b) open a new window with
the link given.
I've been naughty here and have hardcoded the method names etc. but
these are all defined in /usr/include/tablet-browser-interface.h
And, yes, this works under Fremantle. ;)
Best Regards,
Faheem
On Thu, Sep 17, 2009 at 11:15 AM, Thomas Perl <th.perl@gmail.com> wrote:
> Hello!
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
>
> Thanks,
> Thomas
>
I'm a libosso whore so this is how I do it:
#include <libosso.h>
osso_context_t* osso_context;
osso_rpc_t* osso_retval = { 0 };
char *open = "http://www.google.com";
osso_context = osso_initialize ("com.what.ever", "0.9.9", FALSE, NULL);
osso_rpc_run(osso_context, "com.nokia.osso_browser",
"/com/nokia/osso_browser", "com.nokia.osso_browser",
"open_new_window", osso_retval, DBUS_TYPE_STRING, open,
DBUS_TYPE_INVALID);
osso_deinitialize(osso_context);
"open_new_window" does what it says on the tin: a new window is opened
with the URL supplied. You can also substitute that for "load_url"
which will, depending if a window is already open, a) load the link
given into a browser that is already open OR b) open a new window with
the link given.
I've been naughty here and have hardcoded the method names etc. but
these are all defined in /usr/include/tablet-browser-interface.h
And, yes, this works under Fremantle. ;)
Best Regards,
Faheem
On Thu, Sep 17, 2009 at 11:15 AM, Thomas Perl <th.perl@gmail.com> wrote:
> Hello!
>
> Is there a command-line utility that can be used or a D-Bus call? If so,
> where is the D-Bus call documented (sample code would be enough ;).
>
> Thanks,
> Thomas
>
Re: Fremantle: Opening URLs and local files

Till Harbaum / Lists
Hi,
i am using tablet-browser-interface which imho exists
for exactly this purpose:
#include <tablet-browser-interface.h>
osso_rpc_run_with_defaults(my_osso_context, "osso_browser",
OSSO_BROWSER_OPEN_NEW_WINDOW_REQ, NULL,
DBUS_TYPE_STRING, my_url,
DBUS_TYPE_BOOLEAN, FALSE, DBUS_TYPE_INVALID);
Till
Am Donnerstag 17 September 2009 schrieb Faheem Pervez:
> Hi,
>
> I'm a libosso whore so this is how I do it:
>
> #include <libosso.h>
>
> osso_context_t* osso_context;
> osso_rpc_t* osso_retval = { 0 };
> char *open = "http://www.google.com";
>
> osso_context = osso_initialize ("com.what.ever", "0.9.9", FALSE, NULL);
> osso_rpc_run(osso_context, "com.nokia.osso_browser",
> "/com/nokia/osso_browser", "com.nokia.osso_browser",
> "open_new_window", osso_retval, DBUS_TYPE_STRING, open,
> DBUS_TYPE_INVALID);
> osso_deinitialize(osso_context);
>
> "open_new_window" does what it says on the tin: a new window is opened
> with the URL supplied. You can also substitute that for "load_url"
> which will, depending if a window is already open, a) load the link
> given into a browser that is already open OR b) open a new window with
> the link given.
>
> I've been naughty here and have hardcoded the method names etc. but
> these are all defined in /usr/include/tablet-browser-interface.h
>
> And, yes, this works under Fremantle. ;)
>
> Best Regards,
> Faheem
>
> On Thu, Sep 17, 2009 at 11:15 AM, Thomas Perl <th.perl@gmail.com> wrote:
> > Hello!
> >
> > Is there a command-line utility that can be used or a D-Bus call? If so,
> > where is the D-Bus call documented (sample code would be enough ;).
> >
> > Thanks,
> > Thomas
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers@maemo.org
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
i am using tablet-browser-interface which imho exists
for exactly this purpose:
#include <tablet-browser-interface.h>
osso_rpc_run_with_defaults(my_osso_context, "osso_browser",
OSSO_BROWSER_OPEN_NEW_WINDOW_REQ, NULL,
DBUS_TYPE_STRING, my_url,
DBUS_TYPE_BOOLEAN, FALSE, DBUS_TYPE_INVALID);
Till
Am Donnerstag 17 September 2009 schrieb Faheem Pervez:
> Hi,
>
> I'm a libosso whore so this is how I do it:
>
> #include <libosso.h>
>
> osso_context_t* osso_context;
> osso_rpc_t* osso_retval = { 0 };
> char *open = "http://www.google.com";
>
> osso_context = osso_initialize ("com.what.ever", "0.9.9", FALSE, NULL);
> osso_rpc_run(osso_context, "com.nokia.osso_browser",
> "/com/nokia/osso_browser", "com.nokia.osso_browser",
> "open_new_window", osso_retval, DBUS_TYPE_STRING, open,
> DBUS_TYPE_INVALID);
> osso_deinitialize(osso_context);
>
> "open_new_window" does what it says on the tin: a new window is opened
> with the URL supplied. You can also substitute that for "load_url"
> which will, depending if a window is already open, a) load the link
> given into a browser that is already open OR b) open a new window with
> the link given.
>
> I've been naughty here and have hardcoded the method names etc. but
> these are all defined in /usr/include/tablet-browser-interface.h
>
> And, yes, this works under Fremantle. ;)
>
> Best Regards,
> Faheem
>
> On Thu, Sep 17, 2009 at 11:15 AM, Thomas Perl <th.perl@gmail.com> wrote:
> > Hello!
> >
> > Is there a command-line utility that can be used or a D-Bus call? If so,
> > where is the D-Bus call documented (sample code would be enough ;).
> >
> > Thanks,
> > Thomas
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers@maemo.org
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
Re: Fremantle: Opening URLs and local files
2009-10-06 17:37 UTC
On Thu, 2009-09-17 at 13:45 +0300, Claudio Saavedra wrote:
> El jue, 17-09-2009 a las 12:15 +0200, Thomas Perl escribió:
> > Hello!
> >
> > What is the canonical way of opening a browser and the media player
> > (or more general: opening a URL and opening a local file) from code
> > on Fremantle?
>
> gtk_show_uri() should work in theory, but I don't know if it does in
> practice.
Just for the record: It's not working very well ;)
If you use gtk_show_uri() with something like this: "http://zwong.de"
you get an error that the process "epiphany" could not be executed.
For "mailto:nothing@icandy.de" you get an error that the process
"evolution" could not be executed and so on...
I was looking for a method which will work on http, ftp, mailto and file
URIs, but it looks like there is nothing ready made. So I now check the
protocol and do whatever DBus call is appropriate.
Cheers!
Conny
> El jue, 17-09-2009 a las 12:15 +0200, Thomas Perl escribió:
> > Hello!
> >
> > What is the canonical way of opening a browser and the media player
> > (or more general: opening a URL and opening a local file) from code
> > on Fremantle?
>
> gtk_show_uri() should work in theory, but I don't know if it does in
> practice.
Just for the record: It's not working very well ;)
If you use gtk_show_uri() with something like this: "http://zwong.de"
you get an error that the process "epiphany" could not be executed.
For "mailto:nothing@icandy.de" you get an error that the process
"evolution" could not be executed and so on...
I was looking for a method which will work on http, ftp, mailto and file
URIs, but it looks like there is nothing ready made. So I now check the
protocol and do whatever DBus call is appropriate.
Cheers!
Conny
Re: Fremantle: Opening URLs and local files
2009-10-06 18:34 UTC
On Tuesday 06 October 2009 18:37:51 Cornelius Hald wrote:
> I was looking for a method which will work on http, ftp, mailto and file
> URIs, but it looks like there is nothing ready made. So I now check the
> protocol and do whatever DBus call is appropriate.
Sounds like a good candidate for a library function!
> I was looking for a method which will work on http, ftp, mailto and file
> URIs, but it looks like there is nothing ready made. So I now check the
> protocol and do whatever DBus call is appropriate.
Sounds like a good candidate for a library function!
Re: Fremantle: Opening URLs and local files
2009-10-06 19:10 UTC
On Tue, 2009-10-06 at 19:34 +0100, Graham Cobb wrote:
> On Tuesday 06 October 2009 18:37:51 Cornelius Hald wrote:
> > I was looking for a method which will work on http, ftp, mailto and file
> > URIs, but it looks like there is nothing ready made. So I now check the
> > protocol and do whatever DBus call is appropriate.
>
> Sounds like a good candidate for a library function!
Yes it does. Maybe we can put it into Hildon/HildonExtras at some point.
Now I only need a way of opening the file manager. But I'll make a
separate thread for that.
> On Tuesday 06 October 2009 18:37:51 Cornelius Hald wrote:
> > I was looking for a method which will work on http, ftp, mailto and file
> > URIs, but it looks like there is nothing ready made. So I now check the
> > protocol and do whatever DBus call is appropriate.
>
> Sounds like a good candidate for a library function!
Yes it does. Maybe we can put it into Hildon/HildonExtras at some point.
Now I only need a way of opening the file manager. But I'll make a
separate thread for that.
What is the canonical way of opening a browser and the media player
(or more general: opening a URL and opening a local file) from code
on Fremantle?
Is there a command-line utility that can be used or a D-Bus call? If so,
where is the D-Bus call documented (sample code would be enough ;).
Thanks,
Thomas