Reply
Thread Tools
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#1
Hi,
I'm writing a small desktop applet from where I need to launch the n900's image-viewer application with the selected image and I've just installed final 5.0 SDK as well. Failing to launch image-viewer giving a cmd from my program, I installed osso-xterm to check if the cmd works but I couldn't launch it even from xterm with this cmd "/usr/bin/image-viewer" or just "image-viewer". I was wondering how is it possible to achieve this. Below is the code snippet I've used and running it in the debian system (outside scratchbox) using "eog -f imagepath.jpg" runs fine:

Code:
static gboolean openDefaultImageViewer(GtkWidget *event_box, GdkEventButton *event, Data *data){
	gint ret;
	gchar *filepath = (gchar *)g_list_nth_data(data->list, data->cur_image);
	gchar *cmd = g_strconcat("eog -f ", filepath, NULL);
	ret = g_spawn_command_line_async(cmd, NULL);
	g_free(cmd);
	return ret;
}
I tried with both cmds I mentioned earlier as the replacement to the "cmd" in the above code but nothing happens. Also, is it possible to open the image viewer with the selected image file? Also, why does the image-viewer in the SDK shows two broken images and nothing else coz I've pictures under "/home/jay/photoapplet" directory (of course scratchbox home) also I couldn't find any option to scan directory or anything like that. Any help/suggestion would be great.. Thank you
 
pelago's Avatar
Posts: 2,121 | Thanked: 1,540 times | Joined on Mar 2008 @ Oxford, UK
#2
I know very little about this sort of thing, but I wonder if the correct method to do this is to send a dbus call...?
 

The Following User Says Thank You to pelago For This Useful Post:
Posts: 432 | Thanked: 645 times | Joined on Mar 2009
#3
Hi,

there is a header file in the scratchbox (/usr/include/hildon-mime.h), where you find this method:

Code:
gint hildon_mime_open_file (DBusConnection     *con, 
       const  gchar   *file);
It opens the file with the right program according to the mime-type settings. In your case it would be the image-viewer.

Cheers Daniel
 

The Following 4 Users Say Thank You to danielwilms For This Useful Post:
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#4
Thanks guys that was an awesome tip for now I can at least make the image-viewer open with the selected image but the thing now is it just opens up with the selected image and have no other images in the same folder, like it normally happens like it list all the other images as well in the same directory and displays next image if i click next. So, is there any way I can change the default image folder as well to the current image's folder using dbus or any other way and again change back to the normal one when exited. I think this is how it is done, if I'm not wrong. Thanks
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 20:41.