[balsa/wip/gtk4: 296/351] ab-window: Use G_DECLARE and G_DEFINE
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4: 296/351] ab-window: Use G_DECLARE and G_DEFINE
- Date: Wed, 23 May 2018 21:41:51 +0000 (UTC)
commit 8fbbe3821053b12f274ad2504602ad0325aefa19
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Apr 26 20:28:29 2018 -0400
ab-window: Use G_DECLARE and G_DEFINE
and make the object structure private.
src/ab-window.c | 54 ++++++++++++++++++++++++++++++++----------------------
src/ab-window.h | 50 +++++++-------------------------------------------
2 files changed, 39 insertions(+), 65 deletions(-)
---
diff --git a/src/ab-window.c b/src/ab-window.c
index 071e143..398f215 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -85,30 +85,40 @@ struct _BalsaAbWindowClass
GtkDialogClass parent_class;
};
-GType
-balsa_ab_window_get_type(void)
+struct _BalsaAbWindow
{
- static GType ab_type = 0;
-
- if ( !ab_type ) {
- static const GTypeInfo ab_info = {
- sizeof(BalsaAbWindowClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) balsa_ab_window_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(BalsaAbWindow),
- 0, /* n_preallocs */
- (GInstanceInitFunc) balsa_ab_window_init
- };
- ab_type =
- g_type_register_static(GTK_TYPE_DIALOG, "BalsaAbWindow",
- &ab_info, 0);
- }
- return ab_type;
-}
+ GtkDialog parent;
+
+ /* Are we composing? */
+ gboolean composing;
+
+ /* The current address book */
+ LibBalsaAddressBook *current_address_book;
+
+ /* the filter entry */
+ GtkWidget *filter_entry;
+
+ /* The address list */
+ GtkWidget *address_list;
+
+ /* The send to list */
+ GtkWidget *recipient_list;
+
+ /* Radio buttons for dist list mode */
+ GtkWidget *single_address_mode_radio;
+ GtkWidget *dist_address_mode_radio;
+ guint toggle_handler_id;
+
+ /* Stuff to hide when not in compose mode */
+ GtkWidget *send_to_label;
+ GtkWidget *send_to_list;
+ GtkWidget *arrow_box;
+
+ /* The address book list */
+ GtkWidget *combo_box;
+};
+G_DEFINE_TYPE(BalsaAbWindow, balsa_ab_window, GTK_TYPE_DIALOG)
GtkWidget *
balsa_ab_window_new(gboolean composing, GtkWindow* parent)
diff --git a/src/ab-window.h b/src/ab-window.h
index a9ec989..a158c55 100644
--- a/src/ab-window.h
+++ b/src/ab-window.h
@@ -1,6 +1,6 @@
/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
/* Balsa E-Mail Client
- * Copyright (C) 1997-2016 Stuart Parmenter and others,
+ * Copyright (C) 1997-2018 Stuart Parmenter and others,
* See the file AUTHORS for a list.
*
* This program is free software; you can redistribute it and/or modify
@@ -23,50 +23,14 @@
#include <gtk/gtk.h>
#include <libbalsa.h>
-#define BALSA_TYPE_AB_WINDOW (balsa_ab_window_get_type ())
-#define BALSA_AB_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BALSA_TYPE_AB_WINDOW,
BalsaAbWindow))
-#define BALSA_AB_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BALSA_TYPE_AB_WINDOW,
BalsaAbWindowClass))
-#define BALSA_IS_AB_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BALSA_TYPE_AB_WINDOW))
-#define BALSA_IS_AB_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BALSA_TYPE_AB_WINDOW))
+#define BALSA_TYPE_AB_WINDOW balsa_ab_window_get_type()
+G_DECLARE_FINAL_TYPE(BalsaAbWindow,
+ balsa_ab_window,
+ BALSA,
+ AB_WINDOW,
+ GtkDialog)
-typedef struct _BalsaAbWindow BalsaAbWindow;
-typedef struct _BalsaAbWindowClass BalsaAbWindowClass;
-
-struct _BalsaAbWindow
-{
- GtkDialog parent;
-
- /* Are we composing? */
- gboolean composing;
-
- /* The current address book */
- LibBalsaAddressBook *current_address_book;
-
- /* the filter entry */
- GtkWidget *filter_entry;
-
- /* The address list */
- GtkWidget *address_list;
-
- /* The send to list */
- GtkWidget *recipient_list;
-
- /* Radio buttons for dist list mode */
- GtkWidget *single_address_mode_radio;
- GtkWidget *dist_address_mode_radio;
- guint toggle_handler_id;
-
- /* Stuff to hide when not in compose mode */
- GtkWidget *send_to_label;
- GtkWidget *send_to_list;
- GtkWidget *arrow_box;
-
- /* The address book list */
- GtkWidget *combo_box;
-};
-
-GType balsa_ab_window_get_type(void);
GtkWidget *balsa_ab_window_new(gboolean composing, GtkWindow* parent);
gchar *balsa_ab_window_get_recipients(BalsaAbWindow *ab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]