2009-04-20 16:20:40 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-11-23 22:43:00 -08:00
|
|
|
#include "efreet_alloca.h"
|
2010-11-25 15:48:59 -08:00
|
|
|
|
2010-11-26 09:05:16 -08:00
|
|
|
#ifdef HAVE_EVIL
|
|
|
|
# include <Evil.h>
|
2009-04-20 16:20:40 -07:00
|
|
|
#endif
|
|
|
|
|
2010-11-25 15:52:57 -08:00
|
|
|
#include <Ecore_File.h>
|
|
|
|
|
2011-02-05 11:05:55 -08:00
|
|
|
/* define macros and variable for using the eina logging system */
|
|
|
|
#define EFREET_MODULE_LOG_DOM _efreet_desktop_log_dom
|
|
|
|
int _efreet_desktop_log_dom = -1;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
#include "Efreet.h"
|
|
|
|
#include "efreet_private.h"
|
|
|
|
|
2010-01-24 13:21:27 -08:00
|
|
|
#define DESKTOP_VERSION "1.0"
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-02-04 18:06:05 -08:00
|
|
|
/**
|
2010-11-23 12:14:13 -08:00
|
|
|
* The current desktop environment (e.g. "Enlightenment" or "Gnome")
|
2007-02-04 18:06:05 -08:00
|
|
|
*/
|
2010-11-23 12:14:13 -08:00
|
|
|
static const char *desktop_environment = NULL;
|
2007-02-04 18:06:05 -08:00
|
|
|
|
2010-03-03 04:28:21 -08:00
|
|
|
/**
|
2010-11-23 12:14:13 -08:00
|
|
|
* A list of the desktop types available
|
2010-04-15 12:19:48 -07:00
|
|
|
*/
|
2010-11-23 12:14:13 -08:00
|
|
|
static Eina_List *efreet_desktop_types = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int EFREET_DESKTOP_TYPE_APPLICATION = 0;
|
|
|
|
EAPI int EFREET_DESKTOP_TYPE_LINK = 0;
|
|
|
|
EAPI int EFREET_DESKTOP_TYPE_DIRECTORY = 0;
|
2007-02-05 13:16:55 -08:00
|
|
|
|
2007-02-05 12:23:31 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Information about custom types
|
|
|
|
*/
|
|
|
|
typedef struct Efreet_Desktop_Type_Info Efreet_Desktop_Type_Info;
|
|
|
|
struct Efreet_Desktop_Type_Info
|
|
|
|
{
|
2007-02-05 13:16:55 -08:00
|
|
|
int id;
|
2010-04-01 12:31:49 -07:00
|
|
|
const char *type;
|
2007-02-05 12:23:31 -08:00
|
|
|
Efreet_Desktop_Type_Parse_Cb parse_func;
|
2007-02-05 13:16:55 -08:00
|
|
|
Efreet_Desktop_Type_Save_Cb save_func;
|
2007-02-05 12:23:31 -08:00
|
|
|
Efreet_Desktop_Type_Free_Cb free_func;
|
|
|
|
};
|
|
|
|
|
2007-03-27 12:41:23 -07:00
|
|
|
static int efreet_desktop_read(Efreet_Desktop *desktop);
|
2007-02-05 13:16:55 -08:00
|
|
|
static Efreet_Desktop_Type_Info *efreet_desktop_type_parse(const char *type_str);
|
2010-04-15 12:20:31 -07:00
|
|
|
static void efreet_desktop_type_info_free(Efreet_Desktop_Type_Info *info);
|
2007-09-06 09:15:10 -07:00
|
|
|
static void *efreet_desktop_application_fields_parse(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2007-09-06 09:15:10 -07:00
|
|
|
static void efreet_desktop_application_fields_save(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2007-02-05 13:16:55 -08:00
|
|
|
static void *efreet_desktop_link_fields_parse(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2007-09-06 09:15:10 -07:00
|
|
|
static void efreet_desktop_link_fields_save(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2007-09-06 09:15:10 -07:00
|
|
|
static int efreet_desktop_generic_fields_parse(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2007-09-06 09:15:10 -07:00
|
|
|
static void efreet_desktop_generic_fields_save(Efreet_Desktop *desktop,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini);
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Bool efreet_desktop_x_fields_parse(const Eina_Hash *hash,
|
2010-02-04 01:12:35 -08:00
|
|
|
const void *key,
|
|
|
|
void *data,
|
|
|
|
void *fdata);
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Bool efreet_desktop_x_fields_save(const Eina_Hash *hash,
|
2010-02-04 01:12:35 -08:00
|
|
|
const void *key,
|
|
|
|
void *value,
|
|
|
|
void *fdata);
|
2010-10-20 13:39:54 -07:00
|
|
|
static int efreet_desktop_environment_check(Efreet_Desktop *desktop);
|
2010-04-15 12:20:31 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns > 0 on success or 0 on failure
|
|
|
|
* @brief Initialize the Desktop parser subsystem
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
efreet_desktop_init(void)
|
|
|
|
{
|
2010-10-07 15:22:33 -07:00
|
|
|
_efreet_desktop_log_dom = eina_log_domain_register
|
|
|
|
("efreet_desktop", EFREET_DEFAULT_LOG_COLOR);
|
2009-10-09 23:19:13 -07:00
|
|
|
if (_efreet_desktop_log_dom < 0)
|
|
|
|
{
|
2011-03-18 12:47:57 -07:00
|
|
|
EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_desktop");
|
2010-02-04 01:12:35 -08:00
|
|
|
return 0;
|
2009-10-09 23:19:13 -07:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-11-26 12:48:50 -08:00
|
|
|
#ifdef HAVE_EVIL
|
2010-11-26 09:05:16 -08:00
|
|
|
if (!evil_sockets_init())
|
|
|
|
{
|
|
|
|
ERR("Could not initialize Winsock system");
|
|
|
|
return 0;
|
|
|
|
}
|
2010-11-26 12:48:50 -08:00
|
|
|
#endif
|
2010-11-26 09:05:16 -08:00
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
efreet_desktop_types = NULL;
|
2007-02-05 13:16:55 -08:00
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
EFREET_DESKTOP_TYPE_APPLICATION = efreet_desktop_type_add("Application",
|
|
|
|
efreet_desktop_application_fields_parse,
|
|
|
|
efreet_desktop_application_fields_save,
|
2007-02-05 13:16:55 -08:00
|
|
|
NULL);
|
2007-09-06 09:15:10 -07:00
|
|
|
EFREET_DESKTOP_TYPE_LINK = efreet_desktop_type_add("Link",
|
|
|
|
efreet_desktop_link_fields_parse,
|
2007-02-05 13:16:55 -08:00
|
|
|
efreet_desktop_link_fields_save, NULL);
|
2007-09-06 09:15:10 -07:00
|
|
|
EFREET_DESKTOP_TYPE_DIRECTORY = efreet_desktop_type_add("Directory", NULL,
|
2007-02-05 13:16:55 -08:00
|
|
|
NULL, NULL);
|
2007-02-04 18:06:05 -08:00
|
|
|
|
2009-10-09 23:19:13 -07:00
|
|
|
return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @returns the number of initializations left for this system
|
|
|
|
* @brief Attempts to shut down the subsystem if nothing else is using it
|
|
|
|
*/
|
2009-10-09 23:19:13 -07:00
|
|
|
void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_shutdown(void)
|
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
|
2007-02-04 18:06:05 -08:00
|
|
|
IF_RELEASE(desktop_environment);
|
2010-08-03 13:46:25 -07:00
|
|
|
EINA_LIST_FREE(efreet_desktop_types, info)
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
efreet_desktop_type_info_free(info);
|
2010-11-26 12:48:50 -08:00
|
|
|
#ifdef HAVE_EVIL
|
2010-11-26 09:05:16 -08:00
|
|
|
evil_sockets_shutdown();
|
2010-11-26 12:48:50 -08:00
|
|
|
#endif
|
2009-10-09 23:19:13 -07:00
|
|
|
eina_log_domain_unregister(_efreet_desktop_log_dom);
|
2011-02-05 11:06:55 -08:00
|
|
|
_efreet_desktop_log_dom = -1;
|
2010-03-01 10:16:32 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Desktop *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_get(const char *file)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
desktop = efreet_desktop_new(file);
|
|
|
|
if (!desktop) return NULL;
|
|
|
|
|
2011-02-10 06:25:44 -08:00
|
|
|
/* If we didn't find this file in the eet cache, add path to search path */
|
2010-03-03 11:42:38 -08:00
|
|
|
if (!desktop->eet)
|
2011-08-31 02:10:18 -07:00
|
|
|
{
|
|
|
|
/* Check whether the desktop type is a system type,
|
|
|
|
* and therefor known by the cache builder */
|
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
|
|
|
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
|
|
|
if (info && (
|
|
|
|
info->id == EFREET_DESKTOP_TYPE_APPLICATION ||
|
|
|
|
info->id == EFREET_DESKTOP_TYPE_LINK ||
|
|
|
|
info->id == EFREET_DESKTOP_TYPE_DIRECTORY
|
|
|
|
))
|
|
|
|
efreet_cache_desktop_add(desktop);
|
|
|
|
}
|
2010-03-03 11:42:38 -08:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
return desktop;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-06-22 02:39:58 -07:00
|
|
|
efreet_desktop_ref(Efreet_Desktop *desktop)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
2007-06-22 02:39:58 -07:00
|
|
|
desktop->ref++;
|
|
|
|
return desktop->ref;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Desktop *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_empty_new(const char *file)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
desktop = NEW(Efreet_Desktop, 1);
|
|
|
|
if (!desktop) return NULL;
|
|
|
|
|
|
|
|
desktop->orig_path = strdup(file);
|
2007-06-16 17:33:39 -07:00
|
|
|
desktop->load_time = ecore_file_mod_time(file);
|
2007-06-14 11:37:31 -07:00
|
|
|
|
2007-06-14 08:53:02 -07:00
|
|
|
desktop->ref = 1;
|
2007-06-14 11:37:31 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
return desktop;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Desktop *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_new(const char *file)
|
|
|
|
{
|
2010-03-01 10:16:32 -08:00
|
|
|
Efreet_Desktop *desktop = NULL;
|
2012-10-18 01:10:35 -07:00
|
|
|
char *tmp;
|
2010-03-01 10:16:32 -08:00
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
|
|
|
|
|
2012-10-18 01:10:35 -07:00
|
|
|
tmp = eina_file_path_sanitize(file);
|
|
|
|
if (!tmp) return NULL;
|
|
|
|
|
|
|
|
desktop = efreet_cache_desktop_find(tmp);
|
|
|
|
free(tmp);
|
2010-11-23 12:14:13 -08:00
|
|
|
if (desktop)
|
2010-03-01 10:16:32 -08:00
|
|
|
{
|
2011-02-10 06:25:44 -08:00
|
|
|
desktop->ref++;
|
2011-08-18 02:03:44 -07:00
|
|
|
if (!efreet_desktop_environment_check(desktop))
|
2010-03-01 10:16:32 -08:00
|
|
|
{
|
2011-08-18 02:03:44 -07:00
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
return NULL;
|
2010-03-01 10:16:32 -08:00
|
|
|
}
|
2011-08-18 02:03:44 -07:00
|
|
|
return desktop;
|
2010-03-01 10:16:32 -08:00
|
|
|
}
|
2010-03-15 12:57:57 -07:00
|
|
|
return efreet_desktop_uncached_new(file);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-15 12:57:57 -07:00
|
|
|
EAPI Efreet_Desktop *
|
|
|
|
efreet_desktop_uncached_new(const char *file)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop = NULL;
|
2012-10-18 01:10:35 -07:00
|
|
|
char *tmp;
|
2010-03-15 12:57:57 -07:00
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
|
2012-10-18 01:10:35 -07:00
|
|
|
if (!ecore_file_exists(file)) return NULL;
|
2012-05-23 13:10:27 -07:00
|
|
|
|
2012-10-18 01:10:35 -07:00
|
|
|
tmp = eina_file_path_sanitize(file);
|
|
|
|
if (!tmp) return NULL;
|
2007-07-26 04:37:23 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
desktop = NEW(Efreet_Desktop, 1);
|
2012-10-18 01:10:35 -07:00
|
|
|
if (!desktop)
|
|
|
|
{
|
|
|
|
free(tmp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
desktop->orig_path = tmp;
|
2010-03-27 13:53:52 -07:00
|
|
|
desktop->ref = 1;
|
2010-03-15 12:57:57 -07:00
|
|
|
if (!efreet_desktop_read(desktop))
|
|
|
|
{
|
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-06-14 11:37:31 -07:00
|
|
|
|
2007-03-27 12:41:23 -07:00
|
|
|
return desktop;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_save(Efreet_Desktop *desktop)
|
|
|
|
{
|
2007-02-05 13:16:55 -08:00
|
|
|
Efreet_Desktop_Type_Info *info;
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Ini *ini;
|
|
|
|
int ok = 1;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
|
|
|
|
2009-05-15 04:47:39 -07:00
|
|
|
ini = efreet_ini_new(NULL);
|
2010-08-04 12:15:38 -07:00
|
|
|
if (!ini) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_ini_section_add(ini, "Desktop Entry");
|
|
|
|
efreet_ini_section_set(ini, "Desktop Entry");
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
2007-09-06 09:15:10 -07:00
|
|
|
if (info)
|
2007-02-04 18:06:05 -08:00
|
|
|
{
|
2007-02-05 13:16:55 -08:00
|
|
|
efreet_ini_string_set(ini, "Type", info->type);
|
|
|
|
if (info->save_func) info->save_func(desktop, ini);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-02-04 18:06:05 -08:00
|
|
|
else
|
|
|
|
ok = 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
|
|
|
|
if (desktop->only_show_in)
|
|
|
|
{
|
|
|
|
val = efreet_desktop_string_list_join(desktop->only_show_in);
|
2010-08-04 12:15:53 -07:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
efreet_ini_string_set(ini, "OnlyShowIn", val);
|
|
|
|
FREE(val);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
if (desktop->not_show_in)
|
|
|
|
{
|
|
|
|
val = efreet_desktop_string_list_join(desktop->not_show_in);
|
2010-08-04 12:15:53 -07:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
efreet_ini_string_set(ini, "NotShowIn", val);
|
|
|
|
FREE(val);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
efreet_desktop_generic_fields_save(desktop, ini);
|
|
|
|
/* When we save the file, it should be updated to the
|
|
|
|
* latest version that we support! */
|
2010-01-24 13:21:27 -08:00
|
|
|
efreet_ini_string_set(ini, "Version", DESKTOP_VERSION);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-15 12:10:51 -07:00
|
|
|
if (!efreet_ini_save(ini, desktop->orig_path)) ok = 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
efreet_ini_free(ini);
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_save_as(Efreet_Desktop *desktop, const char *file)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0);
|
|
|
|
|
2011-02-10 06:25:44 -08:00
|
|
|
/* If we save data from eet as new, we will be in trouble */
|
|
|
|
if (desktop->eet) return 0;
|
|
|
|
|
|
|
|
IF_FREE(desktop->orig_path);
|
2007-02-03 05:05:30 -08:00
|
|
|
desktop->orig_path = strdup(file);
|
|
|
|
return efreet_desktop_save(desktop);
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_free(Efreet_Desktop *desktop)
|
|
|
|
{
|
|
|
|
if (!desktop) return;
|
|
|
|
|
2007-06-14 08:53:02 -07:00
|
|
|
desktop->ref--;
|
|
|
|
if (desktop->ref > 0) return;
|
2007-06-14 11:37:31 -07:00
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
if (desktop->eet)
|
|
|
|
{
|
2011-02-10 06:25:44 -08:00
|
|
|
efreet_cache_desktop_free(desktop);
|
2010-03-01 10:16:32 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
IF_FREE(desktop->orig_path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
IF_FREE(desktop->version);
|
|
|
|
IF_FREE(desktop->name);
|
|
|
|
IF_FREE(desktop->generic_name);
|
|
|
|
IF_FREE(desktop->comment);
|
|
|
|
IF_FREE(desktop->icon);
|
|
|
|
IF_FREE(desktop->url);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
IF_FREE(desktop->try_exec);
|
|
|
|
IF_FREE(desktop->exec);
|
|
|
|
IF_FREE(desktop->path);
|
|
|
|
IF_FREE(desktop->startup_wm_class);
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
IF_FREE_LIST(desktop->only_show_in, eina_stringshare_del);
|
|
|
|
IF_FREE_LIST(desktop->not_show_in, eina_stringshare_del);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
IF_FREE_LIST(desktop->categories, eina_stringshare_del);
|
|
|
|
IF_FREE_LIST(desktop->mime_types, eina_stringshare_del);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
IF_FREE_HASH(desktop->x);
|
|
|
|
|
|
|
|
if (desktop->type_data)
|
|
|
|
{
|
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
info = eina_list_nth(efreet_desktop_types, desktop->type);
|
|
|
|
if (info->free_func)
|
|
|
|
info->free_func(desktop->type_data);
|
|
|
|
}
|
2011-02-10 06:25:44 -08:00
|
|
|
free(desktop);
|
2007-02-05 12:23:31 -08:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_environment_set(const char *environment)
|
|
|
|
{
|
2008-10-15 07:48:03 -07:00
|
|
|
if (desktop_environment) eina_stringshare_del(desktop_environment);
|
|
|
|
if (environment) desktop_environment = eina_stringshare_add(environment);
|
2007-02-03 05:05:30 -08:00
|
|
|
else desktop_environment = NULL;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI const char *
|
2007-07-17 08:07:59 -07:00
|
|
|
efreet_desktop_environment_get(void)
|
|
|
|
{
|
|
|
|
return desktop_environment;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI unsigned int
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_category_count_get(Efreet_Desktop *desktop)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
return eina_list_count(desktop->categories);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_category_add(Efreet_Desktop *desktop, const char *category)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(desktop);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(category);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
if (eina_list_search_unsorted(desktop->categories,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(strcmp), category)) return;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
desktop->categories = eina_list_append(desktop->categories,
|
2008-10-15 07:48:03 -07:00
|
|
|
(void *)eina_stringshare_add(category));
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_category_del(Efreet_Desktop *desktop, const char *category)
|
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
char *found = NULL;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
if ((found = eina_list_search_unsorted(desktop->categories,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(strcmp), category)))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
eina_stringshare_del(found);
|
|
|
|
desktop->categories = eina_list_remove(desktop->categories, found);
|
|
|
|
|
|
|
|
return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-02-04 18:06:05 -08:00
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-05 12:23:31 -08:00
|
|
|
efreet_desktop_type_add(const char *type, Efreet_Desktop_Type_Parse_Cb parse_func,
|
2007-02-05 13:16:55 -08:00
|
|
|
Efreet_Desktop_Type_Save_Cb save_func,
|
2007-02-05 12:23:31 -08:00
|
|
|
Efreet_Desktop_Type_Free_Cb free_func)
|
2007-02-04 18:06:05 -08:00
|
|
|
{
|
|
|
|
int id;
|
2007-02-05 12:23:31 -08:00
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
|
|
|
|
info = NEW(Efreet_Desktop_Type_Info, 1);
|
|
|
|
if (!info) return 0;
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
id = eina_list_count(efreet_desktop_types);
|
2007-02-05 13:16:55 -08:00
|
|
|
|
|
|
|
info->id = id;
|
2010-04-01 12:31:49 -07:00
|
|
|
info->type = eina_stringshare_add(type);
|
2007-02-05 12:23:31 -08:00
|
|
|
info->parse_func = parse_func;
|
2007-02-05 13:16:55 -08:00
|
|
|
info->save_func = save_func;
|
2007-02-05 12:23:31 -08:00
|
|
|
info->free_func = free_func;
|
2007-02-04 18:06:05 -08:00
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
efreet_desktop_types = eina_list_append(efreet_desktop_types, info);
|
2007-02-04 18:06:05 -08:00
|
|
|
|
2007-02-05 13:16:55 -08:00
|
|
|
return id;
|
2007-02-04 18:06:05 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
|
|
|
efreet_desktop_type_alias(int from_type, const char *alias)
|
2007-06-20 11:04:26 -07:00
|
|
|
{
|
|
|
|
Efreet_Desktop_Type_Info *info;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
info = eina_list_nth(efreet_desktop_types, from_type);
|
2007-06-20 11:04:26 -07:00
|
|
|
if (!info) return -1;
|
|
|
|
|
|
|
|
return efreet_desktop_type_add(alias, info->parse_func, info->save_func, info->free_func);
|
|
|
|
}
|
|
|
|
|
2010-04-15 12:20:31 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
efreet_desktop_x_field_set(Efreet_Desktop *desktop, const char *key, const char *data)
|
2007-02-05 12:23:31 -08:00
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), EINA_FALSE);
|
2010-04-15 12:20:31 -07:00
|
|
|
|
|
|
|
if (!desktop->x)
|
|
|
|
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
|
|
|
|
|
|
|
eina_hash_del_by_key(desktop->x, key);
|
|
|
|
eina_hash_add(desktop->x, key, eina_stringshare_add(data));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key)
|
|
|
|
{
|
|
|
|
const char *ret;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop->x, NULL);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), NULL);
|
2010-04-15 12:20:31 -07:00
|
|
|
|
|
|
|
ret = eina_hash_find(desktop->x, key);
|
|
|
|
if (!ret)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return eina_stringshare_add(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
efreet_desktop_x_field_del(Efreet_Desktop *desktop, const char *key)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop->x, EINA_FALSE);
|
2010-04-15 12:20:31 -07:00
|
|
|
|
|
|
|
return eina_hash_del_by_key(desktop->x, key);
|
2007-02-05 12:23:31 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void *
|
2007-02-05 12:23:31 -08:00
|
|
|
efreet_desktop_type_data_get(Efreet_Desktop *desktop)
|
|
|
|
{
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, NULL);
|
2007-02-05 12:23:31 -08:00
|
|
|
return desktop->type_data;
|
|
|
|
}
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EAPI Eina_List *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_string_list_parse(const char *string)
|
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Eina_List *list = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *tmp;
|
|
|
|
char *s, *p;
|
2010-04-01 12:32:10 -07:00
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(string, NULL);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-01 12:32:10 -07:00
|
|
|
len = strlen(string) + 1;
|
|
|
|
tmp = alloca(len);
|
|
|
|
memcpy(tmp, string, len);
|
2007-02-03 05:05:30 -08:00
|
|
|
s = tmp;
|
|
|
|
|
|
|
|
while ((p = strchr(s, ';')))
|
|
|
|
{
|
|
|
|
if (p > tmp && *(p-1) == '\\') continue;
|
|
|
|
*p = '\0';
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
list = eina_list_append(list, (void *)eina_stringshare_add(s));
|
2007-02-03 05:05:30 -08:00
|
|
|
s = p + 1;
|
|
|
|
}
|
|
|
|
/* If this is true, the .desktop file does not follow the standard */
|
|
|
|
if (*s)
|
|
|
|
{
|
2007-04-04 03:41:53 -07:00
|
|
|
#ifdef STRICT_SPEC
|
2009-09-21 09:36:29 -07:00
|
|
|
WRN("[Efreet]: Found a string list without ';' "
|
|
|
|
"at the end: %s", string);
|
2007-02-03 05:05:30 -08:00
|
|
|
#endif
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
list = eina_list_append(list, (void *)eina_stringshare_add(s));
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2007-11-04 04:29:36 -08:00
|
|
|
EAPI char *
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
efreet_desktop_string_list_join(Eina_List *list)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Eina_List *l;
|
2010-08-03 12:30:53 -07:00
|
|
|
const char *elem;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *string;
|
|
|
|
size_t size, pos, len;
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
if (!list) return strdup("");
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
size = 1024;
|
|
|
|
string = malloc(size);
|
2010-08-03 12:31:04 -07:00
|
|
|
if (!string) return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
pos = 0;
|
|
|
|
|
2010-08-03 12:30:53 -07:00
|
|
|
EINA_LIST_FOREACH(list, l, elem)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-08-03 12:30:53 -07:00
|
|
|
len = strlen(elem);
|
2007-02-03 05:05:30 -08:00
|
|
|
/* +1 for ';' */
|
|
|
|
if ((len + pos + 1) >= size)
|
|
|
|
{
|
2010-08-03 12:30:53 -07:00
|
|
|
char *tmp;
|
2007-05-04 08:02:55 -07:00
|
|
|
size = len + pos + 1024;
|
2010-08-03 12:30:53 -07:00
|
|
|
tmp = realloc(string, size);
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
free(string);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
string = tmp;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2010-08-03 12:30:53 -07:00
|
|
|
strcpy(string + pos, elem);
|
2007-02-03 05:05:30 -08:00
|
|
|
pos += len;
|
|
|
|
strcpy(string + pos, ";");
|
|
|
|
pos += 1;
|
|
|
|
}
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
2010-04-15 12:20:31 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop The desktop to fill
|
2010-04-15 12:20:31 -07:00
|
|
|
* @return Returns 1 on success, 0 on failure
|
|
|
|
* @brief initialize an Efreet_Desktop from the contents of @a file
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_desktop_read(Efreet_Desktop *desktop)
|
|
|
|
{
|
|
|
|
Efreet_Ini *ini;
|
|
|
|
int error = 0;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
ini = efreet_ini_new(desktop->orig_path);
|
2010-08-04 12:15:38 -07:00
|
|
|
if (!ini) return 0;
|
2010-04-15 12:20:31 -07:00
|
|
|
if (!ini->data)
|
|
|
|
{
|
|
|
|
efreet_ini_free(ini);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok = efreet_ini_section_set(ini, "Desktop Entry");
|
|
|
|
if (!ok) ok = efreet_ini_section_set(ini, "KDE Desktop Entry");
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
ERR("efreet_desktop_new error: no Desktop Entry section");
|
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!error)
|
|
|
|
{
|
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
|
|
|
|
info = efreet_desktop_type_parse(efreet_ini_string_get(ini, "Type"));
|
|
|
|
if (info)
|
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
desktop->type = info->id;
|
|
|
|
val = efreet_ini_string_get(ini, "Version");
|
|
|
|
if (val) desktop->version = strdup(val);
|
|
|
|
|
|
|
|
if (info->parse_func)
|
|
|
|
desktop->type_data = info->parse_func(desktop, ini);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!error && !efreet_desktop_generic_fields_parse(desktop, ini)) error = 1;
|
2010-10-20 13:39:54 -07:00
|
|
|
if (!error && !efreet_desktop_environment_check(desktop)) error = 1;
|
2010-04-15 12:20:31 -07:00
|
|
|
if (!error)
|
|
|
|
eina_hash_foreach(ini->section, efreet_desktop_x_fields_parse, desktop);
|
|
|
|
|
|
|
|
efreet_ini_free(ini);
|
|
|
|
|
|
|
|
desktop->load_time = ecore_file_mod_time(desktop->orig_path);
|
|
|
|
|
|
|
|
if (error) return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param type_str the type as a string
|
2010-04-15 12:20:31 -07:00
|
|
|
* @return the parsed type
|
|
|
|
* @brief parse the type string into an Efreet_Desktop_Type
|
|
|
|
*/
|
|
|
|
static Efreet_Desktop_Type_Info *
|
|
|
|
efreet_desktop_type_parse(const char *type_str)
|
|
|
|
{
|
|
|
|
Efreet_Desktop_Type_Info *info;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
if (!type_str) return NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(efreet_desktop_types, l, info)
|
|
|
|
{
|
|
|
|
if (!strcmp(info->type, type_str))
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @brief Free an Efreet Desktop_Type_Info struct
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_desktop_type_info_free(Efreet_Desktop_Type_Info *info)
|
|
|
|
{
|
|
|
|
if (!info) return;
|
|
|
|
IF_RELEASE(info->type);
|
|
|
|
free(info);
|
|
|
|
}
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to store parsed fields in
|
|
|
|
* @param ini the Efreet_Ini to parse fields from
|
2007-02-05 13:16:55 -08:00
|
|
|
* @return No value
|
2007-02-03 05:05:30 -08:00
|
|
|
* @brief Parse application specific desktop fields
|
|
|
|
*/
|
2007-02-05 13:16:55 -08:00
|
|
|
static void *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_application_fields_parse(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
val = efreet_ini_string_get(ini, "TryExec");
|
|
|
|
if (val) desktop->try_exec = strdup(val);
|
|
|
|
|
|
|
|
val = efreet_ini_string_get(ini, "Exec");
|
|
|
|
if (val) desktop->exec = strdup(val);
|
|
|
|
|
|
|
|
val = efreet_ini_string_get(ini, "Path");
|
|
|
|
if (val) desktop->path = strdup(val);
|
|
|
|
|
|
|
|
val = efreet_ini_string_get(ini, "StartupWMClass");
|
|
|
|
if (val) desktop->startup_wm_class = strdup(val);
|
|
|
|
|
2012-06-11 02:01:35 -07:00
|
|
|
val = efreet_ini_string_get(ini, "Categories");
|
2012-06-14 01:29:53 -07:00
|
|
|
if (val)
|
|
|
|
desktop->categories = efreet_desktop_string_list_parse(val);
|
2012-06-11 02:01:35 -07:00
|
|
|
val = efreet_ini_string_get(ini, "MimeType");
|
|
|
|
if (val) desktop->mime_types = efreet_desktop_string_list_parse(val);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
desktop->terminal = efreet_ini_boolean_get(ini, "Terminal");
|
|
|
|
desktop->startup_notify = efreet_ini_boolean_get(ini, "StartupNotify");
|
|
|
|
|
2007-02-05 13:16:55 -08:00
|
|
|
return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to save fields from
|
|
|
|
* @param ini the Efreet_Ini to save fields to
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Save application specific desktop fields
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_desktop_application_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (desktop->try_exec)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_ini_string_set(ini, "TryExec", desktop->try_exec);
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (desktop->exec)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_ini_string_set(ini, "Exec", desktop->exec);
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (desktop->path)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_ini_string_set(ini, "Path", desktop->path);
|
|
|
|
|
|
|
|
if (desktop->startup_wm_class)
|
|
|
|
efreet_ini_string_set(ini, "StartupWMClass", desktop->startup_wm_class);
|
|
|
|
|
|
|
|
if (desktop->categories)
|
|
|
|
{
|
|
|
|
val = efreet_desktop_string_list_join(desktop->categories);
|
2010-08-04 12:15:53 -07:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
efreet_ini_string_set(ini, "Categories", val);
|
|
|
|
FREE(val);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (desktop->mime_types)
|
|
|
|
{
|
|
|
|
val = efreet_desktop_string_list_join(desktop->mime_types);
|
2010-08-04 12:15:53 -07:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
efreet_ini_string_set(ini, "MimeType", val);
|
|
|
|
FREE(val);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
efreet_ini_boolean_set(ini, "Terminal", desktop->terminal);
|
|
|
|
efreet_ini_boolean_set(ini, "StartupNotify", desktop->startup_notify);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to store parsed fields in
|
|
|
|
* @param ini the Efreet_Ini to parse fields from
|
2007-02-05 13:16:55 -08:00
|
|
|
* @return Returns no value
|
2007-02-03 05:05:30 -08:00
|
|
|
* @brief Parse link specific desktop fields
|
|
|
|
*/
|
2007-02-05 13:16:55 -08:00
|
|
|
static void *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_desktop_link_fields_parse(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
val = efreet_ini_string_get(ini, "URL");
|
|
|
|
if (val) desktop->url = strdup(val);
|
2007-02-05 13:16:55 -08:00
|
|
|
return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to save fields from
|
|
|
|
* @param ini the Efreet_Ini to save fields in
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Save link specific desktop fields
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_desktop_link_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
if (desktop->url) efreet_ini_string_set(ini, "URL", desktop->url);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to store parsed fields in
|
|
|
|
* @param ini the Efreet_Ini to parse fields from
|
2010-09-08 04:27:59 -07:00
|
|
|
* @return 1 if parsed successfully, 0 otherwise
|
2007-02-03 05:05:30 -08:00
|
|
|
* @brief Parse desktop fields that all types can include
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_desktop_generic_fields_parse(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
const char *val;
|
2010-10-20 13:39:54 -07:00
|
|
|
const char *not_show_in = NULL, *only_show_in = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
val = efreet_ini_localestring_get(ini, "Name");
|
2012-06-18 05:12:44 -07:00
|
|
|
#ifndef STRICT_SPEC
|
2012-06-11 02:38:10 -07:00
|
|
|
if (!val) val = efreet_ini_localestring_get(ini, "_Name");
|
2012-06-18 05:12:44 -07:00
|
|
|
#endif
|
2007-02-03 05:05:30 -08:00
|
|
|
if (val) desktop->name = strdup(val);
|
2007-09-06 09:15:10 -07:00
|
|
|
else
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2012-06-11 02:38:10 -07:00
|
|
|
ERR("efreet_desktop_generic_fields_parse error: no Name or _Name fields");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
val = efreet_ini_localestring_get(ini, "GenericName");
|
|
|
|
if (val) desktop->generic_name = strdup(val);
|
|
|
|
|
|
|
|
val = efreet_ini_localestring_get(ini, "Comment");
|
2012-06-18 05:12:44 -07:00
|
|
|
#ifndef STRICT_SPEC
|
2012-06-11 02:38:10 -07:00
|
|
|
if (!val) val = efreet_ini_localestring_get(ini, "_Comment");
|
2012-06-18 05:12:44 -07:00
|
|
|
#endif
|
2007-02-03 05:05:30 -08:00
|
|
|
if (val) desktop->comment = strdup(val);
|
|
|
|
|
|
|
|
val = efreet_ini_localestring_get(ini, "Icon");
|
|
|
|
if (val) desktop->icon = strdup(val);
|
|
|
|
|
|
|
|
desktop->no_display = efreet_ini_boolean_get(ini, "NoDisplay");
|
|
|
|
desktop->hidden = efreet_ini_boolean_get(ini, "Hidden");
|
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
only_show_in = efreet_ini_string_get(ini, "OnlyShowIn");
|
|
|
|
not_show_in = efreet_ini_string_get(ini, "NotShowIn");
|
|
|
|
if (only_show_in && not_show_in)
|
|
|
|
WRN("Both OnlyShowIn and NotShowIn in %s, preferring OnlyShowIn", desktop->orig_path);
|
|
|
|
if (only_show_in) desktop->only_show_in = efreet_desktop_string_list_parse(only_show_in);
|
|
|
|
else if (not_show_in) desktop->not_show_in = efreet_desktop_string_list_parse(not_show_in);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param desktop the Efreet_Desktop to save fields from
|
|
|
|
* @param ini the Efreet_Ini to save fields to
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns nothing
|
|
|
|
* @brief Save desktop fields that all types can include
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_desktop_generic_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
|
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
if (desktop->name)
|
|
|
|
{
|
|
|
|
efreet_ini_localestring_set(ini, "Name", desktop->name);
|
|
|
|
val = efreet_ini_string_get(ini, "Name");
|
|
|
|
if (!val)
|
|
|
|
efreet_ini_string_set(ini, "Name", desktop->name);
|
|
|
|
}
|
|
|
|
if (desktop->generic_name)
|
|
|
|
{
|
|
|
|
efreet_ini_localestring_set(ini, "GenericName", desktop->generic_name);
|
|
|
|
val = efreet_ini_string_get(ini, "GenericName");
|
|
|
|
if (!val)
|
|
|
|
efreet_ini_string_set(ini, "GenericName", desktop->generic_name);
|
|
|
|
}
|
|
|
|
if (desktop->comment)
|
|
|
|
{
|
|
|
|
efreet_ini_localestring_set(ini, "Comment", desktop->comment);
|
|
|
|
val = efreet_ini_string_get(ini, "Comment");
|
|
|
|
if (!val)
|
|
|
|
efreet_ini_string_set(ini, "Comment", desktop->comment);
|
|
|
|
}
|
|
|
|
if (desktop->icon)
|
|
|
|
{
|
|
|
|
efreet_ini_localestring_set(ini, "Icon", desktop->icon);
|
|
|
|
val = efreet_ini_string_get(ini, "Icon");
|
|
|
|
if (!val)
|
|
|
|
efreet_ini_string_set(ini, "Icon", desktop->icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
efreet_ini_boolean_set(ini, "NoDisplay", desktop->no_display);
|
|
|
|
efreet_ini_boolean_set(ini, "Hidden", desktop->hidden);
|
2007-11-22 22:57:39 -08:00
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
if (desktop->x) eina_hash_foreach(desktop->x, efreet_desktop_x_fields_save,
|
2010-02-04 01:12:35 -08:00
|
|
|
ini);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param node The node to work with
|
|
|
|
* @param desktop The desktop file to work with
|
2009-02-26 14:35:38 -08:00
|
|
|
* @return Returns always true, to be used in eina_hash_foreach()
|
2007-11-22 22:57:39 -08:00
|
|
|
* @brief Parses out an X- key from @a node and stores in @a desktop
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Bool
|
2009-02-26 14:35:38 -08:00
|
|
|
efreet_desktop_x_fields_parse(const Eina_Hash *hash __UNUSED__, const void *key, void *value, void *fdata)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
Efreet_Desktop * desktop = fdata;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-02-26 14:35:38 -08:00
|
|
|
if (!desktop) return EINA_TRUE;
|
2008-12-17 07:33:43 -08:00
|
|
|
if (strncmp(key, "X-", 2)) return EINA_TRUE;
|
|
|
|
|
2009-02-26 14:35:38 -08:00
|
|
|
if (!desktop->x)
|
2010-02-04 01:12:35 -08:00
|
|
|
desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
2010-03-25 22:33:12 -07:00
|
|
|
eina_hash_del_by_key(desktop->x, key);
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_add(desktop->x, key, (void *)eina_stringshare_add(value));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-11-22 22:57:39 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param node The node to work with
|
|
|
|
* @param ini The ini file to work with
|
2007-11-22 22:57:39 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Stores an X- key from @a node and stores in @a ini
|
|
|
|
*/
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Bool
|
2009-02-26 14:35:38 -08:00
|
|
|
efreet_desktop_x_fields_save(const Eina_Hash *hash __UNUSED__, const void *key, void *value, void *fdata)
|
2007-11-22 22:57:39 -08:00
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
Efreet_Ini *ini = fdata;
|
|
|
|
efreet_ini_string_set(ini, key, value);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2007-11-22 22:57:39 -08:00
|
|
|
}
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param ini The Efreet_Ini to parse values from
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return 1 if desktop should be included in current environement, 0 otherwise
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Determines if a desktop should be included in the current environment,
|
2007-02-03 05:05:30 -08:00
|
|
|
* based on the values of the OnlyShowIn and NotShowIn fields
|
|
|
|
*/
|
|
|
|
static int
|
2010-10-20 13:39:54 -07:00
|
|
|
efreet_desktop_environment_check(Efreet_Desktop *desktop)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-02-25 08:46:51 -08:00
|
|
|
Eina_List *list;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
int found = 0;
|
|
|
|
char *val;
|
|
|
|
|
|
|
|
if (!desktop_environment)
|
2010-11-06 09:47:43 -07:00
|
|
|
{
|
|
|
|
//if (desktop->only_show_in) return 0;
|
2010-02-04 01:12:35 -08:00
|
|
|
return 1;
|
2010-11-06 09:47:43 -07:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
if (desktop->only_show_in)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-10-20 13:39:54 -07:00
|
|
|
EINA_LIST_FOREACH(desktop->only_show_in, list, val)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
|
|
|
if (!strcmp(val, desktop_environment))
|
2010-10-20 13:39:54 -07:00
|
|
|
{
|
2010-02-04 01:12:35 -08:00
|
|
|
found = 1;
|
2010-10-20 13:39:54 -07:00
|
|
|
break;
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
|
|
|
|
if (desktop->not_show_in)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
2010-10-20 13:39:54 -07:00
|
|
|
EINA_LIST_FOREACH(desktop->not_show_in, list, val)
|
|
|
|
{
|
|
|
|
if (!strcmp(val, desktop_environment))
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return !found;
|
2010-02-04 01:12:35 -08:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-10-20 13:39:54 -07:00
|
|
|
return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|