forked from enlightenment/enlightenment
parent
21d37fcbbc
commit
118d57ac9d
|
@ -3,51 +3,51 @@
|
|||
typedef struct _E_Config_Data
|
||||
{
|
||||
const char *title, *icon, *dialog, *filename;
|
||||
Eina_Bool show_autostart;
|
||||
Eina_Bool show_autostart;
|
||||
} E_Config_Data;
|
||||
|
||||
typedef struct _E_Config_App_List
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_Object *o_list, *o_add, *o_del, *o_desc;
|
||||
Eina_List *desks;
|
||||
Evas_Object *o_list, *o_add, *o_del, *o_desc;
|
||||
Eina_List *desks;
|
||||
} E_Config_App_List;
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
E_Config_Data *data;
|
||||
Evas_Object *o_list, *o_up, *o_down, *o_del;
|
||||
Eina_List *apps;
|
||||
Ecore_Timer *fill_delay;
|
||||
E_Config_Data *data;
|
||||
Evas_Object *o_list, *o_up, *o_down, *o_del;
|
||||
Eina_List *apps;
|
||||
Ecore_Timer *fill_delay;
|
||||
E_Config_App_List apps_user;
|
||||
E_Config_App_List apps_xdg; /* xdg autostart apps */
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
static E_Config_Dialog *_create_dialog(E_Container *con, E_Config_Data *data);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Eina_List *_load_menu(const char *path);
|
||||
static Eina_List *_load_order(const char *path);
|
||||
static int _save_menu(E_Config_Dialog_Data *cfdata);
|
||||
static int _save_order(E_Config_Dialog_Data *cfdata);
|
||||
static void _fill_apps_list(E_Config_App_List *apps);
|
||||
static void _fill_xdg_list(E_Config_App_List *apps);
|
||||
static void _fill_order_list(E_Config_Dialog_Data *cfdata);
|
||||
static void _cb_apps_list_selected(void *data);
|
||||
static void _cb_order_list_selected(void *data);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static int _cb_desks_name(const void *data1, const void *data2);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _cb_add(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_del(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_up(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_down(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_order_del(void *data, void *data2 __UNUSED__);
|
||||
static Eina_Bool _cb_fill_delay(void *data);
|
||||
static void _list_items_state_set(E_Config_App_List *apps);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Eina_List *_load_menu(const char *path);
|
||||
static Eina_List *_load_order(const char *path);
|
||||
static int _save_menu(E_Config_Dialog_Data *cfdata);
|
||||
static int _save_order(E_Config_Dialog_Data *cfdata);
|
||||
static void _fill_apps_list(E_Config_App_List *apps);
|
||||
static void _fill_xdg_list(E_Config_App_List *apps);
|
||||
static void _fill_order_list(E_Config_Dialog_Data *cfdata);
|
||||
static void _cb_apps_list_selected(void *data);
|
||||
static void _cb_order_list_selected(void *data);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static int _cb_desks_name(const void *data1, const void *data2);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _cb_add(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_del(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_up(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_down(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_order_del(void *data, void *data2 __UNUSED__);
|
||||
static Eina_Bool _cb_fill_delay(void *data);
|
||||
static void _list_items_state_set(E_Config_App_List *apps);
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_apps_add(E_Container *con, const char *params __UNUSED__)
|
||||
|
@ -157,7 +157,7 @@ _create_dialog(E_Container *con, E_Config_Data *data)
|
|||
v->basic.apply_cfdata = _basic_apply;
|
||||
|
||||
cfd = e_config_dialog_new(con, data->title, "E", data->dialog,
|
||||
data->icon, 0, v, data);
|
||||
data->icon, 0, v, data);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
|
@ -219,30 +219,30 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
|
||||
if (cfdata->data->show_autostart)
|
||||
{
|
||||
/* XDG autostart page */
|
||||
ot = e_widget_table_add(evas, EINA_FALSE);
|
||||
cfdata->apps_xdg.o_list = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
e_widget_ilist_multi_select_set(cfdata->apps_xdg.o_list, EINA_TRUE);
|
||||
e_widget_size_min_get(cfdata->apps_xdg.o_list, &mw, NULL);
|
||||
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_list, mw, (75 * e_scale));
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_list, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
/* XDG autostart page */
|
||||
ot = e_widget_table_add(evas, EINA_FALSE);
|
||||
cfdata->apps_xdg.o_list = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
e_widget_ilist_multi_select_set(cfdata->apps_xdg.o_list, EINA_TRUE);
|
||||
e_widget_size_min_get(cfdata->apps_xdg.o_list, &mw, NULL);
|
||||
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_list, mw, (75 * e_scale));
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_list, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
|
||||
cfdata->apps_xdg.o_desc = e_widget_textblock_add(evas);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_desc, 100, (45 * e_scale));
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_desc, 0, 1, 2, 1, 1, 1, 0, 0);
|
||||
cfdata->apps_xdg.o_desc = e_widget_textblock_add(evas);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_desc, 100, (45 * e_scale));
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_desc, 0, 1, 2, 1, 1, 1, 0, 0);
|
||||
|
||||
cfdata->apps_xdg.o_add = e_widget_button_add(evas, _("Add"), "list-add",
|
||||
_cb_add, &cfdata->apps_xdg, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_xdg.o_add, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_add, 0, 2, 1, 1, 1, 1, 1, 0);
|
||||
cfdata->apps_xdg.o_del = e_widget_button_add(evas, _("Remove"), "list-remove",
|
||||
_cb_del, &cfdata->apps_xdg, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_xdg.o_del, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_del, 1, 2, 1, 1, 1, 1, 1, 0);
|
||||
cfdata->apps_xdg.o_add = e_widget_button_add(evas, _("Add"), "list-add",
|
||||
_cb_add, &cfdata->apps_xdg, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_xdg.o_add, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_add, 0, 2, 1, 1, 1, 1, 1, 0);
|
||||
cfdata->apps_xdg.o_del = e_widget_button_add(evas, _("Remove"), "list-remove",
|
||||
_cb_del, &cfdata->apps_xdg, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_xdg.o_del, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_xdg.o_del, 1, 2, 1, 1, 1, 1, 1, 0);
|
||||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("System"), ot,
|
||||
1, 1, 1, 1, 0.5, 0.0);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("System"), ot,
|
||||
1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
|
||||
/* Selection page */
|
||||
|
@ -254,11 +254,11 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_size_min_set(cfdata->apps_user.o_list, mw, (75 * e_scale));
|
||||
e_widget_table_object_append(ot, cfdata->apps_user.o_list, 0, 0, 2, 1, 1, 1, 1, 1);
|
||||
cfdata->apps_user.o_add = e_widget_button_add(evas, _("Add"), "list-add",
|
||||
_cb_add, &cfdata->apps_user, NULL);
|
||||
_cb_add, &cfdata->apps_user, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_user.o_add, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_user.o_add, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
cfdata->apps_user.o_del = e_widget_button_add(evas, _("Remove"), "list-remove",
|
||||
_cb_del, &cfdata->apps_user, NULL);
|
||||
_cb_del, &cfdata->apps_user, NULL);
|
||||
e_widget_disabled_set(cfdata->apps_user.o_del, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->apps_user.o_del, 1, 1, 1, 1, 1, 1, 1, 0);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Applications"), ot,
|
||||
|
@ -278,7 +278,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_disabled_set(cfdata->o_down, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->o_down, 1, 1, 1, 1, 1, 1, 1, 0);
|
||||
cfdata->o_del = e_widget_button_add(evas, _("Remove"), "list-remove",
|
||||
_cb_order_del, cfdata, NULL);
|
||||
_cb_order_del, cfdata, NULL);
|
||||
e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
|
||||
e_widget_table_object_append(ot, cfdata->o_del, 2, 1, 1, 1, 1, 1, 1, 0);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Order"), ot,
|
||||
|
@ -409,7 +409,7 @@ _list_items_state_set(E_Config_App_List *apps)
|
|||
end = NULL;
|
||||
}
|
||||
|
||||
if (!end) break;
|
||||
if (!end) break;
|
||||
|
||||
if (eina_list_search_unsorted(apps->cfdata->apps, _cb_desks_sort, desk))
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ _list_items_state_set(E_Config_App_List *apps)
|
|||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(end, "e,state,unchecked", "e");
|
||||
edje_object_signal_emit(end, "e,state,unchecked", "e");
|
||||
}
|
||||
|
||||
icon = e_util_desktop_icon_add(desk, 24, evas);
|
||||
|
@ -486,19 +486,19 @@ _fill_xdg_list(E_Config_App_List *apps)
|
|||
files = ecore_file_ls(path);
|
||||
EINA_LIST_FREE(files, file)
|
||||
{
|
||||
Eina_List *ll;
|
||||
Eina_List *ll;
|
||||
|
||||
if ((file[0] == '.') || !(ext = strrchr(file, '.')) || (strcmp(ext, ".desktop")))
|
||||
{
|
||||
free(file);
|
||||
continue;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/%s", path, file);
|
||||
free(file);
|
||||
if ((file[0] == '.') || !(ext = strrchr(file, '.')) || (strcmp(ext, ".desktop")))
|
||||
{
|
||||
free(file);
|
||||
continue;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/%s", path, file);
|
||||
free(file);
|
||||
|
||||
desk = efreet_desktop_new(buf);
|
||||
if (!desk)
|
||||
continue;
|
||||
desk = efreet_desktop_new(buf);
|
||||
if (!desk)
|
||||
continue;
|
||||
|
||||
ll = eina_list_search_unsorted_list(apps->desks, _cb_desks_sort, desk);
|
||||
if (ll)
|
||||
|
@ -576,13 +576,13 @@ _cb_apps_list_selected(void *data)
|
|||
|
||||
if (apps->o_desc)
|
||||
{
|
||||
Efreet_Desktop *desk;
|
||||
int sel;
|
||||
Efreet_Desktop *desk;
|
||||
int sel;
|
||||
|
||||
sel = e_widget_ilist_selected_get(apps->o_list);
|
||||
desk = eina_list_nth(apps->desks, sel);
|
||||
if (desk)
|
||||
e_widget_textblock_markup_set(apps->o_desc, desk->comment);
|
||||
sel = e_widget_ilist_selected_get(apps->o_list);
|
||||
desk = eina_list_nth(apps->desks, sel);
|
||||
if (desk)
|
||||
e_widget_textblock_markup_set(apps->o_desc, desk->comment);
|
||||
}
|
||||
|
||||
e_widget_disabled_set(apps->o_add, !disabled);
|
||||
|
@ -697,15 +697,15 @@ _cb_order_del(void *data, void *data2 __UNUSED__)
|
|||
if (!(cfdata = data)) return;
|
||||
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_list), l, it)
|
||||
{
|
||||
Efreet_Desktop *desk;
|
||||
Efreet_Desktop *desk;
|
||||
|
||||
if ((!it->selected) || (it->header)) continue;
|
||||
|
||||
if ((desk = eina_list_search_unsorted(cfdata->apps, _cb_desks_name, it->label)))
|
||||
{
|
||||
cfdata->apps = eina_list_remove(cfdata->apps, desk);
|
||||
efreet_desktop_unref(desk);
|
||||
}
|
||||
if ((desk = eina_list_search_unsorted(cfdata->apps, _cb_desks_name, it->label)))
|
||||
{
|
||||
cfdata->apps = eina_list_remove(cfdata->apps, desk);
|
||||
efreet_desktop_unref(desk);
|
||||
}
|
||||
}
|
||||
|
||||
_list_items_state_set(&(cfdata->apps_xdg));
|
||||
|
@ -824,12 +824,13 @@ _cb_fill_delay(void *data)
|
|||
|
||||
if (cfdata->data->show_autostart)
|
||||
{
|
||||
_fill_xdg_list(&cfdata->apps_xdg);
|
||||
e_widget_size_min_get(cfdata->apps_xdg.o_list, &mw, NULL);
|
||||
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_list, mw, (175 * e_scale));
|
||||
_fill_xdg_list(&cfdata->apps_xdg);
|
||||
e_widget_size_min_get(cfdata->apps_xdg.o_list, &mw, NULL);
|
||||
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
||||
e_widget_size_min_set(cfdata->apps_xdg.o_list, mw, (175 * e_scale));
|
||||
}
|
||||
|
||||
cfdata->fill_delay = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,57 +11,58 @@ struct _Config_Glob
|
|||
struct _Config_Mime
|
||||
{
|
||||
const char *mime;
|
||||
Eina_List *globs;
|
||||
Eina_List *globs;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Evas_Object *deflist, *mimelist, *entry;
|
||||
} obj;
|
||||
Efreet_Ini *ini;
|
||||
Eina_List *mimes;
|
||||
Eina_List *desks;
|
||||
Efreet_Ini *ini;
|
||||
Eina_List *mimes;
|
||||
Eina_List *desks;
|
||||
|
||||
const char *selmime;
|
||||
const char *selapp;
|
||||
|
||||
const char **seldest;
|
||||
|
||||
char *browser_custom;
|
||||
|
||||
const char *browser_desktop;
|
||||
const char *mailto_desktop;
|
||||
const char *file_desktop;
|
||||
const char *trash_desktop;
|
||||
|
||||
const char *selmime;
|
||||
const char *selapp;
|
||||
|
||||
const char **seldest;
|
||||
|
||||
char *browser_custom;
|
||||
|
||||
const char *browser_desktop;
|
||||
const char *mailto_desktop;
|
||||
const char *file_desktop;
|
||||
const char *trash_desktop;
|
||||
|
||||
Ecore_Event_Handler *desk_change_handler;
|
||||
int gen;
|
||||
int gen;
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static Eina_Bool _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__);
|
||||
static void _load_mimes(E_Config_Dialog_Data *cfdata, char *file);
|
||||
static void _load_globs(E_Config_Dialog_Data *cfdata, char *file);
|
||||
static int _sort_mimes(const void *data1, const void *data2);
|
||||
static Eina_Bool _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__);
|
||||
static void _load_mimes(E_Config_Dialog_Data *cfdata, char *file);
|
||||
static void _load_globs(E_Config_Dialog_Data *cfdata, char *file);
|
||||
static int _sort_mimes(const void *data1, const void *data2);
|
||||
static Config_Mime *_find_mime(E_Config_Dialog_Data *cfdata, char *mime);
|
||||
static Config_Glob *_find_glob(Config_Mime *mime, char *glob);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desktop, int general);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desktop, int general);
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_defapps(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
|
||||
if (e_config_dialog_find("E", "applications/default_applications"))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _create_data;
|
||||
|
@ -71,7 +72,7 @@ e_int_config_defapps(E_Container *con, const char *params __UNUSED__)
|
|||
|
||||
cfd = e_config_dialog_new(con, _("Default Applications"),
|
||||
"E", "applications/default_applications",
|
||||
"preferences-applications-default", 0, v, NULL);
|
||||
"preferences-applications-default", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
|
@ -85,13 +86,13 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
const char *key, *s, *homedir;
|
||||
Eina_List *l;
|
||||
E_Config_Env_Var *evr;
|
||||
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
if (!cfdata) return NULL;
|
||||
|
||||
|
||||
cfdata->desk_change_handler = ecore_event_handler_add
|
||||
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desks_update, cfdata);
|
||||
|
||||
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desks_update, cfdata);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/applications/defaults.list",
|
||||
efreet_data_home_get());
|
||||
myini = efreet_ini_new(buf);
|
||||
|
@ -140,30 +141,30 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
if (!strcmp(evr->var, "BROWSER"))
|
||||
{
|
||||
if ((evr->val) && (!evr->unset))
|
||||
cfdata->browser_custom = strdup(evr->val);
|
||||
cfdata->browser_custom = strdup(evr->val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
homedir = e_user_homedir_get();
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "/usr/local/etc/mime.types");
|
||||
if (ecore_file_exists(buf)) _load_mimes(cfdata, buf);
|
||||
snprintf(buf, sizeof(buf), "/etc/mime.types");
|
||||
if (ecore_file_exists(buf)) _load_mimes(cfdata, buf);
|
||||
|
||||
|
||||
EINA_LIST_FOREACH(efreet_config_dirs_get(), l, s)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/mime/globs", s);
|
||||
if (ecore_file_exists(buf)) _load_globs(cfdata, buf);
|
||||
}
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.mime.types", homedir);
|
||||
if (ecore_file_exists(buf)) _load_mimes(cfdata, buf);
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/mime/globs", efreet_data_home_get());
|
||||
if (ecore_file_exists(buf)) _load_globs(cfdata, buf);
|
||||
|
||||
|
||||
cfdata->mimes = eina_list_sort(cfdata->mimes, 0, _sort_mimes);
|
||||
return cfdata;
|
||||
}
|
||||
|
@ -184,7 +185,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
EINA_LIST_FREE(cfdata->mimes, m)
|
||||
{
|
||||
Config_Glob *g;
|
||||
|
||||
|
||||
if (!m) continue;
|
||||
EINA_LIST_FREE(m->globs, g)
|
||||
{
|
||||
|
@ -197,9 +198,9 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
}
|
||||
if (cfdata->ini) efreet_ini_free(cfdata->ini);
|
||||
EINA_LIST_FREE(cfdata->desks, desk)
|
||||
efreet_desktop_free(desk);
|
||||
efreet_desktop_free(desk);
|
||||
if (cfdata->desk_change_handler)
|
||||
ecore_event_handler_del(cfdata->desk_change_handler);
|
||||
ecore_event_handler_del(cfdata->desk_change_handler);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
|
@ -209,11 +210,11 @@ _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__)
|
|||
E_Config_Dialog_Data *cfdata = data;
|
||||
Efreet_Desktop *desk;
|
||||
EINA_LIST_FREE(cfdata->desks, desk)
|
||||
efreet_desktop_free(desk);
|
||||
efreet_desktop_free(desk);
|
||||
if (cfdata->gen)
|
||||
_fill_apps_list(cfdata, cfdata->obj.deflist, &(cfdata->selapp), 1);
|
||||
_fill_apps_list(cfdata, cfdata->obj.deflist, &(cfdata->selapp), 1);
|
||||
else
|
||||
_fill_apps_list(cfdata, cfdata->obj.deflist, cfdata->seldest, 0);
|
||||
_fill_apps_list(cfdata, cfdata->obj.deflist, cfdata->seldest, 0);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
@ -274,18 +275,18 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
Evas_Object *otb, *ot, *ob, *of, *il;
|
||||
Eina_List *l;
|
||||
Config_Mime *m;
|
||||
|
||||
|
||||
otb = e_widget_toolbook_add(evas, 24, 24);
|
||||
|
||||
|
||||
ot = e_widget_table_add(evas, EINA_FALSE);
|
||||
|
||||
|
||||
ob = e_widget_label_add(evas, _("Custom Browser Command"));
|
||||
e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 1, 0, 0);
|
||||
|
||||
|
||||
ob = e_widget_entry_add(evas, &(cfdata->browser_custom), NULL, NULL, NULL);
|
||||
cfdata->obj.entry = ob;
|
||||
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 1, 1, 1, 0);
|
||||
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Default Applications"), 0);
|
||||
il = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
evas_event_freeze(evas);
|
||||
|
@ -302,7 +303,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
evas_event_thaw(evas);
|
||||
e_widget_framelist_object_append_full(of, il, 1, 1, 1, 1, 0.5, 0.5, 120, 200, 9999, 9999);
|
||||
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 0, 1);
|
||||
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Selected Application"), 0);
|
||||
il = e_widget_ilist_add(evas, 24, 24, &(cfdata->selapp));
|
||||
cfdata->obj.deflist = il;
|
||||
|
@ -313,9 +314,9 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Core"), ot,
|
||||
1, 1, 1, 1, 0.5, 0.0);
|
||||
|
||||
|
||||
ot = e_widget_table_add(evas, EINA_FALSE);
|
||||
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Types"), 0);
|
||||
il = e_widget_ilist_add(evas, 24, 24, &(cfdata->selmime));
|
||||
evas_event_freeze(evas);
|
||||
|
@ -323,14 +324,14 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_ilist_freeze(il);
|
||||
e_widget_ilist_selector_set(il, 1);
|
||||
EINA_LIST_FOREACH(cfdata->mimes, l, m)
|
||||
e_widget_ilist_append(il, NULL, m->mime, _sel_mime_cb, cfdata, m->mime);
|
||||
e_widget_ilist_append(il, NULL, m->mime, _sel_mime_cb, cfdata, m->mime);
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_ilist_thaw(il);
|
||||
edje_thaw();
|
||||
evas_event_thaw(evas);
|
||||
e_widget_framelist_object_append_full(of, il, 1, 1, 1, 1, 0.5, 0.5, 120, 200, 9999, 9999);
|
||||
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Selected Application"), 0);
|
||||
il = e_widget_ilist_add(evas, 24, 24, &(cfdata->selapp));
|
||||
cfdata->obj.mimelist = il;
|
||||
|
@ -341,7 +342,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("General"), ot,
|
||||
1, 1, 1, 1, 0.5, 0.0);
|
||||
|
||||
|
||||
e_widget_toolbook_page_show(otb, 0);
|
||||
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
|
@ -358,23 +359,23 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
if (cfdata->ini)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
|
||||
if ((cfdata->browser_desktop) && (cfdata->browser_desktop[0]))
|
||||
{
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/http",
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/http",
|
||||
cfdata->browser_desktop);
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/https",
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/https",
|
||||
cfdata->browser_desktop);
|
||||
}
|
||||
if ((cfdata->mailto_desktop) && (cfdata->mailto_desktop[0]))
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/mailto",
|
||||
cfdata->mailto_desktop);
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/mailto",
|
||||
cfdata->mailto_desktop);
|
||||
if ((cfdata->file_desktop) && (cfdata->file_desktop[0]))
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/file",
|
||||
cfdata->file_desktop);
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/file",
|
||||
cfdata->file_desktop);
|
||||
if ((cfdata->trash_desktop) && (cfdata->trash_desktop[0]))
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/trash",
|
||||
cfdata->trash_desktop);
|
||||
efreet_ini_string_set(cfdata->ini, "x-scheme-handler/trash",
|
||||
cfdata->trash_desktop);
|
||||
snprintf(buf, sizeof(buf), "%s/applications/defaults.list",
|
||||
efreet_data_home_get());
|
||||
efreet_ini_save(cfdata->ini, buf);
|
||||
|
@ -388,7 +389,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
}
|
||||
if (evr)
|
||||
{
|
||||
evr->unset =0;
|
||||
evr->unset = 0;
|
||||
if (evr->val) eina_stringshare_del(evr->val);
|
||||
}
|
||||
else
|
||||
|
@ -434,28 +435,32 @@ _load_mimes(E_Config_Dialog_Data *cfdata, char *file)
|
|||
char *p, *pp;
|
||||
Config_Mime *config_mime;
|
||||
Config_Glob *config_glob;
|
||||
|
||||
|
||||
if (!cfdata) return;
|
||||
|
||||
|
||||
f = fopen(file, "rb");
|
||||
if (!f) return;
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
p = buf;
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n')) p++;
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
if (*p == '#') continue;
|
||||
if ((*p == '\n') || (*p == 0)) continue;
|
||||
pp = p;
|
||||
while (!isblank(*p) && (*p != 0) && (*p != '\n')) p++;
|
||||
while (!isblank(*p) && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
if ((*p == '\n') || (*p == 0)) continue;
|
||||
strncpy(mimetype, pp, (p - pp));
|
||||
mimetype[p - pp] = 0;
|
||||
do
|
||||
{
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n')) p++;
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
if ((*p == '\n') || (*p == 0)) continue;
|
||||
pp = p;
|
||||
while (!isblank(*p) && (*p != 0) && (*p != '\n')) p++;
|
||||
while (!isblank(*p) && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
strncpy(ext, pp, (p - pp));
|
||||
ext[p - pp] = 0;
|
||||
config_mime = _find_mime(cfdata, mimetype);
|
||||
|
@ -466,7 +471,7 @@ _load_mimes(E_Config_Dialog_Data *cfdata, char *file)
|
|||
{
|
||||
config_mime->mime = eina_stringshare_add(mimetype);
|
||||
if (!config_mime->mime)
|
||||
free(config_mime);
|
||||
free(config_mime);
|
||||
else
|
||||
{
|
||||
config_glob = E_NEW(Config_Glob, 1);
|
||||
|
@ -500,19 +505,21 @@ _load_globs(E_Config_Dialog_Data *cfdata, char *file)
|
|||
char *p, *pp;
|
||||
Config_Mime *config_mime;
|
||||
Config_Glob *config_glob;
|
||||
|
||||
|
||||
if (!cfdata) return;
|
||||
|
||||
|
||||
f = fopen(file, "rb");
|
||||
if (!f) return;
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
p = buf;
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n')) p++;
|
||||
while (isblank(*p) && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
if (*p == '#') continue;
|
||||
if ((*p == '\n') || (*p == 0)) continue;
|
||||
pp = p;
|
||||
while ((*p != ':') && (*p != 0) && (*p != '\n')) p++;
|
||||
while ((*p != ':') && (*p != 0) && (*p != '\n'))
|
||||
p++;
|
||||
if ((*p == '\n') || (*p == 0)) continue;
|
||||
strncpy(mimetype, pp, (p - pp));
|
||||
mimetype[p - pp] = 0;
|
||||
|
@ -533,7 +540,7 @@ _load_globs(E_Config_Dialog_Data *cfdata, char *file)
|
|||
{
|
||||
config_mime->mime = eina_stringshare_add(mimetype);
|
||||
if (!config_mime->mime)
|
||||
free(config_mime);
|
||||
free(config_mime);
|
||||
else
|
||||
{
|
||||
config_glob = E_NEW(Config_Glob, 1);
|
||||
|
@ -563,7 +570,7 @@ _sort_mimes(const void *data1, const void *data2)
|
|||
const Config_Mime *m1 = data1, *m2 = data2;
|
||||
if (!m1) return 1;
|
||||
if (!m2) return -1;
|
||||
return (strcmp(m1->mime, m2->mime));
|
||||
return strcmp(m1->mime, m2->mime);
|
||||
}
|
||||
|
||||
static Config_Mime *
|
||||
|
@ -571,7 +578,7 @@ _find_mime(E_Config_Dialog_Data *cfdata, char *mime)
|
|||
{
|
||||
Config_Mime *cm;
|
||||
Eina_List *l;
|
||||
|
||||
|
||||
if (!cfdata) return NULL;
|
||||
EINA_LIST_FOREACH(cfdata->mimes, l, cm)
|
||||
{
|
||||
|
@ -586,7 +593,7 @@ _find_glob(Config_Mime *mime, char *globbing)
|
|||
{
|
||||
Config_Glob *g;
|
||||
Eina_List *l;
|
||||
|
||||
|
||||
if (!mime) return NULL;
|
||||
EINA_LIST_FOREACH(mime->globs, l, g)
|
||||
{
|
||||
|
@ -601,7 +608,7 @@ static int
|
|||
_cb_desks_sort(const void *data1, const void *data2)
|
||||
{
|
||||
const Efreet_Desktop *d1, *d2;
|
||||
|
||||
|
||||
if (!(d1 = data1)) return 1;
|
||||
if (!d1->name) return 1;
|
||||
if (!(d2 = data2)) return -1;
|
||||
|
@ -617,7 +624,7 @@ _sel_desk_gen_cb(void *data)
|
|||
if ((s) && (cfdata->selmime))
|
||||
{
|
||||
if (cfdata->ini)
|
||||
efreet_ini_string_set(cfdata->ini, cfdata->selmime, s);
|
||||
efreet_ini_string_set(cfdata->ini, cfdata->selmime, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,7 +643,7 @@ _sel_desk_cb(void *data)
|
|||
{
|
||||
Eina_List *l;
|
||||
Efreet_Desktop *desk;
|
||||
|
||||
|
||||
EINA_LIST_FOREACH(cfdata->desks, l, desk)
|
||||
{
|
||||
if ((!strcmp(desk->orig_path, *(cfdata->seldest))) ||
|
||||
|
@ -645,7 +652,7 @@ _sel_desk_cb(void *data)
|
|||
if (desk->exec)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
free(cfdata->browser_custom);
|
||||
cfdata->browser_custom = strdup(desk->exec);
|
||||
for (p = cfdata->browser_custom; *p; p++)
|
||||
|
@ -681,14 +688,14 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desk
|
|||
Efreet_Desktop *desk = NULL;
|
||||
Evas *evas;
|
||||
int sel, i;
|
||||
|
||||
|
||||
if (!cfdata->desks)
|
||||
{
|
||||
desks = efreet_util_desktop_name_glob_list("*");
|
||||
EINA_LIST_FREE(desks, desk)
|
||||
{
|
||||
Eina_List *ll;
|
||||
|
||||
|
||||
if (desk->no_display)
|
||||
{
|
||||
efreet_desktop_free(desk);
|
||||
|
@ -698,7 +705,7 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desk
|
|||
if (ll)
|
||||
{
|
||||
Efreet_Desktop *old;
|
||||
|
||||
|
||||
old = eina_list_data_get(ll);
|
||||
/*
|
||||
* This fixes when we have several .desktop with the same name,
|
||||
|
@ -711,14 +718,14 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desk
|
|||
eina_list_data_set(ll, desk);
|
||||
}
|
||||
else
|
||||
efreet_desktop_free(desk);
|
||||
efreet_desktop_free(desk);
|
||||
}
|
||||
else
|
||||
cfdata->desks = eina_list_append(cfdata->desks, desk);
|
||||
cfdata->desks = eina_list_append(cfdata->desks, desk);
|
||||
}
|
||||
cfdata->desks = eina_list_sort(cfdata->desks, -1, _cb_desks_sort);
|
||||
}
|
||||
|
||||
|
||||
evas = evas_object_evas_get(il);
|
||||
evas_event_freeze(evas);
|
||||
edje_freeze();
|
||||
|
@ -730,26 +737,26 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desk
|
|||
EINA_LIST_FOREACH(cfdata->desks, l, desk)
|
||||
{
|
||||
Evas_Object *icon = NULL;
|
||||
|
||||
|
||||
if ((desktop) && (*desktop))
|
||||
{
|
||||
if ((!strcmp(desk->orig_path, *desktop)) ||
|
||||
(!strcmp(ecore_file_file_get(desk->orig_path), *desktop)))
|
||||
sel = i;
|
||||
sel = i;
|
||||
}
|
||||
|
||||
|
||||
icon = e_util_desktop_icon_add(desk, 24, evas);
|
||||
if (general)
|
||||
e_widget_ilist_append(il, icon, desk->name,
|
||||
_sel_desk_gen_cb, cfdata,
|
||||
ecore_file_file_get(desk->orig_path));
|
||||
e_widget_ilist_append(il, icon, desk->name,
|
||||
_sel_desk_gen_cb, cfdata,
|
||||
ecore_file_file_get(desk->orig_path));
|
||||
else
|
||||
e_widget_ilist_append(il, icon, desk->name,
|
||||
_sel_desk_cb, cfdata,
|
||||
ecore_file_file_get(desk->orig_path));
|
||||
e_widget_ilist_append(il, icon, desk->name,
|
||||
_sel_desk_cb, cfdata,
|
||||
ecore_file_file_get(desk->orig_path));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_ilist_thaw(il);
|
||||
edje_thaw();
|
||||
|
@ -760,3 +767,4 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il, const char **desk
|
|||
e_widget_ilist_nth_show(il, sel, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,33 +2,34 @@
|
|||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Eina_List *desks;
|
||||
Eina_List *desks;
|
||||
Ecore_Event_Handler *desk_change_handler;
|
||||
|
||||
struct {
|
||||
|
||||
struct
|
||||
{
|
||||
Evas_Object *list, *del;
|
||||
} obj;
|
||||
};
|
||||
|
||||
/* local function prototypes */
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static Eina_Bool _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il);
|
||||
static void _btn_cb_del(void *data, void *data2);
|
||||
static void _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__);
|
||||
static Eina_Bool _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__);
|
||||
static int _cb_desks_sort(const void *data1, const void *data2);
|
||||
static void _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il);
|
||||
static void _btn_cb_del(void *data, void *data2);
|
||||
static void _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__);
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_delapps(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
|
||||
if (e_config_dialog_find("E", "applications/del_applications"))
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
|
@ -48,8 +49,8 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->desk_change_handler = ecore_event_handler_add
|
||||
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desks_update, cfdata);
|
||||
|
||||
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desks_update, cfdata);
|
||||
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
|
@ -57,10 +58,11 @@ static void
|
|||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Efreet_Desktop *desk;
|
||||
|
||||
EINA_LIST_FREE(cfdata->desks, desk) efreet_desktop_free(desk);
|
||||
|
||||
EINA_LIST_FREE(cfdata->desks, desk)
|
||||
efreet_desktop_free(desk);
|
||||
if (cfdata->desk_change_handler)
|
||||
ecore_event_handler_del(cfdata->desk_change_handler);
|
||||
ecore_event_handler_del(cfdata->desk_change_handler);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
|
@ -69,9 +71,9 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
{
|
||||
Evas_Object *of, *li, *ob;
|
||||
Evas_Coord mw, mh;
|
||||
|
||||
|
||||
of = e_widget_table_add(evas, 0);
|
||||
|
||||
|
||||
li = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
cfdata->obj.list = li;
|
||||
e_widget_ilist_multi_select_set(li, EINA_TRUE);
|
||||
|
@ -81,15 +83,15 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_size_min_set(li, mw, mh);
|
||||
e_widget_on_change_hook_set(li, _widget_list_selection_changed, cfdata);
|
||||
e_widget_table_object_append(of, li, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
|
||||
_fill_apps_list(cfdata, cfdata->obj.list);
|
||||
e_widget_ilist_go(li);
|
||||
|
||||
|
||||
ob = e_widget_button_add(evas, _("Delete"), NULL, _btn_cb_del, cfdata, NULL);
|
||||
cfdata->obj.del = ob;
|
||||
e_widget_disabled_set(ob, 1);
|
||||
e_widget_table_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 0);
|
||||
|
||||
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
e_win_centered_set(cfd->dia->win, 1);
|
||||
return of;
|
||||
|
@ -100,17 +102,18 @@ _desks_update(void *data, int ev_type __UNUSED__, void *ev __UNUSED__)
|
|||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
Efreet_Desktop *desk;
|
||||
|
||||
EINA_LIST_FREE(cfdata->desks, desk) efreet_desktop_free(desk);
|
||||
|
||||
EINA_LIST_FREE(cfdata->desks, desk)
|
||||
efreet_desktop_free(desk);
|
||||
_fill_apps_list(cfdata, cfdata->obj.list);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_desks_sort(const void *data1, const void *data2)
|
||||
{
|
||||
const Efreet_Desktop *d1, *d2;
|
||||
|
||||
|
||||
if (!(d1 = data1)) return 1;
|
||||
if (!d1->name) return 1;
|
||||
if (!(d2 = data2)) return -1;
|
||||
|
@ -126,11 +129,11 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il)
|
|||
Evas *evas;
|
||||
const char *desktop_dir = e_user_desktop_dir_get();
|
||||
int n = 0;
|
||||
|
||||
|
||||
if (!desktop_dir) return;
|
||||
|
||||
|
||||
n = strlen(desktop_dir);
|
||||
|
||||
|
||||
if (!cfdata->desks)
|
||||
{
|
||||
desks = efreet_util_desktop_name_glob_list("*");
|
||||
|
@ -142,9 +145,9 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il)
|
|||
continue;
|
||||
}
|
||||
if (!strncmp(desk->orig_path, desktop_dir, n))
|
||||
cfdata->desks = eina_list_append(cfdata->desks, desk);
|
||||
cfdata->desks = eina_list_append(cfdata->desks, desk);
|
||||
else
|
||||
efreet_desktop_free(desk);
|
||||
efreet_desktop_free(desk);
|
||||
}
|
||||
cfdata->desks = eina_list_sort(cfdata->desks, -1, _cb_desks_sort);
|
||||
}
|
||||
|
@ -154,16 +157,16 @@ _fill_apps_list(E_Config_Dialog_Data *cfdata, Evas_Object *il)
|
|||
edje_freeze();
|
||||
e_widget_ilist_freeze(il);
|
||||
e_widget_ilist_clear(il);
|
||||
|
||||
|
||||
EINA_LIST_FOREACH(cfdata->desks, l, desk)
|
||||
{
|
||||
Evas_Object *icon = e_util_desktop_icon_add(desk, 24, evas);
|
||||
|
||||
|
||||
e_widget_ilist_append(il, icon, desk->name,
|
||||
NULL, desk->orig_path,
|
||||
desk->orig_path);
|
||||
}
|
||||
|
||||
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_ilist_thaw(il);
|
||||
edje_thaw();
|
||||
|
@ -176,11 +179,11 @@ _btn_cb_del(void *data, void *data2 __UNUSED__)
|
|||
E_Config_Dialog_Data *cfdata = data;
|
||||
const Eina_List *l;
|
||||
const E_Ilist_Item *it;
|
||||
|
||||
|
||||
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->obj.list), l, it)
|
||||
{
|
||||
const char *file;
|
||||
|
||||
|
||||
if (!it->selected) continue;
|
||||
file = e_widget_ilist_item_data_get(it);
|
||||
if (file) ecore_file_unlink(file);
|
||||
|
@ -194,7 +197,7 @@ _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__)
|
|||
const Eina_List *l;
|
||||
const E_Ilist_Item *it;
|
||||
int selnum = 0;
|
||||
|
||||
|
||||
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->obj.list), l, it)
|
||||
{
|
||||
if (!it->selected) continue;
|
||||
|
@ -203,3 +206,4 @@ _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__)
|
|||
if (selnum == 0) e_widget_disabled_set(cfdata->obj.del, 1);
|
||||
else e_widget_disabled_set(cfdata->obj.del, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
/* PROTOTYPES - same all the time */
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
/* Actual config data we will be playing with whil the dialog is active */
|
||||
|
@ -23,19 +23,19 @@ e_int_config_deskenv(E_Container *con, const char *params __UNUSED__)
|
|||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "windows/desktop_environments"))
|
||||
if (e_config_dialog_find("E", "windows/desktop_environments"))
|
||||
return NULL;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
|
||||
/* methods */
|
||||
v->create_cfdata = _create_data;
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply;
|
||||
v->basic.create_widgets = _basic_create;
|
||||
|
||||
/* create config diaolg for NULL object/data */
|
||||
cfd = e_config_dialog_new(con, _("Desktop Environments"), "E",
|
||||
"windows/desktop_environments",
|
||||
cfd = e_config_dialog_new(con, _("Desktop Environments"), "E",
|
||||
"windows/desktop_environments",
|
||||
"preferences-desktop-environments", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ static void *
|
|||
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata);
|
||||
return cfdata;
|
||||
|
@ -86,17 +86,18 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
Evas_Object *o, *ob;
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
ob = e_widget_check_add(evas, _("Load X Resources"),
|
||||
ob = e_widget_check_add(evas, _("Load X Resources"),
|
||||
&(cfdata->load_xrdb));
|
||||
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
||||
ob = e_widget_check_add(evas, _("Load X Modifier Map"),
|
||||
ob = e_widget_check_add(evas, _("Load X Modifier Map"),
|
||||
&(cfdata->load_xmodmap));
|
||||
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
||||
ob = e_widget_check_add(evas, _("Start GNOME services on login"),
|
||||
ob = e_widget_check_add(evas, _("Start GNOME services on login"),
|
||||
&(cfdata->load_gnome));
|
||||
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
||||
ob = e_widget_check_add(evas, _("Start KDE services on login"),
|
||||
ob = e_widget_check_add(evas, _("Start KDE services on login"),
|
||||
&(cfdata->load_kde));
|
||||
e_widget_list_object_append(o, ob, 1, 0, 0.0);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,50 +9,50 @@ static E_Module *conf_module = NULL;
|
|||
EAPI E_Module_Api e_modapi =
|
||||
{
|
||||
E_MODULE_API_VERSION,
|
||||
"Settings - Applications"
|
||||
"Settings - Applications"
|
||||
};
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
e_configure_registry_category_add("applications", 20, _("Apps"), NULL,
|
||||
e_configure_registry_category_add("applications", 20, _("Apps"), NULL,
|
||||
"preferences-applications");
|
||||
e_configure_registry_item_add("applications/new_application", 10,
|
||||
_("Create Launcher"), NULL,
|
||||
"preferences-applications-add",
|
||||
e_configure_registry_item_add("applications/new_application", 10,
|
||||
_("Create Launcher"), NULL,
|
||||
"preferences-applications-add",
|
||||
e_int_config_apps_add);
|
||||
e_configure_registry_item_add("applications/del_application", 20,
|
||||
_("Delete Personal Launchers"), NULL,
|
||||
"preferences-applications-del",
|
||||
_("Delete Personal Launchers"), NULL,
|
||||
"preferences-applications-del",
|
||||
e_int_config_delapps);
|
||||
e_configure_registry_item_add("applications/favorite_applications", 30,
|
||||
_("Favorite Applications"), NULL,
|
||||
_("Favorite Applications"), NULL,
|
||||
"user-bookmarks",
|
||||
e_int_config_apps_favs);
|
||||
e_configure_registry_item_add("applications/ibar_applications", 40,
|
||||
_("IBar Applications"), NULL,
|
||||
"preferences-applications-ibar",
|
||||
e_configure_registry_item_add("applications/ibar_applications", 40,
|
||||
_("IBar Applications"), NULL,
|
||||
"preferences-applications-ibar",
|
||||
e_int_config_apps_ibar);
|
||||
e_configure_registry_item_add("applications/restart_applications", 50,
|
||||
_("Restart Applications"), NULL,
|
||||
"preferences-applications-restart",
|
||||
e_configure_registry_item_add("applications/restart_applications", 50,
|
||||
_("Restart Applications"), NULL,
|
||||
"preferences-applications-restart",
|
||||
e_int_config_apps_restart);
|
||||
e_configure_registry_item_add("applications/startup_applications", 60,
|
||||
_("Startup Applications"), NULL,
|
||||
"preferences-applications-startup",
|
||||
e_configure_registry_item_add("applications/startup_applications", 60,
|
||||
_("Startup Applications"), NULL,
|
||||
"preferences-applications-startup",
|
||||
e_int_config_apps_startup);
|
||||
e_configure_registry_item_add("applications/default_applications", 70,
|
||||
_("Default Applications"), NULL,
|
||||
"preferences-desktop-default-applications",
|
||||
_("Default Applications"), NULL,
|
||||
"preferences-desktop-default-applications",
|
||||
e_int_config_defapps);
|
||||
e_configure_registry_item_add("applications/desktop_environments", 80,
|
||||
_("Desktop Environments"), NULL,
|
||||
"preferences-desktop-environments",
|
||||
_("Desktop Environments"), NULL,
|
||||
"preferences-desktop-environments",
|
||||
e_int_config_deskenv);
|
||||
e_configure_registry_category_add("internal", -1, _("Internal"), NULL,
|
||||
e_configure_registry_category_add("internal", -1, _("Internal"), NULL,
|
||||
"enlightenment/internal");
|
||||
e_configure_registry_item_add("internal/ibar_other", -1, _("IBar Other"),
|
||||
NULL, "preferences-system-windows",
|
||||
e_configure_registry_item_add("internal/ibar_other", -1, _("IBar Other"),
|
||||
NULL, "preferences-system-windows",
|
||||
e_int_config_apps_ibar_other);
|
||||
|
||||
conf_module = m;
|
||||
|
@ -65,7 +65,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
while ((cfd = e_config_dialog_get("E", "_config_apps_dialog")))
|
||||
while ((cfd = e_config_dialog_get("E", "_config_apps_dialog")))
|
||||
e_object_del(E_OBJECT(cfd));
|
||||
e_configure_registry_item_del("internal/ibar_other");
|
||||
e_configure_registry_category_del("internal");
|
||||
|
@ -87,3 +87,4 @@ e_modapi_save(E_Module *m __UNUSED__)
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue