* WIP: fixes for gtk3.2 (prevent warnings for deprecated widgets)
This commit is contained in:
@ -22,6 +22,10 @@
|
||||
#include <mu-str.h>
|
||||
#include <mu-date.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mu_msg_header_view_class_init (MuMsgHeaderViewClass *klass);
|
||||
static void mu_msg_header_view_init (MuMsgHeaderView *obj);
|
||||
@ -41,12 +45,21 @@ struct _MuMsgHeaderViewPrivate {
|
||||
MU_TYPE_MSG_HEADER_VIEW, \
|
||||
MuMsgHeaderViewPrivate))
|
||||
/* globals */
|
||||
#ifdef HAVE_GTK3
|
||||
static GtkBoxClass *parent_class = NULL;
|
||||
#else
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
|
||||
/* uncomment the following if you have defined any signals */
|
||||
/* static guint signals[LAST_SIGNAL] = {0}; */
|
||||
|
||||
#ifdef HAVE_GTK3
|
||||
G_DEFINE_TYPE (MuMsgHeaderView, mu_msg_header_view, GTK_TYPE_BOX);
|
||||
#else
|
||||
G_DEFINE_TYPE (MuMsgHeaderView, mu_msg_header_view, GTK_TYPE_VBOX);
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
|
||||
static void
|
||||
@ -73,6 +86,12 @@ mu_msg_header_view_init (MuMsgHeaderView *obj)
|
||||
{
|
||||
obj->_priv = MU_MSG_HEADER_VIEW_GET_PRIVATE(obj);
|
||||
obj->_priv->_table = NULL;
|
||||
|
||||
#ifdef HAVE_GTK3
|
||||
static GtkBoxClass *parent_class = NULL;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -99,7 +118,7 @@ get_label (const gchar *txt, gboolean istitle)
|
||||
markup = g_strdup_printf ("<b>%s</b>: ", txt);
|
||||
gtk_label_set_markup (GTK_LABEL(label), markup);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
|
||||
g_free (markup);
|
||||
g_free (markup);
|
||||
} else {
|
||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_text (GTK_LABEL(label), txt ? txt : "");
|
||||
@ -121,7 +140,7 @@ add_row (GtkWidget *table, guint row, const char* fieldname, const char *value,
|
||||
label = get_label (fieldname, TRUE);
|
||||
al = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (al), label);
|
||||
|
||||
|
||||
gtk_table_attach (
|
||||
GTK_TABLE(table), al,
|
||||
0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
|
||||
@ -134,21 +153,21 @@ add_row (GtkWidget *table, guint row, const char* fieldname, const char *value,
|
||||
gtk_table_attach (
|
||||
GTK_TABLE(table), al, 1, 2, row, row + 1, GTK_FILL,
|
||||
0, 0, 0);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *
|
||||
get_table (MuMsg *msg)
|
||||
{
|
||||
GtkWidget *table;
|
||||
int row;
|
||||
|
||||
|
||||
row = 0;
|
||||
|
||||
table = gtk_table_new (5, 2, FALSE);
|
||||
|
||||
|
||||
if (add_row (table, row, "From", mu_msg_get_from (msg), TRUE))
|
||||
++row;
|
||||
if (add_row (table, row, "To", mu_msg_get_to (msg), FALSE))
|
||||
@ -170,7 +189,7 @@ void
|
||||
mu_msg_header_view_set_message (MuMsgHeaderView *self, MuMsg *msg)
|
||||
{
|
||||
g_return_if_fail (MU_IS_MSG_HEADER_VIEW(self));
|
||||
|
||||
|
||||
if (self->_priv->_table) {
|
||||
gtk_container_remove (GTK_CONTAINER(self), self->_priv->_table);
|
||||
self->_priv->_table = NULL;
|
||||
@ -183,4 +202,3 @@ mu_msg_header_view_set_message (MuMsgHeaderView *self, MuMsg *msg)
|
||||
gtk_widget_show_all (self->_priv->_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* convenience macros */
|
||||
@ -38,7 +42,12 @@ typedef struct _MuMsgHeaderViewClass MuMsgHeaderViewClass;
|
||||
typedef struct _MuMsgHeaderViewPrivate MuMsgHeaderViewPrivate;
|
||||
|
||||
struct _MuMsgHeaderView {
|
||||
GtkVBox parent;
|
||||
#ifdef HAVE_GTK3
|
||||
GtkBox parent;
|
||||
#else
|
||||
GtkVBox parent;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
/* insert public members, if any */
|
||||
|
||||
/* private */
|
||||
@ -46,7 +55,11 @@ struct _MuMsgHeaderView {
|
||||
};
|
||||
|
||||
struct _MuMsgHeaderViewClass {
|
||||
#ifdef HAVE_GTK3
|
||||
GtkBoxClass parent_class;
|
||||
#else
|
||||
GtkVBoxClass parent_class;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
/* insert signal callback declarations, e.g. */
|
||||
/* void (* my_event) (MuMsgHeaderView* obj); */
|
||||
};
|
||||
@ -64,4 +77,3 @@ void mu_msg_header_view_set_message (MuMsgHeaderView *self, MuMsg *msg);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MU_MSG_HEADER_VIEW_H__ */
|
||||
|
||||
|
||||
@ -17,12 +17,17 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include "mu-msg-view.h"
|
||||
#include "mu-msg-body-view.h"
|
||||
#include "mu-msg-header-view.h"
|
||||
#include "mu-msg-attach-view.h"
|
||||
#include "mu-msg-part.h"
|
||||
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mu_msg_view_class_init (MuMsgViewClass *klass);
|
||||
static void mu_msg_view_init (MuMsgView *obj);
|
||||
@ -43,19 +48,31 @@ struct _MuMsgViewPrivate {
|
||||
MU_TYPE_MSG_VIEW, \
|
||||
MuMsgViewPrivate))
|
||||
/* globals */
|
||||
#ifdef HAVE_GTK3
|
||||
static GtkBoxClass *parent_class = NULL;
|
||||
#else
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
|
||||
/* uncomment the following if you have defined any signals */
|
||||
/* static guint signals[LAST_SIGNAL] = {0}; */
|
||||
|
||||
#ifdef HAVE_GTK3
|
||||
G_DEFINE_TYPE (MuMsgView, mu_msg_view, GTK_TYPE_BOX);
|
||||
#else
|
||||
G_DEFINE_TYPE (MuMsgView, mu_msg_view, GTK_TYPE_VBOX);
|
||||
#endif /*HAVE_GTK3*/
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_message (MuMsgView *self, MuMsg *msg)
|
||||
{
|
||||
if (self->_priv->_msg == msg)
|
||||
return; /* nothing to todo */
|
||||
|
||||
|
||||
if (self->_priv->_msg) {
|
||||
mu_msg_unref (self->_priv->_msg);
|
||||
self->_priv->_msg = NULL;
|
||||
@ -97,19 +114,19 @@ on_body_action_requested (GtkWidget *w, const char* action,
|
||||
} else if (g_strcmp0 (action, "view-message") == 0) {
|
||||
if (self->_priv->_msg)
|
||||
mu_msg_view_set_message (self, self->_priv->_msg);
|
||||
|
||||
|
||||
} else if (g_strcmp0 (action, "reindex") == 0) {
|
||||
g_warning ("reindex");
|
||||
} else {
|
||||
g_warning ("unknown action '%s'", action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_attach_activated (GtkWidget *w, guint partnum, MuMsg *msg)
|
||||
{
|
||||
gchar *filepath;
|
||||
|
||||
|
||||
filepath = mu_msg_part_filepath_cache (msg, partnum);
|
||||
if (filepath) {
|
||||
GError *err;
|
||||
@ -120,7 +137,7 @@ on_attach_activated (GtkWidget *w, guint partnum, MuMsg *msg)
|
||||
if (err)
|
||||
g_error_free(err);
|
||||
}
|
||||
|
||||
|
||||
mu_util_play (filepath, TRUE, FALSE);
|
||||
g_free (filepath);
|
||||
}
|
||||
@ -139,17 +156,17 @@ mu_msg_view_init (MuMsgView *self)
|
||||
self->_priv->_attachexpander = gtk_expander_new_with_mnemonic
|
||||
("_Attachments");
|
||||
gtk_container_add (GTK_CONTAINER(self->_priv->_attachexpander),
|
||||
self->_priv->_attach);
|
||||
self->_priv->_attach);
|
||||
g_signal_connect (self->_priv->_attach, "attach-activated",
|
||||
G_CALLBACK(on_attach_activated),
|
||||
self);
|
||||
|
||||
|
||||
self->_priv->_body = mu_msg_body_view_new ();
|
||||
g_signal_connect (self->_priv->_body,
|
||||
"action-requested",
|
||||
G_CALLBACK(on_body_action_requested),
|
||||
self);
|
||||
|
||||
|
||||
gtk_box_pack_start (GTK_BOX(self), self->_priv->_headers,
|
||||
FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX(self), self->_priv->_attachexpander,
|
||||
@ -176,7 +193,7 @@ void
|
||||
mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
||||
{
|
||||
gint attachnum;
|
||||
|
||||
|
||||
g_return_if_fail (MU_IS_MSG_VIEW(self));
|
||||
|
||||
set_message (self, msg);
|
||||
@ -185,10 +202,10 @@ mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
||||
msg);
|
||||
attachnum = mu_msg_attach_view_set_message (MU_MSG_ATTACH_VIEW(self->_priv->_attach),
|
||||
msg);
|
||||
|
||||
|
||||
mu_msg_body_view_set_message (MU_MSG_BODY_VIEW(self->_priv->_body),
|
||||
msg);
|
||||
|
||||
|
||||
gtk_widget_set_visible (self->_priv->_headers, TRUE);
|
||||
gtk_widget_set_visible (self->_priv->_attachexpander, attachnum > 0);
|
||||
gtk_widget_set_visible (self->_priv->_body, TRUE);
|
||||
@ -198,14 +215,14 @@ mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
||||
|
||||
void
|
||||
mu_msg_view_set_message_source (MuMsgView *self, MuMsg *msg)
|
||||
{
|
||||
{
|
||||
g_return_if_fail (MU_IS_MSG_VIEW(self));
|
||||
|
||||
set_message (self, msg);
|
||||
|
||||
|
||||
mu_msg_body_view_set_message_source (MU_MSG_BODY_VIEW(self->_priv->_body),
|
||||
msg);
|
||||
|
||||
|
||||
gtk_widget_set_visible (self->_priv->_headers, FALSE);
|
||||
gtk_widget_set_visible (self->_priv->_attachexpander, FALSE);
|
||||
gtk_widget_set_visible (self->_priv->_body, TRUE);
|
||||
@ -217,7 +234,7 @@ void
|
||||
mu_msg_view_set_note (MuMsgView *self, const gchar* html)
|
||||
{
|
||||
g_return_if_fail (MU_IS_MSG_VIEW(self));
|
||||
|
||||
|
||||
gtk_widget_set_visible (self->_priv->_headers, FALSE);
|
||||
gtk_widget_set_visible (self->_priv->_attachexpander, FALSE);
|
||||
gtk_widget_set_visible (self->_priv->_body, TRUE);
|
||||
@ -225,4 +242,3 @@ mu_msg_view_set_note (MuMsgView *self, const gchar* html)
|
||||
mu_msg_body_view_set_note (MU_MSG_BODY_VIEW(self->_priv->_body),
|
||||
html);
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* convenience macros */
|
||||
@ -38,16 +42,22 @@ typedef struct _MuMsgViewClass MuMsgViewClass;
|
||||
typedef struct _MuMsgViewPrivate MuMsgViewPrivate;
|
||||
|
||||
struct _MuMsgView {
|
||||
GtkVBox parent;
|
||||
/* insert public members, if any */
|
||||
#ifdef HAVE_GTK3
|
||||
GtkBox parent;
|
||||
#else
|
||||
GtkVBox parent;
|
||||
#endif /*!HAVE_GTK3*/
|
||||
|
||||
/* private */
|
||||
MuMsgViewPrivate *_priv;
|
||||
};
|
||||
|
||||
struct _MuMsgViewClass {
|
||||
#ifdef HAVE_GTK3
|
||||
GtkBoxClass parent_class;
|
||||
#else
|
||||
GtkVBoxClass parent_class;
|
||||
/* insert signal callback declarations, e.g. */
|
||||
#endif /*!HAVE_GTK3*/
|
||||
/* void (* my_event) (MuMsgView* obj); */
|
||||
};
|
||||
|
||||
@ -65,4 +75,3 @@ void mu_msg_view_set_message_source (MuMsgView *self, MuMsg *msg);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MU_MSG_VIEW_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user