Commit Graph

129 Commits

Author SHA1 Message Date
Carsten Haitzler f4f5a042a6 efreet - fix command generation by fixing string buffer expansion
so by chance i discovered efreet is doing bad things(tm) when
expanding/appending to string buffers to generate commands based off
desktop files. the string append basically was buggy, so fixed it by
making it a lot simpler and more obvious and now reliable.

@fix
2016-09-25 23:50:53 +09:00
Carsten Haitzler 07ffb2e5c5 efreet xml parse - handle 0 sized xml specially to avoid crash
fixes T4493
2016-09-20 14:55:35 +09:00
Jean Guyomarc'h 1ab1e3697d efreet: mime types database can be empty
When the mime types database is empty, the file will
be exactly 28 bytes.

Fixes T4426
2016-08-26 21:16:39 +02:00
Mike Blumenkrantz 8c3efbd174 efreet: add doc note about stringshare reliability for efreet_mime_type_get() 2016-08-26 10:20:45 -04:00
Carsten Haitzler 510c093602 efreet - convert crash into NULL mimes when no mime db found
so ok - efreet crashed letting you know you have a missing mimedb...
return NULL instead fixes T4425 :) - rememebr to kill your efreetd's
to get a new mimedb - log out and in will do that.
2016-08-24 10:00:50 +09:00
Carsten Haitzler 561f8eaa8f efreet - save about 240-300k or so of memory used by efreet mime
so efreet mime was loading a bunch of mime type info files, parsing
them on startup and allocating memory to store all this mime info -
globs, mimetype strings and more. all a big waste of memory as its
allocated on the heap per process where its the SAME data files loaded
every time.

so make an efreet mime cache file and a tool to create it from mime
files. mmap this file with all the hashes/strings in it so all that
data is mmaped once in memory and shared between all processes and it
is only paged in on demand - as actually read/needed so if your
process doesnt need to know about mime stuff.. it wont touch it anyway.

this saves about 240-300k or so of memory in my tests. this has not
covered the mime MAGIC files which still consume memory and are on the
heap. this is more complex so it will take more time to come up with a
nice file format for the data that is nicely mmaped etc.

@optimize
2016-08-23 12:04:06 +09:00
Carsten Haitzler 56c52311e5 efreet - fix efreet_*_dir_get() to support the xdg env vars
these api's didnt respect the env vars xdg dictates should override
the xdg dirs for that process. this fixes this and uses them if set

@fix
2016-08-23 12:04:06 +09:00
Marcel Hollerbach 3f1d40cff8 efreet: free fallback cache on shutdown
this fixes errors like:
ERR<4864>:eet lib/eet/eet_lib.c:645 eet_shutdown() File '/home/osauser/.cache/efreet/icons___efreet_fallback_localhost.localdomain.eet' is still open 1 times !

@fix
2016-08-04 17:04:50 +02:00
Carsten Haitzler 2ca5075193 efreet - fix mime file path messing with short paths like /
this fixes T4015

@fix
2016-07-05 16:28:52 +09:00
Carsten Haitzler 9527240d74 efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right
thing now... except one (ecore_shutdown) with comment inline where
eo_shutdown is not called. if this is called we are in crash land.
this needs further inspection.
2016-07-04 21:30:34 +09:00
Mike Blumenkrantz 200f45c2b5 efreet: add locking for efreet_desktop_x_field_get()
in a threaded environment, reading from a hash is not atomic and is
subject to race conditions

@fix

ref 39417cf0ea
2016-01-25 11:27:02 -05:00
Mike Blumenkrantz 9aee7c249a efreet: reject invalid "" data for Efreet_Desktop->x hash
ref T3096

@fix
2016-01-25 11:27:01 -05:00
Andy Williams c4cd3f19bf [efreet] document NULL return possibility.
If file is not found then NULL is the fallback
2016-01-20 23:37:15 +00:00
Vincent Torri e20978054a Efreet: support language, country and modifer on Windows
Summary:
On Windows, the environment variables LANG, LC_ALL and LC_MESSAGES
do not exist, so retrieve langage and country modifier directly from the systeM

Test Plan: verify the value with some ptrinF

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3464
2015-12-18 16:48:34 +09:00
Vincent Torri 3b44645363 efl: add binary mode to f(re)open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:04:36 +01:00
Carsten Haitzler 5263e61585 efreet desktop tracking - fix monitoring of dirs of custom desktops
@fix

