2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
|
2012-12-27 05:38:40 -08:00
|
|
|
#include "elm_priv.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_systray_eo.h"
|
2012-12-27 05:38:40 -08:00
|
|
|
#include "elm_systray_watcher.h"
|
|
|
|
|
|
|
|
EAPI int ELM_EVENT_SYSTRAY_READY = 0;
|
|
|
|
|
|
|
|
typedef struct _Elm_Systray_Private_Data
|
|
|
|
{
|
|
|
|
Elm_Systray_Category cat;
|
|
|
|
Elm_Systray_Status status;
|
|
|
|
|
|
|
|
const char *att_icon_name;
|
|
|
|
const char *icon_name;
|
|
|
|
const char *icon_theme_path;
|
|
|
|
const char *id;
|
|
|
|
const char *title;
|
|
|
|
const char *menu;
|
|
|
|
const Eo *menu_obj;
|
|
|
|
} Elm_Systray_Private_Data;
|
|
|
|
|
|
|
|
static Elm_Systray_Private_Data _item = {
|
|
|
|
.cat = ELM_SYSTRAY_CATEGORY_APP_STATUS,
|
|
|
|
.status = ELM_SYSTRAY_STATUS_ACTIVE,
|
|
|
|
.att_icon_name = NULL,
|
|
|
|
.icon_name = NULL,
|
|
|
|
.icon_theme_path = NULL,
|
|
|
|
.id = NULL,
|
|
|
|
.title = NULL,
|
|
|
|
.menu = NULL,
|
|
|
|
.menu_obj = NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OBJ_PATH "/org/ayatana/NotificationItem/StatusNotifierItem"
|
|
|
|
#define INTERFACE "org.kde.StatusNotifierItem"
|
|
|
|
|
|
|
|
static Eina_Bool _elm_need_systray = EINA_FALSE;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
static Eldbus_Connection *_conn = NULL;
|
|
|
|
static Eldbus_Service_Interface *_iface = NULL;
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
static const char *_Elm_Systray_Cat_Str[] = {
|
|
|
|
[ELM_SYSTRAY_CATEGORY_APP_STATUS] = "ApplicationStatus",
|
|
|
|
[ELM_SYSTRAY_CATEGORY_COMMUNICATIONS] = "Communications",
|
|
|
|
[ELM_SYSTRAY_CATEGORY_SYS_SERVICES] = "SystemServices",
|
|
|
|
[ELM_SYSTRAY_CATEGORY_HARDWARE] = "Hardware",
|
|
|
|
[ELM_SYSTRAY_CATEGORY_OTHER] = "Other"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_Elm_Systray_Status_Str[] = {
|
|
|
|
[ELM_SYSTRAY_STATUS_ACTIVE] = "Active",
|
|
|
|
[ELM_SYSTRAY_STATUS_PASSIVE] = "Passive",
|
|
|
|
[ELM_SYSTRAY_STATUS_ATTENTION] = "NeedsAttention"
|
|
|
|
};
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
// org.kde.StatusNotifierItem Service
|
|
|
|
// =============================================================================
|
|
|
|
// =============================================================================
|
|
|
|
// Methods
|
|
|
|
// =============================================================================
|
2013-04-23 09:05:43 -07:00
|
|
|
static Eldbus_Message *
|
|
|
|
_empty_method(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
|
|
|
const Eldbus_Message *msg)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
return eldbus_message_method_return_new(msg);
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
static const Eldbus_Method methods[] = {
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
"Scroll",
|
2013-04-23 09:05:43 -07:00
|
|
|
ELDBUS_ARGS({"i", "delta"}, {"s", "orientation"}),
|
2012-12-27 05:38:40 -08:00
|
|
|
NULL,
|
|
|
|
_empty_method,
|
|
|
|
0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"SecondaryActivate",
|
2013-04-23 09:05:43 -07:00
|
|
|
ELDBUS_ARGS({"i", "x"}, {"i", "y"}),
|
2012-12-27 05:38:40 -08:00
|
|
|
NULL,
|
|
|
|
_empty_method,
|
|
|
|
0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"XAyatanaSecondaryActivate",
|
2013-04-23 09:05:43 -07:00
|
|
|
ELDBUS_ARGS({"u", "timestamp"}),
|
2012-12-27 05:38:40 -08:00
|
|
|
NULL,
|
|
|
|
_empty_method,
|
|
|
|
0
|
|
|
|
},
|
|
|
|
{ NULL, NULL, NULL, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
// Signals
|
|
|
|
// =============================================================================
|
|
|
|
typedef enum _Elm_Systray_Service_Signals
|
|
|
|
{
|
|
|
|
ELM_SYSTRAY_SIGNAL_NEWATTENTIONICON,
|
|
|
|
ELM_SYSTRAY_SIGNAL_NEWICON,
|
|
|
|
ELM_SYSTRAY_SIGNAL_NEWICONTHEMEPATH,
|
|
|
|
ELM_SYSTRAY_SIGNAL_NEWSTATUS,
|
|
|
|
ELM_SYSTRAY_SIGNAL_NEWTITLE,
|
|
|
|
ELM_SYSTRAY_SIGNAL_XAYATANANEWLABEL
|
|
|
|
} Elm_Systray_Service_Signals;
|
|
|
|
|
|
|
|
#define _elm_systray_signal_emit(sig, ...) \
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_signal_emit(_iface, sig, __VA_ARGS__)
|
2012-12-27 05:38:40 -08:00
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
static const Eldbus_Signal signals[] = {
|
2012-12-27 05:38:40 -08:00
|
|
|
[ELM_SYSTRAY_SIGNAL_NEWATTENTIONICON] = {
|
|
|
|
"NewAttentionIcon", NULL, 0
|
|
|
|
},
|
|
|
|
[ELM_SYSTRAY_SIGNAL_NEWICON] = {
|
|
|
|
"NewIcon", NULL, 0
|
|
|
|
},
|
|
|
|
[ELM_SYSTRAY_SIGNAL_NEWICONTHEMEPATH] = {
|
2013-04-23 09:05:43 -07:00
|
|
|
"NewIconThemePath", ELDBUS_ARGS({"s", "icon_theme_path"}), 0
|
2012-12-27 05:38:40 -08:00
|
|
|
},
|
|
|
|
[ELM_SYSTRAY_SIGNAL_NEWSTATUS] = {
|
2013-04-23 09:05:43 -07:00
|
|
|
"NewStatus", ELDBUS_ARGS({"s", "status"}), 0
|
2012-12-27 05:38:40 -08:00
|
|
|
},
|
|
|
|
[ELM_SYSTRAY_SIGNAL_NEWTITLE] = {
|
|
|
|
"NewTitle", NULL, 0
|
|
|
|
},
|
|
|
|
[ELM_SYSTRAY_SIGNAL_XAYATANANEWLABEL] = {
|
2013-04-23 09:05:43 -07:00
|
|
|
"XAyatanaNewLabel", ELDBUS_ARGS({"s", "label"}, {"s", "guide"}), 0
|
2012-12-27 05:38:40 -08:00
|
|
|
},
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
// Properties
|
|
|
|
// =============================================================================
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_str_empty_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', "");
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_attention_icon_name_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.att_icon_name ? _item.att_icon_name : "";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_category_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', _Elm_Systray_Cat_Str[_item.cat]);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_icon_name_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.icon_name ? _item.icon_name : "";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_icon_theme_path_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.icon_theme_path ? _item.icon_theme_path : "";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_id_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.id ? _item.id : "";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_menu_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.menu ? _item.menu : "/";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 'o', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_status_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's',
|
2012-12-27 05:38:40 -08:00
|
|
|
_Elm_Systray_Status_Str[_item.status]);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_title_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *s = _item.title ? _item.title : "";
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 's', s);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2013-04-23 09:05:43 -07:00
|
|
|
_prop_xayatana_orderindex_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
|
2012-12-27 05:38:40 -08:00
|
|
|
const char *propname EINA_UNUSED,
|
2013-04-23 09:05:43 -07:00
|
|
|
Eldbus_Message_Iter *iter,
|
|
|
|
const Eldbus_Message *request_msg EINA_UNUSED,
|
|
|
|
Eldbus_Message **error EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_message_iter_basic_append(iter, 'u', 0);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
static const Eldbus_Property properties[] = {
|
2012-12-27 05:38:40 -08:00
|
|
|
{ "AttentionAcessibleDesc", "s", _prop_str_empty_get, NULL, 0 },
|
|
|
|
{ "AttentionIconName", "s", _prop_attention_icon_name_get, NULL, 0 },
|
|
|
|
{ "Category", "s", _prop_category_get, NULL, 0 },
|
|
|
|
{ "IconAcessibleDesc", "s", _prop_str_empty_get, NULL, 0 },
|
|
|
|
{ "IconName", "s", _prop_icon_name_get, NULL, 0 },
|
|
|
|
{ "IconThemePath", "s", _prop_icon_theme_path_get, NULL, 0 },
|
|
|
|
{ "Id", "s", _prop_id_get, NULL, 0 },
|
|
|
|
{ "Menu", "o", _prop_menu_get, NULL, 0 },
|
|
|
|
{ "Status", "s", _prop_status_get, NULL, 0 },
|
|
|
|
{ "Title", "s", _prop_title_get, NULL, 0 },
|
|
|
|
{ "XAyatanaLabelGuide", "s", _prop_str_empty_get, NULL, 0 },
|
|
|
|
{ "XAyatanaLabel", "s", _prop_str_empty_get, NULL, 0 },
|
|
|
|
{ "XAyatanaOrderingIndex", "u", _prop_xayatana_orderindex_get, NULL, 0 },
|
|
|
|
{ NULL, NULL, NULL, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
static const Eldbus_Service_Interface_Desc _iface_desc = {
|
2014-07-15 01:31:06 -07:00
|
|
|
INTERFACE, methods, signals, properties, NULL, NULL
|
2012-12-27 05:38:40 -08:00
|
|
|
};
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
static void
|
|
|
|
_menu_died(void *data EINA_UNUSED,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_item.menu_obj = NULL;
|
|
|
|
|
|
|
|
eina_stringshare_replace(&(_item.menu), NULL);
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Menu");
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_category_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, Elm_Systray_Category cat)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (_item.cat == cat) return;
|
|
|
|
|
|
|
|
_item.cat = cat;
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Category");
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static Elm_Systray_Category
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_category_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.cat;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_status_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, Elm_Systray_Status st)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (_item.status == st) return;
|
|
|
|
|
|
|
|
_item.status = st;
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Status");
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_systray_signal_emit(ELM_SYSTRAY_SIGNAL_NEWSTATUS,
|
|
|
|
_Elm_Systray_Status_Str[_item.status]);
|
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static Elm_Systray_Status
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_status_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.status;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_att_icon_name_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const char *att_icon_name)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (!eina_stringshare_replace(&(_item.att_icon_name), att_icon_name)) return;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "AttentionIconName");
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_systray_signal_emit(ELM_SYSTRAY_SIGNAL_NEWATTENTIONICON, NULL);
|
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_att_icon_name_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.att_icon_name;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_icon_name_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const char *icon_name)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (!eina_stringshare_replace(&(_item.icon_name), icon_name)) return;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "IconName");
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_systray_signal_emit(ELM_SYSTRAY_SIGNAL_NEWICON, NULL);
|
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_icon_name_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.icon_name;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_icon_theme_path_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const char *icon_theme_path)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (!eina_stringshare_replace(&(_item.icon_theme_path), icon_theme_path))
|
|
|
|
return;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "IconThemePath");
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_systray_signal_emit(ELM_SYSTRAY_SIGNAL_NEWICONTHEMEPATH,
|
|
|
|
_item.icon_theme_path);
|
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_icon_theme_path_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.icon_theme_path;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_id_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const char *id)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (!eina_stringshare_replace(&(_item.id), id)) return;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Id");
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_id_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.id;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_title_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const char *title)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
if (!eina_stringshare_replace(&(_item.title), title)) return;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Title");
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_systray_signal_emit(ELM_SYSTRAY_SIGNAL_NEWTITLE, NULL);
|
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_title_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.title;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_systray_menu_set(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED, const Eo *menu_obj)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
|
|
|
const char *menu = NULL;
|
|
|
|
|
|
|
|
if (_item.menu_obj == menu_obj) return;
|
|
|
|
|
|
|
|
if (menu_obj)
|
|
|
|
{
|
|
|
|
menu = _elm_dbus_menu_register((Eo *) menu_obj);
|
|
|
|
evas_object_event_callback_add((Evas_Object *) menu_obj,
|
|
|
|
EVAS_CALLBACK_DEL, _menu_died, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_stringshare_replace(&(_item.menu), menu);
|
|
|
|
|
|
|
|
if (_item.menu_obj)
|
|
|
|
evas_object_event_callback_del_full((Evas_Object *) _item.menu_obj,
|
|
|
|
EVAS_CALLBACK_DEL, _menu_died, NULL);
|
|
|
|
|
|
|
|
_item.menu_obj = menu_obj;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_property_changed(_iface, "Menu");
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static const Eo*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_systray_menu_get(const Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
return _item.menu_obj;
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_systray_register(Eo *obj EINA_UNUSED, void *priv EINA_UNUSED)
|
2012-12-27 05:38:40 -08:00
|
|
|
{
|
2014-03-26 06:20:50 -07:00
|
|
|
if (!_elm_need_systray) return EINA_FALSE;
|
2012-12-27 05:38:40 -08:00
|
|
|
|
2014-03-26 06:20:50 -07:00
|
|
|
return _elm_systray_watcher_status_notifier_item_register(OBJ_PATH);
|
2012-12-27 05:38:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_need_systray(void)
|
|
|
|
{
|
|
|
|
if (_elm_need_systray) return EINA_TRUE;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
if (!elm_need_eldbus()) return EINA_FALSE;
|
2012-12-27 05:38:40 -08:00
|
|
|
|
2017-12-18 18:14:37 -08:00
|
|
|
ELM_EVENT_SYSTRAY_READY = ecore_event_type_new();
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
if (!_elm_systray_watcher_init()) return EINA_FALSE;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
|
2012-12-27 05:38:40 -08:00
|
|
|
if (!_conn) goto err;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
_iface = eldbus_service_interface_register(_conn, OBJ_PATH, &_iface_desc);
|
2012-12-27 05:38:40 -08:00
|
|
|
if (!_iface) goto err;
|
|
|
|
|
|
|
|
_elm_need_systray = EINA_TRUE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
err:
|
|
|
|
if (_conn)
|
|
|
|
{
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_connection_unref(_conn);
|
2012-12-27 05:38:40 -08:00
|
|
|
_conn = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
_elm_systray_watcher_shutdown();
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_elm_unneed_systray(void)
|
|
|
|
{
|
|
|
|
if (!_elm_need_systray) return;
|
|
|
|
|
2017-03-09 16:16:56 -08:00
|
|
|
ecore_event_type_flush(ELM_EVENT_SYSTRAY_READY);
|
|
|
|
|
2012-12-27 05:38:40 -08:00
|
|
|
_elm_need_systray = EINA_FALSE;
|
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_service_interface_unregister(_iface);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
2013-04-23 09:05:43 -07:00
|
|
|
eldbus_connection_unref(_conn);
|
2012-12-27 05:38:40 -08:00
|
|
|
|
|
|
|
_elm_systray_watcher_shutdown();
|
|
|
|
|
|
|
|
eina_stringshare_del(_item.att_icon_name);
|
|
|
|
eina_stringshare_del(_item.icon_name);
|
|
|
|
eina_stringshare_del(_item.icon_theme_path);
|
|
|
|
eina_stringshare_del(_item.id);
|
|
|
|
eina_stringshare_del(_item.title);
|
|
|
|
eina_stringshare_del(_item.menu);
|
|
|
|
|
|
|
|
if (_item.menu_obj)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full((Evas_Object *) _item.menu_obj,
|
|
|
|
EVAS_CALLBACK_DEL, _menu_died,
|
|
|
|
NULL);
|
|
|
|
_item.menu_obj = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
elm_systray: add back beta constructor
Summary:
1/2 year ago we have removed the automatic generation of legacy
headers. In this go we also removed the installation of legacy eo beta
APIs, as they definitly should not be used. However, there is the legacy
systray API which does not depend directly on eo. Apps could use this
before due to specifying the BETA define, now they only can call the
API, but cannot construct the object they need. This adds this back
under the beta tag, so those apps can continue working.
I am not sure myself if i like the commit or not, its a beta thing, why
should we fix it. However, Its quite a easy thing to add such a
constructor method for us, and enables app to continue working.
Reviewers: zmike, segfaultxavi
Reviewed By: zmike
Subscribers: jf_simon, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9757
2019-08-29 07:06:42 -07:00
|
|
|
EAPI Elm_Systray*
|
|
|
|
elm_systray_add(Evas_Object *win)
|
|
|
|
{
|
|
|
|
return efl_add(ELM_SYSTRAY_CLASS, win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_systray_eo.c"
|