]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-account-chooser.h
d58fcf12fbfa0743ee983ba1a63b31ae49a4a3ea
[empathy.git] / libempathy-gtk / empathy-account-chooser.h
1 /*
2  * Copyright (C) 2005-2007 Imendio AB
3  * Copyright (C) 2007-2011 Collabora Ltd.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA  02110-1301  USA
19  *
20  * Authors: Martyn Russell <martyn@imendio.com>
21  *          Xavier Claessens <xclaesse@gmail.com>
22  */
23
24 #ifndef __EMPATHY_ACCOUNT_CHOOSER_H__
25 #define __EMPATHY_ACCOUNT_CHOOSER_H__
26
27 #include <gtk/gtk.h>
28
29 #include <telepathy-glib/telepathy-glib.h>
30
31 G_BEGIN_DECLS
32
33 #define EMPATHY_TYPE_ACCOUNT_CHOOSER (empathy_account_chooser_get_type ())
34 #define EMPATHY_ACCOUNT_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooser))
35 #define EMPATHY_ACCOUNT_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserClass))
36 #define EMPATHY_IS_ACCOUNT_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_ACCOUNT_CHOOSER))
37 #define EMPATHY_IS_ACCOUNT_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_ACCOUNT_CHOOSER))
38 #define EMPATHY_ACCOUNT_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserClass))
39
40 /**
41  * EmpathyAccountChooserFilterResultCallback:
42  * @is_enabled: indicated whether the account should be enabled
43  * @user_data: user data passed to the callback
44  */
45 typedef void (* EmpathyAccountChooserFilterResultCallback) (gboolean is_enabled,
46     gpointer user_data);
47
48 /**
49  * EmpathyAccountChooserFilterFunc:
50  * @account: a #TpAccount
51  * @callback: an #EmpathyAccountChooserFilterResultCallback accepting the result
52  * @callback_data: data passed to the @callback
53  * @user_data: user data passed to the callback
54  */
55 typedef void (* EmpathyAccountChooserFilterFunc) (
56   TpAccount *account,
57   EmpathyAccountChooserFilterResultCallback callback,
58   gpointer callback_data,
59   gpointer user_data);
60
61
62 typedef struct _EmpathyAccountChooser EmpathyAccountChooser;
63 typedef struct _EmpathyAccountChooserClass EmpathyAccountChooserClass;
64 typedef struct _EmpathyAccountChooserPriv EmpathyAccountChooserPriv;
65
66 struct _EmpathyAccountChooser
67 {
68   GtkComboBox parent;
69
70   /*<private>*/
71   EmpathyAccountChooserPriv *priv;
72 };
73
74 struct _EmpathyAccountChooserClass
75 {
76   GtkComboBoxClass parent_class;
77 };
78
79 GType empathy_account_chooser_get_type (void) G_GNUC_CONST;
80
81 GtkWidget * empathy_account_chooser_new (void);
82
83 TpAccount * empathy_account_chooser_dup_account (EmpathyAccountChooser *self);
84 TpAccount * empathy_account_chooser_get_account (EmpathyAccountChooser *self);
85
86 gboolean empathy_account_chooser_set_account (EmpathyAccountChooser *self,
87     TpAccount *account);
88
89 TpConnection * empathy_account_chooser_get_connection (
90     EmpathyAccountChooser *self);
91
92 void empathy_account_chooser_set_all (EmpathyAccountChooser *self);
93
94 TpAccountManager * empathy_account_chooser_get_account_manager (
95     EmpathyAccountChooser *self);
96
97 gboolean empathy_account_chooser_get_has_all_option (
98     EmpathyAccountChooser *self);
99
100 void empathy_account_chooser_set_has_all_option (EmpathyAccountChooser *self,
101     gboolean has_all_option);
102
103 gboolean empathy_account_chooser_has_all_selected (EmpathyAccountChooser *self);
104
105 void empathy_account_chooser_set_filter (EmpathyAccountChooser *self,
106     EmpathyAccountChooserFilterFunc filter,
107     gpointer user_data);
108
109 gboolean empathy_account_chooser_is_ready (EmpathyAccountChooser *self);
110
111 void empathy_account_chooser_refilter (EmpathyAccountChooser *self);
112
113 /* Pre-defined filters */
114
115 void empathy_account_chooser_filter_is_connected (TpAccount *account,
116     EmpathyAccountChooserFilterResultCallback callback,
117     gpointer callback_data,
118     gpointer user_data);
119
120 void empathy_account_chooser_filter_supports_chatrooms (TpAccount *account,
121     EmpathyAccountChooserFilterResultCallback callback,
122     gpointer callback_data,
123     gpointer user_data);
124
125 G_END_DECLS
126
127 #endif /* __EMPATHY_ACCOUNT_CHOOSER_H__ */