From 054c0881696a85f537e93b4950a28f505a3dc0f7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 24 Sep 2009 18:04:36 -0400 Subject: BugĀ 589153 - Use GtkBuilder instead of libglade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widgets/table/e-table-field-chooser.c | 61 ++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 19 deletions(-) (limited to 'widgets/table/e-table-field-chooser.c') diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 231ad0801f..8d6ddb59e3 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -29,6 +29,8 @@ #include "e-util/e-util.h" #include "e-util/e-util-private.h" +#include "misc/e-canvas.h" + #include "e-table-field-chooser.h" #include "e-table-field-chooser-item.h" @@ -53,8 +55,6 @@ e_table_field_chooser_class_init (ETableFieldChooserClass *klass) object_class = (GObjectClass*) klass; - glade_init(); - object_class->set_property = e_table_field_chooser_set_property; object_class->get_property = e_table_field_chooser_get_property; object_class->dispose = e_table_field_chooser_dispose; @@ -135,28 +135,55 @@ static void resize(GnomeCanvas *canvas, ETableFieldChooser *etfc) ensure_nonzero_step_increments (etfc); } +static GtkWidget * +create_content (GnomeCanvas **canvas) +{ + GtkWidget *vbox_top; + GtkWidget *label1; + GtkWidget *scrolledwindow1; + GtkWidget *canvas_buttons; + + g_return_val_if_fail (canvas != NULL, NULL); + + vbox_top = gtk_vbox_new (FALSE, 4); + gtk_widget_show (vbox_top); + + label1 = gtk_label_new (_("To add a column to your table, drag it into\nthe location in which you want it to appear.")); + gtk_widget_show (label1); + gtk_box_pack_start (GTK_BOX (vbox_top), label1, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (vbox_top), scrolledwindow1, TRUE, TRUE, 0); + GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + canvas_buttons = e_canvas_new (); + gtk_widget_show (canvas_buttons); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), canvas_buttons); + GTK_WIDGET_UNSET_FLAGS (canvas_buttons, GTK_CAN_FOCUS); + GTK_WIDGET_UNSET_FLAGS (canvas_buttons, GTK_CAN_DEFAULT); + + *canvas = GNOME_CANVAS (canvas_buttons); + + return vbox_top; +} + static void e_table_field_chooser_init (ETableFieldChooser *etfc) { - GladeXML *gui; GtkWidget *widget; - gchar *filename = g_build_filename (EVOLUTION_GLADEDIR, - "e-table-field-chooser.glade", - NULL); - gui = glade_xml_new (filename, NULL, GETTEXT_PACKAGE); - g_free (filename); - etfc->gui = gui; - - widget = glade_xml_get_widget(gui, "vbox-top"); + + widget = create_content (&etfc->canvas); if (!widget) { return; } - gtk_widget_reparent(widget, - GTK_WIDGET(etfc)); - gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + gtk_widget_set_size_request (widget, -1, 250); + gtk_box_pack_start (GTK_BOX (etfc), widget, TRUE, TRUE, 0); - etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons")); + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); etfc->rect = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS( etfc->canvas ) ), gnome_canvas_rect_get_type(), @@ -208,10 +235,6 @@ e_table_field_chooser_dispose (GObject *object) g_object_unref (etfc->header); etfc->header = NULL; - if (etfc->gui) - g_object_unref (etfc->gui); - etfc->gui = NULL; - if (G_OBJECT_CLASS (e_table_field_chooser_parent_class)->dispose) (* G_OBJECT_CLASS (e_table_field_chooser_parent_class)->dispose) (object); } -- cgit