this is wrong - start monitoring every/any dir in which a desktop file
exists that we load a desktop file from. imagine you browse directories
in efm with lots of desktop files in them - we end up monitoring lots
of directories that we then rememebr and don't un-monitor. this
disables monitoring of dirs from which we load a .desktop file from to
fix this.
2015-12-02 20:53:27 +09:00
Marcel Hollerbach 7b9bb510b4 efreet_icon: Fix wrong inherit selection
Summary:
The list of elem->paths is given with the actual icon at position 0 and
the bigger the index is the lower the icon in the inherit structure is.

Due to the for loop beginning at 0 walking to the end this
direction is flipped. So the last r is returned, which is the lowest
icon in the inherit structure.

This is fixed by returning if the first valid path is found.

@fix

Test Plan: run jesus or efm with a custom icon theme beore the wrong icons are taken, now the correct ones are taken

Reviewers: raster, cedric

Subscribers: DaveMDS

Differential Revision: https://phab.enlightenment.org/D3366
2015-11-25 09:35:07 +01:00
Carsten Haitzler e89253e597 efreet - fix efreetd kill and start with clean cache case blank icons
if you kill efreetd ANd delete all the caches, the restart of efreetd
will lose all icons until an app re-registeres icon extensions and it
can scan all icons .. and then app has to actually get the right
upodate events and do the update properly when this happens. this
fixes that scenario

@fix
2015-08-12 20:08:14 +09:00
Vincent Torri b7a277efa0 Efreet: Fix config and data dir paths on windows.
@fix
2015-07-08 16:29:05 +01:00
Carsten Haitzler 2f4fb3edac efreet - improve edstop exec find to use the command with less args
efreet will just match any desktop file (at random basically -
whatever is first in the list), thjat has the base command looked at.
if you have various desktip files with the same command, like:

mycommand
mycommand %U
mycommand -a -b -c /path/to/file
/usr/bin/mycommand

etc. - which one does it match? it'll pick the first and the list
ordering is arbitrary, so this is pretty bad. this strips off the base
command at the start (full path or whatever) and then uses the command
with the shortest argument length. this means the generic command is
found first if we look for "mycommand" in the above list, whihc ends
up the best... ESPECIALLY for steam which does just this.
2015-07-05 12:53:14 +09:00
Carsten Haitzler ddb3a60518 efreetd - new ipc - re-register on reconnect 2015-06-25 11:41:15 +09:00
Carsten Haitzler 5abfefe99e efl - efreetd service move from dbus session bus to ecore ipc
this fixes warnings about no efreet dbus session bus in non session
environments as brought up on the mailing lists with:

Subject: Re: [E-devel] [EGIT] [core/efl] master 01/01: edje: unset
efreet cache update flag to prevent dbus connections

this moves all of efreetd client and server to ecore ipc, with client
auto-launching efreetd if not found as a service and trying for up to
500ms to connect. efreetd times out on last connection or no
connections after 10sec so it wont hang around forever if not in use.
it seems to work in my testing, so let me know if there is an issue.

@fix
2015-06-24 19:28:17 +09:00
Cedric BAIL 5098e787e8 efreet: use portable environment lookup. 2015-05-14 18:41:48 +02:00
Cedric BAIL 493a2b3ab4 efreet: lower error message to warning. 2015-05-14 18:41:47 +02:00
Sebastian Dransfeld 9e0a00d768 efreet: fix signed warning
Update to 6a0d23. Casting to int isn't a real solution, since we could
have values which overflows.

Since we want the absolute value, just make sure we subtract the larger
value from the smaller.
2015-05-11 13:34:10 +02:00
Cedric BAIL 0b4a911450 efreet: remove the need to order the header correctly for Windows. 2015-05-07 09:53:10 +02:00
Mike Blumenkrantz 3571e7364e efreet: fix leak in efreet_util_desktop_exec_find()
@fix
2015-04-22 19:34:59 -04:00
Jean-Philippe Andre 6a0d2382f1 Efreet: Silence clang warning
[unsigned - unsigned] is unsigned and might wrap around, the implicit
conversion to int (by calling abs()) saved the game here.
2015-04-21 20:32:54 +09:00
Davide Andreoli 762d4fb551 Efreet: do not get confused by path ending with / in XDG_* vars
This @fix the parsing of dirs from the xdg env vars. Now always remove
the leading / char from the paths.

This was causing lots of trouble on my system, where XDG_DATA_DIRS is:
/usr/local/share/enlightenment:/usr/local/share:/usr/local/share/:/usr/share/

At first /usr/local/share was added 2 times in the list, one with the / and one
witout, causing a double lookup for each file.

