]> git.0d.be Git - empathy.git/blob - ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin.c
Use a flat namespace for internal includes
[empathy.git] / ubuntu-online-accounts / cc-plugins / app-plugin / empathy-app-plugin.c
1 /*
2  * empathy-app-plugin.c
3  *
4  * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include "config.h"
22
23 #include "empathy-app-plugin.h"
24
25 #include "empathy-client-factory.h"
26
27 #include "empathy-app-plugin-widget.h"
28
29 G_DEFINE_TYPE (EmpathyAppPlugin, empathy_app_plugin, AP_TYPE_APPLICATION_PLUGIN)
30
31 static void
32 widget_done_cb (EmpathyAppPluginWidget *widget,
33     ApApplicationPlugin *plugin)
34 {
35   ap_application_plugin_emit_finished (plugin);
36 }
37
38 static GtkWidget *
39 empathy_app_plugin_build_widget (ApApplicationPlugin *plugin)
40 {
41   GtkWidget *widget;
42
43   widget = empathy_app_plugin_widget_new (
44       ap_application_plugin_get_account (plugin));
45
46   g_signal_connect (widget, "done",
47       G_CALLBACK (widget_done_cb), plugin);
48
49   gtk_widget_show (widget);
50
51   return widget;
52 }
53
54 static void
55 empathy_app_plugin_class_init (EmpathyAppPluginClass *klass)
56 {
57   ApApplicationPluginClass *app_class = AP_APPLICATION_PLUGIN_CLASS (klass);
58
59   app_class->build_widget = empathy_app_plugin_build_widget;
60 }
61
62 static void
63 empathy_app_plugin_init (EmpathyAppPlugin *self)
64 {
65   if (tp_account_manager_can_set_default ())
66     {
67       EmpathyClientFactory *factory;
68       TpAccountManager *am;
69
70       factory = empathy_client_factory_dup ();
71       am = tp_account_manager_new_with_factory (
72           TP_SIMPLE_CLIENT_FACTORY (factory));
73       tp_account_manager_set_default (am);
74
75       g_object_unref (factory);
76       g_object_unref (am);
77     }
78 }
79
80 GType
81 ap_module_get_object_type (void)
82 {
83   return EMPATHY_TYPE_APP_PLUGIN;
84 }