~ubuntu-branches/ubuntu/precise/gwibber/precise-proposed

« back to all changes in this revision

Viewing changes to client/gwibber-preferences.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-07-15 17:14:14 UTC
  • mto: This revision was merged to the branch mainline in revision 80.
  • Revision ID: james.westby@ubuntu.com-20110715171414-80ca971vzd56gtmh
Tags: upstream-3.1.2
ImportĀ upstreamĀ versionĀ 3.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* gwibber-preferences.c generated by valac 0.12.0, the Vala compiler
 
2
 * generated from gwibber-preferences.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2010 Canonical Ltd.
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify it 
 
8
 * under the terms of the GNU General Public License version 3, as published 
 
9
 * by the Free Software Foundation.
 
10
 
 
11
 * This program is distributed in the hope that it will be useful, but 
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
 
13
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
14
 * PURPOSE.  See the GNU General Public License for more details.
 
15
 
 
16
 * You should have received a copy of the GNU General Public License along 
 
17
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authored by Ken VanDine <ken.vandine@canonical.com>
 
20
 */
 
21
 
 
22
#include <glib.h>
 
23
#include <glib-object.h>
 
24
#include <gtk/gtk.h>
 
25
#include <gio/gio.h>
 
26
#include <stdlib.h>
 
27
#include <string.h>
 
28
 
 
29
 
 
30
#define TYPE_GWIBBER_PREFERENCES (gwibber_preferences_get_type ())
 
31
#define GWIBBER_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GWIBBER_PREFERENCES, GwibberPreferences))
 
32
#define GWIBBER_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GWIBBER_PREFERENCES, GwibberPreferencesClass))
 
33
#define IS_GWIBBER_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GWIBBER_PREFERENCES))
 
34
#define IS_GWIBBER_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GWIBBER_PREFERENCES))
 
35
#define GWIBBER_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GWIBBER_PREFERENCES, GwibberPreferencesClass))
 
36
 
 
37
typedef struct _GwibberPreferences GwibberPreferences;
 
38
typedef struct _GwibberPreferencesClass GwibberPreferencesClass;
 
39
typedef struct _GwibberPreferencesPrivate GwibberPreferencesPrivate;
 
40
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
41
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
42
#define _g_free0(var) (var = (g_free (var), NULL))
 
43
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
 
44
 
 
45
struct _GwibberPreferences {
 
46
        GObject parent_instance;
 
47
        GwibberPreferencesPrivate * priv;
 
48
        GtkBuilder* builder;
 
49
};
 
50
 
 
51
struct _GwibberPreferencesClass {
 
52
        GObjectClass parent_class;
 
53
};
 
54
 
 
55
 
 
56
static gpointer gwibber_preferences_parent_class = NULL;
 
57
 
 
58
GType gwibber_preferences_get_type (void) G_GNUC_CONST;
 
59
enum  {
 
60
        GWIBBER_PREFERENCES_DUMMY_PROPERTY
 
61
};
 
62
GwibberPreferences* gwibber_preferences_new (void);
 
63
GwibberPreferences* gwibber_preferences_construct (GType object_type);
 
64
void gwibber_preferences_on_close_button_clicked (GwibberPreferences* self);
 
65
void gwibber_preferences_on_prefs_dialog_destroy_event (GwibberPreferences* self);
 
66
static GObject * gwibber_preferences_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
67
static void _g_free0_ (gpointer var);
 
68
static void _g_list_free__g_free0_ (GList* self);
 
69
static void gwibber_preferences_finalize (GObject* obj);
 
70
gint _vala_main (gchar** args, int args_length1);
 
71
 
 
72
 
 
73
GwibberPreferences* gwibber_preferences_construct (GType object_type) {
 
74
        GwibberPreferences * self = NULL;
 
75
        self = (GwibberPreferences*) g_object_new (object_type, NULL);
 
76
        return self;
 
77
}
 
