forked from enlightenment/efl
colorclass: remove remote editor, make base api public
the remote editor needs to be rewritten to use x11 client messages and wayland shell extensions at some point. need to make this stable now to use in e20 release
This commit is contained in:
parent
3aa16297cc
commit
783aeefeeb
|
@ -12,7 +12,7 @@ test_colorclass()
|
|||
win = elm_win_util_standard_add("colorclass", "Color Classes");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
|
||||
cc = elm_color_class_editor_add(win, 0);
|
||||
cc = elm_color_class_editor_add(win);
|
||||
elm_win_resize_object_add(win, cc);
|
||||
evas_object_size_hint_weight_set(cc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(cc, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
|
|
@ -510,17 +510,10 @@ libelementary_la_LIBADD = \
|
|||
libelementary_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
EXTRA_DIST = \
|
||||
elm_color_class.xml \
|
||||
elm_factory.h \
|
||||
elm_factory.c \
|
||||
elm_intro.h.in
|
||||
|
||||
$(COLORCLASS_GEN): elm_color_class.xml
|
||||
@cd $(top_builddir)/src/lib && \
|
||||
@eldbus_codegen@ $(abs_top_srcdir)/src/lib/elm_color_class.xml
|
||||
elm_color_class.c: $(COLORCLASS_GEN)
|
||||
|
||||
|
||||
elm_eolian_files = \
|
||||
elm_access.eo \
|
||||
elm_actionslider.eo \
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
#include "elm_color_class.h"
|
||||
#include "eldbus_elementary_colorclass.h"
|
||||
|
||||
static Eldbus_Proxy *cc_proxy;
|
||||
static Ecore_Event_Handler *h1;
|
||||
static Ecore_Event_Handler *h2;
|
||||
//static Eldbus_Proxy *cc_proxy;
|
||||
//static Ecore_Event_Handler *h1;
|
||||
//static Ecore_Event_Handler *h2;
|
||||
|
||||
typedef struct Colorclass
|
||||
{
|
||||
|
@ -28,7 +27,7 @@ typedef struct Colorclass_UI
|
|||
Evas_Object *reset;
|
||||
Evas_Object *cs;
|
||||
|
||||
uint64_t winid;
|
||||
//uint64_t winid;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
Colorclass *current; //actually Elm_Color_Overlay
|
||||
|
@ -37,7 +36,7 @@ typedef struct Colorclass_UI
|
|||
Eina_Bool change_reset : 1;
|
||||
Eina_Bool exist : 1;
|
||||
} Colorclass_UI;
|
||||
|
||||
#if 0
|
||||
typedef enum
|
||||
{
|
||||
COLORCLASS_SIGNAL_EDIT,
|
||||
|
@ -55,6 +54,7 @@ static const Eldbus_Signal colorclass_editor_signals[] =
|
|||
|
||||
static Eina_Inlist *remote_ccuis;
|
||||
static Eldbus_Service_Interface *remote_iface;
|
||||
#endif
|
||||
static Elm_Color_Class_Name_Cb tl_cb;
|
||||
static Elm_Color_Class_List_Cb list_cb;
|
||||
|
||||
|
@ -80,7 +80,7 @@ _colorclass_cc_update(Colorclass_UI *cc, int num)
|
|||
0, 0, 0, 0,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_dbus_signal_changed(Colorclass_UI *cc)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ _dbus_signal_changed(Colorclass_UI *cc)
|
|||
eldbus_message_iter_container_close(iter, array);
|
||||
eldbus_service_signal_send(remote_iface, msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
_colorclass_select(void *data, Evas_Object *obj EINA_UNUSED, const char *sig, const char *src EINA_UNUSED)
|
||||
{
|
||||
|
@ -136,9 +136,9 @@ _colorclass_changed(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
|
||||
elm_colorselector_color_get(cc->cs, (int*)&cc->current->color[cc->num].r, (int*)&cc->current->color[cc->num].g,
|
||||
(int*)&cc->current->color[cc->num].b, (int*)&cc->current->color[cc->num].a);
|
||||
if (cc->winid && remote_iface)
|
||||
_dbus_signal_changed(cc);
|
||||
else
|
||||
//if (cc->winid && remote_iface)
|
||||
//_dbus_signal_changed(cc);
|
||||
//else
|
||||
edje_color_class_set(cc->current->name,
|
||||
cc->current->color[0].r, cc->current->color[0].g, cc->current->color[0].b, cc->current->color[0].a,
|
||||
cc->current->color[1].r, cc->current->color[1].g, cc->current->color[1].b, cc->current->color[1].a,
|
||||
|
@ -162,17 +162,17 @@ _colorclass_reset(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
Colorclass color;
|
||||
|
||||
if (!cc->current) return EINA_FALSE;
|
||||
if (cc->winid && remote_iface)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
//if (cc->winid && remote_iface)
|
||||
//{
|
||||
//Eldbus_Message *msg;
|
||||
|
||||
msg = eldbus_service_signal_new(remote_iface, COLORCLASS_SIGNAL_RESET);
|
||||
eldbus_message_arguments_append(msg, "t", cc->winid);
|
||||
eldbus_message_arguments_append(msg, "s", cc->current->name);
|
||||
eldbus_service_signal_send(remote_iface, msg);
|
||||
cc->change_reset = 1;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
//msg = eldbus_service_signal_new(remote_iface, COLORCLASS_SIGNAL_RESET);
|
||||
//eldbus_message_arguments_append(msg, "t", cc->winid);
|
||||
//eldbus_message_arguments_append(msg, "s", cc->current->name);
|
||||
//eldbus_service_signal_send(remote_iface, msg);
|
||||
//cc->change_reset = 1;
|
||||
//return EINA_FALSE;
|
||||
//}
|
||||
edje_color_class_del(cc->current->name);
|
||||
edje_color_class_get(cc->current->name,
|
||||
(int*)&color.color[0].r, (int*)&color.color[0].g, (int*)&color.color[0].b, (int*)&color.color[0].a,
|
||||
|
@ -288,17 +288,17 @@ _colorclass_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
|
|||
Colorclass_UI *cc = data;
|
||||
|
||||
_colorclass_save(cc);
|
||||
if (cc->winid)
|
||||
remote_ccuis = eina_inlist_remove(remote_ccuis, EINA_INLIST_GET(cc));
|
||||
if (cc->winid && remote_iface && (!remote_ccuis))
|
||||
{
|
||||
Eldbus_Connection *conn;
|
||||
//if (cc->winid)
|
||||
//remote_ccuis = eina_inlist_remove(remote_ccuis, EINA_INLIST_GET(cc));
|
||||
//if (cc->winid && remote_iface && (!remote_ccuis))
|
||||
//{
|
||||
//Eldbus_Connection *conn;
|
||||
|
||||
conn = eldbus_service_connection_get(remote_iface);
|
||||
eldbus_name_release(conn, ELM_COLOR_CLASS_METHOD_BASE, NULL, NULL);
|
||||
ELM_SAFE_FREE(remote_iface, eldbus_service_interface_unregister);
|
||||
eldbus_connection_unref(conn);
|
||||
}
|
||||
//conn = eldbus_service_connection_get(remote_iface);
|
||||
//eldbus_name_release(conn, ELM_COLOR_CLASS_METHOD_BASE, NULL, NULL);
|
||||
//ELM_SAFE_FREE(remote_iface, eldbus_service_interface_unregister);
|
||||
//eldbus_connection_unref(conn);
|
||||
//}
|
||||
free(cc);
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ _colorclass_item_del(Edje_Color_Class *ecc, Evas_Object *obj EINA_UNUSED)
|
|||
eina_stringshare_del(ecc->desc);
|
||||
free(ecc);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_dbus_request_name_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ _dbus_reset(void *d EINA_UNUSED, int t EINA_UNUSED, Elementary_Colorclass_Reset_
|
|||
eldbus_proxy_send(cc_proxy, msg, NULL, NULL, -1);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
#endif
|
||||
static Elm_Genlist_Item_Class itc =
|
||||
{
|
||||
.item_style = "default",
|
||||
|
@ -532,7 +532,7 @@ static Elm_Genlist_Item_Class itc =
|
|||
},
|
||||
.version = ELM_GENLIST_ITEM_CLASS_VERSION
|
||||
};
|
||||
|
||||
#if 0
|
||||
static Colorclass_UI *
|
||||
_dbus_ccui_find(uint64_t winid)
|
||||
{
|
||||
|
@ -636,29 +636,29 @@ _dbus_timeout(Colorclass_UI *cc)
|
|||
elm_object_text_set(cc->ly, "Application was unable to provide color scheme info");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* internal */ void
|
||||
elm_color_class_init(void)
|
||||
{
|
||||
eldbus_init();
|
||||
cc_proxy = elementary_colorclass_proxy_get(eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION), ELM_COLOR_CLASS_METHOD_BASE, NULL);
|
||||
h1 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_EDIT_EVENT, (Ecore_Event_Handler_Cb)_dbus_edit, NULL);
|
||||
h2 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_CHANGED_EVENT, (Ecore_Event_Handler_Cb)_dbus_changed, NULL);
|
||||
h2 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_RESET_EVENT, (Ecore_Event_Handler_Cb)_dbus_reset, NULL);
|
||||
//eldbus_init();
|
||||
//cc_proxy = elementary_colorclass_proxy_get(eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION), ELM_COLOR_CLASS_METHOD_BASE, NULL);
|
||||
//h1 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_EDIT_EVENT, (Ecore_Event_Handler_Cb)_dbus_edit, NULL);
|
||||
//h2 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_CHANGED_EVENT, (Ecore_Event_Handler_Cb)_dbus_changed, NULL);
|
||||
//h2 = ecore_event_handler_add(ELEMENTARY_COLORCLASS_RESET_EVENT, (Ecore_Event_Handler_Cb)_dbus_reset, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
elm_color_class_shutdown(void)
|
||||
{
|
||||
Eldbus_Connection *conn = eldbus_object_connection_get(eldbus_proxy_object_get(cc_proxy));
|
||||
ELM_SAFE_FREE(cc_proxy, eldbus_proxy_unref);
|
||||
eldbus_connection_unref(conn);
|
||||
ecore_event_handler_del(h1);
|
||||
ecore_event_handler_del(h2);
|
||||
h1 = h2 = NULL;
|
||||
eldbus_shutdown();
|
||||
//Eldbus_Connection *conn = eldbus_object_connection_get(eldbus_proxy_object_get(cc_proxy));
|
||||
//ELM_SAFE_FREE(cc_proxy, eldbus_proxy_unref);
|
||||
//eldbus_connection_unref(conn);
|
||||
//ecore_event_handler_del(h1);
|
||||
//ecore_event_handler_del(h2);
|
||||
//h1 = h2 = NULL;
|
||||
//eldbus_shutdown();
|
||||
}
|
||||
|
||||
#if 0
|
||||
static const Eldbus_Method colorclass_editor_methods[] =
|
||||
{
|
||||
{ "SendCC", ELDBUS_ARGS({"t", "Window ID"}, {"b", "reset"}, {"a(ssa(iiii))", "Array of color classes"}), NULL, _dbus_send_cc, 0},
|
||||
|
@ -670,9 +670,9 @@ static const Eldbus_Service_Interface_Desc base_desc =
|
|||
{
|
||||
ELM_COLOR_CLASS_METHOD_BASE, colorclass_editor_methods, colorclass_editor_signals, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
#endif
|
||||
EAPI Evas_Object *
|
||||
elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
||||
elm_color_class_editor_add(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object *ly, *bt, *gl, *cs;
|
||||
Colorclass_UI *cc;
|
||||
|
@ -683,7 +683,7 @@ elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
|||
|
||||
cc = calloc(1, sizeof(Colorclass_UI));
|
||||
if (!cc) return NULL;
|
||||
if (!winid)
|
||||
//if (!winid)
|
||||
{
|
||||
it = edje_color_class_active_iterator_new();
|
||||
EINA_ITERATOR_FOREACH(it, ecc)
|
||||
|
@ -710,6 +710,7 @@ elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
|||
}
|
||||
eina_iterator_free(it);
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
if (!remote_iface)
|
||||
|
@ -725,6 +726,7 @@ elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
|||
remote_ccuis = eina_inlist_append(remote_ccuis, EINA_INLIST_GET(cc));
|
||||
}
|
||||
cc->winid = winid;
|
||||
#endif
|
||||
cc->ly = ly = elm_layout_add(obj);
|
||||
if (!elm_layout_theme_set(ly, "layout", "colorclass", "base"))
|
||||
CRI("Failed to set layout!");
|
||||
|
@ -759,14 +761,15 @@ elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
|||
EINA_LIST_FREE(ccs, ecc)
|
||||
elm_genlist_item_append(gl, &itc, ecc, NULL, 0, NULL, NULL);
|
||||
|
||||
if (winid)
|
||||
{
|
||||
/* FIXME: translate */
|
||||
elm_object_text_set(ly, "Loading color scheme...");
|
||||
elm_object_signal_emit(ly, "elm,state,info", "elm");
|
||||
elm_object_signal_emit(ly, "elm,state,remote", "elm");
|
||||
}
|
||||
else if (list_cb)
|
||||
//if (winid)
|
||||
//{
|
||||
///* FIXME: translate */
|
||||
//elm_object_text_set(ly, "Loading color scheme...");
|
||||
//elm_object_signal_emit(ly, "elm,state,info", "elm");
|
||||
//elm_object_signal_emit(ly, "elm,state,remote", "elm");
|
||||
//}
|
||||
//else
|
||||
if (list_cb)
|
||||
{
|
||||
ccs = list_cb();
|
||||
EINA_LIST_FREE(ccs, ecc)
|
||||
|
@ -774,7 +777,7 @@ elm_color_class_editor_add(Evas_Object *obj, uint64_t winid)
|
|||
if (test)
|
||||
{
|
||||
if (eina_hash_find(test, ecc->name)) continue;
|
||||
eina_hash_add(test, ecc->name, ecc2);
|
||||
eina_hash_add(test, ecc->name, ecc);
|
||||
}
|
||||
elm_genlist_item_sorted_insert(gl, &itc, ecc, NULL, 0, (Eina_Compare_Cb)_colorclass_sort, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#ifdef EFL_BETA_API_SUPPORT
|
||||
# ifndef ELM_COLOR_CLASS_H
|
||||
# define ELM_COLOR_CLASS_H
|
||||
#ifndef ELM_COLOR_CLASS_H
|
||||
# define ELM_COLOR_CLASS_H
|
||||
|
||||
/**
|
||||
* @defgroup Elm_Color_Class_Group Color Class Editor
|
||||
|
@ -10,7 +9,7 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#define ELM_COLOR_CLASS_METHOD_BASE "org.elementary.colorclass"
|
||||
//#define ELM_COLOR_CLASS_METHOD_BASE "org.elementary.colorclass"
|
||||
|
||||
/**
|
||||
* @typedef Elm_Color_Class_Name_Cb
|
||||
|
@ -31,19 +30,15 @@ typedef Eina_List *(*Elm_Color_Class_List_Cb)(void);
|
|||
/**
|
||||
* @brief Create a new color class editor
|
||||
* @param obj The parent object
|
||||
* @param winid The remote window id to edit
|
||||
*
|
||||
* A color class editor is a visual representation of the color schemes in an application.
|
||||
* Values changed in the editor are stored in Elementary's config and will remain until they
|
||||
* are reset or the config is cleared. By default, the editor will load only the currently active
|
||||
* color classes in an application.
|
||||
*
|
||||
* If @p winid is provided the editor will run in remote mode, managing color classes over DBus
|
||||
* for applications which provide the required interfaces.
|
||||
*
|
||||
* @since 1.14
|
||||
*/
|
||||
EAPI Evas_Object *elm_color_class_editor_add(Evas_Object *obj, uint64_t winid);
|
||||
EAPI Evas_Object *elm_color_class_editor_add(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Set a callback to provide translations for color class descriptions
|
||||
|
@ -83,5 +78,4 @@ EAPI void elm_color_class_list_cb_set(Elm_Color_Class_List_Cb cb);
|
|||
EAPI Eina_List *elm_color_class_util_edje_file_list(Eina_File *f);
|
||||
/** }@ */
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node name="/">
|
||||
<interface name="org.elementary.colorclass">
|
||||
<method name="SendCC">
|
||||
<arg type="t" name="winid" direction="in" />
|
||||
<arg type="b" name="reset" direction="in" />
|
||||
<arg type="a(ssa(iiii))" name="Array of color classes" direction="in" />
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
|
||||
</method>
|
||||
<method name="Close">
|
||||
<arg type="t" name="winid" direction="in" />
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
|
||||
</method>
|
||||
<signal name="Edit">
|
||||
<arg type="t" name="winid" direction="out" />
|
||||
</signal>
|
||||
<signal name="Changed">
|
||||
<arg type="t" name="winid" direction="out" />
|
||||
<arg type="s" name="Color class name" direction="out" />
|
||||
<arg type="a(iiii)" name="Colors" direction="out" />
|
||||
</signal>
|
||||
<signal name="Reset">
|
||||
<arg type="t" name="winid" direction="out" />
|
||||
<arg type="s" name="name" direction="out" />
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
||||
|
Loading…
Reference in New Issue