Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright © 2018 Canonical Ltd. |
3 |
|
|
* |
4 |
|
|
* This program is free software; you can redistribute it and/or |
5 |
|
|
* modify it under the terms of the GNU General Public License as |
6 |
|
|
* published by the Free Software Foundation; either version 2 of the |
7 |
|
|
* License, or (at your option) any later version. |
8 |
|
|
* |
9 |
|
|
* This program is distributed in the hope that it will be useful, but |
10 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 |
|
|
* General Public License for more details. |
13 |
|
|
* |
14 |
|
|
* You should have received a copy of the GNU General Public License |
15 |
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>. |
16 |
|
|
*/ |
17 |
|
|
|
18 |
|
|
#include <config.h> |
19 |
|
|
#include "cc-input-source.h" |
20 |
|
|
|
21 |
|
|
enum |
22 |
|
|
{ |
23 |
|
|
SIGNAL_LABEL_CHANGED, |
24 |
|
|
SIGNAL_LAST |
25 |
|
|
}; |
26 |
|
|
|
27 |
|
|
static guint signals[SIGNAL_LAST] = {0}; |
28 |
|
|
|
29 |
|
✗ |
G_DEFINE_TYPE (CcInputSource, cc_input_source, G_TYPE_OBJECT) |
30 |
|
|
|
31 |
|
|
void |
32 |
|
✗ |
cc_input_source_class_init (CcInputSourceClass *klass) |
33 |
|
|
{ |
34 |
|
✗ |
signals[SIGNAL_LABEL_CHANGED] = |
35 |
|
✗ |
g_signal_new ("label-changed", |
36 |
|
|
G_TYPE_FROM_CLASS (klass), |
37 |
|
|
G_SIGNAL_RUN_LAST, |
38 |
|
|
0, |
39 |
|
|
NULL, NULL, |
40 |
|
|
NULL, |
41 |
|
|
G_TYPE_NONE, |
42 |
|
|
0); |
43 |
|
✗ |
} |
44 |
|
|
|
45 |
|
|
void |
46 |
|
✗ |
cc_input_source_init (CcInputSource *source) |
47 |
|
|
{ |
48 |
|
✗ |
} |
49 |
|
|
|
50 |
|
|
void |
51 |
|
✗ |
cc_input_source_emit_label_changed (CcInputSource *source) |
52 |
|
|
{ |
53 |
|
✗ |
g_return_if_fail (CC_IS_INPUT_SOURCE (source)); |
54 |
|
✗ |
g_signal_emit (source, signals[SIGNAL_LABEL_CHANGED], 0); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
gchar * |
58 |
|
✗ |
cc_input_source_get_label (CcInputSource *source) |
59 |
|
|
{ |
60 |
|
✗ |
g_return_val_if_fail (CC_IS_INPUT_SOURCE (source), NULL); |
61 |
|
✗ |
return CC_INPUT_SOURCE_GET_CLASS (source)->get_label (source); |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
gboolean |
65 |
|
✗ |
cc_input_source_matches (CcInputSource *source, |
66 |
|
|
CcInputSource *source2) |
67 |
|
|
{ |
68 |
|
✗ |
g_return_val_if_fail (CC_IS_INPUT_SOURCE (source), FALSE); |
69 |
|
✗ |
return CC_INPUT_SOURCE_GET_CLASS (source)->matches (source, source2); |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
const gchar * |
73 |
|
✗ |
cc_input_source_get_layout (CcInputSource *source) |
74 |
|
|
{ |
75 |
|
✗ |
g_return_val_if_fail (CC_IS_INPUT_SOURCE (source), NULL); |
76 |
|
✗ |
return CC_INPUT_SOURCE_GET_CLASS (source)->get_layout (source); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
const gchar * |
80 |
|
✗ |
cc_input_source_get_layout_variant (CcInputSource *source) |
81 |
|
|
{ |
82 |
|
✗ |
g_return_val_if_fail (CC_IS_INPUT_SOURCE (source), NULL); |
83 |
|
✗ |
return CC_INPUT_SOURCE_GET_CLASS (source)->get_layout_variant (source); |
84 |
|
|
} |
85 |
|
|
|