aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-field-chooser-dialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-table-field-chooser-dialog.c')
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c194
1 files changed, 97 insertions, 97 deletions
diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c
index e4116f101d..d7e725fd12 100644
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ b/widgets/table/e-table-field-chooser-dialog.c
@@ -24,73 +24,71 @@
#include <config.h>
#include "e-table-field-chooser-dialog.h"
#include "gal/util/e-i18n.h"
+#include "gal/util/e-util.h"
+#include <gtk/gtkstock.h>
static void e_table_field_chooser_dialog_init (ETableFieldChooserDialog *card);
static void e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass);
-static void e_table_field_chooser_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_dialog_destroy (GtkObject *object);
-static void e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, gint button);
+static void e_table_field_chooser_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void e_table_field_chooser_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void e_table_field_chooser_dialog_dispose (GObject *object);
+static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id);
-static GnomeDialogClass *parent_class = NULL;
+#define PARENT_TYPE GTK_TYPE_DIALOG
+static GtkDialogClass *parent_class = NULL;
/* The arguments we take */
enum {
- ARG_0,
- ARG_DND_CODE,
- ARG_FULL_HEADER,
- ARG_HEADER
+ PROP_0,
+ PROP_DND_CODE,
+ PROP_FULL_HEADER,
+ PROP_HEADER
};
-GtkType
-e_table_field_chooser_dialog_get_type (void)
-{
- static GtkType table_field_chooser_dialog_type = 0;
-
- if (!table_field_chooser_dialog_type)
- {
- static const GtkTypeInfo table_field_chooser_dialog_info =
- {
-
- "ETableFieldChooserDialog",
- sizeof (ETableFieldChooserDialog),
- sizeof (ETableFieldChooserDialogClass),
- (GtkClassInitFunc) e_table_field_chooser_dialog_class_init,
- (GtkObjectInitFunc) e_table_field_chooser_dialog_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- table_field_chooser_dialog_type = gtk_type_unique (gnome_dialog_get_type (), &table_field_chooser_dialog_info);
- }
-
- return table_field_chooser_dialog_type;
-}
+E_MAKE_TYPE (e_table_field_chooser_dialog,
+ "ETableFieldChooserDialog",
+ ETableFieldChooserDialog,
+ e_table_field_chooser_dialog_class_init,
+ e_table_field_chooser_dialog_init,
+ PARENT_TYPE);
static void
e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass)
{
- GtkObjectClass *object_class;
- GnomeDialogClass *dialog_class;
-
- object_class = (GtkObjectClass*) klass;
- dialog_class = GNOME_DIALOG_CLASS (klass);
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- object_class->destroy = e_table_field_chooser_dialog_destroy;
- object_class->set_arg = e_table_field_chooser_dialog_set_arg;
- object_class->get_arg = e_table_field_chooser_dialog_get_arg;
-
- dialog_class->clicked = e_table_field_chooser_dialog_clicked;
-
- gtk_object_add_arg_type ("ETableFieldChooserDialog::dnd_code", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_DND_CODE);
- gtk_object_add_arg_type ("ETableFieldChooserDialog::full_header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_FULL_HEADER);
- gtk_object_add_arg_type ("ETableFieldChooserDialog::header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_HEADER);
+ GObjectClass *object_class;
+ GtkDialogClass *dialog_class;
+
+ object_class = (GObjectClass*) klass;
+ dialog_class = GTK_DIALOG_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = e_table_field_chooser_dialog_dispose;
+ object_class->set_property = e_table_field_chooser_dialog_set_property;
+ object_class->get_property = e_table_field_chooser_dialog_get_property;
+
+ dialog_class->response = e_table_field_chooser_dialog_response;
+
+ g_object_class_install_property (object_class, PROP_DND_CODE,
+ g_param_spec_string ("dnd_code",
+ _("DnD code"),
+ /*_( */"XXX blurb" /*)*/,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FULL_HEADER,
+ g_param_spec_object ("full_header",
+ _("Full Header"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TABLE_HEADER_TYPE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_HEADER,
+ g_param_spec_object ("header",
+ _("Header"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TABLE_HEADER_TYPE,
+ G_PARAM_READWRITE));
}
static void
@@ -103,22 +101,21 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos
e_table_field_chooser_dialog->full_header = NULL;
e_table_field_chooser_dialog->header = NULL;
- gnome_dialog_append_buttons(GNOME_DIALOG(e_table_field_chooser_dialog),
- GTK_STOCK_CLOSE,
- NULL);
+ gtk_dialog_add_button(GTK_DIALOG(e_table_field_chooser_dialog),
+ GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
gtk_window_set_policy(GTK_WINDOW(e_table_field_chooser_dialog), FALSE, TRUE, FALSE);
widget = e_table_field_chooser_new();
e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER(widget);
- gtk_object_set(GTK_OBJECT(widget),
- "dnd_code", e_table_field_chooser_dialog->dnd_code,
- "full_header", e_table_field_chooser_dialog->full_header,
- "header", e_table_field_chooser_dialog->header,
- NULL);
+ g_object_set(widget,
+ "dnd_code", e_table_field_chooser_dialog->dnd_code,
+ "full_header", e_table_field_chooser_dialog->full_header,
+ "header", e_table_field_chooser_dialog->header,
+ NULL);
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_table_field_chooser_dialog)->vbox),
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_table_field_chooser_dialog)->vbox),
widget, TRUE, TRUE, 0);
gtk_widget_show(GTK_WIDGET(widget));
@@ -129,16 +126,17 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos
GtkWidget*
e_table_field_chooser_dialog_new (void)
{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_dialog_get_type ()));
+ GtkWidget *widget = g_object_new (E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, NULL);
return widget;
}
static void
-e_table_field_chooser_dialog_destroy (GtkObject *object)
+e_table_field_chooser_dialog_dispose (GObject *object)
{
ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object);
- g_free (etfcd->dnd_code);
+ if (etfcd->dnd_code)
+ g_free (etfcd->dnd_code);
etfcd->dnd_code = NULL;
if (etfcd->full_header)
@@ -148,48 +146,50 @@ e_table_field_chooser_dialog_destroy (GtkObject *object)
if (etfcd->header)
g_object_unref (etfcd->header);
etfcd->header = NULL;
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_table_field_chooser_dialog_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_table_field_chooser_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (arg_id){
- case ARG_DND_CODE:
+ switch (prop_id){
+ case PROP_DND_CODE:
g_free(etfcd->dnd_code);
- etfcd->dnd_code = g_strdup(GTK_VALUE_STRING (*arg));
+ etfcd->dnd_code = g_strdup(g_value_get_string (value));
if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "dnd_code", etfcd->dnd_code,
- NULL);
+ g_object_set(etfcd->etfc,
+ "dnd_code", etfcd->dnd_code,
+ NULL);
break;
- case ARG_FULL_HEADER:
+ case PROP_FULL_HEADER:
if (etfcd->full_header)
g_object_unref (etfcd->full_header);
- if (GTK_VALUE_OBJECT(*arg))
- etfcd->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
+ if (g_value_get_object (value))
+ etfcd->full_header = E_TABLE_HEADER(g_value_get_object (value));
else
etfcd->full_header = NULL;
if (etfcd->full_header)
g_object_ref (etfcd->full_header);
if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "full_header", etfcd->full_header,
- NULL);
+ g_object_set(etfcd->etfc,
+ "full_header", etfcd->full_header,
+ NULL);
break;
- case ARG_HEADER:
+ case PROP_HEADER:
if (etfcd->header)
g_object_unref (etfcd->header);
- if (GTK_VALUE_OBJECT(*arg))
- etfcd->header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
+ if (g_value_get_object (value))
+ etfcd->header = E_TABLE_HEADER(g_value_get_object (value));
else
etfcd->header = NULL;
if (etfcd->header)
g_object_ref (etfcd->header);
if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "header", etfcd->header,
- NULL);
+ g_object_set(etfcd->etfc,
+ "header", etfcd->header,
+ NULL);
break;
default:
break;
@@ -197,28 +197,28 @@ e_table_field_chooser_dialog_set_arg (GtkObject *object, GtkArg *arg, guint arg_
}
static void
-e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_table_field_chooser_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (arg_id) {
- case ARG_DND_CODE:
- GTK_VALUE_STRING (*arg) = g_strdup (etfcd->dnd_code);
+ switch (prop_id) {
+ case PROP_DND_CODE:
+ g_value_set_string (value, g_strdup (etfcd->dnd_code));
break;
- case ARG_FULL_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfcd->full_header);
+ case PROP_FULL_HEADER:
+ g_value_set_object (value, etfcd->full_header);
break;
- case ARG_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfcd->header);
+ case PROP_HEADER:
+ g_value_set_object (value, etfcd->header);
break;
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, int button)
+e_table_field_chooser_dialog_response (GtkDialog *dialog, int id)
{
- if (button == 0)
- gnome_dialog_close(dialog);
+ if (id == GTK_RESPONSE_OK)
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}