root/trunk/libtinymailui/tny-header-view.c
| Revision 3666 (checked in by jdapena, 7 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* libtinymailui - The Tiny Mail UI library |
| 2 | * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with self library; if not, write to the |
| 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * TnyHeaderView: |
| 23 | * |
| 24 | * A view for a #TnyHeader |
| 25 | * |
| 26 | * free-function: g_object_unref |
| 27 | **/ |
| 28 | |
| 29 | #include <config.h> |
| 30 | |
| 31 | #include <tny-header-view.h> |
| 32 | |
| 33 | /** |
| 34 | * tny_header_view_clear: |
| 35 | * @self: A #TnyHeaderView |
| 36 | * |
| 37 | * Clear @self, show nothing |
| 38 | * |
| 39 | * since: 1.0 |
| 40 | * audience: application-developer, type-implementer |
| 41 | **/ |
| 42 | void |
| 43 | tny_header_view_clear (TnyHeaderView *self) |
| 44 | { |
| 45 | #ifdef DEBUG |
| 46 | if (!TNY_HEADER_VIEW_GET_IFACE (self)->clear) |
| 47 | g_critical ("You must implement tny_header_view_clear\n"); |
| 48 | #endif |
| 49 | |
| 50 | TNY_HEADER_VIEW_GET_IFACE (self)->clear(self); |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | |
| 55 | /** |
| 56 | * tny_header_view_set_header: |
| 57 | * @self: A #TnyHeaderView |
| 58 | * @header: A #TnyHeader |
| 59 | * |
| 60 | * Set @self to display @header |
| 61 | * |
| 62 | * Note that the #TnyHeaderView type is often used in a composition with a |
| 63 | * #TnyMsgView type (the #TnyMsgView implementation contains or aggregates a |
| 64 | * #TnyHeaderView). |
| 65 | * |
| 66 | * since: 1.0 |
| 67 | * audience: application-developer, type-implementer |
| 68 | **/ |
| 69 | void |
| 70 | tny_header_view_set_header (TnyHeaderView *self, TnyHeader *header) |
| 71 | { |
| 72 | #ifdef DEBUG |
| 73 | if (!TNY_HEADER_VIEW_GET_IFACE (self)->set_header) |
| 74 | g_critical ("You must implement tny_header_view_set_header\n"); |
| 75 | #endif |
| 76 | |
| 77 | TNY_HEADER_VIEW_GET_IFACE (self)->set_header(self, header); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | static void |
| 82 | tny_header_view_base_init (gpointer g_class) |
| 83 | { |
| 84 | static gboolean initialized = FALSE; |
| 85 | |
| 86 | if (!initialized) { |
| 87 | /* create interface signals here. */ |
| 88 | initialized = TRUE; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | static gpointer |
| 93 | tny_header_view_register_type (gpointer notused) |
| 94 | { |
| 95 | GType type = 0; |
| 96 | |
| 97 | static const GTypeInfo info = |
| 98 | { |
| 99 | sizeof (TnyHeaderViewIface), |
| 100 | tny_header_view_base_init, /* base_init */ |
| 101 | NULL, /* base_finalize */ |
| 102 | NULL, /* class_init */ |
| 103 | NULL, /* class_finalize */ |
| 104 | NULL, /* class_data */ |
| 105 | 0, |
| 106 | 0, /* n_preallocs */ |
| 107 | NULL /* instance_init */ |
| 108 | }; |
| 109 | type = g_type_register_static (G_TYPE_INTERFACE, |
| 110 | "TnyHeaderView", &info, 0); |
| 111 | |
| 112 | g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); |
| 113 | |
| 114 | return GUINT_TO_POINTER (type); |
| 115 | } |
| 116 | |
| 117 | GType |
| 118 | tny_header_view_get_type (void) |
| 119 | { |
| 120 | static GOnce once = G_ONCE_INIT; |
| 121 | g_once (&once, tny_header_view_register_type, NULL); |
| 122 | return GPOINTER_TO_UINT (once.retval); |
| 123 | } |
Note: See TracBrowser for help on using the browser.
