2007-02-03 05:05:30 -08:00
|
|
|
/* vim: set sw=4 ts=4 sts=4 et: */
|
|
|
|
#ifndef EFREET_PRIVATE_H
|
|
|
|
#define EFREET_PRIVATE_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file efreet_private.h
|
|
|
|
* @brief Contains methods and defines that are private to the Efreet
|
|
|
|
* implementaion
|
|
|
|
* @addtogroup Efreet_Private Efreet_Private: Private methods and defines
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2007-08-12 03:00:02 -07:00
|
|
|
#include "config.h"
|
2007-02-03 05:05:30 -08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/types.h>
|
2007-03-26 09:17:40 -07:00
|
|
|
#include <sys/stat.h>
|
2007-02-03 05:05:30 -08:00
|
|
|
#include <dirent.h>
|
2007-03-25 12:01:45 -07:00
|
|
|
#include <fnmatch.h>
|
2007-03-26 09:17:40 -07:00
|
|
|
#include <limits.h>
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2007-08-12 03:00:02 -07:00
|
|
|
#ifdef HAVE_ALLOCA_H
|
|
|
|
#include <alloca.h>
|
|
|
|
#endif
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_File.h>
|
2007-03-26 09:17:40 -07:00
|
|
|
#include <Ecore_Str.h>
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
#include "efreet_xml.h"
|
|
|
|
#include "efreet_ini.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @def NEW(x, c)
|
|
|
|
* Allocate and zero out c structures of type x
|
|
|
|
*/
|
|
|
|
#define NEW(x, c) calloc(c, sizeof(x))
|
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def FREE(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* Free x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define FREE(x) do { free(x); x = NULL; } while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE(x)
|
|
|
|
* If x is set, free x and set to NULL
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE(x) do { if (x) FREE(x); } while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @def IF_RELEASE(x)
|
|
|
|
* If x is set, ecore_string_release x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_RELEASE(x) do { \
|
|
|
|
if (x) { \
|
|
|
|
const char *__tmp; __tmp = (x); (x) = NULL; ecore_string_release(__tmp); \
|
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE_LIST(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* If x is a valid pointer destroy x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE_LIST(x) do { \
|
|
|
|
if (x) { \
|
|
|
|
Ecore_List *__tmp; __tmp = (x); (x) = NULL; ecore_list_destroy(__tmp); \
|
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE_DLIST(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* If x is a valid pointer destroy x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE_DLIST(x) do { \
|
|
|
|
if (x) { \
|
|
|
|
Ecore_DList *__tmp; __tmp = (x); (x) = NULL; ecore_dlist_destroy(__tmp); \
|
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE_HASH(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* If x is a valid pointer destroy x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE_HASH(x) do { \
|
|
|
|
if (x) { \
|
|
|
|
Ecore_Hash *__tmp; __tmp = (x); (x) = NULL; ecore_hash_destroy(__tmp); \
|
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @def __UNUSED__
|
|
|
|
* A flag to mark a function parameter as unused
|
|
|
|
*/
|
|
|
|
#if HAVE___ATTRIBUTE__
|
|
|
|
#define __UNUSED__ __attribute__((unused))
|
|
|
|
#else
|
|
|
|
#define __UNUSED__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
/**
|
|
|
|
* @def PATH_MAX
|
|
|
|
* Convenience define to set the maximim path length
|
|
|
|
*/
|
|
|
|
#define PATH_MAX 4096
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* The different types of commands in an Exec entry
|
|
|
|
*/
|
2007-09-06 09:15:10 -07:00
|
|
|
enum Efreet_Desktop_Command_Flag
|
2007-02-03 05:05:30 -08:00
|
|
|
{
|
|
|
|
EFREET_DESKTOP_EXEC_FLAG_FULLPATH = 0x0001,
|
|
|
|
EFREET_DESKTOP_EXEC_FLAG_URI = 0x0002,
|
|
|
|
EFREET_DESKTOP_EXEC_FLAG_DIR = 0x0004,
|
|
|
|
EFREET_DESKTOP_EXEC_FLAG_FILE = 0x0008
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Efreet_Desktop_Command_Flag
|
|
|
|
*/
|
|
|
|
typedef enum Efreet_Desktop_Command_Flag Efreet_Desktop_Command_Flag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Efreet_Desktop_Command
|
|
|
|
*/
|
|
|
|
typedef struct Efreet_Desktop_Command Efreet_Desktop_Command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Holds information on a desktop Exec command entry
|
|
|
|
*/
|
|
|
|
struct Efreet_Desktop_Command
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
int num_pending;
|
|
|
|
|
|
|
|
Efreet_Desktop_Command_Flag flags;
|
|
|
|
|
|
|
|
Efreet_Desktop_Command_Cb cb_command;
|
|
|
|
Efreet_Desktop_Progress_Cb cb_progress;
|
|
|
|
void *data;
|
|
|
|
|
|
|
|
Ecore_List *files; /**< list of Efreet_Desktop_Command_File */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Efreet_Desktop_Command_File
|
|
|
|
*/
|
|
|
|
typedef struct Efreet_Desktop_Command_File Efreet_Desktop_Command_File;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Stores information on a file passed to the desktop Exec command
|
|
|
|
*/
|
|
|
|
struct Efreet_Desktop_Command_File
|
|
|
|
{
|
|
|
|
Efreet_Desktop_Command *command;
|
|
|
|
char *dir;
|
|
|
|
char *file;
|
|
|
|
char *fullpath;
|
|
|
|
char *uri;
|
|
|
|
|
|
|
|
int pending;
|
|
|
|
};
|
|
|
|
|
|
|
|
int efreet_base_init(void);
|
|
|
|
void efreet_base_shutdown(void);
|
|
|
|
|
|
|
|
int efreet_icon_init(void);
|
|
|
|
void efreet_icon_shutdown(void);
|
|
|
|
|
|
|
|
int efreet_menu_init(void);
|
|
|
|
void efreet_menu_shutdown(void);
|
2007-09-06 09:15:10 -07:00
|
|
|
Ecore_List *efreet_default_dirs_get(const char *user_dir,
|
|
|
|
Ecore_List *system_dirs,
|
2007-02-06 17:12:25 -08:00
|
|
|
const char *suffix);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
int efreet_ini_init(void);
|
|
|
|
int efreet_ini_shutdown(void);
|
|
|
|
|
|
|
|
int efreet_desktop_init(void);
|
|
|
|
int efreet_desktop_shutdown(void);
|
|
|
|
|
|
|
|
const char *efreet_home_dir_get(void);
|
|
|
|
|
|
|
|
const char *efreet_lang_get(void);
|
|
|
|
const char *efreet_lang_country_get(void);
|
|
|
|
const char *efreet_lang_modifier_get(void);
|
|
|
|
|
|
|
|
size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);
|
|
|
|
|
2007-07-17 08:07:59 -07:00
|
|
|
const char *efreet_desktop_environment_get(void);
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|