~bcurtiswx/ubuntu/precise/empathy/3.4.2.1-0ubuntu1

« back to all changes in this revision

Viewing changes to libempathy/empathy-handler.c

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2009-11-16 23:40:52 UTC
  • mfrom: (1.1.39 upstream)
  • mto: (6.3.7 experimental)
  • mto: This revision was merged to the branch mainline in revision 80.
  • Revision ID: james.westby@ubuntu.com-20091116234052-7hhwrpeln4mwdyw7
Tags: upstream-2.29.2
ImportĀ upstreamĀ versionĀ 2.29.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
  gpointer channels_user_data;
47
47
 
48
48
  gchar *name;
 
49
  gchar *busname;
49
50
 
50
51
  GPtrArray *filters;
51
52
  GStrv *capabilities;
 
53
 
 
54
  gboolean dispose_run;
52
55
} EmpathyHandlerPriv;
53
56
 
54
57
static void empathy_handler_client_handler_iface_init (gpointer g_iface,
89
92
  EmpathyHandler *handler = EMPATHY_HANDLER (obj);
90
93
  EmpathyHandlerPriv *priv = GET_PRIV (handler);
91
94
  TpDBusDaemon *dbus;
92
 
  gchar *busname;
93
95
  gchar *object_path;
94
96
 
95
97
  priv = GET_PRIV (handler);
96
98
 
97
 
  busname = g_strdup_printf (TP_CLIENT_BUS_NAME_BASE"%s", priv->name);
 
99
  priv->busname = g_strdup_printf (TP_CLIENT_BUS_NAME_BASE"%s", priv->name);
98
100
  object_path = g_strdup_printf (TP_CLIENT_OBJECT_PATH_BASE"%s",
99
101
    priv->name);
100
102
 
101
103
  dbus = tp_dbus_daemon_dup (NULL);
102
104
 
103
105
  g_assert (tp_dbus_daemon_request_name (dbus,
104
 
    busname, TRUE, NULL));
 
106
    priv->busname, TRUE, NULL));
105
107
  dbus_g_connection_register_g_object (tp_get_bus (),
106
108
    object_path, obj);
107
109
 
108
110
  DEBUG ("Registered at '%s'", object_path);
109
111
 
110
 
  g_free (busname);
111
112
  g_free (object_path);
112
113
  g_object_unref (dbus);
113
114
 
115
116
}
116
117
 
117
118
static void
 
119
handler_dispose (GObject *object)
 
120
{
 
121
  EmpathyHandlerPriv *priv = GET_PRIV (object);
 
122
  TpDBusDaemon *dbus;
 
123
 
 
124
  if (priv->dispose_run)
 
125
    return;
 
126
 
 
127
  priv->dispose_run = TRUE;
 
128
 
 
129
  dbus = tp_dbus_daemon_dup (NULL);
 
130
 
 
131
  tp_dbus_daemon_release_name (dbus, priv->busname, NULL);
 
132
 
 
133
  g_object_unref (dbus);
 
134
 
 
135
  if (G_OBJECT_CLASS (empathy_handler_parent_class)->dispose != NULL)
 
136
    G_OBJECT_CLASS (empathy_handler_parent_class)->dispose (object);
 
137
}
 
138
 
 
139
static void
118
140
handler_finalize (GObject *object)
119
141
{
120
142
  EmpathyHandlerPriv *priv = GET_PRIV (object);
126
148
    g_boxed_free (G_TYPE_STRV, priv->capabilities);
127
149
 
128
150
  g_free (priv->name);
 
151
  g_free (priv->busname);
 
152
 
 
153
  if (G_OBJECT_CLASS (empathy_handler_parent_class)->finalize != NULL)
 
154
    G_OBJECT_CLASS (empathy_handler_parent_class)->finalize (object);
129
155
}
130
156
 
131
157
static void
149
175
        break;
150
176
      case PROP_NAME:
151
177
        priv->name = g_value_dup_string (value);
152
 
        if (EMP_STR_EMPTY (priv->name))
153
 
          {
154
 
            TpDBusDaemon *bus;
 
178
        if (EMP_STR_EMPTY (priv->name))
 
179
          {
 
180
            TpDBusDaemon *bus;
155
181
 
156
 
            bus = tp_dbus_daemon_dup (NULL);
157
 
            priv->name = g_strdup_printf ("%s%p",
 
182
            bus = tp_dbus_daemon_dup (NULL);
 
183
            priv->name = g_strdup_printf ("badger_%s_%p",
158
184
                tp_dbus_daemon_get_unique_name (bus), object);
 
185
            g_strdelimit (priv->name, ":.", '_');
159
186
            g_object_unref (bus);
160
187
          }
161
188
        break;
243
270
  };
244
271
 
245
272
  object_class->finalize = handler_finalize;
 
273
  object_class->dispose = handler_dispose;
246
274
  object_class->constructor = handler_constructor;
247
275
 
248
276
  object_class->get_property = handler_get_property;