78
 
 
79
 
 
80
GwibberPreferences* gwibber_preferences_new (void) {
 
81
        return gwibber_preferences_construct (TYPE_GWIBBER_PREFERENCES);
 
82
}
 
83
 
 
84
 
 
85
void gwibber_preferences_on_close_button_clicked (GwibberPreferences* self) {
 
86
        g_return_if_fail (self != NULL);
 
87
        g_debug ("gwibber-preferences.vala:86: on_close_button_clicked");
 
88
        gtk_main_quit ();
 
89
}
 
90
 
 
91
 
 
92
void gwibber_preferences_on_prefs_dialog_destroy_event (GwibberPreferences* self) {
 
93
        g_return_if_fail (self != NULL);
 
94
        g_debug ("gwibber-preferences.vala:91: on_prefs_dialog_destroy_event");
 
95
        gtk_main_quit ();
 
96
}
 
97
 
 
98
 
 
99
static gpointer _g_object_ref0 (gpointer self) {
 
100
        return self ? g_object_ref (self) : NULL;
 
101
}
 
102
 
 
103
 
 
104
static void _g_free0_ (gpointer var) {
 
105
        var = (g_free (var), NULL);
 
106
}
 
107
 
 
108
 
 
109
static void _g_list_free__g_free0_ (GList* self) {
 
110
        g_list_foreach (self, (GFunc) _g_free0_, NULL);
 
111
        g_list_free (self);
 
112
}
 
113
 
 
114
 
 
115
static GObject * gwibber_preferences_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
116
        GObject * obj;
 
117
        GObjectClass * parent_class;
 
118
        GwibberPreferences * self;
 
119
        GtkBuilder* _tmp0_ = NULL;
 
120
        GObject* _tmp1_ = NULL;
 
121
        GObject* _tmp2_;
 
122
        GtkDialog* _tmp3_;
 
123
        GtkDialog* dialog;
 
124
        GObject* _tmp4_ = NULL;
 
125
        GObject* _tmp5_;
 
126
        GtkWidget* _tmp6_;
 
127
        GtkWidget* tray_icon;
 
128
        GSettings* _tmp7_ = NULL;
 
129
        GSettings* settings;
 
130
        GList* BOOL_SETTINGS;
 
131
        GList* INT_SETTINGS;
 
132
        GList* STRING_SETTINGS;
 
133
        gchar* _tmp8_;
 
134
        gchar* _tmp9_;
 
135
        gchar* _tmp10_;
 
136
        gchar* _tmp13_;
 
137
        gchar* _tmp14_;
 
138
        gchar* _tmp15_;
 
139
        gchar* _tmp16_;
 
140
        gchar* _tmp17_;
 
141
        gchar* _tmp18_;
 
142
        gchar* _tmp19_;
 
143
        gchar* _tmp20_;
 
144
        gchar* _tmp21_;
 
145
        gchar* _tmp22_;
 
146
        gchar* _tmp23_;
 
147
        GError * _inner_error_ = NULL;
 
148
        parent_class = G_OBJECT_CLASS (gwibber_preferences_parent_class);
 
149
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
150
        self = GWIBBER_PREFERENCES (obj);
 
151
        _tmp0_ = gtk_builder_new ();
 
152
        _g_object_unref0 (self->builder);
 
153
        self->builder = _tmp0_;
 
154
        gtk_builder_add_from_file (self->builder, "/usr/share/gwibber/ui/gwibber-preferences-dialog.ui", &_inner_error_);
 
155
        if (_inner_error_ != NULL) {
 
156
                goto __catch0_g_error;
 
157
        }
 
158
        gtk_builder_connect_signals (self->builder, NULL);
 
159
        _tmp1_ = gtk_builder_get_object (self->builder, "prefs_dialog");
 
160
        _tmp2_ = _tmp1_;
 