Secondly the icon cache was totally unusable as the cached paths ended up
as: /usr/share//icons/Mint-X/places/32/folder.svg. The double / in there
was making the cache lookup to fail and anways return the biggest icon
available. Causing a big system slowdown whe searching for icons.

As a bonus the function now use eina_str_split instead of the custom splitting
code that require a bad special handling for the last item.
2015-01-25 12:44:09 +01:00
kabeer khan ee3bcaf71d efreetd_cache: Resolved TODO checking symbolic link to monitor real path
Summary: Signed-off-by: kabeer khan <kabeer.khan@samsung.com>

Reviewers: englebass

Reviewed By: englebass

Subscribers: devilhorns, cedric

Differential Revision: https://phab.enlightenment.org/D1625
2014-11-18 12:24:06 +01:00
Nicolas Aguirre f078d16391 efreet: add documentation for Efreet_Version structure. 2014-10-20 18:02:03 +02:00
Sebastian Dransfeld d1207854f4 efreet: fix show/nowshow
This partly reverts c700192, as the change here was wrong.
2014-09-30 23:19:57 +02:00
Sebastian Dransfeld b624345bbd efreet: improve messages 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld d8aead7ab8 efreet: remove dead code 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld f60fdced44 efreet: tab to spaces 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld 88843b7377 efreet: TODO++ 2014-09-25 13:54:13 +02:00
Sebastian Dransfeld 8204212f36 efreet: Fix leak
When doing efreet_desktop_command_append_multiple we add all files from
command, whilst still looping command->files. So the command was created
with all files for all files.

Set l to NULL, since we parse all elements in command->files in
efreet_desktop_command_append_multiple to break the loop.
2014-09-25 09:24:27 +02:00
Sebastian Dransfeld 8e740ea765 efreet: remove debug fprintf 2014-09-25 09:22:07 +02:00
Sebastian Dransfeld 0f4f0a7e5e efreet: Fix leak on error
If we encountered an error, special hashes in internal desktop struct
wasn't free'd.
2014-09-25 09:01:12 +02:00
Sebastian Dransfeld 793fd5e847 efreet: Implement fields added by desktop spec 1.1 2014-09-25 08:47:45 +02:00
Sebastian Dransfeld c700192736 efreet: Accept both only_show_in and not_show_in
In one file it is allowed with both OnlyShowIn and NotShowIn, and it is
the user who has to ensure that these lists don' clash.

@fix
2014-09-25 08:47:45 +02:00
Sebastian Dransfeld 54d5653e1b efreet: Store known desktop environments 2014-09-18 10:48:50 +02:00
Carsten Haitzler 3539afeaf0 make indenting consistent
this doesnt mean its right - it just matches. efreet needs some indent
love.
2014-08-14 20:56:55 +09:00
Adrien Nader a2d8c1651b efreet: replace 4096 with sizeof(buf) in snprintf(buf, 4096, ...).
buf is a local variable defined as:
  char buf[4096];
The current code is correct; this change only makes sure the value won't
get out-of-sync later on.
2014-08-14 20:55:58 +09:00
Adrien Nader 3778036926 efreet: reverse if's condition and swap then/else blocks for readability
The reversal makes it possible to merge two #if and unspaghetti the code
a bit.

Since the diff is not very readable, here is the before/after to show
the spirit:

  before:

    #if cond
      if (...)
    #endif
        do_foo();
    #if cond
      else
        do_bar();
    #endif

  after:

    #if cond
      if ( ! ...)
        do_bar();
      else
    #endif
        do_foo();
2014-08-14 20:55:58 +09:00
Adrien Nader 0fb9f5d516 efreet: remove #ifdef GETUID inside #ifdef _WIN32 (it's always false). 2014-08-14 20:55:58 +09:00
Sebastian Dransfeld e7198621c5 efreet: use eina_file_mkstemp to create filename 2014-08-14 13:30:48 +02:00
Sebastian Dransfeld 95a02295c1 efreet: remove creation of XDG_RUNTIME_DIR
XDG_RUNTIME_DIR should be created and set by the system, not a library.
2014-08-14 13:01:29 +02:00
Carsten Haitzler 356d10fbee efreet - add menu ref/unref calls and refcounting to try solve e issue
not much more to say really... efreet_menu_free now unrefs nd checks
for 0 refcount first... unref just calls it to be "nice"

@feature
2014-07-23 20:36:19 +09:00
Jean-Philippe Andre 62e3c75777 Efreet: Fix shadow warning 2014-06-19 10:33:49 +09:00