aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/email-custom-header
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-01 10:53:20 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-02-20 23:04:25 +0800
commit23f5773903d64a554d977ae7d0ebbaca73528f1f (patch)
tree104e1a59da8bf96b004bce204b79f47bbe0a6d13 /plugins/email-custom-header
parent49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff)
downloadgsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.bz2
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.lz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.xz
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst
gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'plugins/email-custom-header')
-rw-r--r--plugins/email-custom-header/email-custom-header.c144
-rw-r--r--plugins/email-custom-header/email-custom-header.h34
2 files changed, 70 insertions, 108 deletions
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c
index 4e65f21c85..5376d26410 100644
--- a/plugins/email-custom-header/email-custom-header.c
+++ b/plugins/email-custom-header/email-custom-header.c
@@ -38,6 +38,10 @@
#define d(x)
#define GCONF_KEY_CUSTOM_HEADER "/apps/evolution/eplugin/email_custom_header/customHeader"
+#define CUSTOM_HEADER_OPTIONS_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialogPrivate))
+
typedef struct {
GConfClient *gconf;
GtkWidget *treeview;
@@ -53,7 +57,7 @@ enum {
HEADER_N_COLUMNS
};
-struct _EmailCustomHeaderOptionsDialogPrivate {
+struct _CustomHeaderOptionsDialogPrivate {
GtkBuilder *builder;
/*Widgets*/
GtkWidget *main;
@@ -68,10 +72,8 @@ struct _EmailCustomHeaderOptionsDialogPrivate {
};
/* epech - e-plugin email custom header*/
-static void epech_dialog_class_init (GObjectClass *object_class);
+GType custom_header_options_dialog_get_type (void);
static void epech_dialog_finalize (GObject *object);
-static void epech_dialog_init (GObject *object);
-static void epech_dialog_dispose (GObject *object);
static void epech_setup_widgets (CustomHeaderOptionsDialog *mch);
static gint epech_check_existing_composer_window (gconstpointer a, gconstpointer b);
static void commit_changes (ConfigData *cd);
@@ -80,6 +82,11 @@ GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl);
gboolean e_plugin_ui_init (GtkUIManager *ui_manager, EMsgComposer *composer);
GtkWidget *org_gnome_email_custom_header_config_option (EPlugin *epl, struct _EConfigHookItemFactoryData *data);
+G_DEFINE_TYPE (
+ CustomHeaderOptionsDialog,
+ custom_header_options_dialog,
+ G_TYPE_OBJECT)
+
gint
e_plugin_lib_enable (EPlugin *ep,
gint enable)
@@ -90,7 +97,7 @@ e_plugin_lib_enable (EPlugin *ep,
static void
epech_get_widgets_data (CustomHeaderOptionsDialog *mch)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
HeaderValueComboBox *sub_combo_box_get;
gint selected_item;
gint index_column;
@@ -111,7 +118,7 @@ epech_get_widgets_data (CustomHeaderOptionsDialog *mch)
static gboolean
epech_get_widgets (CustomHeaderOptionsDialog *mch)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
priv = mch->priv;
#define EMAIL_CUSTOM_HEADER(name) e_builder_get_widget (priv->builder, name)
@@ -131,7 +138,7 @@ epech_get_widgets (CustomHeaderOptionsDialog *mch)
static void
epech_fill_widgets_with_data (CustomHeaderOptionsDialog *mch)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
HeaderValueComboBox *sub_combo_box_fill;
gint set_index_column;
@@ -154,37 +161,7 @@ epech_fill_widgets_with_data (CustomHeaderOptionsDialog *mch)
CustomHeaderOptionsDialog *
epech_dialog_new (void)
{
- CustomHeaderOptionsDialog *mch;
-
- mch = g_object_new (EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, NULL);
-
- return mch;
-}
-
-GType
-epech_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof (CustomHeaderOptionsDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) epech_dialog_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (CustomHeaderOptionsDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) epech_dialog_init,
- NULL /* instance_init */
- };
- type = g_type_register_static (G_TYPE_OBJECT,
- "CustomHeaderOptionsDialogType",
- &info, 0);
- }
-
- return type;
+ return g_object_new (EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, NULL);
}
static void
@@ -192,7 +169,7 @@ epech_header_options_cb (GtkDialog *dialog,
gint state,
gpointer func_data)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
CustomHeaderOptionsDialog *mch;
mch = func_data;
@@ -220,7 +197,7 @@ static gboolean
epech_dialog_run (CustomHeaderOptionsDialog *mch,
GtkWidget *parent)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
GtkWidget *toplevel;
g_return_val_if_fail (mch != NULL || EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG (mch), FALSE);
@@ -243,7 +220,9 @@ epech_dialog_run (CustomHeaderOptionsDialog *mch,
gtk_window_set_transient_for (GTK_WINDOW (toplevel),GTK_WINDOW (parent));
epech_fill_widgets_with_data (mch);
- g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(epech_header_options_cb), mch);
+ g_signal_connect (
+ priv->main, "response",
+ G_CALLBACK (epech_header_options_cb), mch);
gtk_widget_show (priv->main);
return TRUE;
@@ -267,7 +246,7 @@ epech_load_from_gconf (GConfClient *client,
const gchar *path,
CustomHeaderOptionsDialog *mch)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
EmailCustomHeaderDetails temp_header_details= {-1, -1, NULL, NULL};
CustomSubHeader temp_header_value_details = {NULL};
GSList *header_list,*q;
@@ -310,7 +289,7 @@ epech_load_from_gconf (GConfClient *client,
static void
epech_setup_widgets (CustomHeaderOptionsDialog *mch)
{
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
EmailCustomHeaderDetails *temp_header_ptr,*temp;
CustomSubHeader *temp_header_value_ptr;
HeaderValueComboBox sub_combo_box = {NULL};
@@ -391,71 +370,44 @@ epech_setup_widgets (CustomHeaderOptionsDialog *mch)
}
static void
-epech_dialog_class_init (GObjectClass *object)
+custom_header_options_dialog_class_init (CustomHeaderOptionsDialogClass *class)
{
- CustomHeaderOptionsDialogClass *klass;
GObjectClass *object_class;
- klass = EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_CLASS (object);
- parent_class = g_type_class_peek_parent (klass);
- object_class = G_OBJECT_CLASS (klass);
+ g_type_class_add_private (
+ class, sizeof (CustomHeaderOptionsDialogPrivate));
+ object_class = G_OBJECT_CLASS (class);
object_class->finalize = epech_dialog_finalize;
- object_class->dispose = epech_dialog_dispose;
-
- signals[MCH_RESPONSE] = g_signal_new ("emch_response",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CustomHeaderOptionsDialogClass, emch_response),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
+
+ signals[MCH_RESPONSE] = g_signal_new (
+ "emch_response",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CustomHeaderOptionsDialogClass, emch_response),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
}
static void
-epech_dialog_init (GObject *object)
+custom_header_options_dialog_init (CustomHeaderOptionsDialog *mch)
{
- CustomHeaderOptionsDialog *mch;
- EmailCustomHeaderOptionsDialogPrivate *priv;
-
- mch = EMAIL_CUSTOM_HEADEROPTIONS_DIALOG (object);
- priv = g_new0 (EmailCustomHeaderOptionsDialogPrivate, 1);
- mch->priv = priv;
- priv->builder = NULL;
- priv->main = NULL;
- priv->page = NULL;
- priv->header_table = NULL;
+ mch->priv = CUSTOM_HEADER_OPTIONS_DIALOG_GET_PRIVATE (mch);
}
static void
epech_dialog_finalize (GObject *object)
{
- CustomHeaderOptionsDialog *mch = (CustomHeaderOptionsDialog *) object;
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
- g_return_if_fail (EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG (mch));
- priv = mch->priv;
- g_free (priv->help_section);
-
- if (mch->priv) {
- g_free (mch->priv);
- mch->priv = NULL;
- }
-
- if (parent_class->finalize)
- (* parent_class->finalize) (object);
-}
+ priv = CUSTOM_HEADER_OPTIONS_DIALOG_GET_PRIVATE (object);
-static void
-epech_dialog_dispose (GObject *object)
-{
- CustomHeaderOptionsDialog *mch = (CustomHeaderOptionsDialog *) object;
-
- g_return_if_fail (EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG (mch));
+ g_free (priv->help_section);
- if (parent_class->dispose)
- (* parent_class->dispose) (object);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (custom_header_options_dialog_parent_class)->finalize (object);
}
static void
@@ -464,7 +416,7 @@ epech_append_to_custom_header (CustomHeaderOptionsDialog *dialog,
gpointer data)
{
EMsgComposer *composer;
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ CustomHeaderOptionsDialogPrivate *priv;
EmailCustomHeaderDetails *temp_header_ptr;
CustomSubHeader *temp_header_value_ptr;
gint index_subtype,sub_type_index;
@@ -573,8 +525,12 @@ static void action_email_custom_header_cb (GtkAction *action, EMsgComposer *comp
}
epech_dialog_run (dialog, GTK_WIDGET (composer));
- g_signal_connect (dialog, "emch_response", G_CALLBACK (epech_append_to_custom_header), GTK_WIDGET (composer));
- g_signal_connect (GTK_WIDGET (composer), "destroy", G_CALLBACK (epech_custom_header_options_commit), composer);
+ g_signal_connect (
+ dialog, "emch_response",
+ G_CALLBACK (epech_append_to_custom_header), composer);
+ g_signal_connect (
+ composer, "destroy",
+ G_CALLBACK (epech_custom_header_options_commit), composer);
}
static GtkActionEntry entries[] = {
diff --git a/plugins/email-custom-header/email-custom-header.h b/plugins/email-custom-header/email-custom-header.h
index 00fa2ef763..1a1c35c5a1 100644
--- a/plugins/email-custom-header/email-custom-header.h
+++ b/plugins/email-custom-header/email-custom-header.h
@@ -22,25 +22,33 @@
*
*/
-#ifndef __EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_H__
-#define __EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_H__
+#ifndef EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_H
+#define EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_H
#include <gtk/gtk.h>
-#define EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG (epech_dialog_get_type ())
-#define EMAIL_CUSTOM_HEADEROPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialog))
-#define EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialogClass))
-#define EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG))
-#define EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG))
+#define EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG \
+ (custom_header_options_dialog_get_type ())
+#define EMAIL_CUSTOM_HEADEROPTIONS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialog))
+#define EMAIL_CUSTOM_HEADEROPTIONS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialogClass))
+#define EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG))
+#define EMAIL_CUSTOM_HEADER_OPTIONS_IS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EMAIL_CUSTOM_HEADER_OPTIONS_DIALOG))
typedef struct _CustomHeaderOptionsDialog CustomHeaderOptionsDialog;
typedef struct _CustomHeaderOptionsDialogClass CustomHeaderOptionsDialogClass;
-typedef struct _EmailCustomHeaderOptionsDialogPrivate EmailCustomHeaderOptionsDialogPrivate;
+typedef struct _CustomHeaderOptionsDialogPrivate CustomHeaderOptionsDialogPrivate;
struct _CustomHeaderOptionsDialog {
- GObject object;
- /* Private data */
- EmailCustomHeaderOptionsDialogPrivate *priv;
+ GObject parent;
+ CustomHeaderOptionsDialogPrivate *priv;
};
typedef struct {
@@ -55,7 +63,7 @@ typedef struct {
} CustomSubHeader;
typedef struct {
- GtkWidget *header_value_combo_box;
+ GtkWidget *header_value_combo_box;
} HeaderValueComboBox;
struct _CustomHeaderOptionsDialogClass {
@@ -75,9 +83,7 @@ enum {
};
static guint signals[LAST_SIGNAL] = {0};
-static GObjectClass *parent_class = NULL;
-GType epech_dialog_get_type (void);
CustomHeaderOptionsDialog *epech_dialog_new (void);
static gboolean epech_dialog_run (CustomHeaderOptionsDialog *mch, GtkWidget *parent);
static void epech_get_header_list (CustomHeaderOptionsDialog *mch);