]> git.0d.be Git - empathy.git/commitdiff
Don't set empty values for the default EmpathyHandler
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 1 Sep 2009 13:48:59 +0000 (15:48 +0200)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 1 Sep 2009 14:49:39 +0000 (16:49 +0200)
This implies the following:
- have an empty default handler when the Dispatcher is used directly
  with the singleton
- autogenerate the name for the default handler
- set priv->filters in the handler to an empty GPtrArray in this case,
  as that can't be NULL.

libempathy/empathy-dispatcher.c
libempathy/empathy-handler.c

index 7aec41438306c9208b2db9d3bf840166696821d8..fca24daeb0094d9dc8d5ff7b60e16257fc58a132 100644 (file)
@@ -890,6 +890,9 @@ dispatcher_constructor (GType type,
 
   priv = GET_PRIV (dispatcher);
 
+  if (priv->handler == NULL)
+    priv->handler = empathy_handler_new (NULL, NULL, NULL);
+
   empathy_handler_set_handle_channels_func (priv->handler,
     empathy_dispatcher_handle_channels,
     dispatcher);
index 649903058d9fdd997ecbf8c2f98fe7874c536aaf..9a597889ee9bfb89473e9196c55d3296f610ddab 100644 (file)
@@ -141,12 +141,23 @@ handler_set_property (GObject *object,
     {
       case PROP_CHANNEL_FILTER:
         priv->filters = g_value_dup_boxed (value);
+       if (priv->filters == NULL)
+         priv->filters = g_ptr_array_new ();
         break;
       case PROP_CAPABILITIES:
         priv->capabilities = g_value_dup_boxed (value);
         break;
       case PROP_NAME:
         priv->name = g_value_dup_string (value);
+       if (EMP_STR_EMPTY (priv->name))
+         {
+           TpDBusDaemon *bus;
+
+           bus = tp_dbus_daemon_dup (NULL);
+           priv->name = g_strdup_printf ("%s%p",
+                tp_dbus_daemon_get_unique_name (bus), object);
+            g_object_unref (bus);
+          }
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);