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

« back to all changes in this revision

Viewing changes to client/public-item.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
/* public-item.c generated by valac 0.12.0, the Vala compiler
 
2
 * generated from public-item.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2011 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 Neil Jagdish Patel <njpatel@gmail.com>
 
20
 */
 
21
 
 
22
#include <glib.h>
 
23
#include <glib-object.h>
 
24
#include <gtk/gtk.h>
 
25
#include <gwibber-gtk.h>
 
26
#include <gee.h>
 
27
#include <stdlib.h>
 
28
#include <string.h>
 
29
#include <dee.h>
 
30
 
 
31
 
 
32
#define TYPE_TAB_BAR_ITEM (tab_bar_item_get_type ())
 
33
#define TAB_BAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAB_BAR_ITEM, TabBarItem))
 
34
#define TAB_BAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAB_BAR_ITEM, TabBarItemClass))
 
35
#define IS_TAB_BAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAB_BAR_ITEM))
 
36
#define IS_TAB_BAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAB_BAR_ITEM))
 
37
#define TAB_BAR_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAB_BAR_ITEM, TabBarItemClass))
 
38
 
 
39
typedef struct _TabBarItem TabBarItem;
 
40
typedef struct _TabBarItemClass TabBarItemClass;
 
41
typedef struct _TabBarItemPrivate TabBarItemPrivate;
 
42
 
 
43
#define TYPE_PUBLIC_ITEM (public_item_get_type ())
 
44
#define PUBLIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUBLIC_ITEM, PublicItem))
 
45
#define PUBLIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PUBLIC_ITEM, PublicItemClass))
 
46
#define IS_PUBLIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PUBLIC_ITEM))
 
47
#define IS_PUBLIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PUBLIC_ITEM))
 
48
#define PUBLIC_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PUBLIC_ITEM, PublicItemClass))
 
49
 
 
50
typedef struct _PublicItem PublicItem;
 
51
typedef struct _PublicItemClass PublicItemClass;
 
52
typedef struct _PublicItemPrivate PublicItemPrivate;
 
53
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
54
 
 
55
struct _TabBarItem {
 
56
        GtkButton parent_instance;
 
57
        TabBarItemPrivate * priv;
 
58
};
 
59
 
 
60
struct _TabBarItemClass {
 
61
        GtkButtonClass parent_class;
 
62
        GtkWidget* (*get_toolbar) (TabBarItem* self);
 
63
        GtkWidget* (*get_view) (TabBarItem* self);
 
64
};
 
65
 
 
66
struct _PublicItem {
 
67
        TabBarItem parent_instance;
 
68
        PublicItemPrivate * priv;
 
69
};
 
70
 
 
71
struct _PublicItemClass {
 
72
        TabBarItemClass parent_class;
 
73
};
 
74
 
 
75
struct _PublicItemPrivate {
 
76
        GwibberGtkStreamView* _view;
 
77
};
 
78
 
 
79
 
 
80
static gpointer public_item_parent_class = NULL;
 
81
 
 
82
GType tab_bar_item_get_type (void) G_GNUC_CONST;
 
83
GType public_item_get_type (void) G_GNUC_CONST;
 
84
#define PUBLIC_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PUBLIC_ITEM, PublicItemPrivate))
 
85
enum  {
 
86
        PUBLIC_ITEM_DUMMY_PROPERTY
 
87
};
 
88
PublicItem* public_item_new (GeeHashMap* streams);
 
89
PublicItem* public_item_construct (GType object_type, GeeHashMap* streams);
 
90
static void public_item_on_row_added (PublicItem* self);
 
91
static GtkWidget* public_item_real_get_toolbar (TabBarItem* base);
 
92
static GtkWidget* public_item_real_get_view (TabBarItem* base);
 
93
static GObject * public_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
94
GeeHashMap* tab_bar_item_get_streams (TabBarItem* self);
 
95
const gchar* tab_bar_item_get_stream (TabBarItem* self);
 
96
static void _public_item_on_row_added_dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self);
 
97
static void public_item_finalize (GObject* obj);
 
98
 
 
99
 
 
100
PublicItem* public_item_construct (GType object_type, GeeHashMap* streams) {
 
101
        PublicItem * self = NULL;
 
102
        g_return_val_if_fail (streams != NULL, NULL);
 
103
        self = (PublicItem*) g_object_new (object_type, "stream", "public", "icon-name", "web-browser", "tooltip", "Public", "streams", streams, NULL);
 
104
        return self;
 
105
}
 
106
 
 
107
 
 
108
PublicItem* public_item_new (GeeHashMap* streams) {
 
109
        return public_item_construct (TYPE_PUBLIC_ITEM, streams);
 
110
}
 
111
 
 
112
 
 
113
static void public_item_on_row_added (PublicItem* self) {
 
114
        g_return_if_fail (self != NULL);
 
115
        gtk_widget_set_no_show_all ((GtkWidget*) self, FALSE);
 
116
        gtk_widget_show_all ((GtkWidget*) self);
 
117
}
 
