r10 - include src
by abd4lla@fedoraproject.org
Author: abd4lla
Date: 2009-12-02 21:23:40 +0000 (Wed, 02 Dec 2009)
New Revision: 10
Added:
include/dbus_utils.h
include/firedbus_interface.h
src/dbus_utils.c
src/firedbus.c
Log:
Unfinished code in an attempt to make fkiptc a gobject
Added: include/dbus_utils.h
===================================================================
--- include/dbus_utils.h (rev 0)
+++ include/dbus_utils.h 2009-12-02 21:23:40 UTC (rev 10)
@@ -0,0 +1,28 @@
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
+
+/* inclusion guard */
+#ifndef __FIREKIT_DBUS_UTILS__H__
+#define __FIREKIT_DBUS_UTILS__H__
+#include <stdio.h>
+#include <dbus/dbus-glib.h>
+#include <stdlib.h>
+
+gboolean firekit_firedbus_connect(DBusGConnection **connection, GError **error);
+gboolean firekit_firedbus_request_servicename(const char* name, DBusGConnection *connection, GError **error);
+gboolean firekit_firedbus_init(const char *name, const char *path, DBusGConnection **connection, GError **error);
+#endif //__FIREKIT_DBUS_UTILS__H__
Added: include/firedbus_interface.h
===================================================================
--- include/firedbus_interface.h (rev 0)
+++ include/firedbus_interface.h 2009-12-02 21:23:40 UTC (rev 10)
@@ -0,0 +1,118 @@
+/* Generated by dbus-binding-tool; do not edit! */
+
+
+#ifndef __dbus_glib_marshal_firekit_firedbus_MARSHAL_H__
+#define __dbus_glib_marshal_firekit_firedbus_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* BOOLEAN:POINTER (/tmp/dbus-binding-tool-c-marshallers.DRAXXU:1) */
+extern void dbus_glib_marshal_firekit_firedbus_BOOLEAN__POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+dbus_glib_marshal_firekit_firedbus_BOOLEAN__POINTER (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1,
+ gpointer arg_1,
+ gpointer data2);
+ register GMarshalFunc_BOOLEAN__POINTER callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gboolean v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 2);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_pointer (param_values + 1),
+ data2);
+
+ g_value_set_boolean (return_value, v_return);
+}
+
+G_END_DECLS
+
+#endif /* __dbus_glib_marshal_firekit_firedbus_MARSHAL_H__ */
+
+#include <dbus/dbus-glib.h>
+static const DBusGMethodInfo dbus_glib_firekit_firedbus_methods[] = {
+ { (GCallback) firekit_firedbus_open_port, dbus_glib_marshal_firekit_firedbus_BOOLEAN__POINTER, 0 },
+};
+
+const DBusGObjectInfo dbus_glib_firekit_firedbus_object_info = {
+ 0,
+ dbus_glib_firekit_firedbus_methods,
+ 1,
+"org.fedorahosted.firekit\0OpenPort\0S\0\0\0",
+"\0",
+"\0"
+};
+
Added: src/dbus_utils.c
===================================================================
--- src/dbus_utils.c (rev 0)
+++ src/dbus_utils.c 2009-12-02 21:23:40 UTC (rev 10)
@@ -0,0 +1,106 @@
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
+
+#include "dbus_utils.h"
+#include "firedbus.h"
+
+/* Get the dbus connection object with the system bus
+ * @param DBusGConnection *connection: the pointer where we'll assign our connection
+ * @param GError *error: In case of error, we'll set our error here
+ * @return: TRUE on success, otherwise FALSE
+ */
+gboolean firekit_firedbus_connect(DBusGConnection **connection, GError **error){
+ syslog( LOG_DAEMON | LOG_INFO, "Getting connection to system bus\n");
+ *connection = dbus_g_bus_get(DBUS_BUS_SESSION, error);
+ if (connection == NULL){
+ return FALSE;
+ }
+ return TRUE;
+}
+/* Register firekit service name with the dbus daemon
+ * @param const char *name: Service name to register
+ * @param DBusGConnection *connection: The dbus connection
+ * @param GError *error: In case of error, we'll set out error here
+ * @retur: TRUE on success, otherwise FALSE
+ */
+gboolean firekit_firedbus_request_servicename(const char *name, DBusGConnection *connection, GError **error){
+ syslog(LOG_DAEMON | LOG_INFO, "Requesting service name %s from dbus service \n", name);
+ if (connection == NULL){
+ //TODO: set error
+ return FALSE;
+ }
+ DBusGProxy *bus = NULL;
+ guint result;
+ syslog(LOG_DAEMON | LOG_INFO, "Getting proxy of dbus service\n");
+ bus = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ if (bus == NULL){
+ //TODO: set error
+ syslog(LOG_DAEMON | LOG_INFO, "Failed to get proxy of dbus service.\n");
+ return FALSE;
+ }
+ syslog(LOG_DAEMON | LOG_INFO,"Calling RequestName of dbus service\n");
+ if (!dbus_g_proxy_call(bus, "RequestName", error, G_TYPE_STRING, name, G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE, G_TYPE_INVALID,
+ G_TYPE_UINT, &result, G_TYPE_INVALID)){
+ syslog(LOG_DAEMON | LOG_INFO, "Proxy call failed due to: %s\n",(*error)->message);
+ return FALSE;
+ }
+ syslog(LOG_DAEMON | LOG_INFO, "RequestName returned %d \n", result);
+ if (result != 1) {
+ syslog(LOG_DAEMON | LOG_INFO, "Failed to get name %s: %s\n", name, (*error)->message);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/* Initialization method for our dbus interface, it does the following
+ * 1- Gets a connection to dbus
+ * 2- Requests our service name
+ * 3- Creates a new gobject that'll be exposed
+ * 4- Registers that object in the dbus
+ * Register GObject to the dbus service
+ * @param const char *name: Service name "eg: org.fedorahosted.firekit
+ * @param const char *path: Object path "eg: /org/fedorahosted/firekit/Daemon"
+ * @param DBusGConnection *connection: The dbus connection which we'll create and fill
+ * @param GError *error: In case of error, we'll set out error here
+ * @retur: TRUE on success, otherwise FALSE
+ */
+gboolean firekit_firedbus_init(const char *name, const char *path, DBusGConnection **connection, GError **error){
+
+ *error =NULL;
+ *connection = NULL;
+ //Connect to dbus
+ if (!firekit_firedbus_connect(connection, error)){
+ syslog( LOG_DAEMON | LOG_INFO, "Failed to connect to dbus system bus due to %s\n", (*error)->message);
+ return FALSE;
+ }
+ //Request service name
+ if (!firekit_firedbus_request_servicename(name, *connection, error)){
+ syslog( LOG_DAEMON | LOG_INFO, "Failed to request service name %s error message %s \n", name, (*error)->message);
+ return FALSE;
+ }
+ //Create GObject
+ GObject * fdbus_obj = g_object_new(FIREKIT_TYPE_FDBUS, NULL);
+ if (fdbus_obj == NULL){
+ syslog( LOG_DAEMON | LOG_INFO, "Failed to request service name %s error message %s \n", name, (*error)->message);
+ return FALSE;
+ }
+
+ syslog( LOG_DAEMON | LOG_INFO, "Registering GObject at path %s \n", path);
+ dbus_g_connection_register_g_object (*connection, path, fdbus_obj);
+ return TRUE;
+}
+
Added: src/firedbus.c
===================================================================
--- src/firedbus.c (rev 0)
+++ src/firedbus.c 2009-12-02 21:23:40 UTC (rev 10)
@@ -0,0 +1,37 @@
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
+
+#include "firedbus.h"
+#include "firedbus_interface.h"
+#include <stdio.h>
+
+G_DEFINE_TYPE(FirekitFDBus, firekit_firedbus, G_TYPE_OBJECT);
+
+static void firekit_firedbus_class_init (FirekitFDBusClass *self) {
+ /* Install g_object info which is defined in firedbus_interface.h */
+ dbus_g_object_type_install_info ( FIREKIT_TYPE_FDBUS, & dbus_glib_firekit_firedbus_object_info);
+}
+
+static void firekit_firedbus_init(FirekitFDBus *self){
+
+}
+
+gboolean firekit_firedbus_open_port (FirekitFDBus *self, GError **err) {
+ printf("Calling syslog\n");
+ syslog( LOG_DAEMON | LOG_INFO, "firekit_firedbus_open_port called \n");
+ return TRUE;
+}
14 years, 5 months
r9 - / include src
by abd4lla@fedoraproject.org
Author: abd4lla
Date: 2009-12-02 21:23:01 +0000 (Wed, 02 Dec 2009)
New Revision: 9
Modified:
CMakeLists.txt
include/fired.h
include/firedbus.h
include/fkiptc.h
src/CMakeLists.txt
src/fired.c
src/fkiptc.c
Log:
Unfinished code in an attempt to make fkiptc a gobject
Modified: CMakeLists.txt
===================================================================
--- CMakeLists.txt 2009-08-07 02:30:13 UTC (rev 8)
+++ CMakeLists.txt 2009-12-02 21:23:01 UTC (rev 9)
@@ -1,5 +1,12 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(FIREKIT)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
INCLUDE_DIRECTORIES(include)
+
+find_package(GObject2 REQUIRED)
+find_package(GLib2 REQUIRED)
+find_package(DBus-GLib1 REQUIRED)
+
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(tests)
+
Modified: include/fired.h
===================================================================
--- include/fired.h 2009-08-07 02:30:13 UTC (rev 8)
+++ include/fired.h 2009-12-02 21:23:01 UTC (rev 9)
@@ -26,9 +26,11 @@
#include <unistd.h>
#include <syslog.h>
#include <string.h>
+#include "firedbus.h"
+#include <dbus/dbus-glib.h>
-
+/*
int32_t fired_init_daemon(void);
int32_t fired_register_to_dbus(void);
-
+*/
#endif
Modified: include/firedbus.h
===================================================================
--- include/firedbus.h 2009-08-07 02:30:13 UTC (rev 8)
+++ include/firedbus.h 2009-12-02 21:23:01 UTC (rev 9)
@@ -1,50 +1,66 @@
-/*
- * Copyright/Licensing information.
- */
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
/* inclusion guard */
-#ifndef __FIRED_FDBUS_H__
-#define __FIRED_FDBUS_H__
+#ifndef __FIREKIT_FDBUS_H__
+#define __FIREKIT_FDBUS_H__
-#include <glib-object.h>
/*
- * Potentially, include other headers on which this header depends.
+ * Header Inclusions
*/
+#include <glib-object.h>
+#include <syslog.h>
+#include <dbus/dbus-glib.h>
+#include <glib.h>
/*
* Type macros.
*/
-#define FIRED_TYPE_FDBUS (fired_fdbus_get_type())
-#define FIRED_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FIRED_TYPE_FDBUS, FiredFDBus))
-#define FIRED_IS_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FIRED_TYPE_FDBUS))
-#define FIRED_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FIRED_TYPE_FDBUS, FiredFDBusClass))
-#define FIRED_IS_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FIRED_TYPE_FDBUS))
-#define FIRED_FDBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FIRED_TYPE_FDBUS, FiredFDBusClass))
+#define FIREKIT_TYPE_FDBUS (firekit_firedbus_get_type())
+#define FIREKIT_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FIREKIT_TYPE_FDBUS, FirekitFDBus))
+#define FIREKIT_IS_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FIREKIT_TYPE_FDBUS))
+#define FIREKIT_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FIREKIT_TYPE_FDBUS, FirekitFDBusClass))
+#define FIREKIT_IS_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FIREKIT_TYPE_FDBUS))
+#define FIREKIT_FDBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FIREKIT_TYPE_FDBUS, FirekitFDBusClass))
-typedef struct _FiredFDBus FiredFDBus;
-typedef struct _FiredFDBusClass FiredFDBusClass;
+typedef struct _FirekitFDBus FirekitFDBus;
+typedef struct _FirekitFDBusClass FirekitFDBusClass;
-struct _FiredFDBus
+struct _FirekitFDBus
{
GObject parent_instance;
/* instance members */
- gint open_port(void);
};
-struct _FiredFDBusClass
+struct _FirekitFDBusClass
{
GObjectClass parent_class;
/* class members */
};
-/* used by MAMAN_TYPE_BAR */
-GType fired_fdbus_get_type (void);
+//GType firekit_firedbus_get_type (void);
/*
* Method definitions.
*/
+gboolean firekit_firedbus_apply_profile (FirekitFDBus *self, DBUS_TYPE_G_INT_ARRAY ports, gboolean ret, GError **err);
-#endif /* __FIRED_FDBUS_H__ */
+#endif /* __FIREKIT_FDBUS_H__ */
+
Modified: include/fkiptc.h
===================================================================
--- include/fkiptc.h 2009-08-07 02:30:13 UTC (rev 8)
+++ include/fkiptc.h 2009-12-02 21:23:01 UTC (rev 9)
@@ -1 +1,62 @@
-void flush_input_chain(void);
+// Author: Ahmed Kamal <ahmed(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Ahmed Kamal
+
+/* inclusion guard */
+#ifndef __FIREKIT_FKIPTC__H__
+#define __FIREKIT_FKIPTC__H__
+
+/*
+ * Header Inclusions
+ */
+#include <glib-object.h>
+#include <syslog.h>
+
+/*
+ * Type macros.
+ */
+#define FIREKIT_TYPE_IPTC (firekit_iptc_get_type())
+#define FIREKIT_IPTC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FIREKIT_TYPE_IPTC, FirekitIPTC))
+#define FIREKIT_IS_IPTC(obj) ( G_TYPE_CHECK_INSTANCE_TYPE ((obj), FIREKIT_TYPE_IPTC))
+#define FIREKIT_IPTC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FIREKIT_TYPE_IPTC, FirekitIPTCClass))
+#define FIREKIT_IS_IPTC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FIREKIT_TYPE_IPTC))
+#define FIREKIT_IPTC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FIREKIT_TYPE_IPTC, FirekitIPTCClass))
+
+typedef struct _FirekitIPTC FirekitIPTC;
+typedef struct _FirekitIPTCClass FirekitIPTCClass;
+
+enum {
+ FIREKIT_IPTC_TABLE_NAME
+};
+
+struct _FirekitIPTC
+{
+GObject parent_instance;
+ // public
+ char *table_name;
+ // private
+ struct iptc_handle *h;
+};
+
+struct _FirekitIPTCClass
+{
+ GObjectClass parent_class;
+ /* class members */
+};
+
+//gboolean firekit_iptc_(gint *ports);
+
+#endif
Modified: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt 2009-08-07 02:30:13 UTC (rev 8)
+++ src/CMakeLists.txt 2009-12-02 21:23:01 UTC (rev 9)
@@ -1,2 +1,6 @@
-ADD_EXECUTABLE(fired fired.c)
-ADD_LIBRARY(fkiptc fkiptc.c)
+include_directories( ${GObject2_INCLUDE_DIRS} ${GLib2_INCLUDE_DIRS} ${DBus-GLib1_INCLUDE_DIRS} )
+set (LIBS ${LIBS} ${GObject2_LIBRARIES} ${GLib2_LIBRARIES} ${DBus-GLib1_LIBRARIES} )
+set (SRCS ${SRCS} fired dbus_utils firedbus)
+ADD_EXECUTABLE(fired ${SRCS})
+target_link_libraries(fired ${LIBS})
+ADD_LIBRARY(fkiptc fkiptc)
Modified: src/fired.c
===================================================================
--- src/fired.c 2009-08-07 02:30:13 UTC (rev 8)
+++ src/fired.c 2009-12-02 21:23:01 UTC (rev 9)
@@ -15,62 +15,101 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Copyright 2009 Abd4llA
#include "fired.h"
+#include "dbus_utils.h"
+#define FIREKIT_SERVICE_NAME "org.fedorahosted.firekit"
+#define FIREKIT_OBJECT_PATH "/org/fedorahosted/firekit"
+
int main(void) {
-
- /* Our process ID and Session ID */
- pid_t pid, sid;
-
- /* Fork off the parent process */
- pid = fork();
- if (pid < 0) {
- exit(EXIT_FAILURE);
- }
- /* If we got a good PID, then
- * we can exit the parent process. */
- if (pid > 0) {
- exit(EXIT_SUCCESS);
- }
+ g_type_init();
+//
+// /* Our process ID and Session ID */
+// pid_t pid, sid;
+//
+// /* Fork off the parent process */
+// pid = fork();
+// if (pid < 0) {
+// printf("Couldn't fork\n");
+// exit(EXIT_FAILURE);
+// }
+// /* If we got a good PID, then
+// * we can exit the parent process. */
+// if (pid > 0) {
+// exit(EXIT_SUCCESS);
+// }
+//
+//
+// /* Change the file mode mask */
+// umask(0);
+//
+// /* Open any logs here */
+// openlog("FIREKIT", LOG_ODELAY, LOG_DAEMON);
+//
+// /* Create a new SID for the child process */
+// sid = setsid();
+// if (sid < 0) {
+// /* Log the failure */
+// exit(EXIT_FAILURE);
+// }
+//
+//
+//
+// /* Change the current working directory */
+// if ((chdir("/")) < 0) {
+// /* Log the failure */
+// exit(EXIT_FAILURE);
+// }
+//
+// /* Close out the standard file descriptors */
+// //close(STDIN_FILENO);
+//// close(STDOUT_FILENO);
+//// close(STDERR_FILENO);
+//
+///* int32_t logFile = open("/tmp/fired.log",O_RDWR | O_CREAT);
+// if (logFile < 0){
+//
+// exit(EXIT_FAILURE);
+// }
+//*/
- /* Change the file mode mask */
- umask(0);
-
- /* Open any logs here */
-
- /* Create a new SID for the child process */
- sid = setsid();
- if (sid < 0) {
- /* Log the failure */
- exit(EXIT_FAILURE);
- }
-
+ openlog("FIREKIT", LOG_ODELAY, LOG_DAEMON);
+// char * msg = "Registering to dbus\n";
+//
+// /* Register ourselves to dbus daemon */
+//// firekit_initdbus();
+ DBusGConnection *connection;
+ GError *error;
+ GMainLoop * loop;
-
- /* Change the current working directory */
- if ((chdir("/")) < 0) {
- /* Log the failure */
- exit(EXIT_FAILURE);
- }
-
- /* Close out the standard file descriptors */
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
- close(STDERR_FILENO);
+ loop = g_main_loop_new(NULL,FALSE);
- int32_t logFile = open("/tmp/fired.log",O_RDWR | O_CREAT);
- if (logFile < 0){
+ error = NULL;
+ syslog(LOG_DAEMON | LOG_INFO, "Initializing firedbus\n");
+ if (! firekit_firedbus_init(FIREKIT_SERVICE_NAME, FIREKIT_OBJECT_PATH, &connection, &error)){
+ syslog(LOG_DAEMON | LOG_INFO, "Failed to initialize firedbus: %s\n", error->message);
exit(EXIT_FAILURE);
}
- char * msg = "Registering to dbus\n";
+ /*
+ driver_proxy = dbus_g_proxy_new_for_name (connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+ if (!org_freedesktop_DBus_request_name (driver_proxy,"/com/fedoraproject/firekit/Daemon",
+ 0, NULL, &error) ){
+ g_printerr("Failed to get service nice\n");
+ g_error_free(error);
+ exit(EXIT_FAILURE);
+ }
- /* Register ourselves to dbus daemon */
- //register_to_dbus();
-
- /* The Big Loop */
- while (1) {
- /* Do some task here ... */
- write(logFile, msg, strlen(msg));
- sleep(30); /* wait 30 seconds */
- }
- exit(EXIT_SUCCESS);
+ */
+
+// /* The Big Loop */
+// while (1) {
+// /* Do some task here ... */
+// syslog( LOG_DAEMON | LOG_INFO, "Main Loop\n");
+// sleep(30); /* wait 30 seconds */
+// }
+
+ g_main_loop_run(loop);
+ exit(EXIT_SUCCESS);
}
Modified: src/fkiptc.c
===================================================================
--- src/fkiptc.c 2009-08-07 02:30:13 UTC (rev 8)
+++ src/fkiptc.c 2009-12-02 21:23:01 UTC (rev 9)
@@ -69,6 +69,34 @@
//
// } /* main */
+static void firekit_iptc_class_init(FirekitIPTCClass *klass){
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GParamSpec *pspec;
+
+ gobject_class->set_property = firekit_iptc_set_property;
+ //TODO override get_property
+
+ pspec =
+
+}
+static void firekit_iptc_init(FirekitIPTC *object){
+
+}
+
+static void firekit_iptc_set_property(GObject *object, guint propert_id, const GValue *value, GParamSpec *pspec){
+ FirekitIPTC *self = FIREKIT_IPTC (object);
+
+ switch (propert_id){
+ case FIREKIT_IPTC_TABLE_NAME:
+ g_free(self->table_name);
+ self->table_name = g_value_dup_string(value);
+ syslog(LOG_DAEMON | LOG_INFO, "Setting table name with value %s\n", self->table_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
void flush_input_chain(void)
{
printf("Inside flush Input\n");
14 years, 5 months