161
        _tmp3_ = _g_object_ref0 (GTK_IS_DIALOG (_tmp2_) ? ((GtkDialog*) _tmp2_) : NULL);
 
162
        dialog = _tmp3_;
 
163
        _tmp4_ = gtk_builder_get_object (self->builder, "tray_icon_frame");
 
164
        _tmp5_ = _tmp4_;
 
165
        _tmp6_ = _g_object_ref0 (GTK_IS_WIDGET (_tmp5_) ? ((GtkWidget*) _tmp5_) : NULL);
 
166
        tray_icon = _tmp6_;
 
167
        gtk_widget_hide (tray_icon);
 
168
        gtk_widget_show_all ((GtkWidget*) dialog);
 
169
        _g_object_unref0 (tray_icon);
 
170
        _g_object_unref0 (dialog);
 
171
        goto __finally0;
 
172
        __catch0_g_error:
 
173
        {
 
174
                GError * e;
 
175
                e = _inner_error_;
 
176
                _inner_error_ = NULL;
 
177
                g_error ("gwibber-preferences.vala:46: Could not load UI: %s", e->message);
 
178
                _g_error_free0 (e);
 
179
        }
 
180
        __finally0:
 
181
        if (_inner_error_ != NULL) {
 
182
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
183
                g_clear_error (&_inner_error_);
 
184
        }
 
185
        _tmp7_ = g_settings_new ("org.gwibber.preferences");
 
186
        settings = _tmp7_;
 
187
        BOOL_SETTINGS = NULL;
 
188
        INT_SETTINGS = NULL;
 
189
        STRING_SETTINGS = NULL;
 
190
        _tmp8_ = g_strdup ("retweet-style");
 
191
        STRING_SETTINGS = g_list_append (STRING_SETTINGS, _tmp8_);
 
192
        _tmp9_ = g_strdup ("urlshorter");
 
193
        STRING_SETTINGS = g_list_append (STRING_SETTINGS, _tmp9_);
 
194
        _tmp10_ = g_strdup ("interval");
 
195
        INT_SETTINGS = g_list_append (INT_SETTINGS, _tmp10_);
 
196
        {
 
197
                GList* key_collection;
 
198
                GList* key_it;
 
199
                key_collection = INT_SETTINGS;
 
200
                for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
 
201
                        gchar* _tmp11_;
 
202
                        gchar* key;
 
203
                        _tmp11_ = g_strdup ((const gchar*) key_it->data);
 
204
                        key = _tmp11_;
 
205
                        {
 
206
                                GObject* _tmp12_ = NULL;
 
207
                                g_debug ("gwibber-preferences.vala:63: %s", key);
 
208
                                _tmp12_ = gtk_builder_get_object (self->builder, key);
 
209
                                g_settings_bind (settings, key, _tmp12_, "value", G_SETTINGS_BIND_DEFAULT);
 
210
                                _g_free0 (key);
 
211
                        }
 
212
                }
 
213
        }
 
214
        _tmp13_ = g_strdup ("no-notifications");
 
215
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp13_);
 
216
        _tmp14_ = g_strdup ("notify-mentions-only");
 
217
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp14_);
 
218
        _tmp15_ = g_strdup ("show-notifications");
 
219
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp15_);
 
220
        _tmp16_ = g_strdup ("show-tray-icon");
 
221
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp16_);
 
222
        _tmp17_ = g_strdup ("minimize-to-tray");
 
223
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp17_);
 
224
        _tmp18_ = g_strdup ("hide-taskbar-entry");
 
225
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp18_);
 
226
        _tmp19_ = g_strdup ("show-fullname");
 
227
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp19_);
 
228
        _tmp20_ = g_strdup ("reply-append-colon");
 
229
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp20_);
 
230
        _tmp21_ = g_strdup ("shorten-urls");
 
231
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp21_);
 
232
        _tmp22_ = g_strdup ("global-retweet");
 
233
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp22_);
 