118
 
 
119
 
 
120
static GtkWidget* public_item_real_get_toolbar (TabBarItem* base) {
 
121
        PublicItem * self;
 
122
        GtkWidget* result = NULL;
 
123
        self = (PublicItem*) base;
 
124
        result = NULL;
 
125
        return result;
 
126
}
 
127
 
 
128
 
 
129
static gpointer _g_object_ref0 (gpointer self) {
 
130
        return self ? g_object_ref (self) : NULL;
 
131
}
 
132
 
 
133
 
 
134
static GtkWidget* public_item_real_get_view (TabBarItem* base) {
 
135
        PublicItem * self;
 
136
        GtkWidget* result = NULL;
 
137
        GtkWidget* _tmp0_;
 
138
        self = (PublicItem*) base;
 
139
        _tmp0_ = _g_object_ref0 ((GtkWidget*) self->priv->_view);
 
140
        result = _tmp0_;
 
141
        return result;
 
142
}
 
143
 
 
144
 
 
145
static void _public_item_on_row_added_dee_model_row_added (DeeModel* _sender, DeeModelIter* iter, gpointer self) {
 
146
        public_item_on_row_added (self);
 
147
}
 
148
 
 
149
 
 
150
static GObject * public_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
151
        GObject * obj;
 
152
        GObjectClass * parent_class;
 
153
        PublicItem * self;
 
154
        GwibberGtkStreamView* _tmp0_ = NULL;
 
155
        GeeHashMap* _tmp1_ = NULL;
 
156
        const gchar* _tmp2_ = NULL;
 
157
        gpointer _tmp3_ = NULL;
 
158
        DeeModel* _tmp4_;
 
159
        const gchar* _tmp5_ = NULL;
 
160
        DeeModel* _tmp6_ = NULL;
 
161
        parent_class = G_OBJECT_CLASS (public_item_parent_class);
 
162
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
163
        self = PUBLIC_ITEM (obj);
 
164
        _tmp0_ = gwibber_gtk_stream_view_new ();
 
165
        _g_object_unref0 (self->priv->_view);
 
166
        self->priv->_view = g_object_ref_sink (_tmp0_);
 
167
        _tmp1_ = tab_bar_item_get_streams ((TabBarItem*) self);
 
168
        _tmp2_ = tab_bar_item_get_stream ((TabBarItem*) self);
 
169
        _tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, _tmp2_);
 
170
        _tmp4_ = (DeeModel*) _tmp3_;
 
171
        gwibber_gtk_stream_view_set_model (self->priv->_view, _tmp4_);
 
172
        _g_object_unref0 (_tmp4_);
 
173
        _tmp5_ = tab_bar_item_get_stream ((TabBarItem*) self);
 
174
        gwibber_gtk_stream_view_set_stream (self->priv->_view, _tmp5_);
 
175
        gtk_widget_set_no_show_all ((GtkWidget*) self, TRUE);
 
176
        _tmp6_ = gwibber_gtk_stream_view_get_model (self->priv->_view);
 
177
        g_signal_connect_object (_tmp6_, "row-added", (GCallback) _public_item_on_row_added_dee_model_row_added, self, 0);
 
178
        return obj;
 
179
}
 
180
 
 
181
 
 
182
static void public_item_class_init (PublicItemClass * klass) {
 
183
        public_item_parent_class = g_type_class_peek_parent (klass);
 
184
        g_type_class_add_private (klass, sizeof (PublicItemPrivate));
 
185
        TAB_BAR_ITEM_CLASS (klass)->get_toolbar = public_item_real_get_toolbar;
 
186
        TAB_BAR_ITEM_CLASS (klass)->get_view = public_item_real_get_view;
 
187
        G_OBJECT_CLASS (klass)->constructor = public_item_constructor;
 
188
        G_OBJECT_CLASS (klass)->finalize = public_item_finalize;
 
189
}
 
190
 
 
191
 
 
192
static void public_item_instance_init (PublicItem * self) {
 
193
        self->priv = PUBLIC_ITEM_GET_PRIVATE (self);
 
194
}
 
195
 
 
196
 
 
197
static void public_item_finalize (GObject* obj) {
 
198
        PublicItem * self;
 
199
        self = PUBLIC_ITEM (obj);
 
200
        _g_object_unref0 (self->priv->_view);
 
201
        G_OBJECT_CLASS (public_item_parent_class)->finalize (obj);
 
202
}
 
203
 
 
204
 
 
205
GType public_item_get_type (void) {
 
206
        static volatile gsize public_item_type_id__volatile = 0;
 
207
        if (g_once_init_enter (&public_item_type_id__volatile)) {
 
208
                static const GTypeInfo g_define_type_info = { sizeof (PublicItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) public_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublicItem), 0, (GInstanceInitFunc) public_item_instance_init, NULL };
 
209
                GType public_item_type_id;
 
210
                public_item_type_id = g_type_register_static (TYPE_TAB_BAR_ITEM, "PublicItem", &g_define_type_info, 0);
 
211
                g_once_init_leave (&public_item_type_id__volatile, public_item_type_id);
 
212
        }
 
213
        return public_item_type_id__volatile;
 
214
}
 
215
 
 
216
 
 
217