Replace DE open command in favor of xdg-open
Jorge Villaseñor
salinasv at gmail.com
Mon Jan 11 02:13:54 EST 2010
2010/1/7 Mark Doliner <mark at kingant.net>:
> 2010/1/5 Jorge Villaseñor <salinasv at gmail.com>:
>> Talking with a friend of mine we realized that it could be a good idea
>> if pidgin/libpurple (does this must be front or back end issue?) uses
>> just xdg-open instead of asking if the user uses gnome or kde to open
>> URIs with their specific command.
>>
>> Then, talking with darkrain about this issue, we noticed that there
>> are some code duplication regarding open files and URIs.
>>
>> I was about to try to elimiate this code duplication but I want to ask
>> if there is some reason I'm not aware to not use xdg-open and
>> eliminate the DE specific commands and maybe the need of DE detection?
>> AFAIK each DE is suppoused to set the xdg variables so xdg-open can
>> fetch the right program. It also help people using some DE different
>> from kde and gnome, or not using a DE (people who uses awesome).
>
> Is this in reference to the pidgin_notify_uri() function in
> pidgin/gtknotify.c? Have GNOME and KDE always set the appropriate xdg
> variables? If older versions of GNOME did not set them and you remove
> the GNOME-specific and KDE-specific code, it seems like it would harm
> any users who may be using those older versions.
>
> And it's not clear to me how removing that code would help people not
> using kde/gnome... we already attempt to use xdg-open, don't we?
> Could you explain?
>
> --Mark
>
Actually I was referring to file_open_uri() in gtkutils.c since it
perform the gnome/kde checks and if both fail it call
purple_notify_uri() wich perform the same checks.
After some research I found that xdg-open actually calls
gvfs-open/gnome-open, kfmclient, exo-open for gnome, kde and xfce and
mimeopen for a "custom" DE, so it's safe to skip all DE checks in
pidgin/purple itself and just let xdg-open do the job. It also helps
not using kde/gnome because it support xfce and fallback to mimeopen
which pidgin does not in the current implementation. It also can help
to avoid different code for each uri handler since all of them can
just call xdg-open.
I also noticed that pidgin_notify_uri() have a lot of code handling
different browsers but the preferences dialog just set Firefox,
Desktop Default and Manual. I guess we can just delete all that stuff
not handled by prefs. Maybe delete the Firefox entry and add a FAQ
about setting the right browser in DE config or the BROWSER env
variable.
I think is a good idea to avoid anything DE specific. (will try to
take a look at each call of running_gnome() and running_kde() )
PD: Sorry for the delay, I was a little busy in the real world.
Masca
More information about the Devel
mailing list