234
        _tmp23_ = g_strdup ("autostart");
 
235
        BOOL_SETTINGS = g_list_append (BOOL_SETTINGS, _tmp23_);
 
236
        {
 
237
                GList* key_collection;
 
238
                GList* key_it;
 
239
                key_collection = BOOL_SETTINGS;
 
240
                for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
 
241
                        gchar* _tmp24_;
 
242
                        gchar* key;
 
243
                        _tmp24_ = g_strdup ((const gchar*) key_it->data);
 
244
                        key = _tmp24_;
 
245
                        {
 
246
                                GObject* _tmp25_ = NULL;
 
247
                                g_debug ("gwibber-preferences.vala:80: %s", key);
 
248
                                _tmp25_ = gtk_builder_get_object (self->builder, key);
 
249
                                g_settings_bind (settings, key, _tmp25_, "active", G_SETTINGS_BIND_DEFAULT);
 
250
                                _g_free0 (key);
 
251
                        }
 
252
                }
 
253
        }
 
254
        __g_list_free__g_free0_0 (STRING_SETTINGS);
 
255
        __g_list_free__g_free0_0 (INT_SETTINGS);
 
256
        __g_list_free__g_free0_0 (BOOL_SETTINGS);
 
257
        _g_object_unref0 (settings);
 
258
        return obj;
 
259
}
 
260
 
 
261
 
 
262
static void gwibber_preferences_class_init (GwibberPreferencesClass * klass) {
 
263
        gwibber_preferences_parent_class = g_type_class_peek_parent (klass);
 
264
        G_OBJECT_CLASS (klass)->constructor = gwibber_preferences_constructor;
 
265
        G_OBJECT_CLASS (klass)->finalize = gwibber_preferences_finalize;
 
266
}
 
267
 
 
268
 
 
269
static void gwibber_preferences_instance_init (GwibberPreferences * self) {
 
270
}
 
271
 
 
272
 
 
273
static void gwibber_preferences_finalize (GObject* obj) {
 
274
        GwibberPreferences * self;
 
275
        self = GWIBBER_PREFERENCES (obj);
 
276
        _g_object_unref0 (self->builder);
 
277
        G_OBJECT_CLASS (gwibber_preferences_parent_class)->finalize (obj);
 
278
}
 
279
 
 
280
 
 
281
GType gwibber_preferences_get_type (void) {
 
282
        static volatile gsize gwibber_preferences_type_id__volatile = 0;
 
283
        if (g_once_init_enter (&gwibber_preferences_type_id__volatile)) {
 
284
                static const GTypeInfo g_define_type_info = { sizeof (GwibberPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gwibber_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GwibberPreferences), 0, (GInstanceInitFunc) gwibber_preferences_instance_init, NULL };
 
285
                GType gwibber_preferences_type_id;
 
286
                gwibber_preferences_type_id = g_type_register_static (G_TYPE_OBJECT, "GwibberPreferences", &g_define_type_info, 0);
 
287
                g_once_init_leave (&gwibber_preferences_type_id__volatile, gwibber_preferences_type_id);
 
288
        }
 
289
        return gwibber_preferences_type_id__volatile;
 
290
}
 
291
 
 
292
 
 
293
gint _vala_main (gchar** args, int args_length1) {
 
294
        gint result = 0;
 
295
        GwibberPreferences* _tmp0_ = NULL;
 
296
        GwibberPreferences* p;
 
297
        gtk_init (&args_length1, &args);
 
298
        _tmp0_ = gwibber_preferences_new ();
 
299
        p = _tmp0_;
 
300
        gtk_main ();
 
301
        result = 0;
 
302
        _g_object_unref0 (p);
 
303
        return result;
 
304
}
 
305
 
 
306
 
 
307
int main (int argc, char ** argv) {
 
308
        g_type_init ();
 
309
        return _vala_main (argv, argc);
 
310
}
 
311
 
 
312
 
 
313