From 17ae818b51912113e57f931e6df57b97ad662668 Mon Sep 17 00:00:00 2001
From: Roman Rakus <rrakus@redhat.com>
Date: Mon, 20 Dec 2010 16:11:34 +0100
Subject: [PATCH] Renamed fmci to matahari + some cleanup.

Signed-off-by: Roman Rakus <rrakus@redhat.com>
---
 src/cmake/modules/DBusMacros.cmake      |    2 +-
 src/host/matahari-host-dbus.c           |   43 +++++++++++++------------
 src/include/fmci/fmci-class.h           |   52 -------------------------------
 src/include/matahari/mh_gobject_class.h |   49 +++++++++++++++++++++++++++++
 4 files changed, 72 insertions(+), 74 deletions(-)
 delete mode 100644 src/include/fmci/fmci-class.h
 create mode 100644 src/include/matahari/mh_gobject_class.h

diff --git a/src/cmake/modules/DBusMacros.cmake b/src/cmake/modules/DBusMacros.cmake
index f689e58..ff15939 100644
--- a/src/cmake/modules/DBusMacros.cmake
+++ b/src/cmake/modules/DBusMacros.cmake
@@ -19,7 +19,7 @@ macro(generate_dbus_interfaces SCHEMA APIS)
         add_custom_command(
             OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${API}/matahari-${API}-dbus-glue.h
             COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${API}/
-            COMMAND ${BIND_TOOL} --prefix=fmci --mode=glib-server
+            COMMAND ${BIND_TOOL} --prefix=matahari --mode=glib-server
                 --output=${CMAKE_CURRENT_BINARY_DIR}/${API}/matahari-${API}-dbus-glue.h
                 ${CMAKE_CURRENT_BINARY_DIR}/dbus/matahari-${API}-dbus.xml
             DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dbus/matahari-${API}-dbus.xml
diff --git a/src/host/matahari-host-dbus.c b/src/host/matahari-host-dbus.c
index ba63f9e..fbea56c 100644
--- a/src/host/matahari-host-dbus.c
+++ b/src/host/matahari-host-dbus.c
@@ -28,14 +28,11 @@
 #include <dbus/dbus-glib-bindings.h>
 
 /* GObject class definition */
-#include "fmci/fmci-class.h"
+#include "matahari/mh_gobject_class.h"
 
 /* Host methods */
 #include "matahari/host.h"
 
-/* Generated dbus stuff for host */
-#include "matahari-host-dbus-glue.h"
-
 /* Generated properties list */
 #include "matahari-host-dbus-properties.h"
 
@@ -46,7 +43,7 @@
 
 /* Dbus methods */
 gboolean
-Host_identify(Fmci* fmci, GError** error)
+Host_identify(Matahari* matahari, GError** error)
 {
 //  host_identify(5);
 //  fprintf(stderr, "host_identify() is missing\n");
@@ -54,25 +51,29 @@ Host_identify(Fmci* fmci, GError** error)
 }
 
 gboolean
-Host_shutdown(Fmci* fmci, GError** error)
+Host_shutdown(Matahari* matahari, GError** error)
 {
   host_shutdown();
   return TRUE;
 }
 
 gboolean
-Host_reboot(Fmci* fmci, GError** error)
+Host_reboot(Matahari* matahari, GError** error)
 {
   host_reboot();
   return TRUE;
 }
 
+/* Generated dbus stuff for host */
+#include "matahari-host-dbus-glue.h"
+
+
 //TODO: Properties get/set
 static void
-fmci_set_property(GObject *object, guint property_id, const GValue *value,
+matahari_set_property(GObject *object, guint property_id, const GValue *value,
     GParamSpec *pspec)
 {
-  Fmci *self = FMCI(object);
+  Matahari *self = MATAHARI(object);
   switch (property_id)
     {
   case PROP_UUID:
@@ -103,10 +104,10 @@ fmci_set_property(GObject *object, guint property_id, const GValue *value,
 }
 
 static void
-fmci_get_property(GObject *object, guint property_id, GValue *value,
+matahari_get_property(GObject *object, guint property_id, GValue *value,
     GParamSpec *pspec)
 {
-  Fmci *self = FMCI(object);
+  Matahari *self = MATAHARI(object);
   switch (property_id)
     {
   case PROP_UUID:
@@ -145,23 +146,23 @@ fmci_get_property(GObject *object, guint property_id, GValue *value,
 }
 
 /* Generate the GObject boilerplate */
-G_DEFINE_TYPE(Fmci, fmci, G_TYPE_OBJECT)
+G_DEFINE_TYPE(Matahari, matahari, G_TYPE_OBJECT)
 
 /* Class init */
 static void
-fmci_class_init(FmciClass *fmci_class)
+matahari_class_init(MatahariClass *matahari_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS(fmci_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS(matahari_class);
   GParamSpec *pspec;
 
-  gobject_class->set_property = fmci_set_property;
-  gobject_class->get_property = fmci_get_property;
+  gobject_class->set_property = matahari_set_property;
+  gobject_class->get_property = matahari_get_property;
 
   //TODO: Proper properties initialization
   int i;
   for (i = 0; properties_Host[i].name != NULL; i++)
   {
-    printf("Writing property: %s\n", properties_Host[i].name);
+    g_print("Writing property: %s\n", properties_Host[i].name);
     switch (properties_Host[i].type)
     {
         case 's':
@@ -205,19 +206,19 @@ fmci_class_init(FmciClass *fmci_class)
                                          properties_Host[i].flags);
             break;
         default:
-            fprintf(stderr, "Unknown type: %c\n", properties_Host[i].type);
+            g_printerr("Unknown type: %c\n", properties_Host[i].type);
             pspec = NULL;
     }
     if (pspec)
         g_object_class_install_property(gobject_class, properties_Host[i].prop, pspec);
   }
 
-  dbus_g_object_type_install_info(FMCI_TYPE, &dbus_glib_fmci_object_info);
+  dbus_g_object_type_install_info(MATAHARI_TYPE, &dbus_glib_matahari_object_info);
 }
 
 /* Instance init */
 static void
-fmci_init(Fmci *fmci)
+matahari_init(Matahari *matahari)
 {
 }
 
@@ -243,7 +244,7 @@ main(int argc, char** argv)
       exit(1);
     }
 
-  obj = g_object_new(FMCI_TYPE, NULL);
+  obj = g_object_new(MATAHARI_TYPE, NULL);
   dbus_g_connection_register_g_object(connection, HOST_OBJECT_PATH, obj);
 
   driver_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS,
diff --git a/src/include/fmci/fmci-class.h b/src/include/fmci/fmci-class.h
deleted file mode 100644
index cdf2596..0000000
--- a/src/include/fmci/fmci-class.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * fmci-class.h
- *
- * Copyright (C) 2010 Red Hat, Inc.
- * Written by Roman Rakus <rrakus@redhat.com>
- * 
- * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#ifndef FMCICLASS_H_
-#define FMCICLASS_H_
-
-#define FMCI_TYPE              (fmci_get_type())
-#define FMCI(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), FMCI_TYPE, Fmci))
-#define FMCI_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), FMCI_TYPE, FmciClass))
-#define IS_FMCI(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), FMCI_TYPE))
-#define IS_FMCI_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), FMCI_TYPE))
-#define FMCI_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), FMCI_TYPE, FmciClass))
-
-typedef struct _Fmci Fmci;
-typedef struct _FmciClass FmciClass;
-
-GType
-fmci_get_type(void);
-
-struct _Fmci
-{
-  GObject parent;
-};
-
-struct _FmciClass
-{
-  GObjectClass parent;
-};
-
-gboolean
-fmci_version(Fmci *fmci, char** version, GError** error);
-
-#endif /* FMCICLASS_H_ */
diff --git a/src/include/matahari/mh_gobject_class.h b/src/include/matahari/mh_gobject_class.h
new file mode 100644
index 0000000..20d3b21
--- /dev/null
+++ b/src/include/matahari/mh_gobject_class.h
@@ -0,0 +1,49 @@
+/*
+ * mh_gobject_class.h
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Written by Roman Rakus <rrakus@redhat.com>
+ * 
+ * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef MHGOBJECTCLASS_H_
+#define MHGOBJECTCLASS_H_
+
+#define MATAHARI_TYPE          (matahari_get_type())
+#define MATAHARI(object)       (G_TYPE_CHECK_INSTANCE_CAST ((object), MATAHARI_TYPE, Matahari))
+#define MATAHARI_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), MATAHARI_TYPE, MatahariClass))
+#define IS_MATAHARI(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), MATAHARI_TYPE))
+#define IS_MATAHARI_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), MATAHARI_TYPE))
+#define MATAHARI_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), MATAHARI_TYPE, MatahariClass))
+
+typedef struct _Matahari Matahari;
+typedef struct _MatahariClass MatahariClass;
+
+GType
+matahari_get_type(void);
+
+struct _Matahari
+{
+  GObject parent;
+};
+
+struct _MatahariClass
+{
+  GObjectClass parent;
+};
+
+#endif /* MHGOBJECTCLASS_H_ */
-- 
1.7.2.3

