List Info

Thread: libgnome: gnome-open.c




libgnome: gnome-open.c
country flaguser name
Germany
2007-06-17 07:23:19
Hello there!

I came upon 'gnome-open' while looking for a way to make
Emacs/Gnus
call the application associated by Gnome as an external
viewer for
attached files.  The impediment is that I couldn't make
gnome-open
wait until the process finishes, neither did I have success
with
gnome_url_show().

I would be delighted by any given insight to this first-time
gnome
hacker to enable him to construct a blocking call to
gnome_url_show().

Kind regards,
Alp zmert

_______________________________________________
gnome-devel-list mailing list
gnome-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list

Re: libgnome: gnome-open.c
user name
2007-06-17 07:41:53

2007-06-17 klockan 14:23 skrev Alp Özmert:
> I came upon 'gnome-open' while looking for a way to
make Emacs/Gnus
> call the application associated by Gnome as an external
viewer for
> attached files.  The impediment is that I couldn't make
gnome-open
> wait until the process finishes, neither did I have
success with
> gnome_url_show().
> 
> I would be delighted by any given insight to this
first-time gnome
> hacker to enable him to construct a blocking call to
> gnome_url_show().

This is not really possible to do reliably. Many Gnome
applications are
single instance apps (e.g. Evince). This means that a second
application
instance will just pass through the command line arguments
(e.g. the
filename to show) to the already running applications, and
quit immediately
afterwards.

  mvrgr, Wouter

-- 
:wq                                                      
mail uwsxs4all.nl
                                                      web http://uwstopia.nl

who's gonna take it like this? :: no way :: you are, you are
       -- gomez

_______________________________________________
gnome-devel-list mailing list
gnome-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list

Re: libgnome: gnome-open.c
country flaguser name
Germany
2007-06-17 10:32:30
Wouter Bolsterlee <uws+gnomexs4all.nl> writes:

> 2007-06-17 klockan 14:23 skrev Alp zmert:
>> I came upon 'gnome-open' while looking for a way to
make Emacs/Gnus
>> call the application associated by Gnome as an
external viewer for
>> attached files.  The impediment is that I couldn't
make gnome-open
>> wait until the process finishes, neither did I have
success with
>> gnome_url_show().
>> 
>> I would be delighted by any given insight to this
first-time gnome
>> hacker to enable him to construct a blocking call
to
>> gnome_url_show().
>
> This is not really possible to do reliably. Many Gnome
> applications are single instance apps (e.g. Evince).
This means
> that a second application instance will just pass
through the
> command line arguments (e.g. the filename to show) to
the already
> running applications, and quit immediately afterwards.

Is there a simple way to find the path to the associated
application? For now that would be sufficient.

Regards,
Alp zmert

_______________________________________________
gnome-devel-list mailing list
gnome-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list

Re: libgnome: gnome-open.c
country flaguser name
Russian Federation
2007-06-17 14:58:24

В Вск, 17/06/2007 в 17:32 +0200, Alp Özmert
пишет:
> Wouter Bolsterlee <uws+gnomexs4all.nl> writes:
> 
> > 2007-06-17 klockan 14:23 skrev Alp Özmert:
> >> I came upon 'gnome-open' while looking for a
way to make Emacs/Gnus
> >> call the application associated by Gnome as an
external viewer for
> >> attached files.  The impediment is that I
couldn't make gnome-open
> >> wait until the process finishes, neither did I
have success with
> >> gnome_url_show().
> >> 
> >> I would be delighted by any given insight to
this first-time gnome
> >> hacker to enable him to construct a blocking
call to
> >> gnome_url_show().
> >
> > This is not really possible to do reliably. Many
Gnome
> > applications are single instance apps (e.g.
Evince). This means
> > that a second application instance will just pass
through the
> > command line arguments (e.g. the filename to show)
to the already
> > running applications, and quit immediately
afterwards.
> 
> Is there a simple way to find the path to the
associated
> application? For now that would be sufficient.
> 
> Regards,
> Alp Özmert

I suppose it's much easier to write your own little program
which will
use gnomevfs in similar way like gnome-open does. In
addition you can
suggest a patch to gnome-open to print this information.

gnome_vfs_mime_get_default_application_for_uri()

is the function you need.

_______________________________________________
gnome-devel-list mailing list
gnome-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list

Re: libgnome: gnome-open.c
country flaguser name
Germany
2007-06-17 17:22:10
Nickolay V. Shmyrev <nshmyrevyandex.ru> writes:

> В Вск, 17/06/2007 в 17:32 +0200, Alp Özmert
пишет:
>> Wouter Bolsterlee <uws+gnomexs4all.nl> writes:
>> 
>> > 2007-06-17 klockan 14:23 skrev Alp Özmert:
>> >> I came upon 'gnome-open' while looking for
a way to make Emacs/Gnus
>> >> call the application associated by Gnome
as an external viewer for
>> >> attached files.  The impediment is that I
couldn't make gnome-open
>> >> wait until the process finishes, neither
did I have success with
>> >> gnome_url_show().
>> >> 
>> >> I would be delighted by any given insight
to this first-time gnome
>> >> hacker to enable him to construct a
blocking call to
>> >> gnome_url_show().
>> >
>> > This is not really possible to do reliably.
Many Gnome
>> > applications are single instance apps (e.g.
Evince). This means
>> > that a second application instance will just
pass through the
>> > command line arguments (e.g. the filename to
show) to the already
>> > running applications, and quit immediately
afterwards.
>> 
>> Is there a simple way to find the path to the
associated
>> application? For now that would be sufficient.
>
> I suppose it's much easier to write your own little
program which will
> use gnomevfs in similar way like gnome-open does. In
addition you can
> suggest a patch to gnome-open to print this
information.
>
> gnome_vfs_mime_get_default_application_for_uri()
>
> is the function you need.

I think if this tool were to be included in the distribution
it
would be best to squash it into gnome-open in order to not
to create
yet another different binary. For now I prefer to keep it as
gnome-mime-exec so there is no clash with my Gnome
installation.

Below you can find my little program, which took me about
one hour
to compile, having spent most of the time with autotools, as
usual. ;)

Regards,
Alp Özmert

gnome-mime-exec.c:

#include <config.h>

#include <glib.h>
#include <stdio.h>
#include <libgnome/gnome-url.h>
#include <libgnome/gnome-program.h>
#include <libgnome/gnome-init.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs.h>

#include <glib/gi18n-lib.h>

int
main (int argc, char *argv[])
{
  GnomeVFSMimeApplication* app;
  const char *exec;

  if (argc < 2) {
    fprintf (stderr, "Usage: %s
<mime-type>n", argv[0]);
    return 1;
  }

  /* initialize GnomeVFS */
  if (!gnome_vfs_init ()) {
    printf ("Could not initialize GnomeVFSn");
    return 1;
  }

  app = gnome_vfs_mime_get_default_application(argv[1]);
  if (!app) {
    printf("Could not find MIME type.n");
    return 1;
  }

  exec = gnome_vfs_mime_application_get_exec(app);
  if (!exec) {
    printf("No associated executable found.n");
  }
  
  printf("%sn", exec);
  return 0;
}

_______________________________________________
gnome-devel-list mailing list
gnome-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )