Created attachment 2521 Add xfce_looks_like_an_uri. Would be nice to have this kinda for function in a central place, since we use it more often nowadays. Suggestions for a better name are welcome :-).
xfce_str_is_uri() or xfce_string_is_uri(). What core apps need to guess if a string is an URI or not? If it's just for conversion, what's wrong with g_filename_from_uri() and friends?
Right now it is used in exo, thunar, garcon (but that is not using xfce libraries) and panel. So technically exo could be used too. Duno about _is_uri, I guess it's fine, but the string "look: I'm online" will return true too. The function is handy then you work with gio, if you have a string (from a config file or dnd for example) you can use this function to pick between g_file_new_for_{uri,path}, in exo-open it is used to decide if we can use gtk_show_uri directly or perform some additional check if it's a file, email address, website etc.
Thinking about it again... Garcon is not going to depend on any Xfce libraries, so there it won't be useful. Thunar could use it because if you have a random string (entered by the user) and you want to create a GFile, there's no way around distinguishing between URIs and local paths. There you need a function like that. I guess exo needs it to, it also takes random strings via e.g. exo-open and needs to find out if they are local paths or URIs. I suppose the appfinder could also use it, should I extend it in a way that allows arbitrary strings to be executed/launched. But since there is no code for it yet, I'm not sure. I think random user input is about the only situation where this is really needed. Other (core) components you can think of where this might be important?
Ah ok, I see. xfce_looks_like_an_uri() is kinda silly name, but... hehe, why not?
I think I'd prefer xfce_str_looks_like_an_uri() but I don't care too much.
Thinking about it, exo is probably a better place for this function. All applications that will use it link to exo and it is somewhat more of an application then a desktop function. So if everybody if fine with this, I'll add exo_str_looks_like_an_uri().
Jep, fine with me.
Added function to exo.