From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][PATCH 04/46] e-tasks: Migrate to eldbus
Date: Tue, 1 Apr 2014 19:13:12 +0200 [thread overview]
Message-ID: <1396372434-10710-4-git-send-email-Martin.Jansa@gmail.com> (raw)
In-Reply-To: <1396372434-10710-1-git-send-email-Martin.Jansa@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
.../0001-dbus-stuff-Convert-to-eldbus.patch | 204 +++++++++++++++++++++
meta-efl/recipes-efl/e17/e-tasks_git.bb | 4 +-
2 files changed, 207 insertions(+), 1 deletion(-)
create mode 100644 meta-efl/recipes-efl/e17/e-tasks/0001-dbus-stuff-Convert-to-eldbus.patch
diff --git a/meta-efl/recipes-efl/e17/e-tasks/0001-dbus-stuff-Convert-to-eldbus.patch b/meta-efl/recipes-efl/e17/e-tasks/0001-dbus-stuff-Convert-to-eldbus.patch
new file mode 100644
index 0000000..f92a772
--- /dev/null
+++ b/meta-efl/recipes-efl/e17/e-tasks/0001-dbus-stuff-Convert-to-eldbus.patch
@@ -0,0 +1,204 @@
+From 37223289b3d85ea8876e7ba7c9ff97ec428073ba Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Sat, 22 Feb 2014 14:36:38 +0100
+Subject: [PATCH] dbus-stuff: Convert to eldbus
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ configure.ac | 2 +-
+ src/Makefile.am | 2 +-
+ src/dbus-stuff.c | 95 ++++++++++++++++++++++++++++++++------------------------
+ src/dbus-stuff.h | 13 ++------
+ src/main.c | 2 +-
+ 5 files changed, 61 insertions(+), 53 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b3e4d12..4ace32a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -15,7 +15,7 @@ AC_HEADER_STDC
+
+ AM_PROG_LIBTOOL
+
+-PKG_CHECK_MODULES(TASKS, [elementary eina dbus-1 edbus sqlite3])
++PKG_CHECK_MODULES(TASKS, [elementary eina dbus-1 eldbus sqlite3])
+
+ AC_OUTPUT([
+ Makefile
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 2143dc9..31d5253 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -8,7 +8,7 @@ AM_CPPFLAGS = \
+ $(TASKS_CFLAGS)
+
+ AM_CFLAGS =\
+- $(EDBUS_CFLAGS) \
++ $(ELDBUS_CFLAGS) \
+ -Wall\
+ -g
+
+diff --git a/src/dbus-stuff.c b/src/dbus-stuff.c
+index 50809bc..9f02ef3 100644
+--- a/src/dbus-stuff.c
++++ b/src/dbus-stuff.c
+@@ -1,8 +1,7 @@
+ /***************************************************************************
+ * dbus-stuff.c
+ *
+- * Copyright 2009 cchandel
+- * <cchandel@yahoo.com>
++ * Copyright 2009 cchandel <cchandel@yahoo.com>
+ ****************************************************************************/
+
+ /*
+@@ -21,51 +20,67 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+ #include "dbus-stuff.h"
+-#include <string.h>
+-#include <E_DBus.h>
+-#include <Elementary.h>
++#include "Eldbus.h"
+
+-void occupy_cpu(void)
++void on_usage_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
++{
++ const char *errname, *errmsg;
++ if (eldbus_message_error_get(msg, &errname, &errmsg))
++ fprintf(stderr, "Error: %s %s\n", errname, errmsg);
++}
++
++int ousaged_resource(const char *resource, int used)
+ {
+- e_dbus_init();
+- conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+-
+- DBusMessage *msg;
+- msg = dbus_message_new_method_call(
+- "org.freesmartphone.ousaged",
+- "/org/freesmartphone/Usage",
+- "org.freesmartphone.Usage",
+- "RequestResource"
+- );
+-
+- const char *resource = "CPU";
+- dbus_message_append_args (msg, DBUS_TYPE_STRING, &resource, DBUS_TYPE_INVALID);
++ eldbus_init();
++ const char *REQUEST = "RequestResource";
++ const char *RELEASE = "ReleaseResource";
++ const int PREQUEST = 1;
+
+- e_dbus_message_send(conn, msg, dbus_reply_cb, -1, NULL);
+- dbus_message_unref(msg);
+-}
++ Eldbus_Connection *conn;
++ Eldbus_Object *obj;
++ Eldbus_Proxy *usage;
++ Eldbus_Pending *pending;
++ conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
++ if (!conn)
++ {
++ fprintf(stderr, "Error: could not get system bus\n");
++ return EXIT_FAILURE;
++ }
+
+-void release_cpu(void)
+-{
+- DBusMessage *msg;
+- msg = dbus_message_new_method_call(
+- "org.freesmartphone.ousaged",
+- "/org/freesmartphone/Usage",
+- "org.freesmartphone.Usage",
+- "ReleaseResource"
+- );
+-
+- const char *resource = "CPU";
+- dbus_message_append_args (msg, DBUS_TYPE_STRING, &resource, DBUS_TYPE_INVALID);
++ obj = eldbus_object_get(conn, "org.freesmartphone.ousaged", "/org/freesmartphone/Usage");
++ if (!obj)
++ {
++ fprintf(stderr, "Error: could not get object\n");
++ return EXIT_FAILURE;
++ }
+
+- e_dbus_message_send(conn, msg, dbus_reply_cb, -1, NULL);
+- dbus_message_unref(msg);
++ usage = eldbus_proxy_get(obj, "org.freesmartphone.Usage");
++ if (!usage)
++ {
++ fprintf(stderr, "Error: could not get proxy\n");
++ return EXIT_FAILURE;
++ }
++
++ pending = eldbus_proxy_call(usage, used == PREQUEST ? REQUEST : RELEASE, on_usage_cb, NULL, -1, "ss", resource);
++ if (!pending)
++ {
++ fprintf(stderr, "Error: could not call\n");
++ return EXIT_FAILURE;
++ }
++ eldbus_proxy_unref(usage);
++ eldbus_object_unref(obj);
++ eldbus_connection_unref(conn);
++
++ eldbus_shutdown();
++ return EXIT_SUCCESS;
+ }
+
+-void dbus_reply_cb(void *data, DBusMessage *replymsg, DBusError *error)
++int request_cpu(void)
+ {
+- if (dbus_error_is_set(error)) {
+- printf("Error: %s - %s\n", error->name, error->message);
+- }
++ return ousaged_resource("CPU", 1);
+ }
+
++int release_cpu(void)
++{
++ return ousaged_resource("CPU" , 0);
++}
+diff --git a/src/dbus-stuff.h b/src/dbus-stuff.h
+index 83d4778..a3c72cb 100644
+--- a/src/dbus-stuff.h
++++ b/src/dbus-stuff.h
+@@ -2,8 +2,7 @@
+ * dbus.h
+ *
+ * Fri Mar 6 12:32:57 2009
+- * Copyright 2009 nidhin
+- * <nidhin@nids-laptop.home>
++ * Copyright 2009 nidhin <nidhin@nids-laptop.home>
+ ****************************************************************************/
+
+ /*
+@@ -22,11 +21,5 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+-#include <E_DBus.h>
+-#include <Elementary.h>
+-
+-void occupy_cpu(void);
+-void release_cpu(void);
+-void dbus_reply_cb(void *data, DBusMessage *replymsg, DBusError *error);
+-
+-E_DBus_Connection *conn;
++int request_cpu(void);
++int release_cpu(void);
+diff --git a/src/main.c b/src/main.c
+index 92d21de..4e4bbe2 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -76,7 +76,7 @@ elm_main(int argc, char **argv)
+ //restore state
+ restore_state();
+
+- occupy_cpu();
++ request_cpu();
+
+ elm_run();
+ //clean up stuff
+--
+1.8.5.3
+
diff --git a/meta-efl/recipes-efl/e17/e-tasks_git.bb b/meta-efl/recipes-efl/e17/e-tasks_git.bb
index d17e4e7..6065157 100644
--- a/meta-efl/recipes-efl/e17/e-tasks_git.bb
+++ b/meta-efl/recipes-efl/e17/e-tasks_git.bb
@@ -4,7 +4,7 @@ AUTHOR = "cchandel"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a"
SECTION = "e/apps"
-DEPENDS = "elementary eina edbus sqlite3"
+DEPENDS = "elementary eina eldbus sqlite3"
inherit autotools
@@ -12,6 +12,8 @@ SRCREV = "890f5ee37d1a5fd1ceb2495950d15151d4cf756b"
PV = "0.0.2+gitr${SRCPV}"
SRC_URI = "git://github.com/shr-project/e-tasks.git"
+SRC_URI += "file://0001-dbus-stuff-Convert-to-eldbus.patch"
+
S = "${WORKDIR}/git"
do_install_append() {
--
1.9.1
next prev parent reply other threads:[~2014-04-01 17:14 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 17:13 [meta-oe][PATCH 01/46] efl: upgrade to 1.9.0 Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 02/46] webkit-efl: upgrade to new snapshot r164189 Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 03/46] e-wm: upgrade to 0.18.4 and drop old 0.17.5 Martin Jansa
2014-04-01 17:13 ` Martin Jansa [this message]
2014-04-01 17:13 ` [meta-oe][PATCH 05/46] python-efl: upgrade to 1.9.0 Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 06/46] eve: restrict for armv7a, because upstream dropped support in webkit-efl Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 07/46] efl, elementary, e-wm: upgrade to latest versions 1.9.2 and 1.18.6 Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 08/46] eve: adapt to webkit-efl changes Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 09/46] mplayer2: bump SRCREV to fix build issues with newer live555 Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 10/46] libdc1394: add libsdl dependency Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 11/46] sound-theme-freedesktop: add glib-2.0 and intltool-native dependency Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 12/46] freerdp: move to nonworking Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 13/46] gnome-control-center: include datadir/mime in PN Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 14/46] tracker: inherit only gnomebase, fix QA warn Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 15/46] libwnck*: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 16/46] elementary: remove --disable-web Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 17/46] wvstreams: fix QA warning Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 18/46] gnome-menus: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 19/46] babl: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 20/46] dconf: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 21/46] gnome-bluetooth: inherit only gnomebase, gtk-icon-cache Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 22/46] libgtop: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 23/46] libgdata: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 24/46] gnome-disk-utility: inherit only gnomebase, gtk-icon-cache Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 25/46] libgnome-keyring: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 26/46] libbonobo: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 27/46] modemmanager: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 28/46] gcr: inherit only gnomebase, gtk-icon-cache Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 29/46] gnome-backgrounds: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 30/46] gnome-themes: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 31/46] zenity: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 32/46] goffice: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 33/46] gtksourceview2: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 34/46] metacity: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 35/46] atftp: include whole sysconfdir in PN Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 36/46] zram: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 37/46] edbus: remove test-gui option Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 38/46] libgnomecanvas: add intltool dependency Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 39/46] mousepad: add dbus and intltool-native dependency Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 40/46] lzip: remove infodir Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 41/46] emacs: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 42/46] libgnomecups: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 43/46] libgnomeprint: " Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 44/46] tracker: remove --disable-introspection Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 45/46] libbonoboui: inherit only gnomebase Martin Jansa
2014-04-01 17:13 ` [meta-oe][PATCH 46/46] gnome-backgrounds: add glib-2.0 dependency Martin Jansa
2014-04-20 8:54 ` [meta-oe][PATCH 01/46] efl: upgrade to 1.9.0 Martin Jansa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396372434-10710-4-git-send-email-Martin.Jansa@gmail.com \
--to=martin.jansa@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.