diff options
Diffstat (limited to 'widgets/misc/e-multi-config-dialog.c')
-rw-r--r-- | widgets/misc/e-multi-config-dialog.c | 108 |
1 files changed, 57 insertions, 51 deletions
diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c index 5411cd1413..847789c70c 100644 --- a/widgets/misc/e-multi-config-dialog.c +++ b/widgets/misc/e-multi-config-dialog.c @@ -37,8 +37,8 @@ #include <gdk-pixbuf/gdk-pixbuf.h> -#define PARENT_TYPE gtk_dialog_get_type () -static GtkDialogClass *parent_class = NULL; +#define PARENT_TYPE gnome_dialog_get_type () +static GnomeDialogClass *parent_class = NULL; #define SWITCH_PAGE_INTERVAL 250 @@ -93,11 +93,11 @@ update_buttons (EMultiConfigDialog *dialog) priv = dialog->priv; if (priv->num_unapplied > 0) { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, TRUE); + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, TRUE); /* OK */ + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, TRUE); /* Apply */ } else { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE); + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); /* OK */ + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, FALSE); /* Apply */ } } @@ -175,7 +175,7 @@ set_page_timeout_callback (void *data) static void do_close (EMultiConfigDialog *dialog) { - gtk_widget_destroy (GTK_WIDGET (dialog)); + gnome_dialog_close (GNOME_DIALOG (dialog)); } static void @@ -231,10 +231,10 @@ table_cursor_change_callback (ETable *etable, } -/* GObject methods. */ +/* GtkObject methods. */ static void -impl_finalize (GObject *object) +impl_destroy (GtkObject *object) { EMultiConfigDialog *dialog; EMultiConfigDialogPrivate *priv; @@ -245,19 +245,22 @@ impl_finalize (GObject *object) if (priv->set_page_timeout_id != 0) g_source_remove (priv->set_page_timeout_id); + if (priv->list_e_table_model != NULL) + gtk_object_unref (GTK_OBJECT (priv->list_e_table_model)); + g_slist_free (priv->pages); g_free (priv); - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } -/* GtkDialog methods. */ +/* GnomeDialog methods. */ static void -impl_response (GtkDialog *dialog, - int response_id) +impl_clicked (GnomeDialog *dialog, + int button_number) { EMultiConfigDialog *multi_config_dialog; EMultiConfigDialogPrivate *priv; @@ -265,36 +268,37 @@ impl_response (GtkDialog *dialog, multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog); priv = multi_config_dialog->priv; - switch (response_id) { - case GTK_RESPONSE_OK: + switch (button_number) { + case 0: /* OK */ do_ok (multi_config_dialog); break; - case GTK_RESPONSE_APPLY: + case 1: /* Apply */ do_apply (multi_config_dialog); break; - case GTK_RESPONSE_CLOSE: - default: + case 2: /* Close */ do_close (multi_config_dialog); break; + default: + g_assert_not_reached (); } } -/* GObject ctors. */ +/* GTK+ ctors. */ static void class_init (EMultiConfigDialogClass *class) { - GObjectClass *object_class; - GtkDialogClass *dialog_class; + GnomeDialogClass *dialog_class; + GtkObjectClass *object_class; - object_class = G_OBJECT_CLASS (class); - object_class->finalize = impl_finalize; + object_class = GTK_OBJECT_CLASS (class); + object_class->destroy = impl_destroy; - dialog_class = GTK_DIALOG_CLASS (class); - dialog_class->response = impl_response; + dialog_class = GNOME_DIALOG_CLASS (class); + dialog_class->clicked = impl_clicked; - parent_class = g_type_class_ref (PARENT_TYPE); + parent_class = gtk_type_class (PARENT_TYPE); } #define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \ @@ -327,7 +331,7 @@ fill_in_pixbufs (EMultiConfigDialog *dialog, int row) 1, colors[i], colors[i]); e_table_model_set_value_at (dialog->priv->list_e_table_model, i + 2, row, pixbuf); - g_object_unref(pixbuf); + gdk_pixbuf_unref(pixbuf); } } @@ -357,7 +361,7 @@ init (EMultiConfigDialog *multi_config_dialog) { EMultiConfigDialogPrivate *priv; ETableModel *list_e_table_model; - GtkWidget *dialog_vbox; + GtkWidget *gnome_dialog_vbox; GtkWidget *hbox; GtkWidget *notebook; GtkWidget *list_e_table; @@ -367,38 +371,40 @@ init (EMultiConfigDialog *multi_config_dialog) ECell *vbox; hbox = gtk_hbox_new (FALSE, 2); - dialog_vbox = GTK_DIALOG (multi_config_dialog)->vbox; - gtk_container_add (GTK_CONTAINER (dialog_vbox), hbox); + gnome_dialog_vbox = GNOME_DIALOG (multi_config_dialog)->vbox; + gtk_container_add (GTK_CONTAINER (gnome_dialog_vbox), hbox); list_e_table_model = e_table_memory_store_new (columns); vbox = e_cell_vbox_new (); pixbuf = e_cell_pixbuf_new(); - g_object_set (G_OBJECT (pixbuf), - "focused_column", 2, - "selected_column", 3, - "unselected_column", 4, - NULL); + gtk_object_set (GTK_OBJECT (pixbuf), + "focused_column", 2, + "selected_column", 3, + "unselected_column", 4, + NULL); e_cell_vbox_append (E_CELL_VBOX (vbox), pixbuf, 1); - g_object_unref (pixbuf); + gtk_object_unref (GTK_OBJECT (pixbuf)); text = e_cell_text_new (NULL, GTK_JUSTIFY_CENTER); e_cell_vbox_append (E_CELL_VBOX (vbox), text, 0); - g_object_unref (text); + gtk_object_unref (GTK_OBJECT (text)); extras = e_table_extras_new (); e_table_extras_add_cell (extras, "vbox", vbox); list_e_table = e_table_scrolled_new (list_e_table_model, extras, list_e_table_spec, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table)), - "cursor_change", G_CALLBACK (table_cursor_change_callback), multi_config_dialog); + e_scroll_frame_set_policy (E_SCROLL_FRAME (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))), + "cursor_change", GTK_SIGNAL_FUNC (table_cursor_change_callback), + multi_config_dialog); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas, - "realize", G_CALLBACK (canvas_realize), multi_config_dialog); + gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas), + "realize", GTK_SIGNAL_FUNC (canvas_realize), + multi_config_dialog); - g_object_unref (extras); + gtk_object_unref (GTK_OBJECT (extras)); gtk_box_pack_start (GTK_BOX (hbox), list_e_table, FALSE, TRUE, 0); @@ -411,13 +417,12 @@ init (EMultiConfigDialog *multi_config_dialog) gtk_widget_show (notebook); gtk_widget_show (list_e_table); - gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog), - GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK); - + gnome_dialog_append_buttons (GNOME_DIALOG (multi_config_dialog), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_APPLY, + GNOME_STOCK_BUTTON_CLOSE, + NULL); + gnome_dialog_set_default (GNOME_DIALOG (multi_config_dialog), 0); gtk_window_set_policy (GTK_WINDOW (multi_config_dialog), FALSE /* allow_shrink */, @@ -489,7 +494,8 @@ e_multi_config_dialog_add_page (EMultiConfigDialog *dialog, if (! e_config_page_is_applied (page_widget)) priv->num_unapplied ++; - g_signal_connect (page_widget, "changed", G_CALLBACK (page_changed_callback), dialog); + gtk_signal_connect (GTK_OBJECT (page_widget), "changed", + GTK_SIGNAL_FUNC (page_changed_callback), dialog); update_buttons (dialog); } |