| | 45 | static void |
|---|
| | 46 | tmut_msg_view_set_unavailable (TnyMsgView *self) |
|---|
| | 47 | { |
|---|
| | 48 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 49 | tny_msg_view_set_unavailable (priv->msg_view); |
|---|
| | 50 | return; |
|---|
| | 51 | } |
|---|
| | 52 | |
|---|
| | 53 | static TnyMsg* |
|---|
| | 54 | tmut_msg_view_get_msg (TnyMsgView *self) |
|---|
| | 55 | { |
|---|
| | 56 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 57 | return tny_msg_view_get_msg (priv->msg_view); |
|---|
| | 58 | } |
|---|
| | 59 | |
|---|
| | 60 | static void |
|---|
| | 61 | tmut_msg_view_set_msg (TnyMsgView *self, TnyMsg *msg) |
|---|
| | 62 | { |
|---|
| | 63 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 64 | |
|---|
| | 65 | tny_msg_view_set_msg (priv->msg_view, msg); |
|---|
| | 66 | |
|---|
| | 67 | return; |
|---|
| | 68 | } |
|---|
| | 69 | |
|---|
| | 70 | |
|---|
| | 71 | |
|---|
| | 72 | |
|---|
| | 73 | static void |
|---|
| | 74 | tmut_msg_view_clear (TnyMsgView *self) |
|---|
| | 75 | { |
|---|
| | 76 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 77 | |
|---|
| | 78 | tny_msg_view_clear (priv->msg_view); |
|---|
| | 79 | |
|---|
| | 80 | return; |
|---|
| | 81 | } |
|---|
| | 82 | |
|---|
| | 83 | static TnyMsgView* |
|---|
| | 84 | tmut_msg_view_create_new_inline_viewer (TnyMsgView *self) |
|---|
| | 85 | { |
|---|
| | 86 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 87 | |
|---|
| | 88 | /* This should not be a window, but the decorated one, as it has to be |
|---|
| | 89 | embeddable within a window. So we even decorate this one as usual. */ |
|---|
| | 90 | |
|---|
| | 91 | return tny_msg_view_create_new_inline_viewer (priv->msg_view); |
|---|
| | 92 | } |
|---|
| | 93 | |
|---|
| | 94 | static TnyMimePartView* |
|---|
| | 95 | tmut_msg_view_create_mime_part_view_for (TnyMsgView *self, TnyMimePart *part) |
|---|
| | 96 | { |
|---|
| | 97 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 98 | |
|---|
| | 99 | return tny_msg_view_create_mime_part_view_for (priv->msg_view, part); |
|---|
| | 100 | } |
|---|
| | 101 | |
|---|
| | 102 | |
|---|
| | 103 | |
|---|
| | 104 | static void |
|---|
| | 105 | tmut_msg_view_mp_clear (TnyMimePartView *self) |
|---|
| | 106 | { |
|---|
| | 107 | tny_msg_view_clear (TNY_MSG_VIEW (self)); |
|---|
| | 108 | |
|---|
| | 109 | return; |
|---|
| | 110 | } |
|---|
| | 111 | |
|---|
| | 112 | |
|---|
| | 113 | static void |
|---|
| | 114 | tmut_msg_view_mp_set_part (TnyMimePartView *self, TnyMimePart *part) |
|---|
| | 115 | { |
|---|
| | 116 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 117 | |
|---|
| | 118 | tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (priv->msg_view), part); |
|---|
| | 119 | |
|---|
| | 120 | return; |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|
| | 123 | |
|---|
| | 124 | static TnyMimePart* |
|---|
| | 125 | tmut_msg_view_mp_get_part (TnyMimePartView *self) |
|---|
| | 126 | { |
|---|
| | 127 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 128 | |
|---|
| | 129 | return tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (priv->msg_view)); |
|---|
| | 130 | } |
|---|
| | 131 | |
|---|
| | 132 | /** |
|---|
| | 133 | * tmut_msg_view_set_view: |
|---|
| | 134 | * @self: a #TnyGtkMsgView instance |
|---|
| | 135 | * @view: a #TnyMsgView to decorate |
|---|
| | 136 | * |
|---|
| | 137 | * Set the @view to decorate with @self |
|---|
| | 138 | **/ |
|---|
| | 139 | void |
|---|
| | 140 | tmut_msg_view_set_view (TMutMsgView *self, TnyMsgView *view) |
|---|
| | 141 | { |
|---|
| | 142 | TMutMsgViewPriv *priv = TMUT_MSG_VIEW_GET_PRIVATE (self); |
|---|
| | 143 | |
|---|
| | 144 | if (G_UNLIKELY (priv->msg_view)) |
|---|
| | 145 | gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (priv->msg_view)); |
|---|
| | 146 | |
|---|
| | 147 | priv->msg_view = view; |
|---|
| | 148 | |
|---|
| | 149 | /* This adds a reference to msgview (it's a gtkwidget) */ |
|---|
| | 150 | gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (self), |
|---|
| | 151 | GTK_WIDGET (view)); |
|---|
| | 152 | |
|---|
| | 153 | gtk_widget_show (GTK_WIDGET (priv->msg_view)); |
|---|
| | 154 | |
|---|
| | 155 | return; |
|---|
| | 156 | } |
|---|
| | 228 | |
|---|
| | 229 | return; |
|---|
| | 230 | } |
|---|
| | 231 | |
|---|
| | 232 | |
|---|
| | 233 | static void |
|---|
| | 234 | tny_msg_view_init (gpointer g, gpointer iface_data) |
|---|
| | 235 | { |
|---|
| | 236 | TnyMsgViewIface *klass = (TnyMsgViewIface *)g; |
|---|
| | 237 | |
|---|
| | 238 | klass->get_msg_func = tmut_msg_view_get_msg; |
|---|
| | 239 | klass->set_msg_func = tmut_msg_view_set_msg; |
|---|
| | 240 | klass->set_unavailable_func = tmut_msg_view_set_unavailable; |
|---|
| | 241 | klass->clear_func = tmut_msg_view_clear; |
|---|
| | 242 | klass->create_mime_part_view_for_func = tmut_msg_view_create_mime_part_view_for; |
|---|
| | 243 | klass->create_new_inline_viewer_func = tmut_msg_view_create_new_inline_viewer; |
|---|
| | 244 | |
|---|
| | 245 | return; |
|---|
| | 246 | } |
|---|
| | 247 | |
|---|
| | 248 | static void |
|---|
| | 249 | tny_mime_part_view_init (gpointer g, gpointer iface_data) |
|---|
| | 250 | { |
|---|
| | 251 | TnyMimePartViewIface *klass = (TnyMimePartViewIface *)g; |
|---|
| | 252 | |
|---|
| | 253 | klass->get_part_func = tmut_msg_view_mp_get_part; |
|---|
| | 254 | klass->set_part_func = tmut_msg_view_mp_set_part; |
|---|
| | 255 | klass->clear_func = tmut_msg_view_mp_clear; |
|---|
| 141 | | type = g_type_register_static (TNY_TYPE_GTK_MSG_VIEW, |
|---|
| | 288 | static const GInterfaceInfo tny_msg_view_info = |
|---|
| | 289 | { |
|---|
| | 290 | (GInterfaceInitFunc) tny_msg_view_init, /* interface_init */ |
|---|
| | 291 | NULL, /* interface_finalize */ |
|---|
| | 292 | NULL /* interface_data */ |
|---|
| | 293 | }; |
|---|
| | 294 | |
|---|
| | 295 | static const GInterfaceInfo tny_mime_part_view_info = |
|---|
| | 296 | { |
|---|
| | 297 | (GInterfaceInitFunc) tny_mime_part_view_init, /* interface_init */ |
|---|
| | 298 | NULL, /* interface_finalize */ |
|---|
| | 299 | NULL /* interface_data */ |
|---|
| | 300 | }; |
|---|
| | 301 | |
|---|
| | 302 | type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, |
|---|