Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: A Clutter-based Twitter client
Homepage: http://live.gnome.org/Tweet
Clone URL: git://github.com/ebassi/tweet.git
Search Repo:
tweet / src / tweet-status-view.c
100644 110 lines (89 sloc) 3.315 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* tweet-status-view.c: Status list viewer
*
* This file is part of Tweet.
* Copyright (C) 2008 Emmanuele Bassi <ebassi@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
 
#include <stdlib.h>
#include <string.h>
 
#include <glib.h>
 
#include <clutter/clutter.h>
#include <clutter/cogl.h>
 
#include <tidy/tidy-list-view.h>
#include <tidy/tidy-list-column.h>
#include <tidy/tidy-cell-renderer.h>
#include <tidy/tidy-stylable.h>
 
#include "tweet-status-column.h"
#include "tweet-status-renderer.h"
#include "tweet-status-view.h"
 
#define TWEET_STATUS_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TWEET_TYPE_STATUS_VIEW, TweetStatusViewPrivate))
 
struct _TweetStatusViewPrivate
{
  guint dummy : 1;
};
 
G_DEFINE_TYPE (TweetStatusView, tweet_status_view, TIDY_TYPE_LIST_VIEW);
 
static void
tweet_status_view_dispose (GObject *gobject)
{
  G_OBJECT_CLASS (tweet_status_view_parent_class)->dispose (gobject);
}
 
static TidyListColumn *
tweet_status_view_create_column (TidyListView *list_view,
                                 guint model_id)
{
  return tweet_status_column_new (list_view, model_id);
}
 
static void
tweet_status_view_class_init (TweetStatusViewClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  TidyListViewClass *list_view_class = TIDY_LIST_VIEW_CLASS (klass);
 
  g_type_class_add_private (klass, sizeof (TweetStatusViewPrivate));
 
  gobject_class->dispose = tweet_status_view_dispose;
 
  list_view_class->create_column = tweet_status_view_create_column;
}
 
static void
tweet_status_view_init (TweetStatusView *view)
{
  view->priv = TWEET_STATUS_VIEW_GET_PRIVATE (view);
 
  tidy_list_view_set_rules_hint (TIDY_LIST_VIEW (view), FALSE);
  tidy_list_view_set_show_headers (TIDY_LIST_VIEW (view), FALSE);
 
  tidy_stylable_set (TIDY_STYLABLE (view),
                     "v-padding", 6,
                     NULL);
}
 
ClutterActor *
tweet_status_view_new (TweetStatusModel *model)
{
  g_return_val_if_fail (TWEET_IS_STATUS_MODEL (model), NULL);
 
  return g_object_new (TWEET_TYPE_STATUS_VIEW,
                       "model", CLUTTER_MODEL (model),
                       NULL);
}
 
void
tweet_status_view_get_cell_geometry (TweetStatusView *view,
                                     gint row_index,
                                     gboolean adjust,
                                     ClutterGeometry *geometry)
{
  g_return_if_fail (TWEET_IS_STATUS_VIEW (view));
 
  tidy_list_view_get_cell_geometry (TIDY_LIST_VIEW (view),
                                    row_index, 0,
                                    adjust,
                                    geometry);
}