2009-04-20 16:20:40 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2010-11-25 15:48:59 -08:00
|
|
|
#undef alloca
|
|
|
|
#ifdef HAVE_ALLOCA_H
|
|
|
|
# include <alloca.h>
|
|
|
|
#elif defined __GNUC__
|
|
|
|
# define alloca __builtin_alloca
|
|
|
|
#elif defined _AIX
|
|
|
|
# define alloca __alloca
|
|
|
|
#elif defined _MSC_VER
|
|
|
|
# include <malloc.h>
|
|
|
|
# define alloca _alloca
|
|
|
|
#else
|
|
|
|
# include <stddef.h>
|
|
|
|
# ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
# endif
|
|
|
|
void *alloca (size_t);
|
|
|
|
#endif
|
|
|
|
|
2009-04-20 16:20:40 -07: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_menu_log_dom
|
|
|
|
static int _efreet_menu_log_dom = -1;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
#include "Efreet.h"
|
|
|
|
#include "efreet_private.h"
|
2009-04-20 16:20:40 -07:00
|
|
|
#include "efreet_xml.h"
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Move Efreet_Menu_Move;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Move
|
|
|
|
{
|
2010-03-30 05:21:33 -07:00
|
|
|
const char *old_name; /**< The menu path to move from */
|
|
|
|
const char *new_name; /**< The menu path to move too */
|
2007-02-03 05:05:30 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Internal Efreet_Menu_Internal;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Internal
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2010-03-13 10:35:39 -08:00
|
|
|
const char *path; /**< The base file path */
|
|
|
|
const char *name; /**< The filename for this menu */
|
2007-02-03 05:05:30 -08:00
|
|
|
} file; /**< The menu file information */
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
const char *internal; /**< The menu name */
|
|
|
|
const char *name; /**< Name to use in the menus */
|
2007-02-05 18:04:50 -08:00
|
|
|
} name; /**< The names for this menu */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
Efreet_Desktop *directory; /**< The directory */
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *directories; /**< All the directories set in the menu file */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
Efreet_Menu_Move *current_move; /**< The current move */
|
|
|
|
|
* 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 *app_dirs; /**< .desktop application directories */
|
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 *app_pool; /**< application pool */
|
|
|
|
Eina_List *applications; /**< applications in this menu */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *directory_dirs; /**< .directory file directories */
|
2008-12-17 07:33:43 -08:00
|
|
|
Eina_Hash *directory_cache; /**< .directory dirs */
|
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 *moves; /**< List of moves to be handled by the menu */
|
|
|
|
Eina_List *filters; /**< Include and Exclude filters */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-02-05 18:04:50 -08:00
|
|
|
Efreet_Menu_Internal *parent; /**< Our parent menu */
|
* 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 *sub_menus; /**< Our sub menus */
|
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 *layout; /**< This menus layout */
|
|
|
|
Eina_List *default_layout; /**< Default layout */
|
2009-03-21 10:00:55 -07:00
|
|
|
signed char show_empty; /**< Whether to show empty menus */
|
|
|
|
signed char in_line; /**< Whether this meny can be inlined */
|
|
|
|
signed char inline_limit; /**< Number of elements which triggers inline */
|
|
|
|
signed char inline_header; /**< Whether we should use the header name when this menu is inlined */
|
|
|
|
signed char inline_alias; /**< Whether we should use the menu name when inlining */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
unsigned char seen_allocated:1; /**< have we set the only_unallocated */
|
|
|
|
unsigned char only_unallocated:1; /**< Show only unallocated .desktops */
|
|
|
|
|
|
|
|
unsigned char seen_deleted:1; /**< Have we seen the deleted item yet */
|
|
|
|
unsigned char deleted:1; /**< The menu is deleted */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_App_Dir Efreet_Menu_App_Dir;
|
|
|
|
|
|
|
|
struct Efreet_Menu_App_Dir
|
|
|
|
{
|
2010-03-30 04:06:56 -07:00
|
|
|
const char *path; /**< directory path */
|
|
|
|
const char *prefix; /**< If it's legacy it can have a prefix */
|
2007-02-03 05:05:30 -08:00
|
|
|
unsigned int legacy:1; /**< is this a legacy dir */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Efreet_Menu_Filter_Op_Type
|
|
|
|
{
|
|
|
|
EFREET_MENU_FILTER_OP_OR,
|
|
|
|
EFREET_MENU_FILTER_OP_AND,
|
|
|
|
EFREET_MENU_FILTER_OP_NOT
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum Efreet_Menu_Filter_Op_Type Efreet_Menu_Filter_Op_Type;
|
|
|
|
|
|
|
|
enum Efreet_Menu_Filter_Type
|
|
|
|
{
|
|
|
|
EFREET_MENU_FILTER_INCLUDE,
|
|
|
|
EFREET_MENU_FILTER_EXCLUDE
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum Efreet_Menu_Filter_Type Efreet_Menu_Filter_Type;
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Filter_Op Efreet_Menu_Filter_Op;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Filter_Op
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op_Type type; /**< The type of operation */
|
* 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 *categories; /**< The categories this op applies too */
|
|
|
|
Eina_List *filenames; /**< The filenames this op applies too */
|
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 *filters; /**< Child filters */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
unsigned char all:1; /**< Applies to all .desktop files */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Filter Efreet_Menu_Filter;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Filter
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Type type; /**< The type of filter */
|
|
|
|
Efreet_Menu_Filter_Op *op; /**< The filter operations */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Efreet_Menu_Layout_Type
|
|
|
|
{
|
|
|
|
EFREET_MENU_LAYOUT_MENUNAME,
|
|
|
|
EFREET_MENU_LAYOUT_FILENAME,
|
|
|
|
EFREET_MENU_LAYOUT_SEPARATOR,
|
|
|
|
EFREET_MENU_LAYOUT_MERGE
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum Efreet_Menu_Layout_Type Efreet_Menu_Layout_Type;
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Layout Efreet_Menu_Layout;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Layout
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout_Type type; /**< The type of layout */
|
2010-04-01 12:30:13 -07:00
|
|
|
const char *name; /**< The name of the element */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* The items below are for Menuname Layout elements */
|
2009-03-21 10:00:55 -07:00
|
|
|
signed char show_empty; /**< Whether to show empty menus */
|
|
|
|
signed char in_line; /**< Whether this meny can be inlined */
|
|
|
|
signed char inline_limit; /**< Number of elements which triggers inline */
|
|
|
|
signed char inline_header; /**< Whether we should use the header name when this menu is inlined */
|
|
|
|
signed char inline_alias; /**< Whether we should use the menu name when inlining */
|
2007-02-03 05:05:30 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Efreet_Menu_Desktop Efreet_Menu_Desktop;
|
|
|
|
|
|
|
|
struct Efreet_Menu_Desktop
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop; /**< The desktop we refer too */
|
2007-02-05 18:16:33 -08:00
|
|
|
const char *id; /**< The desktop file id */
|
2007-02-03 05:05:30 -08:00
|
|
|
unsigned char allocated:1; /**< If this desktop has been allocated */
|
|
|
|
};
|
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
static const char *efreet_menu_prefix = NULL; /**< The $XDG_MENU_PREFIX env var */
|
* 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 *efreet_menu_kde_legacy_dirs = NULL; /**< The directories to use for KDELegacy entries */
|
2007-02-03 05:05:30 -08:00
|
|
|
static const char *efreet_tag_menu = NULL;
|
2010-03-29 13:14:43 -07:00
|
|
|
static const char *efreet_menu_file = NULL; /**< A menu file set explicityl as default */
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Hash *efreet_merged_menus = NULL;
|
|
|
|
static Eina_Hash *efreet_merged_dirs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Hash *efreet_menu_handle_cbs = NULL;
|
|
|
|
static Eina_Hash *efreet_menu_filter_cbs = NULL;
|
|
|
|
static Eina_Hash *efreet_menu_move_cbs = NULL;
|
|
|
|
static Eina_Hash *efreet_menu_layout_cbs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
static const char *efreet_menu_prefix_get(void);
|
|
|
|
|
|
|
|
static Efreet_Menu_Internal *efreet_menu_by_name_find(Efreet_Menu_Internal *internal,
|
2007-09-06 09:15:10 -07:00
|
|
|
const char *name,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Internal **parent);
|
|
|
|
static int efreet_menu_cb_compare_names(Efreet_Menu_Internal *internal, const char *name);
|
|
|
|
static int efreet_menu_cb_md_compare_ids(Efreet_Menu_Desktop *md, const char *name);
|
|
|
|
|
|
|
|
static int efreet_menu_cb_entry_compare_menu(Efreet_Menu *entry, Efreet_Menu_Internal *internal);
|
|
|
|
static int efreet_menu_cb_entry_compare_desktop(Efreet_Menu *entry, Efreet_Desktop *desktop);
|
|
|
|
|
|
|
|
static int efreet_menu_cb_move_compare(Efreet_Menu_Move *move, const char *old);
|
|
|
|
|
|
|
|
static int efreet_menu_process(Efreet_Menu_Internal *internal, unsigned int only_unallocated);
|
|
|
|
static int efreet_menu_process_dirs(Efreet_Menu_Internal *internal);
|
|
|
|
static int efreet_menu_app_dirs_process(Efreet_Menu_Internal *internal);
|
2007-09-06 09:15:10 -07:00
|
|
|
static int efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal,
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *path,
|
|
|
|
const char *id,
|
|
|
|
int legacy);
|
|
|
|
static int efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal);
|
2007-09-06 09:15:10 -07:00
|
|
|
static int efreet_menu_directory_dir_scan(const char *path,
|
2010-02-04 01:12:35 -08:00
|
|
|
const char *relative_path,
|
|
|
|
Eina_Hash *cache);
|
2007-09-06 09:15:10 -07:00
|
|
|
static Efreet_Desktop *efreet_menu_directory_get(Efreet_Menu_Internal *internal,
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *path);
|
2007-09-06 09:15:10 -07:00
|
|
|
static void efreet_menu_process_filters(Efreet_Menu_Internal *internal,
|
2007-02-03 05:05:30 -08:00
|
|
|
unsigned int only_unallocated);
|
2010-08-04 11:21:20 -07:00
|
|
|
static Eina_List *efreet_menu_process_app_pool(Eina_List *pool,
|
|
|
|
Eina_List *applications,
|
|
|
|
Eina_Hash *matches,
|
|
|
|
Efreet_Menu_Filter *filter,
|
|
|
|
unsigned int only_unallocated);
|
2007-02-03 05:05:30 -08:00
|
|
|
static int efreet_menu_filter_matches(Efreet_Menu_Filter_Op *op,
|
|
|
|
Efreet_Menu_Desktop *md);
|
|
|
|
static int efreet_menu_filter_or_matches(Efreet_Menu_Filter_Op *op,
|
|
|
|
Efreet_Menu_Desktop *md);
|
|
|
|
static int efreet_menu_filter_and_matches(Efreet_Menu_Filter_Op *op,
|
|
|
|
Efreet_Menu_Desktop *md);
|
|
|
|
static int efreet_menu_filter_not_matches(Efreet_Menu_Filter_Op *op,
|
|
|
|
Efreet_Menu_Desktop *md);
|
|
|
|
|
|
|
|
static Efreet_Menu *efreet_menu_layout_menu(Efreet_Menu_Internal *internal);
|
|
|
|
static Efreet_Menu *efreet_menu_layout_desktop(Efreet_Menu_Desktop *md);
|
|
|
|
static void efreet_menu_layout_entries_get(Efreet_Menu *entry, Efreet_Menu_Internal *internal,
|
|
|
|
Efreet_Menu_Layout *layout);
|
2008-01-17 14:38:46 -08:00
|
|
|
static int efreet_menu_layout_is_empty(Efreet_Menu *entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
static Efreet_Menu_Internal *efreet_menu_internal_new(void);
|
|
|
|
static void efreet_menu_internal_free(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_sub_menu_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_app_dirs_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_directory_dirs_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_directories_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_move_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_filter_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_layout_list(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_create_default_layout_list(Efreet_Menu_Internal *internal);
|
2010-04-01 12:31:38 -07:00
|
|
|
static const char *efreet_menu_path_get(Efreet_Menu_Internal *internal, const char *suffix);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
static Efreet_Menu_App_Dir *efreet_menu_app_dir_new(void);
|
2009-03-23 03:27:54 -07:00
|
|
|
static void efreet_menu_app_dir_free(Efreet_Menu_App_Dir *dir);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
static Efreet_Menu_Move *efreet_menu_move_new(void);
|
|
|
|
static void efreet_menu_move_free(Efreet_Menu_Move *move);
|
|
|
|
|
|
|
|
static Efreet_Menu_Filter *efreet_menu_filter_new(void);
|
|
|
|
static void efreet_menu_filter_free(Efreet_Menu_Filter *filter);
|
|
|
|
|
|
|
|
static Efreet_Menu_Layout *efreet_menu_layout_new(void);
|
2009-03-23 05:19:31 -07:00
|
|
|
static void efreet_menu_layout_free(Efreet_Menu_Layout *layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
static Efreet_Menu_Filter_Op *efreet_menu_filter_op_new(void);
|
|
|
|
static void efreet_menu_filter_op_free(Efreet_Menu_Filter_Op *op);
|
|
|
|
|
|
|
|
static Efreet_Menu_Desktop *efreet_menu_desktop_new(void);
|
|
|
|
static void efreet_menu_desktop_free(Efreet_Menu_Desktop *md);
|
|
|
|
|
|
|
|
static Efreet_Menu *efreet_menu_entry_new(void);
|
|
|
|
|
|
|
|
static int efreet_menu_handle_menu(Efreet_Menu_Internal *internal, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_name(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
|
|
|
|
static int efreet_menu_handle_sub_menu(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_app_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_default_app_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_directory_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_default_directory_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_directory(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_only_unallocated(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_not_only_unallocated(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_deleted(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_not_deleted(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_include(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_exclude(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_filename(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_category(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_all(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_and(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_or(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_not(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_merge_file(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_merge_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_legacy_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
2007-09-06 09:15:10 -07:00
|
|
|
static Efreet_Menu_Internal *efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
|
|
|
|
Efreet_Menu_Internal *parent,
|
|
|
|
const char *legacy_dir,
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *prefix);
|
|
|
|
static int efreet_menu_handle_kde_legacy_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_move(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_old(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_new(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
static int efreet_menu_handle_default_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
static int efreet_menu_handle_filter(Efreet_Menu_Internal *parent, Efreet_Xml *xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Filter_Type type);
|
|
|
|
static int efreet_menu_handle_filter_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
2007-09-06 09:15:10 -07:00
|
|
|
static int efreet_menu_handle_filter_child_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Filter_Op_Type type);
|
|
|
|
|
|
|
|
static int efreet_menu_handle_layout_menuname(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
static int efreet_menu_handle_layout_filename(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
static int efreet_menu_handle_layout_separator(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
static int efreet_menu_handle_layout_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
|
|
|
|
static int efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *path);
|
|
|
|
static int efreet_menu_merge_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *path);
|
|
|
|
|
|
|
|
static int efreet_menu_cb_app_dirs_compare(Efreet_Menu_App_Dir *a, const char *b);
|
|
|
|
|
|
|
|
static void efreet_menu_resolve_moves(Efreet_Menu_Internal *internal);
|
|
|
|
static void efreet_menu_concatenate(Efreet_Menu_Internal *dest, Efreet_Menu_Internal *src);
|
|
|
|
|
|
|
|
static int efreet_menu_cb_menu_compare(Efreet_Menu_Internal *a, Efreet_Menu_Internal *b);
|
2010-01-16 05:43:28 -08:00
|
|
|
static int efreet_menu_cb_md_compare(const Efreet_Menu_Desktop *a, const Efreet_Menu_Desktop *b);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
static int efreet_menu_save_menu(Efreet_Menu *menu, FILE *f, int indent);
|
2007-02-03 05:05:30 -08:00
|
|
|
static int efreet_menu_save_indent(FILE *f, int indent);
|
2007-02-05 18:16:33 -08:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
static void efreet_menu_path_set(Efreet_Menu_Internal *internal, const char *path);
|
|
|
|
|
|
|
|
int
|
|
|
|
efreet_menu_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2010-08-17 05:03:10 -07:00
|
|
|
const char *key;
|
2007-02-03 05:05:30 -08:00
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
} menu_cbs[] = {
|
|
|
|
{"Menu", efreet_menu_handle_sub_menu},
|
|
|
|
{"AppDir", efreet_menu_handle_app_dir},
|
|
|
|
{"DefaultAppDirs", efreet_menu_handle_default_app_dirs},
|
|
|
|
{"DirectoryDir", efreet_menu_handle_directory_dir},
|
|
|
|
{"DefaultDirectoryDirs", efreet_menu_handle_default_directory_dirs},
|
|
|
|
{"Name", efreet_menu_handle_name},
|
|
|
|
{"Directory", efreet_menu_handle_directory},
|
|
|
|
{"OnlyUnallocated", efreet_menu_handle_only_unallocated},
|
|
|
|
{"NotOnlyUnallocated", efreet_menu_handle_not_only_unallocated},
|
|
|
|
{"Deleted", efreet_menu_handle_deleted},
|
|
|
|
{"NotDeleted", efreet_menu_handle_not_deleted},
|
|
|
|
{"Include", efreet_menu_handle_include},
|
|
|
|
{"Exclude", efreet_menu_handle_exclude},
|
|
|
|
{"MergeFile", efreet_menu_handle_merge_file},
|
|
|
|
{"MergeDir", efreet_menu_handle_merge_dir},
|
|
|
|
{"DefaultMergeDirs", efreet_menu_handle_default_merge_dirs},
|
|
|
|
{"LegacyDir", efreet_menu_handle_legacy_dir},
|
|
|
|
{"KDELegacyDirs", efreet_menu_handle_kde_legacy_dirs},
|
|
|
|
{"Move", efreet_menu_handle_move},
|
|
|
|
{"Layout", efreet_menu_handle_layout},
|
|
|
|
{"DefaultLayout", efreet_menu_handle_default_layout},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2010-08-17 05:03:10 -07:00
|
|
|
const char *key;
|
2007-02-03 05:05:30 -08:00
|
|
|
int (*cb)(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
} filter_cbs[] = {
|
|
|
|
{"Filename", efreet_menu_handle_filename},
|
|
|
|
{"Category", efreet_menu_handle_category},
|
|
|
|
{"All", efreet_menu_handle_all},
|
|
|
|
{"And", efreet_menu_handle_and},
|
|
|
|
{"Or", efreet_menu_handle_or},
|
|
|
|
{"Not", efreet_menu_handle_not},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2010-08-17 05:03:10 -07:00
|
|
|
const char *key;
|
2007-02-03 05:05:30 -08:00
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
} move_cbs[] = {
|
|
|
|
{"Old", efreet_menu_handle_old},
|
|
|
|
{"New", efreet_menu_handle_new},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2010-08-17 05:03:10 -07:00
|
|
|
const char *key;
|
2007-02-03 05:05:30 -08:00
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
} layout_cbs[] = {
|
|
|
|
{"Menuname", efreet_menu_handle_layout_menuname},
|
|
|
|
{"Filename", efreet_menu_handle_layout_filename},
|
|
|
|
{"Separator", efreet_menu_handle_layout_separator},
|
|
|
|
{"Merge", efreet_menu_handle_layout_merge},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2010-10-07 15:22:33 -07:00
|
|
|
_efreet_menu_log_dom = eina_log_domain_register
|
|
|
|
("efreet_menu", EFREET_DEFAULT_LOG_COLOR);
|
2009-10-09 23:19:13 -07:00
|
|
|
if (_efreet_menu_log_dom < 0)
|
|
|
|
{
|
2011-03-18 12:47:57 -07:00
|
|
|
EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_menu");
|
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
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
efreet_menu_handle_cbs = eina_hash_string_superfast_new(NULL);
|
|
|
|
efreet_menu_filter_cbs = eina_hash_string_superfast_new(NULL);
|
|
|
|
efreet_menu_move_cbs = eina_hash_string_superfast_new(NULL);
|
|
|
|
efreet_menu_layout_cbs = eina_hash_string_superfast_new(NULL);
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!efreet_menu_handle_cbs || !efreet_menu_filter_cbs
|
|
|
|
|| !efreet_menu_move_cbs || !efreet_menu_layout_cbs)
|
2009-10-09 23:19:13 -07:00
|
|
|
{
|
|
|
|
eina_log_domain_unregister(_efreet_menu_log_dom);
|
2011-02-05 11:06:55 -08:00
|
|
|
_efreet_menu_log_dom = -1;
|
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
|
|
|
|
|
|
|
/* set Menu into it's own so we can check the XML is valid before trying
|
|
|
|
* to handle it */
|
2008-10-15 07:48:03 -07:00
|
|
|
efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
for (i = 0; menu_cbs[i].key; i++)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
|
|
|
eina_hash_del(efreet_menu_handle_cbs,
|
|
|
|
menu_cbs[i].key,
|
|
|
|
NULL);
|
|
|
|
eina_hash_add(efreet_menu_handle_cbs,
|
|
|
|
menu_cbs[i].key,
|
|
|
|
menu_cbs[i].cb);
|
|
|
|
}
|
2010-08-21 06:52:25 -07:00
|
|
|
for (i = 0; filter_cbs[i].key; i++)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
|
|
|
eina_hash_del(efreet_menu_filter_cbs,
|
|
|
|
filter_cbs[i].key,
|
|
|
|
NULL);
|
|
|
|
eina_hash_add(efreet_menu_filter_cbs,
|
|
|
|
filter_cbs[i].key,
|
|
|
|
filter_cbs[i].cb);
|
|
|
|
}
|
2010-08-21 06:52:25 -07:00
|
|
|
for (i = 0; move_cbs[i].key; i++)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
|
|
|
eina_hash_del(efreet_menu_move_cbs,
|
|
|
|
move_cbs[i].key,
|
|
|
|
NULL);
|
|
|
|
eina_hash_add(efreet_menu_move_cbs,
|
|
|
|
move_cbs[i].key,
|
|
|
|
move_cbs[i].cb);
|
|
|
|
}
|
2010-08-21 06:52:25 -07:00
|
|
|
for (i = 0; layout_cbs[i].key; i++)
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
|
|
|
eina_hash_del(efreet_menu_layout_cbs,
|
|
|
|
layout_cbs[i].key,
|
|
|
|
NULL);
|
|
|
|
eina_hash_add(efreet_menu_layout_cbs,
|
|
|
|
layout_cbs[i].key,
|
|
|
|
layout_cbs[i].cb);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_kde_legacy_init(void)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
char *p, *s;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(efreet_menu_kde_legacy_dirs, eina_stringshare_del);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
f = popen("kde-config --path apps", "r");
|
|
|
|
if (!f) return 0;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
/* XXX if the return from kde-config is a line longer than PATH_MAX,
|
2007-02-03 05:05:30 -08:00
|
|
|
* this won't be correct (increase buffer and get the rest...) */
|
2009-12-23 12:55:23 -08:00
|
|
|
if (!fgets(buf, sizeof(buf), f))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
ERR("Error initializing KDE legacy information");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
s = buf;
|
|
|
|
|
|
|
|
p = strchr(s, ':');
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
*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
|
|
|
efreet_menu_kde_legacy_dirs = eina_list_append(efreet_menu_kde_legacy_dirs,
|
2008-10-15 07:48:03 -07:00
|
|
|
(void *)eina_stringshare_add(s));
|
2007-02-03 05:05:30 -08:00
|
|
|
s = p + 1;
|
|
|
|
p = strchr(s, ':');
|
|
|
|
}
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (*s)
|
* 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_menu_kde_legacy_dirs = eina_list_append(efreet_menu_kde_legacy_dirs,
|
2008-10-15 07:48:03 -07:00
|
|
|
(void *)eina_stringshare_add(s));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
pclose(f);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
efreet_menu_shutdown(void)
|
|
|
|
{
|
2010-03-29 13:14:43 -07:00
|
|
|
IF_RELEASE(efreet_menu_file);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
IF_FREE_HASH(efreet_menu_handle_cbs);
|
|
|
|
IF_FREE_HASH(efreet_menu_filter_cbs);
|
|
|
|
IF_FREE_HASH(efreet_menu_move_cbs);
|
|
|
|
IF_FREE_HASH(efreet_menu_layout_cbs);
|
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(efreet_menu_kde_legacy_dirs, eina_stringshare_del);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
IF_FREE_HASH(efreet_merged_menus);
|
|
|
|
IF_FREE_HASH(efreet_merged_dirs);
|
|
|
|
|
2007-04-04 03:29:10 -07:00
|
|
|
IF_RELEASE(efreet_tag_menu);
|
|
|
|
|
2009-09-21 09:36:29 -07:00
|
|
|
eina_log_domain_unregister(_efreet_menu_log_dom);
|
2011-02-05 11:06:55 -08:00
|
|
|
_efreet_menu_log_dom = -1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Menu *
|
2008-12-15 12:23:24 -08:00
|
|
|
efreet_menu_new(const char *name)
|
2007-06-06 18:22:48 -07:00
|
|
|
{
|
|
|
|
Efreet_Menu *menu;
|
2008-12-15 12:23:24 -08:00
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
|
|
|
|
|
2007-06-06 18:22:48 -07:00
|
|
|
menu = efreet_menu_entry_new();
|
|
|
|
menu->type = EFREET_MENU_ENTRY_MENU;
|
2008-12-15 12:23:24 -08:00
|
|
|
menu->name = eina_stringshare_add(name);
|
2007-06-06 18:22:48 -07:00
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2008-10-25 08:06:31 -07:00
|
|
|
EAPI void
|
|
|
|
efreet_menu_file_set(const char *file)
|
|
|
|
{
|
2010-03-29 13:14:43 -07:00
|
|
|
IF_RELEASE(efreet_menu_file);
|
2008-10-25 08:06:31 -07:00
|
|
|
efreet_menu_file = NULL;
|
2010-03-29 13:14:43 -07:00
|
|
|
if (file) efreet_menu_file = eina_stringshare_add(file);
|
2008-10-25 08:06:31 -07:00
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Menu *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_get(void)
|
|
|
|
{
|
|
|
|
char menu[PATH_MAX];
|
|
|
|
const char *dir;
|
* 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 *config_dirs, *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-26 11:02:17 -07:00
|
|
|
#ifndef STRICT_SPEC
|
2010-01-17 10:57:49 -08:00
|
|
|
/* prefer user set menu */
|
2008-10-25 08:06:31 -07:00
|
|
|
if (efreet_menu_file)
|
|
|
|
{
|
|
|
|
if (ecore_file_exists(efreet_menu_file))
|
2012-10-18 02:11:54 -07:00
|
|
|
return efreet_menu_parse(efreet_menu_file);
|
2008-10-25 08:06:31 -07:00
|
|
|
}
|
2009-03-26 11:02:17 -07:00
|
|
|
#endif
|
2008-10-25 08:06:31 -07:00
|
|
|
|
2010-01-17 10:57:49 -08:00
|
|
|
/* check the users config directory first */
|
|
|
|
snprintf(menu, sizeof(menu), "%s/menus/%sapplications.menu",
|
|
|
|
efreet_config_home_get(), efreet_menu_prefix_get());
|
|
|
|
if (ecore_file_exists(menu))
|
|
|
|
return efreet_menu_parse(menu);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/* fallback to the XDG_CONFIG_DIRS */
|
|
|
|
config_dirs = efreet_config_dirs_get();
|
* 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_FOREACH(config_dirs, l, dir)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-09-06 09:15:10 -07:00
|
|
|
snprintf(menu, sizeof(menu), "%s/menus/%sapplications.menu",
|
2007-02-03 05:05:30 -08:00
|
|
|
dir, efreet_menu_prefix_get());
|
|
|
|
if (ecore_file_exists(menu))
|
|
|
|
return efreet_menu_parse(menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI Efreet_Menu *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_parse(const char *path)
|
|
|
|
{
|
|
|
|
Efreet_Xml *xml;
|
|
|
|
Efreet_Menu_Internal *internal = NULL;
|
|
|
|
Efreet_Menu *entry = NULL;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
xml = efreet_xml_new(path);
|
|
|
|
if (!xml) return NULL;
|
|
|
|
|
|
|
|
/* make sure we've got a <Menu> to start with */
|
|
|
|
if (xml->tag != efreet_tag_menu)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
WRN("Efreet_menu: Menu file didn't start with <Menu> tag.");
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_xml_del(xml);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
IF_FREE_HASH(efreet_merged_menus);
|
2008-12-17 07:33:43 -08:00
|
|
|
efreet_merged_menus = eina_hash_string_superfast_new(NULL);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
IF_FREE_HASH(efreet_merged_dirs);
|
2008-12-17 07:33:43 -08:00
|
|
|
efreet_merged_dirs = eina_hash_string_superfast_new(NULL);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-09-08 04:27:59 -07:00
|
|
|
/* split apart the filename and the path */
|
2007-02-03 05:05:30 -08:00
|
|
|
internal = efreet_menu_internal_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!internal) return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* Set default values */
|
|
|
|
internal->show_empty = 0;
|
|
|
|
internal->in_line = 0;
|
|
|
|
internal->inline_limit = 4;
|
|
|
|
internal->inline_header = 1;
|
|
|
|
internal->inline_alias = 0;
|
|
|
|
|
|
|
|
efreet_menu_path_set(internal, path);
|
|
|
|
if (!efreet_menu_handle_menu(internal, xml))
|
|
|
|
{
|
|
|
|
efreet_xml_del(xml);
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
efreet_xml_del(xml);
|
|
|
|
|
|
|
|
efreet_menu_resolve_moves(internal);
|
|
|
|
|
|
|
|
if (!efreet_menu_process_dirs(internal))
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handle all .desktops */
|
|
|
|
if (!efreet_menu_process(internal, 0))
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handle menus with only unallocated .desktops */
|
|
|
|
if (!efreet_menu_process(internal, 1))
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* layout menu */
|
|
|
|
entry = efreet_menu_layout_menu(internal);
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-05 18:16:33 -08:00
|
|
|
efreet_menu_save(Efreet_Menu *menu, const char *path)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
int ret;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, 0);
|
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
f = fopen(path, "w");
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!f) return 0;
|
|
|
|
fprintf(f, "<?xml version=\"1.0\"?>\n");
|
|
|
|
fprintf(f, "<!DOCTYPE Menu PUBLIC \"-//freedesktop//DTD Menu 1.0//EN\" "
|
|
|
|
"\"http://standards.freedesktop.org/menu-spec/menu-1.0.dtd\">\n");
|
2007-02-05 18:16:33 -08:00
|
|
|
ret = efreet_menu_save_menu(menu, f, 0);
|
|
|
|
fclose(f);
|
2007-02-03 05:05:30 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-02-05 18:16:33 -08:00
|
|
|
efreet_menu_save_menu(Efreet_Menu *menu, FILE *f, int indent)
|
|
|
|
{
|
* 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;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_save_indent(f, indent);
|
|
|
|
fprintf(f, "<Menu>\n");
|
2008-12-13 13:00:49 -08:00
|
|
|
if (menu->name)
|
|
|
|
{
|
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<Name>%s</Name>\n", menu->name);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
if (indent == 0)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-02-05 18:16:33 -08:00
|
|
|
/* Only save these for the root element */
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<DefaultAppDirs/>\n");
|
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<DefaultDirectoryDirs/>\n");
|
|
|
|
}
|
2007-02-05 18:16:33 -08:00
|
|
|
|
2007-05-05 00:21:40 -07:00
|
|
|
if (menu->desktop)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-05-05 00:21:40 -07:00
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<Directory>%s</Directory>\n", menu->desktop->orig_path);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
if (menu->entries)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-02-05 18:16:33 -08:00
|
|
|
Efreet_Menu *entry;
|
|
|
|
int has_desktop = 0, has_menu = 0;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<Layout>\n");
|
* 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_FOREACH(menu->entries, l, entry)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-02-05 18:16:33 -08:00
|
|
|
if (entry->type == EFREET_MENU_ENTRY_MENU)
|
|
|
|
{
|
|
|
|
efreet_menu_save_indent(f, indent + 2);
|
|
|
|
fprintf(f, "<Menuname>%s</Menuname>\n", entry->id);
|
|
|
|
has_menu = 1;
|
|
|
|
}
|
|
|
|
else if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
|
|
|
{
|
|
|
|
efreet_menu_save_indent(f, indent + 2);
|
|
|
|
fprintf(f, "<Filename>%s</Filename>\n", entry->id);
|
|
|
|
has_desktop = 1;
|
|
|
|
}
|
|
|
|
else if (entry->type == EFREET_MENU_ENTRY_SEPARATOR)
|
|
|
|
{
|
|
|
|
efreet_menu_save_indent(f, indent + 2);
|
|
|
|
fprintf(f, "<Separator/>\n");
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-02-05 18:16:33 -08:00
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "</Layout>\n");
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
if (has_desktop)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-02-05 18:16:33 -08:00
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "<Include>\n");
|
* 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_FOREACH(menu->entries, l, entry)
|
2007-02-05 18:16:33 -08:00
|
|
|
{
|
|
|
|
if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
|
|
|
{
|
|
|
|
efreet_menu_save_indent(f, indent + 2);
|
|
|
|
fprintf(f, "<Filename>%s</Filename>\n", entry->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
efreet_menu_save_indent(f, indent + 1);
|
|
|
|
fprintf(f, "</Include>\n");
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2007-02-05 18:16:33 -08:00
|
|
|
if (has_menu)
|
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_FOREACH(menu->entries, l, entry)
|
2007-02-05 18:16:33 -08:00
|
|
|
{
|
|
|
|
if (entry->type == EFREET_MENU_ENTRY_MENU)
|
|
|
|
efreet_menu_save_menu(entry, f, indent + 1);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
2007-02-05 18:16:33 -08:00
|
|
|
efreet_menu_save_indent(f, indent);
|
|
|
|
fprintf(f, "</Menu>\n");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_save_indent(FILE *f, int indent)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < indent; i++)
|
|
|
|
fprintf(f, " ");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-02-06 18:14:46 -08:00
|
|
|
efreet_menu_desktop_insert(Efreet_Menu *menu, Efreet_Desktop *desktop, int pos)
|
|
|
|
{
|
|
|
|
Efreet_Menu *entry;
|
2007-03-25 08:50:09 -07:00
|
|
|
const char *id;
|
2007-02-06 18:14:46 -08:00
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
|
|
|
|
2007-03-25 03:49:04 -07:00
|
|
|
id = efreet_util_path_to_file_id(desktop->orig_path);
|
2007-03-26 09:26:57 -07:00
|
|
|
if (!id) return 0;
|
2007-02-06 18:14:46 -08:00
|
|
|
|
|
|
|
entry = efreet_menu_entry_new();
|
|
|
|
entry->type = EFREET_MENU_ENTRY_DESKTOP;
|
2008-10-15 07:48:03 -07:00
|
|
|
entry->id = eina_stringshare_add(id);
|
|
|
|
entry->name = eina_stringshare_add(desktop->name);
|
|
|
|
if (desktop->icon) entry->icon = eina_stringshare_add(desktop->icon);
|
2007-07-26 12:14:41 -07:00
|
|
|
efreet_desktop_ref(desktop);
|
2007-02-06 18:14:46 -08:00
|
|
|
entry->desktop = desktop;
|
|
|
|
|
2010-03-25 22:29:15 -07:00
|
|
|
if (pos < 0 || (unsigned int)pos >= eina_list_count(menu->entries))
|
* 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
|
|
|
menu->entries = eina_list_append(menu->entries, entry);
|
2007-02-06 18:14:46 -08:00
|
|
|
else
|
|
|
|
{
|
* 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
|
|
|
menu->entries = eina_list_append_relative(menu->entries, entry,
|
|
|
|
eina_list_nth(menu->entries, pos));
|
2007-02-06 18:14:46 -08:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI int
|
2007-09-06 09:15:10 -07:00
|
|
|
efreet_menu_desktop_remove(Efreet_Menu *menu, Efreet_Desktop *desktop)
|
2007-04-05 05:10:32 -07:00
|
|
|
{
|
|
|
|
Efreet_Menu *entry;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
|
2007-04-05 05:10:32 -07: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
|
|
|
entry = eina_list_search_unsorted(menu->entries,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_entry_compare_desktop),
|
2007-04-05 05:10:32 -07:00
|
|
|
desktop);
|
|
|
|
if (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
|
|
|
menu->entries = eina_list_remove(menu->entries, entry);
|
2007-04-05 05:10:32 -07:00
|
|
|
efreet_menu_free(entry);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_dump(Efreet_Menu *menu, const char *indent)
|
|
|
|
{
|
* 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;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(menu);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(indent);
|
|
|
|
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("%s%s: ", indent, menu->name);
|
|
|
|
INF("%s", (menu->icon ? menu->icon : "No icon"));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* XXX dump the rest of the menu info */
|
|
|
|
|
|
|
|
if (menu->entries)
|
|
|
|
{
|
|
|
|
Efreet_Menu *entry;
|
|
|
|
char *new_indent;
|
2010-03-30 05:22:15 -07:00
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
len = strlen(indent) + 3;
|
2010-08-03 12:31:24 -07:00
|
|
|
new_indent = alloca(len);
|
2007-02-03 05:05:30 -08:00
|
|
|
snprintf(new_indent, len, "%s ", indent);
|
|
|
|
|
* 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_FOREACH(menu->entries, l, entry)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
if (entry->type == EFREET_MENU_ENTRY_SEPARATOR)
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("%s|---", new_indent);
|
2007-02-03 05:05:30 -08:00
|
|
|
else if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("%s|-%s", new_indent, entry->name);
|
2007-02-03 05:05:30 -08:00
|
|
|
else if (entry->type == EFREET_MENU_ENTRY_MENU)
|
|
|
|
efreet_menu_dump(entry, new_indent);
|
|
|
|
else if (entry->type == EFREET_MENU_ENTRY_HEADER)
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("%s|---%s", new_indent, entry->name);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Internal struct
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Allocates and initializes a new Efreet_Menu_Internal structure
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static Efreet_Menu_Internal *
|
|
|
|
efreet_menu_internal_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *internal;
|
|
|
|
|
|
|
|
internal = NEW(Efreet_Menu_Internal, 1);
|
2010-08-03 12:31:44 -07:00
|
|
|
if (!internal) return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
internal->show_empty = -1;
|
|
|
|
internal->in_line = -1;
|
|
|
|
internal->inline_limit = -1;
|
|
|
|
internal->inline_header = -1;
|
|
|
|
internal->inline_alias = -1;
|
|
|
|
|
|
|
|
return internal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to free
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Frees up the given menu structure
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
efreet_menu_internal_free(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal) return;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2010-03-13 10:35:39 -08:00
|
|
|
IF_RELEASE(internal->file.path);
|
|
|
|
IF_RELEASE(internal->file.name);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
IF_RELEASE(internal->name.internal);
|
|
|
|
internal->name.name = NULL;
|
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
internal->applications = eina_list_free(internal->applications);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-30 04:07:19 -07:00
|
|
|
IF_FREE_LIST(internal->directories, eina_stringshare_del);
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->app_dirs, efreet_menu_app_dir_free);
|
|
|
|
IF_FREE_LIST(internal->app_pool, efreet_menu_desktop_free);
|
2010-03-30 04:07:07 -07:00
|
|
|
IF_FREE_LIST(internal->directory_dirs, eina_stringshare_del);
|
2007-02-03 05:05:30 -08:00
|
|
|
IF_FREE_HASH(internal->directory_cache);
|
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->moves, efreet_menu_move_free);
|
|
|
|
IF_FREE_LIST(internal->filters, efreet_menu_filter_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->sub_menus, efreet_menu_internal_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->layout, efreet_menu_layout_free);
|
|
|
|
IF_FREE_LIST(internal->default_layout, efreet_menu_layout_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
FREE(internal);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns the XDG_MENU_PREFIX env variable or "" if none set
|
|
|
|
* @brief Retrieves the XDG_MENU_PREFIX or "" if not set.
|
|
|
|
*/
|
|
|
|
static const char *
|
|
|
|
efreet_menu_prefix_get(void)
|
|
|
|
{
|
|
|
|
if (efreet_menu_prefix) return efreet_menu_prefix;
|
|
|
|
|
2010-03-01 10:16:32 -08:00
|
|
|
efreet_menu_prefix = getenv("XDG_MENU_PREFIX");
|
|
|
|
if (!efreet_menu_prefix) efreet_menu_prefix = "";
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return efreet_menu_prefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to populate
|
|
|
|
* @param xml The xml dom tree to populate from
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if this XML tree is valid, 0 otherwise
|
|
|
|
* @brief Populates the given menu from the given xml structure
|
2007-09-06 09:15:10 -07:00
|
|
|
*
|
2007-02-03 05:05:30 -08:00
|
|
|
* We walk the Menu children backwards. The reason for this is so that we
|
|
|
|
* can deal with all the things that make us select the 'last' element
|
|
|
|
* (MergeFile, Directory, etc). We'll see the last one first and can deal
|
|
|
|
* with it right away.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_menu(Efreet_Menu_Internal *internal, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Xml *child;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(xml->children, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
cb = eina_hash_find(efreet_menu_handle_cbs, child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
if (!cb(internal, child))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
WRN("Unknown XML tag: %s", child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent Menu
|
|
|
|
* @param xml The xml that defines the menu
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Handles the sub-menu nodes of the XML file
|
|
|
|
*/
|
2007-02-03 05:05:30 -08:00
|
|
|
static int
|
|
|
|
efreet_menu_handle_sub_menu(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *internal, *match;
|
|
|
|
|
|
|
|
efreet_menu_create_sub_menu_list(parent);
|
|
|
|
|
|
|
|
internal = efreet_menu_internal_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!internal) return 0;
|
2010-03-13 10:35:39 -08:00
|
|
|
internal->file.path = eina_stringshare_add(parent->file.path);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!efreet_menu_handle_menu(internal, xml))
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if this menu already exists we just take this one and stick it on the
|
|
|
|
* start of the existing one */
|
* 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 ((match = eina_list_search_unsorted(parent->sub_menus,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_menu_compare),
|
* 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
|
|
|
internal)))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
|
|
|
|
efreet_menu_concatenate(match, internal);
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
}
|
|
|
|
else
|
* 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
|
|
|
parent->sub_menus = eina_list_prepend(parent->sub_menus, internal);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Handles the AppDir tag
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_app_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
const char *path;
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_App_Dir *app_dir;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_app_dirs_list(parent);
|
|
|
|
path = efreet_menu_path_get(parent, xml->text);
|
|
|
|
if (!path) return 0;
|
|
|
|
|
|
|
|
/* we've already got this guy in our list we can skip it */
|
* 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(parent->app_dirs,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_app_dirs_compare),
|
* 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
|
|
|
path))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
app_dir = efreet_menu_app_dir_new();
|
2010-04-01 12:31:38 -07:00
|
|
|
app_dir->path = path;
|
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
|
|
|
parent->app_dirs = eina_list_prepend(parent->app_dirs, app_dir);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml UNUSED
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the DefaultAppDirs
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_default_app_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml __UNUSED__)
|
|
|
|
{
|
* 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 *prepend = NULL;
|
|
|
|
Eina_List *dirs;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *dir;
|
|
|
|
|
|
|
|
if (!parent) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_app_dirs_list(parent);
|
|
|
|
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
|
|
|
"applications");
|
* 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_FREE(dirs, dir)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-29 13:14:43 -07:00
|
|
|
if (!eina_list_search_unsorted(parent->app_dirs,
|
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_app_dirs_compare),
|
|
|
|
dir))
|
|
|
|
{
|
|
|
|
Efreet_Menu_App_Dir *app_dir;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-29 13:14:43 -07:00
|
|
|
app_dir = efreet_menu_app_dir_new();
|
2010-03-30 04:06:56 -07:00
|
|
|
app_dir->path = eina_stringshare_ref(dir);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-29 13:14:43 -07:00
|
|
|
prepend = eina_list_append(prepend, app_dir);
|
|
|
|
}
|
* 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-03-29 13:14:43 -07:00
|
|
|
eina_stringshare_del(dir);
|
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
|
|
|
parent->app_dirs = eina_list_merge(prepend, parent->app_dirs);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the DirectoryDir tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_directory_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
const char *path;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_directory_dirs_list(parent);
|
|
|
|
path = efreet_menu_path_get(parent, xml->text);
|
|
|
|
if (!path) return 0;
|
|
|
|
|
|
|
|
/* we've already got this guy in our list we can skip it */
|
2009-03-26 10:54:50 -07:00
|
|
|
if (eina_list_search_unsorted(parent->directory_dirs, EINA_COMPARE_CB(strcmp), path))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-04-01 12:31:38 -07:00
|
|
|
parent->directory_dirs = eina_list_prepend(parent->directory_dirs, path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml UNUSED
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the DefaultDirectoryDirs tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_default_directory_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml __UNUSED__)
|
|
|
|
{
|
2010-03-29 13:14:43 -07:00
|
|
|
Eina_List *dirs;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *dir;
|
|
|
|
|
|
|
|
if (!parent) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_directory_dirs_list(parent);
|
2007-09-06 09:15:10 -07:00
|
|
|
dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
|
2007-02-03 05:05:30 -08:00
|
|
|
"desktop-directories");
|
2010-03-29 13:14:43 -07:00
|
|
|
EINA_LIST_FREE(dirs, dir)
|
* 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-03-29 13:14:43 -07:00
|
|
|
if (!eina_list_search_unsorted(parent->directory_dirs, EINA_COMPARE_CB(strcmp), dir))
|
2010-03-30 04:07:07 -07:00
|
|
|
parent->directory_dirs = eina_list_prepend(parent->directory_dirs, eina_stringshare_ref(dir));
|
2010-03-29 13:14:43 -07:00
|
|
|
eina_stringshare_del(dir);
|
* 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
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent Menu
|
|
|
|
* @param xml The xml to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Sets the menu name from the given XML fragment.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_name(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
/* not allowed to have two Name settings in a menu */
|
2007-09-06 09:15:10 -07:00
|
|
|
if (parent->name.internal)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_name() setting second name into menu");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2011-01-29 19:55:06 -08:00
|
|
|
/* ignore the name if it is empty */
|
|
|
|
if (!xml->text) return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* ignore the name if it contains a / */
|
|
|
|
if (strchr(xml->text, '/')) return 1;
|
|
|
|
|
2008-10-15 07:48:03 -07:00
|
|
|
parent->name.internal = eina_stringshare_add(xml->text);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Directory tag
|
|
|
|
*
|
|
|
|
* This just adds the given directory path to a list which we'll walk once
|
|
|
|
* we've traversed the entire menu into memory.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_directory(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_directories_list(parent);
|
2010-03-30 04:07:19 -07:00
|
|
|
parent->directories = eina_list_prepend(parent->directories, eina_stringshare_add(xml->text));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the OnlyUnallocated tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_only_unallocated(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* a later instance has been seen so we can ignore this one */
|
|
|
|
if (parent->seen_allocated) return 1;
|
|
|
|
|
|
|
|
parent->seen_allocated = 1;
|
|
|
|
parent->only_unallocated = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the NotOnlyUnallocated tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_not_only_unallocated(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* a later instance has been seen so we can ignore this one */
|
|
|
|
if (parent->seen_allocated) return 1;
|
|
|
|
|
|
|
|
parent->seen_allocated = 1;
|
|
|
|
parent->only_unallocated = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Deleted tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_deleted(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* a later instance has been seen so we can ignore this one */
|
|
|
|
if (parent->seen_deleted) return 1;
|
|
|
|
|
|
|
|
parent->seen_deleted = 1;
|
|
|
|
parent->deleted = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the NotDeleted tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_not_deleted(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* a later instance has been seen so we can ignore this one */
|
|
|
|
if (parent->seen_deleted) return 1;
|
|
|
|
|
|
|
|
parent->seen_deleted = 1;
|
|
|
|
parent->deleted = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The XML tree to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Handles parsing the Include tag and all subtags
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_include(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
2007-09-06 09:15:10 -07:00
|
|
|
return efreet_menu_handle_filter(parent, xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
EFREET_MENU_FILTER_INCLUDE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Exclude tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_exclude(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
2007-09-06 09:15:10 -07:00
|
|
|
return efreet_menu_handle_filter(parent, xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
EFREET_MENU_FILTER_EXCLUDE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Filename tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_filename(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
2010-03-30 05:20:55 -07:00
|
|
|
op->filenames = eina_list_append(op->filenames, eina_stringshare_add(xml->text));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Category tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_category(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
|
|
|
|
2010-03-30 05:20:55 -07:00
|
|
|
op->categories = eina_list_append(op->categories, eina_stringshare_add(xml->text));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the All tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_all(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
|
|
|
op->all = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the And tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_and(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
return efreet_menu_handle_filter_child_op(op, xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
EFREET_MENU_FILTER_OP_AND);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Or tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_or(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
return efreet_menu_handle_filter_child_op(op, xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
EFREET_MENU_FILTER_OP_OR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Not tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_not(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!op || !xml) return 0;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
return efreet_menu_handle_filter_child_op(op, xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
EFREET_MENU_FILTER_OP_NOT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the MergeFile tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_merge_file(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
* 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-04-01 12:31:38 -07:00
|
|
|
const char *path = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *attr = NULL;
|
|
|
|
int is_path = 1;
|
|
|
|
int ret = 1;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* check to see if this is a path or parent type */
|
|
|
|
attr = efreet_xml_attribute_get(xml, "type");
|
|
|
|
if (attr && !strcmp(attr, "parent"))
|
|
|
|
is_path = 0;
|
|
|
|
|
|
|
|
/* we're given a path */
|
|
|
|
if (is_path)
|
|
|
|
path = efreet_menu_path_get(parent, xml->text);
|
|
|
|
|
|
|
|
/* need to find the next menu with the same name as ours in the config
|
|
|
|
* dir after ours (if we're in a config dir) */
|
|
|
|
else
|
|
|
|
{
|
* 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 *search_dirs;
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *dir, *p;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!parent->file.path)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_merge_file() missing menu path ...");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
search_dirs = efreet_config_dirs_get();
|
|
|
|
|
|
|
|
/* we need to find the next menu with the same name in the directory
|
|
|
|
* after the on the the menu was found in. to do that we first check
|
|
|
|
* if it's in the config_home_directory() if so we need to search
|
|
|
|
* all of the dirs. If it isn't in the config home directory then we
|
|
|
|
* scan the search dirs and look for it. The search_dirs list will
|
|
|
|
* be left at the next pointer so we can start looking for the menu
|
|
|
|
* from that point */
|
|
|
|
|
|
|
|
dir = efreet_config_home_get();
|
2010-03-13 10:35:39 -08:00
|
|
|
if (strncmp(dir, parent->file.path, eina_stringshare_strlen(dir)))
|
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_FOREACH(search_dirs, l, dir)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-13 10:35:39 -08:00
|
|
|
if (!strncmp(dir, parent->file.path, eina_stringshare_strlen(dir)))
|
2007-02-03 05:05:30 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dir)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_merge_file() failed to find "
|
|
|
|
"menu parent directory");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the parent file path may have more path then just the base
|
|
|
|
* directory so we need to append that as well */
|
2010-03-13 10:35:39 -08:00
|
|
|
p = parent->file.path + eina_stringshare_strlen(dir);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* whatever dirs are left in the search dir we need to look for the
|
|
|
|
* menu with the same relative filename */
|
* 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_FOREACH(search_dirs, l, dir)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
char file[PATH_MAX];
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
snprintf(file, sizeof(file), "%s/%s/%s", dir, (p ? p : ""),
|
|
|
|
parent->file.name);
|
|
|
|
if (ecore_file_exists(file))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
path = eina_stringshare_add(file);
|
2007-02-03 05:05:30 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nothing to do if no file found */
|
|
|
|
if (!path) return 1;
|
|
|
|
|
|
|
|
if (!efreet_menu_merge(parent, xml, path))
|
|
|
|
ret = 0;
|
|
|
|
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu to merge into
|
|
|
|
* @param xml The XML to be merged
|
|
|
|
* @param path The path to the .menu file to merge
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *path)
|
|
|
|
{
|
|
|
|
Efreet_Xml *merge_xml;
|
|
|
|
Efreet_Menu_Internal *internal;
|
|
|
|
|
|
|
|
if (!parent || !xml || !path) return 0;
|
|
|
|
|
|
|
|
/* do nothing if the file doesn't exist */
|
|
|
|
if (!ecore_file_exists(path)) return 1;
|
|
|
|
|
|
|
|
/* don't merge the same path twice */
|
2012-10-18 01:10:35 -07:00
|
|
|
if (eina_hash_find(efreet_merged_menus, path))
|
2010-02-04 01:12:35 -08:00
|
|
|
{
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
2010-02-04 01:12:35 -08:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 01:10:35 -07:00
|
|
|
eina_hash_add(efreet_merged_menus, path, (void *)1);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 01:10:35 -07:00
|
|
|
merge_xml = efreet_xml_new(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!merge_xml)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_merge() failed to read in the "
|
2012-10-18 01:10:35 -07:00
|
|
|
"merge file (%s)", path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal = efreet_menu_internal_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!internal) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_path_set(internal, path);
|
|
|
|
efreet_menu_handle_menu(internal, merge_xml);
|
|
|
|
efreet_menu_concatenate(parent, internal);
|
|
|
|
efreet_menu_internal_free(internal);
|
|
|
|
|
|
|
|
efreet_xml_del(merge_xml);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the MergeDir tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_merge_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
const char *path;
|
2007-02-03 05:05:30 -08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!parent || !xml || !xml->text) return 0;
|
|
|
|
|
|
|
|
path = efreet_menu_path_get(parent, xml->text);
|
|
|
|
if (!path) return 1;
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!ecore_file_exists(path))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = efreet_menu_merge_dir(parent, xml, path);
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent the parent menu of the merge
|
|
|
|
* @param xml The xml tree
|
|
|
|
* @param path The path to the merge directory
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Find all of the .menu files in the given directory and merge them
|
|
|
|
* into the @a parent menu.
|
2007-09-06 09:15:10 -07:00
|
|
|
*/
|
2007-02-03 05:05:30 -08:00
|
|
|
static int
|
|
|
|
efreet_menu_merge_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *path)
|
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_File_Direct_Info *info;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !xml || !path) return 0;
|
|
|
|
|
|
|
|
/* check to see if we've merged this directory already */
|
2008-12-17 07:33:43 -08:00
|
|
|
if (eina_hash_find(efreet_merged_dirs, path)) return 1;
|
|
|
|
eina_hash_add(efreet_merged_dirs, path, (void *)1);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
it = eina_file_direct_ls(path);
|
|
|
|
if (!it) return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
EINA_ITERATOR_FOREACH(it, info)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
2012-01-18 17:05:33 -08:00
|
|
|
p = strrchr(info->path + info->name_start, '.');
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!p) continue;
|
|
|
|
if (strcmp(p, ".menu")) continue;
|
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
if (!efreet_menu_merge(parent, xml, info->path))
|
2009-03-23 05:19:31 -07:00
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
2009-03-23 05:19:31 -07:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the DefaultMergeDirs tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_default_merge_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
* 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 *dirs;
|
2010-03-30 05:22:15 -07:00
|
|
|
char path[PATH_MAX], *p, *pp;
|
2010-01-17 10:57:49 -08:00
|
|
|
#ifndef STRICT_SPEC
|
|
|
|
char parent_path[PATH_MAX];
|
|
|
|
#endif
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *prefix;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
prefix = efreet_menu_prefix_get();
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!strcmp(prefix, "gnome-") &&
|
2007-02-03 05:05:30 -08:00
|
|
|
(!strcmp(parent->file.name, "gnome-applications.menu")))
|
2010-03-30 05:21:23 -07:00
|
|
|
{
|
2010-03-30 05:22:15 -07:00
|
|
|
p = alloca(sizeof("applications"));
|
|
|
|
memcpy(p, "applications", sizeof("applications"));
|
2010-03-30 05:21:23 -07:00
|
|
|
}
|
2007-09-06 09:15:10 -07:00
|
|
|
else if ((!strcmp(prefix, "kde-") &&
|
2007-02-03 05:05:30 -08:00
|
|
|
(!strcmp(parent->file.name, "kde-applications.menu"))))
|
2010-03-30 05:21:23 -07:00
|
|
|
{
|
2010-03-30 05:22:15 -07:00
|
|
|
p = alloca(sizeof("applications"));
|
|
|
|
memcpy(p, "applications", sizeof("applications"));
|
2010-03-30 05:21:23 -07:00
|
|
|
}
|
2007-09-06 09:15:10 -07:00
|
|
|
else
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
char *s;
|
2010-03-30 05:22:15 -07:00
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-30 05:22:15 -07:00
|
|
|
len = strlen(parent->file.name) + 1;
|
|
|
|
p = alloca(len);
|
|
|
|
memcpy(p, parent->file.name, len);
|
2007-02-03 05:05:30 -08:00
|
|
|
s = strrchr(p, '.');
|
|
|
|
if (s) *s = '\0';
|
|
|
|
}
|
|
|
|
snprintf(path, sizeof(path), "menus/%s-merged", p);
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
dirs = efreet_default_dirs_get(efreet_config_home_get(),
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_config_dirs_get(), path);
|
* 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-03-30 05:21:23 -07:00
|
|
|
EINA_LIST_FREE(dirs, pp)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-30 05:21:23 -07:00
|
|
|
efreet_menu_merge_dir(parent, xml, pp);
|
|
|
|
eina_stringshare_del(pp);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2010-01-17 10:57:49 -08:00
|
|
|
#ifndef STRICT_SPEC
|
|
|
|
/* Also check the path of the parent file */
|
|
|
|
snprintf(parent_path, sizeof(parent_path), "%s/%s", parent->file.path, path);
|
|
|
|
efreet_menu_merge_dir(parent, xml, parent_path);
|
|
|
|
#endif
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the LegacyDir tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_legacy_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *legacy;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
legacy = efreet_menu_handle_legacy_dir_helper(NULL, parent, xml->text,
|
|
|
|
efreet_xml_attribute_get(xml, "prefix"));
|
2010-08-04 11:21:20 -07:00
|
|
|
if (legacy)
|
|
|
|
{
|
|
|
|
efreet_menu_concatenate(parent, legacy);
|
|
|
|
efreet_menu_internal_free(legacy);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param legacy_dir The legacy directory path
|
|
|
|
* @param prefix The legacy directory prefix if one set
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns the Efreet_Menu_Internal representing the legacy hierarchy
|
|
|
|
* @brief Handles the process of merging @a legacy_dir into @a parent menu
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Internal *
|
|
|
|
efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
|
|
|
|
Efreet_Menu_Internal *parent,
|
|
|
|
const char *legacy_dir,
|
|
|
|
const char *prefix)
|
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
const char *path;
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Internal *legacy_internal;
|
|
|
|
Efreet_Menu_Filter *filter;
|
|
|
|
Efreet_Menu_App_Dir *app_dir;
|
2012-01-18 16:35:51 -08:00
|
|
|
int count = 0;
|
|
|
|
Eina_Iterator *it;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !legacy_dir) return 0;
|
|
|
|
|
|
|
|
path = efreet_menu_path_get(parent, legacy_dir);
|
|
|
|
|
|
|
|
/* nothing to do if the legacy path doesn't exist */
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!path || !ecore_file_exists(path))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
legacy_internal = efreet_menu_internal_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!legacy_internal)
|
|
|
|
return NULL;
|
2008-10-15 07:48:03 -07:00
|
|
|
legacy_internal->name.internal = eina_stringshare_add(ecore_file_file_get(path));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* add the legacy dir as an app dir */
|
|
|
|
app_dir = efreet_menu_app_dir_new();
|
2010-03-30 04:06:56 -07:00
|
|
|
app_dir->path = eina_stringshare_add(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
app_dir->legacy = 1;
|
2010-03-30 04:06:56 -07:00
|
|
|
if (prefix && !strchr(prefix, '/')) app_dir->prefix = eina_stringshare_add(prefix);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
efreet_menu_create_app_dirs_list(legacy_internal);
|
* 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
|
|
|
legacy_internal->app_dirs = eina_list_append(legacy_internal->app_dirs, app_dir);
|
2007-04-04 03:41:53 -07:00
|
|
|
#ifndef STRICT_SPEC
|
2007-02-03 05:05:30 -08:00
|
|
|
if (root)
|
|
|
|
{
|
|
|
|
/* XXX This seems wrong, but it makes efreet pass the fdo tests */
|
|
|
|
app_dir = efreet_menu_app_dir_new();
|
2010-03-30 04:06:56 -07:00
|
|
|
app_dir->path = eina_stringshare_add(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
app_dir->legacy = 1;
|
2010-03-30 04:06:56 -07:00
|
|
|
if (prefix && !strchr(prefix, '/')) app_dir->prefix = eina_stringshare_add(prefix);
|
* 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
|
|
|
root->app_dirs = eina_list_append(root->app_dirs, app_dir);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* add the legacy dir as a directory dir */
|
|
|
|
efreet_menu_create_directory_dirs_list(legacy_internal);
|
2010-03-30 04:07:07 -07:00
|
|
|
legacy_internal->directory_dirs = eina_list_append(legacy_internal->directory_dirs, eina_stringshare_add(path));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* setup a filter for all the conforming .desktop files in the legacy
|
|
|
|
* dir */
|
|
|
|
filter = efreet_menu_filter_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!filter)
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(legacy_internal);
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
filter->type = EFREET_MENU_FILTER_INCLUDE;
|
|
|
|
|
|
|
|
filter->op->type = EFREET_MENU_FILTER_OP_OR;
|
|
|
|
|
|
|
|
efreet_menu_create_filter_list(legacy_internal);
|
* 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
|
|
|
legacy_internal->filters = eina_list_append(legacy_internal->filters, filter);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 02:12:25 -07:00
|
|
|
it = eina_file_stat_ls(path);
|
2012-01-18 16:35:51 -08:00
|
|
|
if (it)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
Eina_File_Direct_Info *info;
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, info)
|
2010-04-17 11:39:13 -07:00
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop = NULL;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
char *exten;
|
2012-01-18 16:35:51 -08:00
|
|
|
const char *fname;
|
2010-04-17 11:39:13 -07:00
|
|
|
|
2012-01-18 17:05:33 -08:00
|
|
|
fname = info->path + info->name_start;
|
2010-04-17 11:39:13 -07:00
|
|
|
/* recurse into sub directories */
|
2012-10-18 02:12:25 -07:00
|
|
|
if (info->type == EINA_FILE_DIR)
|
2010-04-17 11:39:13 -07:00
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *ret;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
ret = efreet_menu_handle_legacy_dir_helper(root ? root : legacy_internal,
|
2012-01-18 16:35:51 -08:00
|
|
|
legacy_internal, info->path, prefix);
|
2010-04-17 11:39:13 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(legacy_internal);
|
|
|
|
eina_stringshare_del(path);
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2010-04-17 11:39:13 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
efreet_menu_create_sub_menu_list(legacy_internal);
|
|
|
|
legacy_internal->sub_menus = eina_list_prepend(legacy_internal->sub_menus, ret);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
if (!strcmp(fname, ".directory"))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
legacy_internal->directory = efreet_desktop_get(info->path);
|
2010-04-17 11:39:13 -07:00
|
|
|
if (legacy_internal->directory
|
|
|
|
&& legacy_internal->directory->type != EFREET_DESKTOP_TYPE_DIRECTORY)
|
|
|
|
{
|
|
|
|
efreet_desktop_free(legacy_internal->directory);
|
|
|
|
legacy_internal->directory = NULL;
|
|
|
|
}
|
|
|
|
continue;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
exten = strrchr(fname, '.');
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
if (exten && !strcmp(exten, ".desktop"))
|
2012-01-18 16:35:51 -08:00
|
|
|
desktop = efreet_desktop_get(info->path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
if (!desktop) continue;
|
|
|
|
|
|
|
|
/* if the .desktop has categories it isn't legacy */
|
|
|
|
if (efreet_desktop_category_count_get(desktop) != 0)
|
2007-07-26 04:40:04 -07:00
|
|
|
{
|
2010-04-17 11:39:13 -07:00
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
continue;
|
2007-07-26 04:40:04 -07:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
/* XXX: This will disappear when the .desktop is free'd */
|
|
|
|
efreet_desktop_category_add(desktop, "Legacy");
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
if (prefix)
|
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s%s", prefix, fname);
|
2010-04-17 11:39:13 -07:00
|
|
|
filter->op->filenames = eina_list_append(filter->op->filenames, eina_stringshare_add(buf));
|
|
|
|
}
|
|
|
|
else
|
2012-01-18 16:35:51 -08:00
|
|
|
filter->op->filenames = eina_list_append(filter->op->filenames, eina_stringshare_add(fname));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-17 11:39:13 -07:00
|
|
|
count++;
|
2009-06-19 23:19:48 -07:00
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
}
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2010-04-01 12:31:38 -07:00
|
|
|
eina_stringshare_del(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
return legacy_internal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml UNUSED
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the KDELegacyDirs tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_kde_legacy_dirs(Efreet_Menu_Internal *parent, Efreet_Xml *xml __UNUSED__)
|
|
|
|
{
|
* 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;
|
2007-02-03 05:05:30 -08:00
|
|
|
const char *dir;
|
|
|
|
|
|
|
|
if (!parent) return 0;
|
|
|
|
|
|
|
|
if (!efreet_menu_kde_legacy_dirs) return 1;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
/* XXX if one _helper() call succeeds, we return success. should this be flipped?
|
2007-02-03 05:05:30 -08:00
|
|
|
* (return fail if on of them failed) */
|
* 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_FOREACH(efreet_menu_kde_legacy_dirs, l, dir)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *kde;
|
|
|
|
|
|
|
|
kde = efreet_menu_handle_legacy_dir_helper(NULL, parent, dir, "kde");
|
2007-09-06 09:15:10 -07:00
|
|
|
if (kde)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
efreet_menu_concatenate(parent, kde);
|
|
|
|
efreet_menu_internal_free(kde);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Move tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_move(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Xml *child;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
efreet_menu_create_move_list(parent);
|
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_FOREACH(xml->children, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
|
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
cb = eina_hash_find(efreet_menu_move_cbs, child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
if (!cb(parent, child))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_move() unknown tag found "
|
|
|
|
"in Move (%s)", child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
parent->current_move = NULL;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Old tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_old(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Move *move;
|
|
|
|
|
|
|
|
if (!parent || !xml || !xml->text) return 0;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (parent->current_move)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_old() saw second <Old> "
|
|
|
|
"before seeing <New>");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we already moved this menu, remove the old move */
|
|
|
|
/* XXX This seems wrong, but it makes efreet pass the fdo tests */
|
2007-04-04 03:41:53 -07:00
|
|
|
#ifndef STRICT_SPEC
|
* 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
|
|
|
move = eina_list_search_unsorted(parent->moves,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_move_compare),
|
* 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
|
|
|
xml->text);
|
|
|
|
if (move)
|
|
|
|
{
|
|
|
|
efreet_menu_move_free(move);
|
|
|
|
parent->moves = eina_list_remove(parent->moves, move);
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
move = efreet_menu_move_new();
|
2010-03-30 05:21:33 -07:00
|
|
|
move->old_name = eina_stringshare_add(xml->text);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
parent->current_move = move;
|
* 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
|
|
|
parent->moves = eina_list_append(parent->moves, move);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the New tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_new(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
if (!parent || !xml || !xml->text) return 0;
|
|
|
|
|
|
|
|
if (!parent->current_move)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_new() saw New before seeing Old");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-30 05:21:33 -07:00
|
|
|
parent->current_move->new_name = eina_stringshare_add(xml->text);
|
2007-02-03 05:05:30 -08:00
|
|
|
parent->current_move = NULL;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the Layout tag and all subtags
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Xml *child;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* We use the last existing layout */
|
|
|
|
if (parent->layout) return 1;
|
|
|
|
|
|
|
|
efreet_menu_create_layout_list(parent);
|
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_FOREACH(xml->children, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
cb = eina_hash_find(efreet_menu_layout_cbs, child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
if (!cb(parent, child, 0))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_move() unknown tag found "
|
|
|
|
"in Layout (%s)", child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The xml tree
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Handles the DefaultLayout tag
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_default_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
Efreet_Xml *child;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
/* We use the last existing layout */
|
|
|
|
if (parent->default_layout) return 1;
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "show_empty");
|
|
|
|
if (val) parent->show_empty = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline");
|
|
|
|
if (val) parent->in_line = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_limit");
|
|
|
|
if (val) parent->inline_limit = atoi(val);
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_header");
|
|
|
|
if (val) parent->inline_header = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_alias");
|
|
|
|
if (val) parent->inline_alias = !strcmp(val, "true");
|
|
|
|
|
|
|
|
efreet_menu_create_default_layout_list(parent);
|
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_FOREACH(xml->children, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
|
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
cb = eina_hash_find(efreet_menu_layout_cbs, child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
if (!cb(parent, child, 1))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_move() unknown tag found in "
|
|
|
|
"DefaultLayout (%s)", child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_layout_menuname(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *layout;
|
|
|
|
const char *val;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
if (!xml->text)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_layout_menuname() The Menuname tag in "
|
|
|
|
"layout needs a filename.");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout = efreet_menu_layout_new();
|
|
|
|
layout->type = EFREET_MENU_LAYOUT_MENUNAME;
|
2010-04-01 12:30:13 -07:00
|
|
|
layout->name = eina_stringshare_add(xml->text);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "show_empty");
|
|
|
|
if (val) layout->show_empty = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline");
|
|
|
|
if (val) layout->in_line = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_limit");
|
|
|
|
if (val) layout->inline_limit = atoi(val);
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_header");
|
|
|
|
if (val) layout->inline_header = !strcmp(val, "true");
|
|
|
|
|
|
|
|
val = efreet_xml_attribute_get(xml, "inline_alias");
|
|
|
|
if (val) layout->inline_alias = !strcmp(val, "true");
|
|
|
|
|
* 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 (def) parent->default_layout = eina_list_append(parent->default_layout, layout);
|
|
|
|
else parent->layout = eina_list_append(parent->layout, layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_layout_filename(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *layout;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
if (!xml->text)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_layout_filename() The Filename tag in "
|
|
|
|
"layout needs a filename.");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout = efreet_menu_layout_new();
|
|
|
|
layout->type = EFREET_MENU_LAYOUT_FILENAME;
|
2010-04-01 12:30:13 -07:00
|
|
|
layout->name = eina_stringshare_add(xml->text);
|
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 (def) parent->default_layout = eina_list_append(parent->default_layout, layout);
|
|
|
|
else parent->layout = eina_list_append(parent->layout, layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_layout_separator(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *layout;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
layout = efreet_menu_layout_new();
|
|
|
|
layout->type = EFREET_MENU_LAYOUT_SEPARATOR;
|
|
|
|
if (def)
|
* 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
|
|
|
parent->default_layout = eina_list_append(parent->default_layout, layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
else
|
* 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
|
|
|
parent->layout = eina_list_append(parent->layout, layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_layout_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *layout;
|
|
|
|
const char *attr;
|
|
|
|
|
|
|
|
if (!parent || !xml) return 0;
|
|
|
|
|
|
|
|
attr = efreet_xml_attribute_get(xml, "type");
|
|
|
|
if (!attr)
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_layout_merge() The Merge tag in layout "
|
|
|
|
"needs a type attribute.");
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(attr, "files") && strcmp(attr, "menus") && strcmp(attr, "all"))
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_layout_merge() The type attribute for "
|
|
|
|
"the Merge tag contains an unknown value (%s).", attr);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout = efreet_menu_layout_new();
|
|
|
|
layout->type = EFREET_MENU_LAYOUT_MERGE;
|
2010-04-01 12:30:13 -07:00
|
|
|
layout->name = eina_stringshare_add(attr);
|
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 (def) parent->default_layout = eina_list_append(parent->default_layout, layout);
|
|
|
|
else parent->layout = eina_list_append(parent->layout, layout);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param parent The parent menu
|
|
|
|
* @param xml The XML tree to parse
|
|
|
|
* @param type The type of filter
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Parses the given XML tree and adds the filter to the parent menu
|
|
|
|
*/
|
|
|
|
static int
|
2007-09-06 09:15:10 -07:00
|
|
|
efreet_menu_handle_filter(Efreet_Menu_Internal *parent, Efreet_Xml *xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Filter_Type type)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter *filter;
|
|
|
|
|
|
|
|
efreet_menu_create_filter_list(parent);
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/* filters have a default or relationship */
|
|
|
|
filter = efreet_menu_filter_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!filter) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
filter->type = type;
|
|
|
|
filter->op->type = EFREET_MENU_FILTER_OP_OR;
|
|
|
|
|
|
|
|
if (!efreet_menu_handle_filter_op(filter->op, xml))
|
|
|
|
{
|
|
|
|
efreet_menu_filter_free(filter);
|
|
|
|
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
|
|
|
parent->filters = eina_list_prepend(parent->filters, filter);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The operation to work with
|
|
|
|
* @param xml The XML tree representing this operation
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Parses the given XML tree and populates the operation
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_handle_filter_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
|
|
|
|
{
|
|
|
|
Efreet_Xml *child;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_FOREACH(xml->children, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
int (*cb)(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
|
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
cb = eina_hash_find(efreet_menu_filter_cbs, child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
if (!cb(op, child))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_filter_op() unknown tag in filter (%s)", child->tag);
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Filter on success or NULL on failure
|
|
|
|
* @brief Creates and initializes an Efreet_Menu_Filter object
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Filter *
|
|
|
|
efreet_menu_filter_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter *filter;
|
|
|
|
|
|
|
|
filter = NEW(Efreet_Menu_Filter, 1);
|
2010-08-03 12:31:44 -07:00
|
|
|
if (!filter) return NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
filter->op = efreet_menu_filter_op_new();
|
|
|
|
if (!filter->op)
|
|
|
|
{
|
|
|
|
FREE(filter);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param filter The filter to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no data
|
|
|
|
* @brief Frees the given filter and all data
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_filter_free(Efreet_Menu_Filter *filter)
|
|
|
|
{
|
|
|
|
if (!filter) return;
|
|
|
|
|
|
|
|
if (filter->op) efreet_menu_filter_op_free(filter->op);
|
|
|
|
filter->op = NULL;
|
|
|
|
|
|
|
|
FREE(filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Layout on success or NULL on failure
|
|
|
|
* @brief Creates and initializes an Efreet_Menu_Layout object
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Layout *
|
|
|
|
efreet_menu_layout_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *layout;
|
|
|
|
|
|
|
|
layout = NEW(Efreet_Menu_Layout, 1);
|
|
|
|
layout->show_empty = -1;
|
|
|
|
layout->in_line = -1;
|
|
|
|
layout->inline_limit = -1;
|
|
|
|
layout->inline_header = -1;
|
|
|
|
layout->inline_alias = -1;
|
|
|
|
|
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param filter The filter to work with
|
2009-03-23 05:19:31 -07:00
|
|
|
* @return Returns no data
|
|
|
|
* @brief Frees the given filter and all data
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_layout_free(Efreet_Menu_Layout *layout)
|
|
|
|
{
|
|
|
|
if (!layout) return;
|
|
|
|
|
2010-04-01 12:30:13 -07:00
|
|
|
IF_RELEASE(layout->name);
|
2009-03-23 05:19:31 -07:00
|
|
|
FREE(layout);
|
|
|
|
}
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Filter_Op on success or NULL on failure
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Creates and initializes an Efreet_Menu_Filter_Op structure
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static Efreet_Menu_Filter_Op *
|
|
|
|
efreet_menu_filter_op_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op *op;
|
|
|
|
|
|
|
|
op = NEW(Efreet_Menu_Filter_Op, 1);
|
|
|
|
|
|
|
|
return op;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The operation to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value.
|
|
|
|
* @brief Frees the given operation and all sub data
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_filter_op_free(Efreet_Menu_Filter_Op *op)
|
|
|
|
{
|
|
|
|
if (!op) return;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2010-03-30 05:20:55 -07:00
|
|
|
IF_FREE_LIST(op->categories, eina_stringshare_del);
|
|
|
|
IF_FREE_LIST(op->filenames, eina_stringshare_del);
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(op->filters, efreet_menu_filter_op_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
FREE(op);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Desktop on success or NULL on failure
|
|
|
|
* @brief Creates and returns an Efreet_Menu_Desktop
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Desktop *
|
|
|
|
efreet_menu_desktop_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Desktop *md;
|
|
|
|
|
|
|
|
md = NEW(Efreet_Menu_Desktop, 1);
|
|
|
|
|
|
|
|
return md;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param md The Efreet_Menu_Desktop to free
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Frees the given structure
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_desktop_free(Efreet_Menu_Desktop *md)
|
|
|
|
{
|
2007-02-05 18:16:33 -08:00
|
|
|
IF_RELEASE(md->id);
|
2007-07-26 03:20:24 -07:00
|
|
|
if (md->desktop) efreet_desktop_free(md->desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
FREE(md);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu on success or NULL on failure
|
|
|
|
* @brief Creates and returns an Efreet_Menu
|
|
|
|
*/
|
|
|
|
static Efreet_Menu *
|
|
|
|
efreet_menu_entry_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu *entry;
|
|
|
|
|
|
|
|
entry = NEW(Efreet_Menu, 1);
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
2007-11-04 01:32:35 -08:00
|
|
|
EAPI void
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_free(Efreet_Menu *entry)
|
|
|
|
{
|
2009-06-19 23:19:48 -07:00
|
|
|
Efreet_Menu *sub;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
if (!entry) return;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
IF_RELEASE(entry->name);
|
|
|
|
IF_RELEASE(entry->icon);
|
2009-06-19 23:19:48 -07:00
|
|
|
EINA_LIST_FREE(entry->entries, sub)
|
|
|
|
efreet_menu_free(sub);
|
2007-02-05 18:16:33 -08:00
|
|
|
IF_RELEASE(entry->id);
|
2007-07-26 12:14:41 -07:00
|
|
|
if (entry->desktop) efreet_desktop_free(entry->desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
FREE(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The op to add a child too
|
|
|
|
* @param xml The XML tree of the child
|
|
|
|
* @param type The type of child to add
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Parses the given XML tree and populates a new child operation.
|
|
|
|
*/
|
|
|
|
static int
|
2007-09-06 09:15:10 -07:00
|
|
|
efreet_menu_handle_filter_child_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml,
|
2007-02-03 05:05:30 -08:00
|
|
|
Efreet_Menu_Filter_Op_Type type)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op *child_op;
|
|
|
|
|
|
|
|
child_op = efreet_menu_filter_op_new();
|
|
|
|
child_op->type = type;
|
|
|
|
|
|
|
|
if (!efreet_menu_handle_filter_op(child_op, xml))
|
|
|
|
{
|
|
|
|
efreet_menu_filter_op_free(child_op);
|
|
|
|
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
|
|
|
op->filters = eina_list_append(op->filters, child_op);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to work with
|
|
|
|
* @param only_unallocated Do we only look for unallocated items?
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if we've successfully processed the menu, 0 otherwise
|
|
|
|
* @brief Handles the processing of the menu data to retrieve the .desktop
|
|
|
|
* files for the menu
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_process(Efreet_Menu_Internal *internal, unsigned int only_unallocated)
|
|
|
|
{
|
* 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;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/* a menu _MUST_ have a name */
|
|
|
|
if (!internal->name.internal || (internal->name.internal[0] == '\0'))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* handle filtering out .desktop files as needed. This deals with all
|
|
|
|
* .desktop files */
|
|
|
|
efreet_menu_process_filters(internal, only_unallocated);
|
|
|
|
|
|
|
|
if (internal->sub_menus)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *sub_internal;
|
|
|
|
|
* 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_FOREACH(internal->sub_menus, l, sub_internal)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
sub_internal->parent = internal;
|
|
|
|
efreet_menu_process(sub_internal, only_unallocated);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This will walk through all of the app dirs and load all the .desktop
|
|
|
|
* files into the cache for the menu. The .desktop files will have their
|
|
|
|
* allocated flag set to 0 */
|
|
|
|
static int
|
|
|
|
efreet_menu_process_dirs(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
* 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;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/* Scan application directories for .desktop files */
|
|
|
|
if (!efreet_menu_app_dirs_process(internal))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Scan directory directories for .directory file */
|
|
|
|
if (!efreet_menu_directory_dirs_process(internal))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (internal->sub_menus)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *sub_internal;
|
|
|
|
|
* 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_FOREACH(internal->sub_menus, l, sub_internal)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
sub_internal->parent = internal;
|
|
|
|
efreet_menu_process_dirs(sub_internal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu the menu to process
|
|
|
|
* @param only_unallocated Only handle menus that deal with unallocated items
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Handles the processing of the filters attached to the given menu.
|
2007-02-03 05:05:30 -08:00
|
|
|
*
|
|
|
|
* For each include filter we'll add the items to our applications array. Each
|
2007-09-06 09:15:10 -07:00
|
|
|
* exclude filter will remove items from the applications array
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_process_filters(Efreet_Menu_Internal *internal, unsigned int only_unallocated)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter *filter;
|
* 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_Menu_Desktop *md;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
int included = 0;
|
|
|
|
|
|
|
|
/* nothing to do if we're checking the other option */
|
|
|
|
if (only_unallocated != internal->only_unallocated) return;
|
|
|
|
|
2010-10-20 13:39:19 -07:00
|
|
|
internal->applications = eina_list_free(internal->applications);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!internal->filters) return;
|
|
|
|
|
* 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_FOREACH(internal->filters, l, filter)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
/* skip excludes until we get an include */
|
|
|
|
if (!included && (filter->type == EFREET_MENU_FILTER_EXCLUDE))
|
|
|
|
continue;
|
|
|
|
included = 1;
|
|
|
|
|
|
|
|
if (filter->type == EFREET_MENU_FILTER_INCLUDE)
|
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
Eina_Hash *matches;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2008-12-17 07:33:43 -08:00
|
|
|
matches = eina_hash_string_superfast_new(NULL);
|
* 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
|
|
|
internal->applications = efreet_menu_process_app_pool(internal->app_pool, internal->applications,
|
2007-02-03 05:05:30 -08:00
|
|
|
matches, filter, internal->only_unallocated);
|
|
|
|
if (internal->parent)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *parent;
|
|
|
|
|
|
|
|
parent = internal->parent;
|
|
|
|
do {
|
* 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
|
|
|
internal->applications = efreet_menu_process_app_pool(parent->app_pool,
|
2007-02-03 05:05:30 -08:00
|
|
|
internal->applications, matches, filter,
|
|
|
|
internal->only_unallocated);
|
|
|
|
} while ((parent = parent->parent));
|
|
|
|
}
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_free(matches);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* check each item in our menu so far and see if it's excluded */
|
* 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
|
|
|
l = internal->applications;
|
|
|
|
while ((md = eina_list_data_get(l)))
|
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
|
|
|
ll = eina_list_next(l);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (efreet_menu_filter_matches(filter->op, md))
|
* 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
|
|
|
internal->applications = eina_list_remove_list(internal->applications, l);
|
|
|
|
l = ll;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sort the menu applications. we do this in process filters so it will only
|
|
|
|
* be done once per menu.*/
|
2010-01-16 05:43:28 -08:00
|
|
|
if (eina_list_count(internal->applications))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-01 13:43:59 -08:00
|
|
|
Eina_List *l2;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-01-16 05:43:28 -08:00
|
|
|
EINA_LIST_FOREACH_SAFE(internal->applications, l, l2, md)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-01-16 05:43:28 -08:00
|
|
|
if (md->desktop->no_display)
|
|
|
|
internal->applications = eina_list_remove_list(internal->applications, l);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2010-01-16 05:43:28 -08:00
|
|
|
internal->applications = eina_list_sort(internal->applications,
|
|
|
|
eina_list_count(internal->applications),
|
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_md_compare));
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param pool The app pool to iterate
|
|
|
|
* @param applications The list of applications to append too
|
|
|
|
* @param matches The hash of previously matched ids
|
|
|
|
* @param filter The menu filter to run on the pool items
|
|
|
|
* @param only_unallocated Do we check only unallocated pool items?
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value.
|
|
|
|
* @brief This will iterate the items in @a pool and append them to @a
|
|
|
|
* applications if they match the @a filter given and aren't previoulsy entered
|
|
|
|
* in @a matches. If @a only_unallocated is set we'll only only at the
|
2007-09-06 09:15:10 -07:00
|
|
|
* .desktop files that haven't been previoulsy matched
|
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
|
|
|
static Eina_List *
|
|
|
|
efreet_menu_process_app_pool(Eina_List *pool, Eina_List *applications,
|
2010-02-04 01:12:35 -08:00
|
|
|
Eina_Hash *matches, Efreet_Menu_Filter *filter,
|
|
|
|
unsigned int only_unallocated)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu_Desktop *md;
|
* 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;
|
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_FOREACH(pool, l, md)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
if (eina_hash_find(matches, md->id)) continue;
|
2007-02-03 05:05:30 -08:00
|
|
|
if (only_unallocated && md->allocated) continue;
|
|
|
|
if (efreet_menu_filter_matches(filter->op, md))
|
|
|
|
{
|
* 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
|
|
|
applications = eina_list_append(applications, md);
|
2010-12-03 06:53:01 -08:00
|
|
|
eina_hash_direct_add(matches, (void *)md->id, md);
|
2007-02-03 05:05:30 -08:00
|
|
|
md->allocated = 1;
|
|
|
|
}
|
|
|
|
}
|
* 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 applications;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation to execute
|
|
|
|
* @param md The desktop to run the filter on
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if this desktop matches the given filter, 0 otherwise
|
|
|
|
* @brief This will execute the given @a filter on the given desktop
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_filter_matches(Efreet_Menu_Filter_Op *op, Efreet_Menu_Desktop *md)
|
|
|
|
{
|
|
|
|
if (op->type == EFREET_MENU_FILTER_OP_OR)
|
|
|
|
return efreet_menu_filter_or_matches(op, md);
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
if (op->type == EFREET_MENU_FILTER_OP_AND)
|
|
|
|
return efreet_menu_filter_and_matches(op, md);
|
|
|
|
|
|
|
|
if (op->type == EFREET_MENU_FILTER_OP_NOT)
|
|
|
|
return efreet_menu_filter_not_matches(op, md);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation to execute
|
|
|
|
* @param md The desktop to execute on
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if the desktop matches, 0 otherwise
|
|
|
|
* @brief Executes the OR operation, @a op, on the desktop, @a md.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_filter_or_matches(Efreet_Menu_Filter_Op *op, Efreet_Menu_Desktop *md)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op *child;
|
* 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;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *t;
|
|
|
|
|
|
|
|
if (op->all) return 1;
|
|
|
|
|
|
|
|
if (op->categories && md->desktop->categories)
|
|
|
|
{
|
* 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_FOREACH(op->categories, l, t)
|
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(md->desktop->categories,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(strcmp), t))
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filenames)
|
|
|
|
{
|
* 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_FOREACH(op->filenames, l, t)
|
2010-03-30 05:21:12 -07:00
|
|
|
if (t == md->id) return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filters)
|
|
|
|
{
|
* 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_FOREACH(op->filters, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
if (efreet_menu_filter_matches(child, md))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation to execute
|
|
|
|
* @param md The desktop to execute on
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if the desktop matches, 0 otherwise
|
|
|
|
* @brief Executes the AND operation, @a op, on the desktop, @a md.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_filter_and_matches(Efreet_Menu_Filter_Op *op, Efreet_Menu_Desktop *md)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op *child;
|
* 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;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *t;
|
|
|
|
|
2007-09-06 09:15:10 -07:00
|
|
|
if (op->categories)
|
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_count(op->categories) > 0) && !md->desktop->categories)
|
2007-02-03 05:05:30 -08:00
|
|
|
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
|
|
|
EINA_LIST_FOREACH(op->categories, l, t)
|
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(md->desktop->categories,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(strcmp), t))
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filenames)
|
|
|
|
{
|
* 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_FOREACH(op->filenames, l, t)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-30 05:21:12 -07:00
|
|
|
if (t != md->id) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filters)
|
|
|
|
{
|
* 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_FOREACH(op->filters, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
if (!efreet_menu_filter_matches(child, md))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param op The filter operation to execute
|
|
|
|
* @param md The desktop to execute on
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 if the desktop matches, 0 otherwise
|
|
|
|
* @brief Executes the NOT operation, @a op, on the desktop, @a md.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_filter_not_matches(Efreet_Menu_Filter_Op *op, Efreet_Menu_Desktop *md)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Filter_Op *child;
|
* 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;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *t;
|
|
|
|
|
|
|
|
/* !all means no desktops match */
|
|
|
|
if (op->all) return 0;
|
|
|
|
|
|
|
|
if (op->categories)
|
|
|
|
{
|
* 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_count(op->categories) > 0) && !md->desktop->categories)
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
|
2012-05-23 13:10:27 -07:00
|
|
|
EINA_LIST_FOREACH(op->categories, l, t)
|
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(md->desktop->categories,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(strcmp), t))
|
2007-02-03 05:05:30 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filenames)
|
|
|
|
{
|
* 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_FOREACH(op->filenames, l, t)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2010-03-30 05:21:12 -07:00
|
|
|
if (t == md->id) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (op->filters)
|
|
|
|
{
|
* 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_FOREACH(op->filters, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
if (efreet_menu_filter_matches(child, md))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param dest The destination menu
|
|
|
|
* @param src The source menu
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Takes the child elements of the menu @a src and puts then on the
|
|
|
|
* _start_ of the menu @a dest.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_concatenate(Efreet_Menu_Internal *dest, Efreet_Menu_Internal *src)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *submenu;
|
|
|
|
|
|
|
|
if (!dest || !src) return;
|
|
|
|
|
|
|
|
if (!dest->directory && src->directory)
|
|
|
|
{
|
|
|
|
dest->directory = src->directory;
|
|
|
|
src->directory = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dest->seen_allocated && src->seen_allocated)
|
|
|
|
{
|
|
|
|
dest->only_unallocated = src->only_unallocated;
|
|
|
|
dest->seen_allocated = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dest->seen_deleted && src->seen_deleted)
|
|
|
|
{
|
|
|
|
dest->deleted = src->deleted;
|
|
|
|
dest->seen_deleted = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->directories)
|
|
|
|
{
|
|
|
|
efreet_menu_create_directories_list(dest);
|
2009-03-26 10:54:50 -07:00
|
|
|
dest->directories = eina_list_merge(src->directories, dest->directories);
|
|
|
|
src->directories = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->app_dirs)
|
|
|
|
{
|
|
|
|
efreet_menu_create_app_dirs_list(dest);
|
* 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
|
|
|
dest->app_dirs = eina_list_merge(src->app_dirs, dest->app_dirs);
|
2010-02-04 01:12:35 -08:00
|
|
|
src->app_dirs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->directory_dirs)
|
|
|
|
{
|
|
|
|
efreet_menu_create_directory_dirs_list(dest);
|
2009-03-26 10:54:50 -07:00
|
|
|
dest->directory_dirs = eina_list_merge(src->directory_dirs, dest->directory_dirs);
|
|
|
|
src->directory_dirs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->moves)
|
|
|
|
{
|
|
|
|
efreet_menu_create_move_list(dest);
|
* 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
|
|
|
dest->moves = eina_list_merge(src->moves, dest->moves);
|
2009-03-26 10:54:50 -07:00
|
|
|
src->moves = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->filters)
|
|
|
|
{
|
|
|
|
efreet_menu_create_filter_list(dest);
|
* 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
|
|
|
dest->filters = eina_list_merge(src->filters, dest->filters);
|
2009-03-26 10:54:50 -07:00
|
|
|
src->filters = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->sub_menus)
|
|
|
|
{
|
|
|
|
efreet_menu_create_sub_menu_list(dest);
|
|
|
|
|
* 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
|
|
|
while ((submenu = eina_list_data_get(eina_list_last(src->sub_menus))))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *match;
|
2007-09-06 09:15:10 -07: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
|
|
|
src->sub_menus = eina_list_remove(src->sub_menus, submenu);
|
2007-02-03 05:05:30 -08:00
|
|
|
/* if this menu is in the list already we just add to that */
|
* 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 ((match = eina_list_search_unsorted(dest->sub_menus,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_menu_compare),
|
* 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
|
|
|
submenu)))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
efreet_menu_concatenate(match, submenu);
|
|
|
|
efreet_menu_internal_free(submenu);
|
|
|
|
}
|
|
|
|
else
|
* 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
|
|
|
dest->sub_menus = eina_list_prepend(dest->sub_menus, submenu);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value
|
|
|
|
* @brief Handles any \<Move\> commands in the menus
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_resolve_moves(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *child;
|
|
|
|
Efreet_Menu_Move *move;
|
* 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;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* child moves are handled before parent moves */
|
|
|
|
if (internal->sub_menus)
|
|
|
|
{
|
* 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_FOREACH(internal->sub_menus, l, child)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_resolve_moves(child);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nothing to do if this menu has no moves */
|
|
|
|
if (!internal->moves) return;
|
2007-09-06 09:15:10 -07: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_FOREACH(internal->moves, l, move)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *origin, *dest, *parent;
|
|
|
|
|
|
|
|
/* if the origin path doesn't exist we do nothing */
|
|
|
|
origin = efreet_menu_by_name_find(internal, move->old_name, &parent);
|
|
|
|
if (!origin) continue;
|
|
|
|
|
|
|
|
/* remove the origin menu from the parent */
|
* 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
|
|
|
parent->sub_menus = eina_list_remove(parent->sub_menus, origin);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* if the destination path doesn't exist we just rename the origin
|
|
|
|
* menu and append to the parents list of children */
|
|
|
|
dest = efreet_menu_by_name_find(internal, move->new_name, &parent);
|
|
|
|
if (!dest)
|
|
|
|
{
|
2010-03-30 05:22:15 -07:00
|
|
|
char *path, *tmp, *t;
|
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/* if the dest path has /'s in it then we need to add menus to
|
|
|
|
* fill out the paths */
|
2010-03-30 05:22:15 -07:00
|
|
|
len = strlen(move->new_name) + 1;
|
|
|
|
t = alloca(len);
|
|
|
|
memcpy(t, move->new_name, len);
|
2007-09-06 09:15:10 -07:00
|
|
|
tmp = t;
|
2007-02-03 05:05:30 -08:00
|
|
|
path = strchr(tmp, '/');
|
|
|
|
while (path)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *ancestor;
|
|
|
|
|
|
|
|
*path = '\0';
|
|
|
|
|
|
|
|
ancestor = efreet_menu_internal_new();
|
2010-08-04 11:21:20 -07:00
|
|
|
if (!ancestor) goto error;
|
2008-10-15 07:48:03 -07:00
|
|
|
ancestor->name.internal = eina_stringshare_add(tmp);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
efreet_menu_create_sub_menu_list(parent);
|
* 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
|
|
|
parent->sub_menus = eina_list_append(parent->sub_menus, ancestor);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
parent = ancestor;
|
|
|
|
tmp = ++path;
|
|
|
|
path = strchr(tmp, '/');
|
|
|
|
}
|
|
|
|
|
|
|
|
IF_RELEASE(origin->name.internal);
|
2008-10-15 07:48:03 -07:00
|
|
|
origin->name.internal = eina_stringshare_add(tmp);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
efreet_menu_create_sub_menu_list(parent);
|
* 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
|
|
|
parent->sub_menus = eina_list_append(parent->sub_menus, origin);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efreet_menu_concatenate(dest, origin);
|
|
|
|
efreet_menu_internal_free(origin);
|
|
|
|
}
|
|
|
|
}
|
2010-08-04 11:21:20 -07:00
|
|
|
error:
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->moves, efreet_menu_move_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to start searching from
|
|
|
|
* @param name The menu name to find
|
|
|
|
* @param parent The parent of the found menu
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns the menu with the given @a name or NULL if none found
|
|
|
|
* @brief Searches the menu tree starting at @a menu looking for a menu with
|
|
|
|
* @a name.
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Internal *
|
|
|
|
efreet_menu_by_name_find(Efreet_Menu_Internal *internal, const char *name, Efreet_Menu_Internal **parent)
|
|
|
|
{
|
2010-03-30 05:22:15 -07:00
|
|
|
char *part, *tmp, *ptr;
|
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (parent) *parent = internal;
|
|
|
|
|
|
|
|
/* find the correct parent menu */
|
2010-03-30 05:22:15 -07:00
|
|
|
len = strlen(name) + 1;
|
|
|
|
tmp = alloca(len);
|
|
|
|
memcpy(tmp, name, len);
|
2007-02-03 05:05:30 -08:00
|
|
|
ptr = tmp;
|
|
|
|
part = strchr(ptr, '/');
|
|
|
|
while (part)
|
|
|
|
{
|
|
|
|
*part = '\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
|
|
|
if (!(internal = eina_list_search_unsorted(internal->sub_menus,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_compare_names),
|
* 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
|
|
|
ptr)))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr = ++part;
|
|
|
|
part = strchr(ptr, '/');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parent) *parent = internal;
|
|
|
|
|
|
|
|
/* find the menu in the parent 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
|
|
|
if (!(internal = eina_list_search_unsorted(internal->sub_menus,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_compare_names),
|
* 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
|
|
|
ptr)))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
* 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 internal;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_path_set(Efreet_Menu_Internal *internal, const char *path)
|
|
|
|
{
|
2010-03-30 05:22:15 -07:00
|
|
|
char *tmp, *p;
|
|
|
|
size_t len;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-30 05:22:15 -07:00
|
|
|
len = strlen(path) + 1;
|
|
|
|
tmp = alloca(len);
|
|
|
|
memcpy(tmp, path, len);
|
2007-02-03 05:05:30 -08:00
|
|
|
p = strrchr(tmp, '/');
|
|
|
|
if (p)
|
|
|
|
{
|
2007-04-04 05:00:40 -07:00
|
|
|
*p = '\0';
|
2007-02-03 05:05:30 -08:00
|
|
|
p++;
|
|
|
|
|
2010-03-13 10:35:39 -08:00
|
|
|
internal->file.path = eina_stringshare_add(tmp);
|
|
|
|
internal->file.name = eina_stringshare_add(p);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_Move struct on success or NULL on failure
|
|
|
|
* @brief Creates an returns a new Efreet_Menu_Move struct or NULL on failure
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_Move *
|
|
|
|
efreet_menu_move_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Move *move;
|
|
|
|
|
|
|
|
move = NEW(Efreet_Menu_Move, 1);
|
|
|
|
|
|
|
|
return move;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param move The Efreet_Menu_Move to free
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns no value.
|
|
|
|
* @brief Frees the given move structure
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
efreet_menu_move_free(Efreet_Menu_Move *move)
|
|
|
|
{
|
|
|
|
if (!move) return;
|
|
|
|
|
2010-03-30 05:21:33 -07:00
|
|
|
IF_RELEASE(move->old_name);
|
|
|
|
IF_RELEASE(move->new_name);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
FREE(move);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* @return Returns a new Efreet_Menu_App_Dir on success or NULL on failure
|
|
|
|
* @brief Creates and initializes a new Efreet_Menu_App_Dir structure
|
|
|
|
*/
|
|
|
|
static Efreet_Menu_App_Dir *
|
|
|
|
efreet_menu_app_dir_new(void)
|
|
|
|
{
|
|
|
|
Efreet_Menu_App_Dir *dir;
|
|
|
|
|
|
|
|
dir = NEW(Efreet_Menu_App_Dir, 1);
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
2009-03-23 05:19:31 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param dir The Efreet_Menu_App_Dir to free
|
2009-03-23 05:19:31 -07:00
|
|
|
* @return Returns no value.
|
|
|
|
* @brief Frees the given dir structure
|
|
|
|
*/
|
2009-03-23 03:27:54 -07:00
|
|
|
static void
|
|
|
|
efreet_menu_app_dir_free(Efreet_Menu_App_Dir *dir)
|
|
|
|
{
|
2009-03-23 05:19:31 -07:00
|
|
|
if (!dir) return;
|
|
|
|
|
2010-03-30 04:06:56 -07:00
|
|
|
IF_RELEASE(dir->path);
|
|
|
|
IF_RELEASE(dir->prefix);
|
2009-03-23 05:19:31 -07:00
|
|
|
FREE(dir);
|
2009-03-23 03:27:54 -07:00
|
|
|
}
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param a The app dir to compare too
|
|
|
|
* @param b The path to compare too
|
2010-01-17 10:56:48 -08:00
|
|
|
* @return Returns 0 if the strings are equals, != 0 otherwise
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Compares the too strings
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_app_dirs_compare(Efreet_Menu_App_Dir *a, const char *b)
|
|
|
|
{
|
2010-01-17 10:56:48 -08:00
|
|
|
if (!a->path || !b) return 1;
|
2011-01-31 03:45:19 -08:00
|
|
|
if (a->path == b) return 0;
|
2010-01-17 10:56:48 -08:00
|
|
|
return strcmp(a->path, b);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_sub_menu_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->sub_menus) return;
|
|
|
|
|
* 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
|
|
|
internal->sub_menus = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_app_dirs_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->app_dirs) return;
|
|
|
|
|
* 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
|
|
|
internal->app_dirs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_directory_dirs_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->directory_dirs) return;
|
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
internal->directory_dirs = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_move_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->moves) return;
|
|
|
|
|
* 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
|
|
|
internal->moves = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_filter_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->filters) return;
|
|
|
|
|
* 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
|
|
|
internal->filters = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_layout_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->layout) return;
|
|
|
|
|
* 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
|
|
|
internal->layout = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_default_layout_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->default_layout) return;
|
|
|
|
|
* 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
|
|
|
internal->default_layout = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_create_directories_list(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (!internal || internal->directories) return;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
internal->directories = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
2010-04-01 12:31:38 -07:00
|
|
|
static const char *
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_path_get(Efreet_Menu_Internal *internal, const char *suffix)
|
|
|
|
{
|
|
|
|
char path[PATH_MAX];
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
/* see if we've got an absolute or relative path */
|
|
|
|
if (suffix[0] == '/')
|
|
|
|
snprintf(path, sizeof(path), "%s", suffix);
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2007-09-06 09:15:10 -07:00
|
|
|
if (!internal->file.path)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2009-09-21 09:36:29 -07:00
|
|
|
INF("efreet_menu_handle_app_dir() missing menu path ...");
|
2007-02-03 05:05:30 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
snprintf(path, sizeof(path), "%s/%s", internal->file.path, suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
len = strlen(path);
|
2007-04-04 05:00:40 -07:00
|
|
|
while (path[len] == '/') path[len--] = '\0';
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-04-01 12:31:38 -07:00
|
|
|
return eina_stringshare_add(path);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_menu_compare(Efreet_Menu_Internal *a, Efreet_Menu_Internal *b)
|
|
|
|
{
|
2010-01-17 10:56:48 -08:00
|
|
|
if (!a->name.internal || !b->name.internal) return 1;
|
2011-01-31 03:45:19 -08:00
|
|
|
if (a->name.internal == b->name.internal) return 0;
|
2010-01-17 10:56:48 -08:00
|
|
|
return strcmp(a->name.internal, b->name.internal);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_app_dirs_process(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
Efreet_Menu_App_Dir *app_dir;
|
* 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_Menu_Desktop *md;
|
|
|
|
Eina_List *l;
|
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_FREE(internal->app_pool, md)
|
2010-02-04 01:12:35 -08:00
|
|
|
efreet_menu_desktop_free(md);
|
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_FOREACH(internal->app_dirs, l, app_dir)
|
2010-02-04 01:12:35 -08:00
|
|
|
efreet_menu_app_dir_scan(internal, app_dir->path, app_dir->prefix, app_dir->legacy);
|
* 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
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const char *id, int legacy)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
Efreet_Menu_Desktop *menu_desktop;
|
2012-01-18 16:35:51 -08:00
|
|
|
char buf2[PATH_MAX];
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_File_Direct_Info *info;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 02:12:25 -07:00
|
|
|
it = eina_file_stat_ls(path);
|
2012-01-18 16:35:51 -08:00
|
|
|
if (!it) return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
EINA_ITERATOR_FOREACH(it, info)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
const char *fname;
|
|
|
|
|
2012-01-18 17:05:33 -08:00
|
|
|
fname = info->path + info->name_start;
|
2007-02-03 05:05:30 -08:00
|
|
|
if (id)
|
2012-01-18 16:35:51 -08:00
|
|
|
snprintf(buf2, sizeof(buf2), "%s-%s", id, fname);
|
2007-02-03 05:05:30 -08:00
|
|
|
else
|
2012-01-18 16:35:51 -08:00
|
|
|
strcpy(buf2, fname);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 02:12:25 -07:00
|
|
|
if (info->type == EINA_FILE_DIR)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
if (!legacy)
|
2012-01-18 16:35:51 -08:00
|
|
|
efreet_menu_app_dir_scan(internal, info->path, buf2, legacy);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
const char *ext;
|
|
|
|
|
|
|
|
ext = strrchr(fname, '.');
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (!ext || strcmp(ext, ".desktop")) continue;
|
2012-01-18 16:35:51 -08:00
|
|
|
desktop = efreet_desktop_get(info->path);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-07-26 04:40:04 -07:00
|
|
|
if (!desktop || desktop->type != EFREET_DESKTOP_TYPE_APPLICATION)
|
|
|
|
{
|
|
|
|
if (desktop) efreet_desktop_free(desktop);
|
|
|
|
continue;
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
/* Don't add two files with the same id in the app pool */
|
* 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(internal->app_pool,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_md_compare_ids),
|
* 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
|
|
|
buf2))
|
2009-06-19 23:19:48 -07:00
|
|
|
{
|
|
|
|
if (desktop) efreet_desktop_free(desktop);
|
* 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
|
|
|
continue;
|
2009-06-19 23:19:48 -07:00
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
menu_desktop = efreet_menu_desktop_new();
|
|
|
|
menu_desktop->desktop = desktop;
|
2008-10-15 07:48:03 -07:00
|
|
|
menu_desktop->id = eina_stringshare_add(buf2);
|
* 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
|
|
|
internal->app_pool = eina_list_prepend(internal->app_pool, menu_desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
|
|
|
* @brief Process the directory dirs in @a menu
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
const char *path;
|
2009-03-26 10:54:50 -07:00
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (internal->directory_dirs)
|
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
internal->directory_cache =
|
2010-02-04 01:12:35 -08:00
|
|
|
eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free));
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(internal->directory_dirs, l, path)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_directory_dir_scan(path, NULL, internal->directory_cache);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (internal->directories)
|
|
|
|
{
|
2009-03-26 10:54:50 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(internal->directories, l, path)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
internal->directory = efreet_menu_directory_get(internal, path);
|
|
|
|
if (internal->directory) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!internal->directory)
|
|
|
|
internal->name.name = internal->name.internal;
|
|
|
|
else
|
|
|
|
internal->name.name = internal->directory->name;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param path The path to scan
|
|
|
|
* @param relative_path The relative portion of the path
|
|
|
|
* @param cache The cache to populate
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns 1 on success or 0 on failure
|
2007-09-06 09:15:10 -07:00
|
|
|
* @brief Scans the given directory dir for .directory files and adds the
|
2007-02-03 05:05:30 -08:00
|
|
|
* applications to the cache
|
|
|
|
*/
|
|
|
|
static int
|
2007-09-06 09:15:10 -07:00
|
|
|
efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
|
2010-02-04 01:12:35 -08:00
|
|
|
Eina_Hash *cache)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
2012-01-18 16:35:51 -08:00
|
|
|
char buf2[PATH_MAX];
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_File_Direct_Info *info;
|
2007-02-03 05:05:30 -08:00
|
|
|
char *ext;
|
|
|
|
|
2012-10-18 02:12:25 -07:00
|
|
|
it = eina_file_stat_ls(path);
|
2012-01-18 16:35:51 -08:00
|
|
|
if (!it) return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
EINA_ITERATOR_FOREACH(it, info)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
const char *fname;
|
|
|
|
|
2012-01-18 17:05:33 -08:00
|
|
|
fname = info->path + info->name_start;
|
2007-02-03 05:05:30 -08:00
|
|
|
if (relative_path)
|
2012-01-18 16:35:51 -08:00
|
|
|
snprintf(buf2, sizeof(buf2), "%s/%s", relative_path, fname);
|
2007-02-03 05:05:30 -08:00
|
|
|
else
|
2012-01-18 16:35:51 -08:00
|
|
|
strcpy(buf2, fname);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2012-10-18 02:12:25 -07:00
|
|
|
if (info->type == EINA_FILE_DIR)
|
2012-01-18 16:35:51 -08:00
|
|
|
efreet_menu_directory_dir_scan(info->path, buf2, cache);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2012-01-18 16:35:51 -08:00
|
|
|
ext = strrchr(fname, '.');
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!ext || strcmp(ext, ".directory")) continue;
|
|
|
|
|
2012-01-18 16:35:51 -08:00
|
|
|
desktop = efreet_desktop_get(info->path);
|
2007-07-26 04:40:04 -07:00
|
|
|
if (!desktop || desktop->type != EFREET_DESKTOP_TYPE_DIRECTORY)
|
|
|
|
{
|
|
|
|
efreet_desktop_free(desktop);
|
|
|
|
continue;
|
|
|
|
}
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-02-04 01:12:35 -08:00
|
|
|
eina_hash_del(cache, buf2, NULL);
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_add(cache, buf2, desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
2012-01-18 16:35:51 -08:00
|
|
|
eina_iterator_free(it);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param menu The menu to work with
|
|
|
|
* @param path The path to work with
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns the desktop file for this path or NULL if none exists
|
|
|
|
* @brief Finds the desktop file for the given path.
|
|
|
|
*/
|
|
|
|
static Efreet_Desktop *
|
|
|
|
efreet_menu_directory_get(Efreet_Menu_Internal *internal, const char *path)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *dir;
|
|
|
|
|
|
|
|
if (internal->directory_cache)
|
|
|
|
{
|
2008-12-17 07:33:43 -08:00
|
|
|
dir = eina_hash_find(internal->directory_cache, path);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (dir) return dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (internal->parent)
|
|
|
|
return efreet_menu_directory_get(internal->parent, path);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2011-01-27 09:49:45 -08:00
|
|
|
* @param a The first desktop
|
|
|
|
* @param b The second desktop
|
2007-02-03 05:05:30 -08:00
|
|
|
* @return Returns the comparison of the desktop files
|
|
|
|
* @brief Compares the desktop files.
|
|
|
|
*/
|
|
|
|
static int
|
2010-01-16 05:43:28 -08:00
|
|
|
efreet_menu_cb_md_compare(const Efreet_Menu_Desktop *a, const Efreet_Menu_Desktop *b)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-04-04 03:41:53 -07:00
|
|
|
#ifdef STRICT_SPEC
|
2007-07-25 10:01:04 -07:00
|
|
|
return strcmp(ecore_file_file_get(a->desktop->orig_path), ecore_file_file_get(b->desktop->orig_path));
|
2007-02-03 05:05:30 -08:00
|
|
|
#else
|
2011-01-31 03:45:19 -08:00
|
|
|
if (a->desktop->name == b->desktop->name) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
return strcasecmp(a->desktop->name, b->desktop->name);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_compare_names(Efreet_Menu_Internal *internal, const char *name)
|
|
|
|
{
|
2011-01-31 03:45:19 -08:00
|
|
|
if (internal->name.internal == name) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
return strcmp(internal->name.internal, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_md_compare_ids(Efreet_Menu_Desktop *md, const char *name)
|
|
|
|
{
|
2011-01-31 03:45:19 -08:00
|
|
|
if (md->id == name) return 0;
|
2007-02-03 05:05:30 -08:00
|
|
|
return strcmp(md->id, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Efreet_Menu *
|
|
|
|
efreet_menu_layout_menu(Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
Efreet_Menu *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
|
|
|
Eina_List *layout = NULL;
|
|
|
|
Eina_List *l;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
if (internal->parent)
|
|
|
|
{
|
|
|
|
/* Copy default layout rules */
|
|
|
|
if (internal->show_empty == -1) internal->show_empty = internal->parent->show_empty;
|
|
|
|
if (internal->in_line == -1) internal->in_line = internal->parent->in_line;
|
|
|
|
if (internal->inline_limit == -1) internal->inline_limit = internal->parent->inline_limit;
|
|
|
|
if (internal->inline_header == -1) internal->inline_header = internal->parent->inline_header;
|
|
|
|
if (internal->inline_alias == -1) internal->inline_alias = internal->parent->inline_alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (internal->layout)
|
|
|
|
layout = internal->layout;
|
|
|
|
|
|
|
|
else if (internal->parent)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *parent;
|
|
|
|
parent = internal->parent;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
layout = parent->default_layout;
|
|
|
|
parent = parent->parent;
|
|
|
|
} while (!layout && parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* init entry */
|
|
|
|
entry = efreet_menu_entry_new();
|
|
|
|
entry->type = EFREET_MENU_ENTRY_MENU;
|
2008-10-15 07:48:03 -07:00
|
|
|
entry->id = eina_stringshare_add(internal->name.internal);
|
|
|
|
entry->name = eina_stringshare_add(internal->name.name);
|
2007-07-26 12:14:41 -07:00
|
|
|
if (internal->directory)
|
|
|
|
{
|
2008-10-15 07:48:03 -07:00
|
|
|
entry->icon = eina_stringshare_add(internal->directory->icon);
|
2007-07-26 12:14:41 -07:00
|
|
|
efreet_desktop_ref(internal->directory);
|
2007-07-26 14:43:43 -07:00
|
|
|
entry->desktop = internal->directory;
|
2007-07-26 12:14:41 -07: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
|
|
|
entry->entries = NULL;
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
#if 1 //STRICT_SPEC
|
|
|
|
if (internal->sub_menus)
|
|
|
|
{
|
* 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
|
|
|
internal->sub_menus = eina_list_sort(internal->sub_menus,
|
|
|
|
0,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_menu_compare));
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (layout)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Layout *lay;
|
|
|
|
|
* 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_FOREACH(layout, l, lay)
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_layout_entries_get(entry, internal, lay);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Default layout, first menus, then desktop */
|
|
|
|
if (internal->sub_menus)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *sub;
|
|
|
|
|
* 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_FOREACH(internal->sub_menus, l, sub)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu *sub_entry;
|
|
|
|
if ((sub->directory && sub->directory->no_display) || sub->deleted) continue;
|
|
|
|
sub_entry = efreet_menu_layout_menu(sub);
|
|
|
|
/* Don't show empty menus */
|
2007-04-14 21:54:45 -07:00
|
|
|
if (!sub_entry->entries)
|
|
|
|
{
|
|
|
|
efreet_menu_free(sub_entry);
|
|
|
|
continue;
|
|
|
|
}
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (internal->applications)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Desktop *md;
|
|
|
|
|
* 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_FOREACH(internal->applications, l, md)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
Efreet_Menu *sub_entry;
|
|
|
|
sub_entry = efreet_menu_layout_desktop(md);
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Don't keep this list around if it is empty */
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Efreet_Menu *
|
|
|
|
efreet_menu_layout_desktop(Efreet_Menu_Desktop *md)
|
|
|
|
{
|
|
|
|
Efreet_Menu *entry;
|
|
|
|
|
|
|
|
/* init entry */
|
|
|
|
entry = efreet_menu_entry_new();
|
|
|
|
entry->type = EFREET_MENU_ENTRY_DESKTOP;
|
2008-10-15 07:48:03 -07:00
|
|
|
entry->id = eina_stringshare_add(md->id);
|
|
|
|
entry->name = eina_stringshare_add(md->desktop->name);
|
|
|
|
if (md->desktop->icon) entry->icon = eina_stringshare_add(md->desktop->icon);
|
2007-07-26 12:14:41 -07:00
|
|
|
efreet_desktop_ref(md->desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
entry->desktop = md->desktop;
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_menu_layout_entries_get(Efreet_Menu *entry, Efreet_Menu_Internal *internal,
|
|
|
|
Efreet_Menu_Layout *layout)
|
|
|
|
{
|
|
|
|
Efreet_Menu *sub_entry;
|
|
|
|
|
|
|
|
if (internal->sub_menus && layout->type == EFREET_MENU_LAYOUT_MENUNAME)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *sub;
|
|
|
|
|
|
|
|
/* Efreet_Menu_Layout might be from DefaultLayout, so we need a local copy */
|
|
|
|
int show_empty, in_line, inline_limit, inline_header, inline_alias;
|
|
|
|
|
|
|
|
if (layout->show_empty == -1) show_empty = internal->show_empty;
|
|
|
|
else show_empty = layout->show_empty;
|
|
|
|
|
|
|
|
if (layout->in_line == -1) in_line = internal->in_line;
|
|
|
|
else in_line = layout->in_line;
|
|
|
|
|
|
|
|
if (layout->inline_limit == -1) inline_limit = internal->inline_limit;
|
|
|
|
else inline_limit = layout->inline_limit;
|
|
|
|
|
|
|
|
if (layout->inline_header == -1) inline_header = internal->inline_header;
|
|
|
|
else inline_header = layout->inline_header;
|
|
|
|
|
|
|
|
if (layout->inline_alias == -1) inline_alias = internal->inline_alias;
|
|
|
|
else inline_alias = layout->inline_alias;
|
|
|
|
|
* 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
|
|
|
sub = eina_list_search_unsorted(internal->sub_menus,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_compare_names), layout->name);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (sub)
|
|
|
|
{
|
|
|
|
if (!(sub->directory && sub->directory->no_display) && !sub->deleted)
|
|
|
|
{
|
|
|
|
sub_entry = efreet_menu_layout_menu(sub);
|
2008-01-17 14:38:46 -08:00
|
|
|
if (!show_empty && efreet_menu_layout_is_empty(sub_entry))
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_free(sub_entry);
|
|
|
|
else if (in_line &&
|
|
|
|
((inline_limit == 0) ||
|
2010-03-25 22:29:15 -07:00
|
|
|
(!sub_entry->entries ||
|
|
|
|
(inline_limit > 0 && eina_list_count(sub_entry->entries) <= (unsigned int)inline_limit))))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
/* Inline */
|
2007-05-02 12:35:43 -07:00
|
|
|
if (!sub_entry->entries)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
/* Can't inline an empty submenu */
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
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
|
|
|
else if (inline_alias && (eina_list_count(sub_entry->entries) == 1))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
Efreet_Menu *tmp;
|
|
|
|
|
* 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
|
|
|
tmp = eina_list_data_get(sub_entry->entries);
|
|
|
|
sub_entry->entries = eina_list_remove_list(sub_entry->entries, sub_entry->entries);
|
2007-05-02 12:35:43 -07:00
|
|
|
IF_RELEASE(tmp->name);
|
|
|
|
tmp->name = sub_entry->name;
|
|
|
|
sub_entry->name = NULL;
|
|
|
|
IF_RELEASE(tmp->icon);
|
|
|
|
tmp->icon = sub_entry->icon;
|
|
|
|
sub_entry->icon = NULL;
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
2007-05-02 12:35:43 -07:00
|
|
|
efreet_menu_free(sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
Efreet_Menu *tmp;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
if (inline_header)
|
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
tmp = efreet_menu_entry_new();
|
|
|
|
tmp->type = EFREET_MENU_ENTRY_HEADER;
|
|
|
|
tmp->name = sub_entry->name;
|
|
|
|
sub_entry->name = NULL;
|
|
|
|
tmp->icon = sub_entry->icon;
|
|
|
|
sub_entry->icon = NULL;
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
|
|
|
}
|
|
|
|
while ((tmp = eina_list_data_get(sub_entry->entries)))
|
|
|
|
{
|
|
|
|
sub_entry->entries = eina_list_remove_list(sub_entry->entries, sub_entry->entries);
|
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-05-02 12:35:43 -07:00
|
|
|
efreet_menu_free(sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
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
|
|
|
internal->sub_menus = eina_list_remove(internal->sub_menus, sub);
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_internal_free(sub);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (internal->applications && layout->type == EFREET_MENU_LAYOUT_FILENAME)
|
|
|
|
{
|
|
|
|
Efreet_Menu_Desktop *md;
|
* 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
|
|
|
md = eina_list_search_unsorted(internal->applications,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_md_compare_ids), layout->name);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (md)
|
|
|
|
{
|
|
|
|
sub_entry = efreet_menu_layout_desktop(md);
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
|
|
|
internal->applications = eina_list_remove(internal->applications, md);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (layout->type == EFREET_MENU_LAYOUT_MERGE)
|
|
|
|
{
|
|
|
|
if (internal->applications && !strcmp(layout->name, "files"))
|
|
|
|
{
|
|
|
|
Efreet_Menu_Desktop *md;
|
|
|
|
|
* 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
|
|
|
while ((md = eina_list_data_get(internal->applications)))
|
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
|
|
|
internal->applications = eina_list_remove_list(internal->applications,
|
|
|
|
internal->applications);
|
|
|
|
sub_entry = eina_list_search_unsorted(entry->entries,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_entry_compare_desktop),
|
* 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
|
|
|
md->desktop);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!sub_entry)
|
|
|
|
{
|
|
|
|
sub_entry = efreet_menu_layout_desktop(md);
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
2009-03-23 05:19:31 -07:00
|
|
|
internal->applications = eina_list_free(internal->applications);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else if (internal->sub_menus && !strcmp(layout->name, "menus"))
|
|
|
|
{
|
|
|
|
Efreet_Menu_Internal *sub;
|
|
|
|
|
* 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
|
|
|
while ((sub = eina_list_data_get(internal->sub_menus)))
|
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
|
|
|
internal->sub_menus = eina_list_remove_list(internal->sub_menus, internal->sub_menus);
|
2007-02-03 05:05:30 -08:00
|
|
|
if ((sub->directory && sub->directory->no_display) || sub->deleted)
|
|
|
|
{
|
|
|
|
efreet_menu_internal_free(sub);
|
|
|
|
continue;
|
|
|
|
}
|
* 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
|
|
|
sub_entry = eina_list_search_unsorted(entry->entries,
|
2009-03-26 10:56:51 -07:00
|
|
|
EINA_COMPARE_CB(efreet_menu_cb_entry_compare_menu),
|
* 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
|
|
|
sub);
|
2007-02-03 05:05:30 -08:00
|
|
|
if (!sub_entry)
|
|
|
|
{
|
|
|
|
sub_entry = efreet_menu_layout_menu(sub);
|
2008-01-17 14:38:46 -08:00
|
|
|
if (!internal->show_empty && efreet_menu_layout_is_empty(sub_entry))
|
2007-02-03 05:05:30 -08:00
|
|
|
efreet_menu_free(sub_entry);
|
|
|
|
else if (internal->in_line &&
|
|
|
|
((internal->inline_limit == 0) ||
|
2010-03-25 22:29:15 -07:00
|
|
|
(!sub_entry->entries ||
|
|
|
|
(internal->inline_limit > 0 && eina_list_count(sub_entry->entries) <= (unsigned int)internal->inline_limit))))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
/* Inline */
|
2007-05-02 12:35:43 -07:00
|
|
|
if (!sub_entry->entries)
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
/* Can't inline an empty submenu */
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
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
|
|
|
else if (internal->inline_alias && (eina_list_count(sub_entry->entries) == 1))
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
Efreet_Menu *tmp;
|
|
|
|
|
* 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
|
|
|
tmp = eina_list_data_get(sub_entry->entries);
|
|
|
|
sub_entry->entries = eina_list_remove_list(sub_entry->entries, sub_entry->entries);
|
2008-10-15 07:48:03 -07:00
|
|
|
eina_stringshare_del(tmp->name);
|
2007-05-02 12:35:43 -07:00
|
|
|
tmp->name = sub_entry->name;
|
|
|
|
sub_entry->name = NULL;
|
|
|
|
IF_RELEASE(tmp->icon);
|
|
|
|
if (sub_entry->icon)
|
|
|
|
{
|
|
|
|
tmp->icon = sub_entry->icon;
|
|
|
|
sub_entry->icon = NULL;
|
|
|
|
}
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
2007-05-02 12:35:43 -07:00
|
|
|
efreet_menu_free(sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
Efreet_Menu *tmp;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
if (internal->inline_header)
|
|
|
|
{
|
2007-05-02 12:35:43 -07:00
|
|
|
tmp = efreet_menu_entry_new();
|
|
|
|
tmp->type = EFREET_MENU_ENTRY_HEADER;
|
|
|
|
tmp->name = sub_entry->name;
|
|
|
|
sub_entry->name = NULL;
|
|
|
|
if (sub_entry->icon) tmp->icon = sub_entry->icon;
|
|
|
|
sub_entry->icon = NULL;
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
|
|
|
}
|
|
|
|
while ((tmp = eina_list_data_get(sub_entry->entries)))
|
|
|
|
{
|
|
|
|
sub_entry->entries = eina_list_remove_list(sub_entry->entries,
|
|
|
|
sub_entry->entries);
|
|
|
|
entry->entries = eina_list_append(entry->entries, tmp);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2007-05-02 12:35:43 -07:00
|
|
|
efreet_menu_free(sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
efreet_menu_internal_free(sub);
|
|
|
|
}
|
2009-03-23 05:19:31 -07:00
|
|
|
IF_FREE_LIST(internal->sub_menus, efreet_menu_internal_free);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
else if (internal->sub_menus && !strcmp(layout->name, "all"))
|
|
|
|
{
|
2010-04-01 12:30:13 -07:00
|
|
|
const char *orig;
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-05-05 00:49:01 -07:00
|
|
|
orig = layout->name;
|
|
|
|
layout->name = "menus";
|
|
|
|
efreet_menu_layout_entries_get(entry, internal, layout);
|
|
|
|
layout->name = "files";
|
|
|
|
efreet_menu_layout_entries_get(entry, internal, layout);
|
|
|
|
layout->name = orig;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (layout->type == EFREET_MENU_LAYOUT_SEPARATOR)
|
|
|
|
{
|
|
|
|
sub_entry = efreet_menu_entry_new();
|
|
|
|
sub_entry->type = EFREET_MENU_ENTRY_SEPARATOR;
|
* 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
|
|
|
entry->entries = eina_list_append(entry->entries, sub_entry);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_entry_compare_menu(Efreet_Menu *entry, Efreet_Menu_Internal *internal)
|
|
|
|
{
|
|
|
|
if (entry->type != EFREET_MENU_ENTRY_MENU) return 1;
|
2010-01-17 10:56:48 -08:00
|
|
|
if (!entry->name || !internal->name.name) return 1;
|
2011-01-31 03:45:19 -08:00
|
|
|
if (entry->name == internal->name.name) return 0;
|
2010-01-17 10:56:48 -08:00
|
|
|
return strcmp(entry->name, internal->name.name);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_entry_compare_desktop(Efreet_Menu *entry, Efreet_Desktop *desktop)
|
|
|
|
{
|
|
|
|
if (entry->type != EFREET_MENU_ENTRY_DESKTOP) return -1;
|
2010-01-17 10:56:48 -08:00
|
|
|
if (!entry->name || !desktop->name) return -1;
|
2011-01-31 03:45:19 -08:00
|
|
|
if (entry->name == desktop->name) return 0;
|
2010-01-17 10:56:48 -08:00
|
|
|
return strcmp(entry->name, desktop->name);
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_cb_move_compare(Efreet_Menu_Move *move, const char *old)
|
|
|
|
{
|
2010-01-17 10:56:48 -08:00
|
|
|
if (!move->old_name || !old) return 1;
|
2010-03-30 05:21:55 -07:00
|
|
|
if (move->old_name == old) return 0;
|
|
|
|
return 1;
|
2007-02-03 05:05:30 -08:00
|
|
|
}
|
2008-01-17 14:38:46 -08:00
|
|
|
|
|
|
|
static int
|
|
|
|
efreet_menu_layout_is_empty(Efreet_Menu *entry)
|
|
|
|
{
|
|
|
|
Efreet_Menu *sub_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
|
|
|
Eina_List *l;
|
2008-01-17 14:38:46 -08:00
|
|
|
|
|
|
|
if (!entry->entries) return 1;
|
|
|
|
|
* 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_FOREACH(entry->entries, l, sub_entry)
|
2008-01-17 14:38:46 -08:00
|
|
|
{
|
|
|
|
if (sub_entry->type == EFREET_MENU_ENTRY_MENU) return 0;
|
|
|
|
if (sub_entry->type == EFREET_MENU_ENTRY_DESKTOP) return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|