[maemo-commits] [maemo-commits] r10447 - in projects/haf/trunk/hildon-desktop: . libhildonwm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Mar 7 13:22:46 EET 2007
Author: moimart
Date: 2007-03-07 13:22:45 +0200 (Wed, 07 Mar 2007)
New Revision: 10447

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
Log:

	* libhildonwm/hd-wm.[ch]: Added hd_wm_get_singleton_without_dbus for
        lib users who don't want to initialize DBus stuff.
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-07 08:50:03 UTC (rev 10446)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-07 11:22:45 UTC (rev 10447)
@@ -1,3 +1,8 @@
+2007-03-07  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildonwm/hd-wm.[ch]: Added hd_wm_get_singleton_without_dbus for
+	lib users who don't want to initialize DBus stuff.
+
 2007-03-06  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hn-others-button.c, libhildondesktop/hildon-home-window.c: use

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-03-07 08:50:03 UTC (rev 10446)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-03-07 11:22:45 UTC (rev 10447)
@@ -128,6 +128,12 @@
   HDWM_SIGNALS
 };
 
+enum
+{
+  PROP_0,
+  PROP_INIT_DBUS
+};
+
 static gint hdwm_signals[HDWM_SIGNALS];
 
 G_DEFINE_TYPE (HDWM, hd_wm, G_TYPE_OBJECT);
@@ -158,9 +164,19 @@
 static gboolean
 hd_wm_relaunch_timeout (gpointer data);
 
-	static void 
+static void 
 hd_wm_check_net_state (HDWM *hdwm, HDWMWatchedWindow *win);
 
+static void hd_wm_get_property (GObject *object,
+		                guint prop_id,
+		                GValue *value,
+		                GParamSpec *pspec);
+
+static void hd_wm_set_property (GObject *object,
+		                guint prop_id,
+		                const GValue *value,
+		                GParamSpec *pspec);
+
 struct xwinv
 {
   Window *wins;
@@ -225,6 +241,8 @@
   gboolean               modal_windows;
 
   GList		        *applications;
+
+  gboolean 		 init_dbus;
 };
 
 static HDWMPrivate *hdwmpriv = NULL; 			/* Singleton instance */
@@ -615,6 +633,9 @@
 {
   GObjectClass *object_class = G_OBJECT_CLASS (hdwm_class);
 
+  object_class->get_property = hd_wm_get_property;
+  object_class->set_property = hd_wm_set_property;
+
   g_type_class_add_private (hdwm_class, sizeof (HDWMPrivate));
 	
   hdwm_signals[HDWM_ENTRY_INFO_CHANGE_SIGNAL] = 
@@ -694,8 +715,51 @@
 		     G_TYPE_NONE,
 		     1,
 		     G_TYPE_BOOLEAN);
+
+  g_object_class_install_property (object_class,
+                                   PROP_INIT_DBUS,
+                                   g_param_spec_boolean("init-dbus",
+                                                        "initdbus",
+                                                        "Max width when horizontal",
+	                                                TRUE,
+							G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 }
 
+static void 
+hd_wm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+  HDWM *hdwm = HD_WM (object);	
+	
+  switch (prop_id)
+  {
+    case PROP_INIT_DBUS:
+      g_value_set_boolean (value, hdwm->priv->init_dbus);
+      break;
+      
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }  
+}
+
+static void 
+hd_wm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+  HDWM *hdwm = HD_WM (object);
+	
+  switch (prop_id)
+  {
+    case PROP_INIT_DBUS:
+      hdwm->priv->init_dbus = g_value_get_boolean (value);
+      break;      
+	  
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }  
+
+}
+
 static void hd_wm_register_object_path (HDWM *hdwm,
 					DBusConnection *conn,
 					DBusObjectPathMessageFunction func,
@@ -812,6 +876,10 @@
 		    G_CALLBACK (hd_keys_reload),
 		    hdwm->keys);
 
+
+  if (!hdwm->priv->init_dbus)
+    return;  
+
   /* Get on the DBus */
 
   dbus_error_init (&error);
@@ -2721,7 +2789,17 @@
   return hdwm;
 }
 
+HDWM *
+hd_wm_get_singleton_without_dbus (void)
+{
+  static HDWM *hdwm = NULL;
 
+  if (!hdwm)
+    hdwm = g_object_new (HD_TYPE_WM, "init-dbus", FALSE, NULL);
+
+  return hdwm;
+}
+
 Atom
 hd_wm_get_atom(gint indx)
 {

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h	2007-03-07 08:50:03 UTC (rev 10446)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h	2007-03-07 11:22:45 UTC (rev 10447)
@@ -174,6 +174,9 @@
 HDWM *
 hd_wm_get_singleton (void);
 
+HDWM *
+hd_wm_get_singleton_without_dbus (void);
+
 /**  Send 'top' request for a certain existing window/view
  *
  * @param info the window/view to be topped


More information about the maemo-commits mailing list