forked from enlightenment/enlightenment
e/appmenu: sanitize method table
Patch by: Lucas De Marchi <lucas.de.marchi@gmail.com> SVN revision: 82179
This commit is contained in:
parent
c83d114491
commit
271bc56cdd
|
@ -6,11 +6,18 @@
|
||||||
|
|
||||||
#define ERROR_WINDOW_NOT_FOUND "com.canonical.AppMenu.Registrar.WindowNotFound"
|
#define ERROR_WINDOW_NOT_FOUND "com.canonical.AppMenu.Registrar.WindowNotFound"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SIGNAL_WINDOW_REGISTERED = 0,
|
||||||
|
SIGNAL_WINDOW_UNREGISTERED,
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
appmenu_application_monitor(void *data, const char *bus EINA_UNUSED, const char *old __UNUSED__, const char *new __UNUSED__)
|
appmenu_application_monitor(void *data, const char *bus EINA_UNUSED, const char *old __UNUSED__, const char *new __UNUSED__)
|
||||||
{
|
{
|
||||||
E_AppMenu_Window *window = data;
|
E_AppMenu_Window *window = data;
|
||||||
edbus_service_signal_emit(window->ctxt->iface, 1, window->window_id);
|
edbus_service_signal_emit(window->ctxt->iface, SIGNAL_WINDOW_UNREGISTERED,
|
||||||
|
window->window_id);
|
||||||
appmenu_window_free(window);
|
appmenu_window_free(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +71,8 @@ _on_register_window(const EDBus_Service_Interface *iface, const EDBus_Message *m
|
||||||
ctxt->windows = eina_list_append(ctxt->windows, window);
|
ctxt->windows = eina_list_append(ctxt->windows, window);
|
||||||
window->ctxt = ctxt;
|
window->ctxt = ctxt;
|
||||||
|
|
||||||
edbus_service_signal_emit(iface, 0, window_id, bus_id, path);
|
edbus_service_signal_emit(iface, SIGNAL_WINDOW_REGISTERED, window_id,
|
||||||
|
bus_id, path);
|
||||||
return edbus_message_method_return_new(msg);
|
return edbus_message_method_return_new(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +105,7 @@ _on_unregister_window(const EDBus_Service_Interface *iface, const EDBus_Message
|
||||||
w = window_find(ctxt, window_id);
|
w = window_find(ctxt, window_id);
|
||||||
if (w)
|
if (w)
|
||||||
appmenu_window_free(w);
|
appmenu_window_free(w);
|
||||||
edbus_service_signal_emit(iface, 1, window_id);
|
edbus_service_signal_emit(iface, SIGNAL_WINDOW_UNREGISTERED, window_id);
|
||||||
return edbus_message_method_return_new(msg);
|
return edbus_message_method_return_new(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,32 +162,27 @@ _on_getmenus(const EDBus_Service_Interface *iface, const EDBus_Message *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const EDBus_Method registrar_methods[] = {
|
static const EDBus_Method registrar_methods[] = {
|
||||||
{
|
{ "RegisterWindow", EDBUS_ARGS({"u", "windowId"},{"o", "menuObjectPath"}),
|
||||||
"RegisterWindow", EDBUS_ARGS({"u", "windowId"},{"o", "menuObjectPath"}),
|
NULL, _on_register_window },
|
||||||
NULL, _on_register_window, 0
|
{ "UnregisterWindow", EDBUS_ARGS({"u", "windowId"}),
|
||||||
},
|
NULL, _on_unregister_window },
|
||||||
{
|
{ "GetMenuForWindow", EDBUS_ARGS({"u", "windowId"}),
|
||||||
"UnregisterWindow", EDBUS_ARGS({"u", "windowId"}),
|
EDBUS_ARGS({"s", "bus_id"},{"o", "menu_path"}), _on_getmenu },
|
||||||
NULL, _on_unregister_window, 0
|
{ "GetMenus", NULL, EDBUS_ARGS({"a(uso)", "array_of_menu"}), _on_getmenus },
|
||||||
},
|
{ }
|
||||||
{
|
|
||||||
"GetMenuForWindow", EDBUS_ARGS({"u", "windowId"}),
|
|
||||||
EDBUS_ARGS({"s", "bus_id"},{"o", "menu_path"}), _on_getmenu, 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"GetMenus", NULL, EDBUS_ARGS({"a(uso)", "array_of_menu"}), _on_getmenus, 0
|
|
||||||
},
|
|
||||||
{ NULL, NULL, NULL, NULL, 0 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EDBus_Signal registrar_signals[] = {
|
static const EDBus_Signal registrar_signals[] = {
|
||||||
{ "WindowRegistered", EDBUS_ARGS({"u", "windowId"}, {"s", "bus_id"}, {"o", "menu_path"}), 0 },
|
[SIGNAL_WINDOW_REGISTERED] =
|
||||||
{ "WindowUnregistered", EDBUS_ARGS({"u", "windowId"}), 0 },
|
{ "WindowRegistered",
|
||||||
{ NULL, NULL, 0 }
|
EDBUS_ARGS({"u", "windowId"}, {"s", "bus_id"}, {"o", "menu_path"}) },
|
||||||
|
[SIGNAL_WINDOW_UNREGISTERED] =
|
||||||
|
{ "WindowUnregistered", EDBUS_ARGS({"u", "windowId"}) },
|
||||||
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EDBus_Service_Interface_Desc registrar_iface = {
|
static const EDBus_Service_Interface_Desc registrar_iface = {
|
||||||
REGISTRAR_IFACE, registrar_methods, registrar_signals, NULL, NULL, NULL
|
REGISTRAR_IFACE, registrar_methods, registrar_signals
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue