![]() |
2010-05-21
, 19:52
|
|
Posts: 172 |
Thanked: 160 times |
Joined on Jan 2010
@ Sweden
|
#31
|
![]() |
2010-05-21
, 20:04
|
Posts: 124 |
Thanked: 213 times |
Joined on Dec 2009
|
#32
|
The Following 3 Users Say Thank You to Dak For This Useful Post: | ||
![]() |
2010-05-21
, 21:23
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#33
|
There's also some mime registration stuff in there that doesn't seem to work yet...it doesn't hurt anything else thoughThe idea was that you could just click on a jarfile in your file browser (or create a desktop shortcut to it) and it would automatically launch jarexec for you. I'm sure it's something simple I've overlooked...maybe somebody can cast some fresh eyes over it and tell me my mistake
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Name=Jarfile NoDisplay=true Exec=/usr/local/bin/javalauncher X-Osso-Service=javalauncher X-Osso-Type=application/x-executable MimeType=application/x-jar;
D-BUS Service] Name=javalauncher Exec=/usr/local/bin/javalauncher
![]() |
2010-05-21
, 22:59
|
|
Posts: 147 |
Thanked: 53 times |
Joined on Dec 2009
@ West London, UK
|
#34
|
There's libswt-hildon but I don't know if it's complete.
![]() |
2010-05-22
, 04:16
|
Posts: 124 |
Thanked: 213 times |
Joined on Dec 2009
|
#35
|
![]() |
2010-05-22
, 05:51
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#36
|
OK...thanks to qwerty I reckon I'm getting somewhere
[See attached .tar.gz]
I converted the Vala into a little C prog (main.c)
I converted the Vala into a little C prog (main.c)
I included the service and desktop files
Now, when I click on a jarfile in FileManager it no longer asks me what I wish to use to open it with....it just does nothing.
So I ran the javalauncher prog on the cmd line, and I could see that it successfully called osso_initialize and osso_mime_set_cb, but I have no way of knowing if the prog is being successfully called by FileManager/mime_open.
What is the best way to debug this mechanism?
dbus_connection_flush((DBusConnection*)osso_get_dbus_connection(ctx));
dbus_connection_read_write((DBusConnection*)osso_get_dbus_connection(ctx), 0);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libosso.h>
//#include "osso-internal.h"
static char* jarexec_cmd = "/usr/local/bin/jarexec";
static void mime_cb(GMainLoop *loop, int argc, gchar** argv)
{
int cmdlen = strlen(jarexec_cmd) + 1;
int arglen = 0;
char* cmd = NULL;
int i = 0;
for (i=0; i<argc; i++)
{
if (argv[i] != NULL)
{
gchar *cmd_filename = NULL;
arglen = strlen(argv[i]);
cmd = malloc(cmdlen + arglen + 1);
memset(cmd, 0x00, cmdlen + arglen + 1);
printf(cmd, "%s %s\n", jarexec_cmd, argv[i]);
fflush(stdout);
cmd_filename = g_filename_from_uri (argv[i], NULL, NULL);
sprintf(cmd, "%s %s", jarexec_cmd, cmd_filename);
g_free(cmd_filename);
//osso_system_note_infoprint () -- would be nice, IMHO
system(cmd);
free (cmd);
}
}
g_main_loop_quit (loop);
}
int main(int argc, char** argv)
{
osso_context_t* ctx = osso_initialize("org.maemo.javalauncher","0.1", 0, NULL);
GMainLoop *loop = g_main_loop_new (NULL, FALSE);
if (ctx != NULL && loop != NULL)
{
printf("javalauncher osso_initialize succeeded\n");
printf("\n");
fflush(stdout);
if (osso_mime_set_cb(ctx, mime_cb, loop) == OSSO_OK)
{
printf("javalauncher osso_mime_set_cb succeeded\n");
fflush(stdout);
/* while (jar_running)
{
dbus_connection_flush((DBusConnection*)osso_get_dbus_connection(ctx));
dbus_connection_read_write((DBusConnection*)osso_get_dbus_connection(ctx), 0);
sleep(1);
} */
g_main_loop_run (loop);
}
else
{
printf("javalauncher osso_mime_set_cb failed\n");
fflush(stdout);
}
}
else
{
printf("javalauncher osso_initialize failed\n");
fflush(stdout);
}
return (EXIT_SUCCESS);
}
The Following 3 Users Say Thank You to qwerty12 For This Useful Post: | ||
![]() |
2010-05-22
, 06:23
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#37
|
![]() |
2010-05-22
, 06:24
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#38
|
![]() |
2010-05-22
, 06:28
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#39
|
90 days eval,,, you gotta write that its eval!? dont be clown... write in the trhead that its evaluation!!
The Following 6 Users Say Thank You to qwerty12 For This Useful Post: | ||
![]() |
2010-05-22
, 06:41
|
|
Posts: 518 |
Thanked: 334 times |
Joined on Mar 2010
@ italy
|
#40
|