use dbus to tell e.TeamWork whenever a link is detected

This was requested by the crazy e18 release manager.
devs/lucas/wip
Boris Faure 9 years ago
parent 3ed65bbcdc
commit f1c3bf52ca
  1. 12
      configure.ac
  2. 3
      src/bin/Makefile.am
  3. 54
      src/bin/dbus.c
  4. 8
      src/bin/dbus.h
  5. 5
      src/bin/main.c
  6. 8
      src/bin/termiolink.c

@ -38,6 +38,15 @@ requirements="\
PKG_CHECK_MODULES([TERMINOLOGY], [${requirements}])
PKG_CHECK_MODULES([ELDBUS],
[eldbus],
[
AC_DEFINE(HAVE_ELDBUS, 1, [DBUS support])
have_eldbus="yes"
],
[have_eldbus="no"]
)
AC_CHECK_FUNCS(mkstemps)
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
@ -96,3 +105,6 @@ echo
echo "Installation...............: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...................: $prefix"
echo
echo "Features:"
echo " dbus................: $have_eldbus"
echo

@ -6,7 +6,7 @@ terminology_CPPFLAGS = -I. \
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@
terminology_LDADD = @TERMINOLOGY_LIBS@
terminology_LDADD = @TERMINOLOGY_LIBS@ @ELDBUS_LIBS@
terminology_SOURCES = \
private.h \
@ -41,6 +41,7 @@ lz4/lz4.c lz4/lz4.h \
utf8.c utf8.h \
win.c win.h \
utils.c utils.h \
dbus.c dbus.h \
extns.h
tybg_SOURCES = \

@ -0,0 +1,54 @@
#include "private.h"
#include <Elementary.h>
#include "dbus.h"
#ifdef HAVE_ELDBUS
#include <Eldbus.h>
static Eldbus_Connection *ty_dbus_conn = NULL;
static Eldbus_Object *ty_e_object = NULL;
void
ty_dbus_link_detect(const char *url)
{
Eldbus_Message *msg;
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
"/org/enlightenment/wm/RemoteObject",
"org.enlightenment.wm.Teamwork",
"LinkDetect");
eldbus_message_arguments_append(msg, "s", url);
eldbus_object_send(ty_e_object, msg, NULL, NULL, -1);
}
void
ty_dbus_init(void)
{
Eldbus_Service_Interface *iface;
if (ty_dbus_conn) return;
eldbus_init();
ty_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
ty_e_object = eldbus_object_get(ty_dbus_conn,
"org.enlightenment.wm.service",
"/org/enlightenment/wm/RemoteObject");
}
void
ty_dbus_shutdown(void)
{
if (ty_dbus_conn) eldbus_connection_unref(ty_dbus_conn);
ty_dbus_conn = NULL;
ty_e_object = NULL;
eldbus_shutdown();
}
#else
void ty_dbus_link_detect(const char *url __UNUSED__) {}
void ty_dbus_init(void) {}
void ty_dbus_shutdown(void) {}
#endif

@ -0,0 +1,8 @@
#ifndef _DBUS_H__
#define _DBUS_H__ 1
void ty_dbus_link_detect(const char *url);
void ty_dbus_init(void);
void ty_dbus_shutdown(void);
#endif

@ -13,6 +13,7 @@
#include "utils.h"
#include "ipc.h"
#include "sel.h"
#include "dbus.h"
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8)
#define PANES_TOP "left"
@ -2936,12 +2937,16 @@ remote:
if (nowm)
ecore_evas_focus_set(ecore_evas_ecore_evas_get(
evas_object_evas_get(wn->win)), 1);
ty_dbus_init();
elm_run();
end:
#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
free(cmd);
#endif
ty_dbus_shutdown();
ipc_shutdown();
while (wins)

@ -2,6 +2,7 @@
#include <Elementary.h>
#include "termio.h"
#include "utils.h"
#include "dbus.h"
static Eina_Bool
coord_back(int *x, int *y, int w, int h __UNUSED__)
@ -204,9 +205,10 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
if ((len > 1) && (!endmatch))
{
Eina_Bool is_file = _is_file(s);
Eina_Bool is_url = link_is_url(s);
if (is_file ||
link_is_email(s) ||
link_is_url(s))
is_url)
{
if (x1r) *x1r = x1;
if (y1r) *y1r = y1;
@ -219,6 +221,10 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
free(s);
return ret;
}
else if (is_url)
{
ty_dbus_link_detect(s);
}
return s;
}

Loading…
Cancel
Save