forked from enlightenment/enlightenment
Save image from X icon works.
TODO - Fix alpha on saved image - If the eap isn't saved, remove the bd->app pointer - Delete the saved image when done SVN revision: 24044
This commit is contained in:
parent
6291d46977
commit
0ec2af42bd
|
@ -1,15 +1,18 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
typedef struct _E_App_Edit E_App_Edit;
|
||||
|
||||
struct _E_App_Edit
|
||||
{
|
||||
{
|
||||
E_App *eap;
|
||||
|
||||
Evas_Object *img;
|
||||
Evas_Object *img_widget;
|
||||
int img_set;
|
||||
|
||||
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
};
|
||||
|
||||
|
@ -64,14 +67,14 @@ e_eap_edit_show(E_Container *con, E_App *a)
|
|||
E_App_Edit *editor;
|
||||
|
||||
if (!con) return;
|
||||
|
||||
|
||||
editor = E_NEW(E_App_Edit, 1);
|
||||
if (!editor) return;
|
||||
|
||||
|
||||
editor->eap = a;
|
||||
editor->img = NULL;
|
||||
e_object_ref(E_OBJECT(editor->eap));
|
||||
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (v)
|
||||
{
|
||||
|
@ -89,7 +92,7 @@ e_eap_edit_show(E_Container *con, E_App *a)
|
|||
|
||||
/* local subsystem functions */
|
||||
|
||||
static void
|
||||
static void
|
||||
_e_eap_edit_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
/*- BASIC -*/
|
||||
|
@ -102,11 +105,11 @@ _e_eap_edit_fill_data(E_Config_Dialog_Data *cfdata)
|
|||
IFDUP(cfdata->editor->eap->win_class, cfdata->wclass);
|
||||
IFDUP(cfdata->editor->eap->win_title, cfdata->wtitle);
|
||||
IFDUP(cfdata->editor->eap->win_role, cfdata->wrole);
|
||||
IFDUP(cfdata->editor->eap->icon_class, cfdata->iclass);
|
||||
IFDUP(cfdata->editor->eap->icon_class, cfdata->iclass);
|
||||
cfdata->startup_notify = cfdata->editor->eap->startup_notify;
|
||||
cfdata->wait_exit = cfdata->editor->eap->wait_exit;
|
||||
/*- COMMON -*/
|
||||
IFDUP(cfdata->editor->eap->image, cfdata->image);
|
||||
IFDUP(cfdata->editor->eap->image, cfdata->image);
|
||||
cfdata->height = cfdata->editor->eap->height;
|
||||
cfdata->width = cfdata->editor->eap->width;
|
||||
if (cfdata->image) cfdata->editor->img_set = 1;
|
||||
|
@ -116,7 +119,7 @@ static void *
|
|||
_e_eap_edit_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
if (!cfdata) return NULL;
|
||||
cfdata->editor = cfd->data;
|
||||
|
@ -136,10 +139,15 @@ _e_eap_edit_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data)
|
|||
E_FREE(data->wclass);
|
||||
E_FREE(data->wtitle);
|
||||
E_FREE(data->wrole);
|
||||
E_FREE(data->iclass);
|
||||
E_FREE(data->iclass);
|
||||
E_FREE(data->image);
|
||||
e_object_unref(E_OBJECT(data->editor->eap));
|
||||
E_FREE(data->editor);
|
||||
if (data->editor)
|
||||
{
|
||||
if (data->editor->img) evas_object_del(data->editor->img);
|
||||
if (data->editor->img_widget) evas_object_del(data->editor->img_widget);
|
||||
free(data->editor);
|
||||
}
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
@ -148,30 +156,30 @@ _e_eap_edit_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data)
|
|||
{
|
||||
E_App_Edit *editor;
|
||||
E_App *eap;
|
||||
|
||||
|
||||
editor = data->editor;
|
||||
eap = editor->eap;
|
||||
|
||||
|
||||
if (eap->name) evas_stringshare_del(eap->name);
|
||||
if (eap->exe) evas_stringshare_del(eap->exe);
|
||||
if (eap->image) evas_stringshare_del(eap->image);
|
||||
|
||||
|
||||
if (data->name) eap->name = evas_stringshare_add(data->name);
|
||||
if (data->exe) eap->exe = evas_stringshare_add(data->exe);
|
||||
if (data->image) eap->image = evas_stringshare_add(data->image);
|
||||
|
||||
|
||||
eap->startup_notify = data->startup_notify;
|
||||
eap->wait_exit = data->wait_exit;
|
||||
|
||||
|
||||
/* FIXME: hardcoded until the eap editor provides fields to change it */
|
||||
if (data->width) eap->width = data->width;
|
||||
else eap->width = 128;
|
||||
if (data->height) eap->height = data->height;
|
||||
else eap->height = 128;
|
||||
else eap->height = 128;
|
||||
|
||||
if ((eap->name) && (eap->exe))
|
||||
if ((eap->name) && (eap->exe))
|
||||
e_app_fields_save(eap);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -180,31 +188,31 @@ _e_eap_edit_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data
|
|||
{
|
||||
E_App_Edit *editor;
|
||||
E_App *eap;
|
||||
|
||||
|
||||
editor = data->editor;
|
||||
eap = editor->eap;
|
||||
|
||||
|
||||
if (eap->name) evas_stringshare_del(eap->name);
|
||||
if (eap->exe) evas_stringshare_del(eap->exe);
|
||||
if (eap->image) evas_stringshare_del(eap->image);
|
||||
|
||||
|
||||
if (eap->generic) evas_stringshare_del(eap->generic);
|
||||
if (eap->comment) evas_stringshare_del(eap->comment);
|
||||
if (eap->win_name) evas_stringshare_del(eap->win_name);
|
||||
if (eap->win_class) evas_stringshare_del(eap->win_class);
|
||||
if (eap->win_class) evas_stringshare_del(eap->win_class);
|
||||
if (eap->win_title) evas_stringshare_del(eap->win_title);
|
||||
if (eap->win_role) evas_stringshare_del(eap->win_role);
|
||||
if (eap->icon_class) evas_stringshare_del(eap->icon_class);
|
||||
|
||||
if (data->startup_notify) eap->startup_notify = 1;
|
||||
|
||||
if (data->startup_notify) eap->startup_notify = 1;
|
||||
else eap->startup_notify = 0;
|
||||
if (data->wait_exit) eap->wait_exit = 1;
|
||||
else eap->wait_exit = 0;
|
||||
|
||||
|
||||
if (data->name) eap->name = evas_stringshare_add(data->name);
|
||||
if (data->exe) eap->exe = evas_stringshare_add(data->exe);
|
||||
if (data->image) eap->image = evas_stringshare_add(data->image);
|
||||
|
||||
|
||||
if (data->generic) eap->generic = evas_stringshare_add(data->generic);
|
||||
if (data->comment) eap->comment = evas_stringshare_add(data->comment);
|
||||
if (data->wname) eap->win_name = evas_stringshare_add(data->wname);
|
||||
|
@ -217,7 +225,7 @@ _e_eap_edit_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data
|
|||
if (data->width) eap->width = data->width;
|
||||
else eap->width = 128;
|
||||
if (data->height) eap->height = data->height;
|
||||
else eap->height = 128;
|
||||
else eap->height = 128;
|
||||
|
||||
if ((eap->name) && (eap->exe))
|
||||
e_app_fields_save(eap);
|
||||
|
@ -231,32 +239,34 @@ _e_eap_edit_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dial
|
|||
E_App_Edit *editor;
|
||||
E_App *eap;
|
||||
Evas_Object *ol, *o;
|
||||
Evas_Object *entry;
|
||||
|
||||
Evas_Object *entry;
|
||||
|
||||
editor = data->editor;
|
||||
eap = editor->eap;
|
||||
|
||||
|
||||
ol = e_widget_table_add(evas, 0);
|
||||
|
||||
|
||||
o = e_widget_frametable_add(evas, _("Icon"), 0);
|
||||
|
||||
if ((!editor->img) || (editor->img_set != 1))
|
||||
{
|
||||
editor->img = e_icon_add(evas);
|
||||
if (eap->path)
|
||||
{
|
||||
e_icon_file_key_set(editor->img, eap->path, "images/0");
|
||||
e_icon_fill_inside_set(editor->img, 1);
|
||||
}
|
||||
}
|
||||
else if (editor->img_set)
|
||||
|
||||
if ((editor->img_set) && (data->image))
|
||||
{
|
||||
if (editor->img) evas_object_del(editor->img);
|
||||
editor->img = e_icon_add(evas);
|
||||
e_icon_file_set(editor->img, data->image);
|
||||
e_icon_fill_inside_set(editor->img, 1);
|
||||
e_icon_fill_inside_set(editor->img, 1);
|
||||
}
|
||||
|
||||
editor->img_widget = e_widget_iconsel_add(evas, editor->img, 48, 48,
|
||||
else if (!editor->img)
|
||||
{
|
||||
editor->img = e_icon_add(evas);
|
||||
if (eap->path)
|
||||
{
|
||||
e_icon_file_key_set(editor->img, eap->path, "images/0");
|
||||
e_icon_fill_inside_set(editor->img, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (editor->img_widget) evas_object_del(editor->img_widget);
|
||||
editor->img_widget = e_widget_iconsel_add(evas, editor->img, 48, 48,
|
||||
&(data->image));
|
||||
e_widget_iconsel_select_callback_add(editor->img_widget, _e_eap_edit_select_cb, editor);
|
||||
e_widget_iconsel_hilite_callback_add(editor->img_widget, _e_eap_edit_hilite_cb, editor);
|
||||
|
@ -264,13 +274,13 @@ _e_eap_edit_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dial
|
|||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
e_widget_table_object_append(ol, o, 0, 0, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
o = e_widget_frametable_add(evas, _("Basic Info"), 0);
|
||||
e_widget_frametable_object_append(o, e_widget_label_add(evas, _("App name")),
|
||||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
||||
|
||||
entry = e_widget_entry_add(evas, &(data->name));
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_frametable_object_append(o, entry,
|
||||
|
@ -281,9 +291,9 @@ _e_eap_edit_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dial
|
|||
1, 1, 1, 1);
|
||||
e_widget_frametable_object_append(o, e_widget_entry_add(evas, &(data->exe)),
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
1, 1, 1, 1);
|
||||
e_widget_table_object_append(ol, o, 1, 0, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
return ol;
|
||||
}
|
||||
|
||||
|
@ -293,22 +303,22 @@ _e_eap_edit_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_D
|
|||
E_App_Edit *editor;
|
||||
E_App *eap;
|
||||
Evas_Object *ol, *o;
|
||||
Evas_Object *entry;
|
||||
|
||||
Evas_Object *entry;
|
||||
|
||||
editor = data->editor;
|
||||
eap = editor->eap;
|
||||
|
||||
|
||||
ol = _e_eap_edit_basic_create_widgets(cfd, evas, data);
|
||||
|
||||
|
||||
o = e_widget_frametable_add(evas, _("General"), 0);
|
||||
|
||||
/*- general info -*/
|
||||
e_widget_frametable_object_append(o, e_widget_label_add(evas, _("Generic Info")),
|
||||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
||||
|
||||
entry = e_widget_entry_add(evas, &(data->generic));
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_frametable_object_append(o, entry,
|
||||
1, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
@ -319,17 +329,17 @@ _e_eap_edit_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_D
|
|||
1, 1, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
e_widget_table_object_append(ol, o, 0, 1, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
/*- window info -*/
|
||||
o = e_widget_frametable_add(evas, _("Window"), 0);
|
||||
|
||||
|
||||
e_widget_frametable_object_append(o, e_widget_label_add(evas, _("Window Name")),
|
||||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
||||
|
||||
entry = e_widget_entry_add(evas, &(data->wname));
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_frametable_object_append(o, entry,
|
||||
1, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
@ -352,25 +362,25 @@ _e_eap_edit_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_D
|
|||
1, 3, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
e_widget_table_object_append(ol, o, 0, 2, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
/*- icon info -*/
|
||||
o = e_widget_frametable_add(evas, _("Icon Theme"), 0);
|
||||
|
||||
|
||||
e_widget_frametable_object_append(o, e_widget_label_add(evas, _("Icon Class")),
|
||||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
||||
|
||||
entry = e_widget_entry_add(evas, &(data->iclass));
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_min_size_set(entry, 100, 1);
|
||||
e_widget_frametable_object_append(o, entry,
|
||||
1, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
||||
|
||||
e_widget_table_object_append(ol, o, 1, 1, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
/*- misc info -*/
|
||||
o = e_widget_frametable_add(evas, _("Misc"), 0);
|
||||
o = e_widget_frametable_add(evas, _("Misc"), 0);
|
||||
e_widget_frametable_object_append(o, e_widget_check_add(evas, _("Startup Notify"), &(data->startup_notify)),
|
||||
0, 0, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
|
@ -378,7 +388,7 @@ _e_eap_edit_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_D
|
|||
0, 1, 1, 1,
|
||||
1, 1, 1, 1);
|
||||
e_widget_table_object_append(ol, o, 1, 2, 1, 1, 1 ,1, 1, 1);
|
||||
|
||||
|
||||
return ol;
|
||||
}
|
||||
|
||||
|
@ -386,7 +396,7 @@ void
|
|||
_e_eap_edit_select_cb(Evas_Object *obj, char *file, void *data)
|
||||
{
|
||||
E_App_Edit *editor;
|
||||
|
||||
|
||||
editor = data;
|
||||
editor->img_set = 1;
|
||||
printf("selected: %s\n", file);
|
||||
|
@ -396,8 +406,8 @@ void
|
|||
_e_eap_edit_hilite_cb(Evas_Object *obj, char *file, void *data)
|
||||
{
|
||||
E_App_Edit *editor;
|
||||
|
||||
|
||||
editor = data;
|
||||
editor->img_set = 1;
|
||||
editor->img_set = 1;
|
||||
printf("hilited: %s\n", file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue