[buoh/cleanups: 18/31] Rewrite view-message to use G_DECLARE_FINAL_TYPE
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh/cleanups: 18/31] Rewrite view-message to use G_DECLARE_FINAL_TYPE
- Date: Wed, 23 Jan 2019 11:20:59 +0000 (UTC)
commit 0afd5dc88d9b6b010bbbd032578d903d0f473915
Author: Jan Tojnar <jtojnar gmail com>
Date: Tue Sep 25 21:21:28 2018 +0200
Rewrite view-message to use G_DECLARE_FINAL_TYPE
src/buoh-view-message.c | 20 ++++++++++----------
src/buoh-view-message.h | 24 +++---------------------
2 files changed, 13 insertions(+), 31 deletions(-)
---
diff --git a/src/buoh-view-message.c b/src/buoh-view-message.c
index a308dbd..b086d78 100644
--- a/src/buoh-view-message.c
+++ b/src/buoh-view-message.c
@@ -25,7 +25,9 @@
#include "buoh-view-message.h"
-struct _BuohViewMessagePrivate {
+struct _BuohViewMessage {
+ GtkViewport parent;
+
GtkWidget *title;
GtkWidget *text;
GtkWidget *icon;
@@ -34,13 +36,11 @@ struct _BuohViewMessagePrivate {
static void buoh_view_message_init (BuohViewMessage *m_view);
static void buoh_view_message_class_init (BuohViewMessageClass *klass);
-G_DEFINE_TYPE_WITH_PRIVATE (BuohViewMessage, buoh_view_message, GTK_TYPE_VIEWPORT)
+G_DEFINE_TYPE (BuohViewMessage, buoh_view_message, GTK_TYPE_VIEWPORT)
static void
buoh_view_message_init (BuohViewMessage *m_view)
{
- m_view->priv = buoh_view_message_get_instance_private (m_view);
-
gtk_widget_init_template (GTK_WIDGET (m_view));
}
@@ -51,9 +51,9 @@ buoh_view_message_class_init (BuohViewMessageClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/buoh/ui/view-message.ui");
- gtk_widget_class_bind_template_child_private (widget_class, BuohViewMessage, title);
- gtk_widget_class_bind_template_child_private (widget_class, BuohViewMessage, text);
- gtk_widget_class_bind_template_child_private (widget_class, BuohViewMessage, icon);
+ gtk_widget_class_bind_template_child (widget_class, BuohViewMessage, title);
+ gtk_widget_class_bind_template_child (widget_class, BuohViewMessage, text);
+ gtk_widget_class_bind_template_child (widget_class, BuohViewMessage, icon);
}
GtkWidget *
@@ -71,7 +71,7 @@ buoh_view_message_set_title (BuohViewMessage *m_view, const gchar *title)
g_return_if_fail (BUOH_IS_VIEW_MESSAGE (m_view));
g_return_if_fail (title != NULL);
- gtk_label_set_text (GTK_LABEL (m_view->priv->title), title);
+ gtk_label_set_text (GTK_LABEL (m_view->title), title);
}
void
@@ -80,7 +80,7 @@ buoh_view_message_set_text (BuohViewMessage *m_view, const gchar *text)
g_return_if_fail (BUOH_IS_VIEW_MESSAGE (m_view));
g_return_if_fail (text != NULL);
- gtk_label_set_markup (GTK_LABEL (m_view->priv->text), text);
+ gtk_label_set_markup (GTK_LABEL (m_view->text), text);
}
void
@@ -89,5 +89,5 @@ buoh_view_message_set_icon (BuohViewMessage *m_view, const gchar *icon)
g_return_if_fail (BUOH_IS_VIEW_MESSAGE (m_view));
g_return_if_fail (icon != NULL);
- gtk_image_set_from_icon_name (GTK_IMAGE (m_view->priv->icon), icon, GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_icon_name (GTK_IMAGE (m_view->icon), icon, GTK_ICON_SIZE_DIALOG);
}
diff --git a/src/buoh-view-message.h b/src/buoh-view-message.h
index 3f84175..74c69ba 100644
--- a/src/buoh-view-message.h
+++ b/src/buoh-view-message.h
@@ -24,27 +24,9 @@
G_BEGIN_DECLS
-typedef struct _BuohViewMessage BuohViewMessage;
-typedef struct _BuohViewMessageClass BuohViewMessageClass;
-typedef struct _BuohViewMessagePrivate BuohViewMessagePrivate;
-
-#define BUOH_TYPE_VIEW_MESSAGE (buoh_view_message_get_type())
-#define BUOH_VIEW_MESSAGE(object) (G_TYPE_CHECK_INSTANCE_CAST((object),
BUOH_TYPE_VIEW_MESSAGE, BuohViewMessage))
-#define BUOH_VIEW_MESSAGE_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), BUOH_TYPE_VIEW_MESSAGE,
BuohViewMessageClass))
-#define BUOH_IS_VIEW_MESSAGE(object) (G_TYPE_CHECK_INSTANCE_TYPE((object),
BUOH_TYPE_VIEW_MESSAGE))
-#define BUOH_IS_VIEW_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), BUOH_TYPE_VIEW_MESSAGE))
-#define BUOH_VIEW_MESSAGE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), BUOH_TYPE_VIEW_MESSAGE,
BuohViewMessageClass))
-
-struct _BuohViewMessage {
- GtkViewport parent;
- BuohViewMessagePrivate *priv;
-};
-
-struct _BuohViewMessageClass {
- GtkViewportClass parent_class;
-};
-
-GType buoh_view_message_get_type (void) G_GNUC_CONST;
+#define BUOH_TYPE_VIEW_MESSAGE buoh_view_message_get_type ()
+G_DECLARE_FINAL_TYPE (BuohViewMessage, buoh_view_message, BUOH, VIEW_MESSAGE, GtkViewport)
+
GtkWidget *buoh_view_message_new (void);
void buoh_view_message_set_title (BuohViewMessage *m_view,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]