diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-25 06:04:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-17 08:33:32 +0800 |
commit | 054c0881696a85f537e93b4950a28f505a3dc0f7 (patch) | |
tree | e63cfece426e2de5898c926eb6737cff229bb38b /modules/mail | |
parent | 6348266ee635db59a12d75497f980dd85d0fcf58 (diff) | |
download | gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.gz gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.tar.zst gsoc2013-evolution-054c0881696a85f537e93b4950a28f505a3dc0f7.zip |
BugĀ 589153 - Use GtkBuilder instead of libglade
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/Makefile.am | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 3 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.c | 54 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.h | 3 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 158 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.h | 3 | ||||
-rw-r--r-- | modules/mail/em-network-prefs.c | 67 | ||||
-rw-r--r-- | modules/mail/em-network-prefs.h | 3 |
8 files changed, 147 insertions, 146 deletions
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am index d3e1ef7c2b..15ee1fc932 100644 --- a/modules/mail/Makefile.am +++ b/modules/mail/Makefile.am @@ -8,7 +8,7 @@ libevolution_module_mail_la_CPPFLAGS = \ $(GNOME_PLATFORM_CFLAGS) \ $(EVOLUTION_MAIL_CFLAGS) \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ + -DEVOLUTION_UIDIR=\""$(uidir)"\" \ -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \ -DG_LOG_DOMAIN=\"evolution-module-mail\" diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 195c6f57d1..1241716340 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -68,7 +68,8 @@ mail_shell_view_toggled (EShellView *shell_view) basename = E_MAIL_READER_UI_DEFINITION; if (view_is_active && priv->merge_id == 0) { - priv->merge_id = e_load_ui_definition (ui_manager, basename); + priv->merge_id = e_load_ui_manager_definition ( + ui_manager, basename); e_mail_reader_create_charset_menu ( E_MAIL_READER (priv->mail_shell_content), ui_manager, priv->merge_id); diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index ac3c663d1b..57ce4dd4c8 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -47,6 +47,7 @@ #include <gtkhtml/gtkhtml.h> #include <editor/gtkhtml-spell-language.h> +#include "e-util/e-util.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" #include "widgets/misc/e-charset-combo-box.h" @@ -56,6 +57,7 @@ #include "mail-config.h" #include "em-config.h" +#include "em-folder-selection-button.h" static gpointer parent_class; @@ -168,7 +170,7 @@ composer_prefs_finalize (GObject *object) { EMComposerPrefs *prefs = (EMComposerPrefs *) object; - g_object_unref (prefs->gui); + g_object_unref (prefs->builder); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); @@ -329,7 +331,7 @@ emcp_widget_glade (EConfig *ec, { EMComposerPrefs *prefs = data; - return glade_xml_get_widget (prefs->gui, item->label); + return e_builder_get_widget (prefs->builder, item->label); } /* plugin meta-data */ @@ -362,7 +364,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, EShellSettings *shell_settings; ESignatureList *signature_list; ESignatureTreeView *signature_tree_view; - GladeXML *gui; GtkTreeView *view; GtkListStore *store; GtkTreeSelection *selection; @@ -373,18 +374,17 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, EMConfigTargetPrefs *target; GSList *l; gint i; - gchar *gladefile; bridge = gconf_bridge_get (); client = mail_config_get_gconf_client (); shell_settings = e_shell_get_shell_settings (shell); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - gui = glade_xml_new (gladefile, "composer_toplevel", NULL); - prefs->gui = gui; - g_free (gladefile); + /* Make sure our custom widget classes are registered with + * GType before we load the GtkBuilder definition file. */ + EM_TYPE_FOLDER_SELECTION_BUTTON; + + prefs->builder = gtk_builder_new (); + e_load_ui_builder_definition (prefs->builder, "mail-config.ui"); /** @HookPoint-EMConfig: Mail Composer Preferences * @Id: org.gnome.evolution.mail.composerPrefs @@ -403,53 +403,53 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* General tab */ /* Default Behavior */ - widget = glade_xml_get_widget (gui, "chkSendHTML"); + widget = e_builder_get_widget (prefs->builder, "chkSendHTML"); e_mutual_binding_new ( shell_settings, "composer-format-html", widget, "active"); - widget = glade_xml_get_widget (gui, "chkPromptEmptySubject"); + widget = e_builder_get_widget (prefs->builder, "chkPromptEmptySubject"); e_mutual_binding_new ( shell_settings, "composer-prompt-empty-subject", widget, "active"); - widget = glade_xml_get_widget (gui, "chkPromptBccOnly"); + widget = e_builder_get_widget (prefs->builder, "chkPromptBccOnly"); e_mutual_binding_new ( shell_settings, "composer-prompt-only-bcc", widget, "active"); - widget = glade_xml_get_widget (gui, "chkAutoSmileys"); + widget = e_builder_get_widget (prefs->builder, "chkAutoSmileys"); e_mutual_binding_new ( shell_settings, "composer-magic-smileys", widget, "active"); - widget = glade_xml_get_widget (gui, "chkRequestReceipt"); + widget = e_builder_get_widget (prefs->builder, "chkRequestReceipt"); e_mutual_binding_new ( shell_settings, "composer-request-receipt", widget, "active"); - widget = glade_xml_get_widget (gui, "chkReplyStartBottom"); + widget = e_builder_get_widget (prefs->builder, "chkReplyStartBottom"); e_mutual_binding_new ( shell_settings, "composer-reply-start-bottom", widget, "active"); - widget = glade_xml_get_widget (gui, "chkOutlookFilenames"); + widget = e_builder_get_widget (prefs->builder, "chkOutlookFilenames"); e_mutual_binding_new ( shell_settings, "composer-outlook-filenames", widget, "active"); - widget = glade_xml_get_widget (gui, "chkTopSignature"); + widget = e_builder_get_widget (prefs->builder, "chkTopSignature"); e_mutual_binding_new ( shell_settings, "composer-top-signature", widget, "active"); - widget = glade_xml_get_widget (gui, "chkEnableSpellChecking"); + widget = e_builder_get_widget (prefs->builder, "chkEnableSpellChecking"); e_mutual_binding_new ( shell_settings, "composer-inline-spelling", widget, "active"); widget = e_charset_combo_box_new (); - container = glade_xml_get_widget (gui, "hboxComposerCharset"); + container = e_builder_get_widget (prefs->builder, "hboxComposerCharset"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); e_mutual_binding_new ( @@ -457,7 +457,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, widget, "charset"); /* Spell Checking */ - widget = glade_xml_get_widget (gui, "listSpellCheckLanguage"); + widget = e_builder_get_widget (prefs->builder, "listSpellCheckLanguage"); view = GTK_TREE_VIEW (widget); store = gtk_list_store_new ( 3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); @@ -480,12 +480,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, "text", 1, NULL); selection = gtk_tree_view_get_selection (view); gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE); - info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo"); + info_pixmap = e_builder_get_widget (prefs->builder, "pixmapSpellInfo"); gtk_image_set_from_stock ( GTK_IMAGE (info_pixmap), GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON); - widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor"); + widget = e_builder_get_widget (prefs->builder, "colorButtonSpellCheckColor"); e_mutual_binding_new_full ( shell_settings, "composer-spell-color", widget, "color", @@ -496,12 +496,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, spell_setup (prefs); /* Forwards and Replies */ - widget = glade_xml_get_widget (gui, "comboboxForwardStyle"); + widget = e_builder_get_widget (prefs->builder, "comboboxForwardStyle"); e_mutual_binding_new ( shell_settings, "mail-forward-style", widget, "active"); - widget = glade_xml_get_widget (gui, "comboboxReplyStyle"); + widget = e_builder_get_widget (prefs->builder, "comboboxReplyStyle"); e_mutual_binding_new_full ( shell_settings, "mail-reply-style", widget, "active", @@ -511,7 +511,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Signatures */ signature_list = e_get_signature_list (); - container = glade_xml_get_widget (gui, "alignSignatures"); + container = e_builder_get_widget (prefs->builder, "alignSignatures"); widget = e_signature_manager_new (signature_list); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); @@ -533,7 +533,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, signature_tree_view = e_signature_manager_get_tree_view ( E_SIGNATURE_MANAGER (widget)); - container = glade_xml_get_widget (gui, "scrolled-sig"); + container = e_builder_get_widget (prefs->builder, "scrolled-sig"); widget = e_signature_preview_new (); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); diff --git a/modules/mail/em-composer-prefs.h b/modules/mail/em-composer-prefs.h index 6faa18b7d9..af4979ae18 100644 --- a/modules/mail/em-composer-prefs.h +++ b/modules/mail/em-composer-prefs.h @@ -24,7 +24,6 @@ #define EM_COMPOSER_PREFS_H #include <gtk/gtk.h> -#include <glade/glade.h> #include <gtkhtml/gtkhtml.h> #include <shell/e-shell.h> @@ -58,7 +57,7 @@ struct _ESignature; struct _EMComposerPrefs { GtkVBox parent; - GladeXML *gui; + GtkBuilder *builder; /* General tab */ diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index dd2caa3f10..93829bbd4f 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -34,12 +34,11 @@ #include <gtkhtml/gtkhtml-properties.h> #include <libxml/tree.h> -#include <glade/glade.h> - #include <gconf/gconf-client.h> #include "libedataserverui/e-cell-renderer-color.h" +#include "e-util/e-util.h" #include "e-util/e-binding.h" #include "e-util/e-datetime-format.h" #include "e-util/e-util-private.h" @@ -47,6 +46,7 @@ #include "e-mail-label-manager.h" #include "mail-config.h" +#include "em-folder-selection-button.h" #include "em-junk.h" #include "em-config.h" #include "mail-session.h" @@ -143,7 +143,7 @@ em_mailer_prefs_finalize (GObject *obj) { EMMailerPrefs *prefs = (EMMailerPrefs *) obj; - g_object_unref (prefs->gui); + g_object_unref (prefs->builder); if (prefs->labels_change_notify_id) { gconf_client_notify_remove (prefs->gconf, prefs->labels_change_notify_id); @@ -671,7 +671,7 @@ emmp_widget_glade(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget * { EMMailerPrefs *prefs = data; - return glade_xml_get_widget(prefs->gui, item->label); + return e_builder_get_widget(prefs->builder, item->label); } /* plugin meta-data */ @@ -741,17 +741,32 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs) } static void -junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs) +junk_plugin_setup (GtkComboBox *combo_box, EMMailerPrefs *prefs) { + GtkListStore *store; + GtkCellRenderer *cell; gint index = 0; gboolean def_set = FALSE; const GList *plugins = mail_session_get_junk_plugins(); gchar *pdefault = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", NULL); + store = gtk_list_store_new (1, G_TYPE_STRING); + gtk_combo_box_set_model (combo_box, GTK_TREE_MODEL (store)); + + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell, + "text", 0, + NULL); + if (!plugins || !g_list_length ((GList *)plugins)) { - gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("No Junk plugin available")); - gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); - gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE); + GtkTreeIter iter; + + gtk_list_store_append (store, &iter); + gtk_list_store_set ( + store, &iter, 0, _("No junk plugin available"), -1); + gtk_combo_box_set_active (combo_box, 0); + gtk_widget_set_sensitive (GTK_WIDGET (combo_box), FALSE); gtk_widget_hide (GTK_WIDGET (prefs->plugin_image)); gtk_widget_hide (GTK_WIDGET (prefs->plugin_status)); gtk_image_set_from_stock (prefs->plugin_image, NULL, 0); @@ -762,13 +777,15 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs) while (plugins) { EMJunkInterface *iface = plugins->data; + GtkTreeIter iter; - gtk_combo_box_append_text (GTK_COMBO_BOX (combo), iface->plugin_name); + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, iface->plugin_name, -1); if (!def_set && pdefault && iface->plugin_name && !strcmp(pdefault, iface->plugin_name)) { gboolean status; def_set = TRUE; - gtk_combo_box_set_active (GTK_COMBO_BOX (combo), index); + gtk_combo_box_set_active (combo_box, index); status = e_plugin_invoke (iface->hook->plugin, iface->validate_binary, NULL) != NULL; if (status) { gchar *text, *html; @@ -794,21 +811,12 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs) index++; } - g_signal_connect (combo, "changed", G_CALLBACK(junk_plugin_changed), prefs); + g_signal_connect ( + combo_box, "changed", + G_CALLBACK(junk_plugin_changed), prefs); g_free (pdefault); } -G_MODULE_EXPORT GtkWidget * -create_combo_text_widget (void) -{ - GtkWidget *widget; - - widget = gtk_combo_box_new_text (); - gtk_widget_show (widget); - - return widget; -} - static void em_mailer_prefs_construct (EMMailerPrefs *prefs, EShell *shell) @@ -823,23 +831,20 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, GtkTreeSelection *selection; GtkCellRenderer *renderer; GtkTreeIter iter; - GladeXML *gui; gboolean locked; gint val, i; EMConfig *ec; EMConfigTargetPrefs *target; GSList *l; - gchar *gladefile; shell_settings = e_shell_get_shell_settings (shell); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - gui = glade_xml_new (gladefile, "preferences_toplevel", NULL); - g_free (gladefile); + /* Make sure our custom widget classes are registered with + * GType before we load the GtkBuilder definition file. */ + EM_TYPE_FOLDER_SELECTION_BUTTON; - prefs->gui = gui; + prefs->builder = gtk_builder_new (); + e_load_ui_builder_definition (prefs->builder, "mail-config.ui"); /** @HookPoint-EMConfig: Mail Preferences Page * @Id: org.gnome.evolution.mail.prefs @@ -858,7 +863,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* General tab */ /* Message Display */ - widget = glade_xml_get_widget (gui, "chkMarkTimeout"); + widget = e_builder_get_widget (prefs->builder, "chkMarkTimeout"); e_mutual_binding_new ( shell_settings, "mail-mark-seen", widget, "active"); @@ -866,7 +871,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* The "mark seen" timeout requires special transform functions * because we display the timeout value to the user in seconds * but store the settings value in milliseconds. */ - widget = glade_xml_get_widget (gui, "spinMarkTimeout"); + widget = e_builder_get_widget (prefs->builder, "spinMarkTimeout"); prefs->timeout = GTK_SPIN_BUTTON (widget); e_mutual_binding_new ( shell_settings, "mail-mark-seen", @@ -878,12 +883,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, mark_seen_timeout_reverse_transform, NULL, NULL); - widget = glade_xml_get_widget (gui, "mlimit_checkbutton"); + widget = e_builder_get_widget (prefs->builder, "mlimit_checkbutton"); e_mutual_binding_new ( shell_settings, "mail-force-message-limit", widget, "active"); - widget = glade_xml_get_widget (gui, "mlimit_spin"); + widget = e_builder_get_widget (prefs->builder, "mlimit_spin"); e_mutual_binding_new ( shell_settings, "mail-force-message-limit", widget, "sensitive"); @@ -891,12 +896,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, shell_settings, "mail-message-text-part-limit", widget, "value"); - widget = glade_xml_get_widget (gui, "address_checkbox"); + widget = e_builder_get_widget (prefs->builder, "address_checkbox"); e_mutual_binding_new ( shell_settings, "mail-address-compress", widget, "active"); - widget = glade_xml_get_widget (gui, "address_spin"); + widget = e_builder_get_widget (prefs->builder, "address_spin"); e_mutual_binding_new ( shell_settings, "mail-address-compress", widget, "sensitive"); @@ -904,25 +909,25 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, shell_settings, "mail-address-count", widget, "value"); - widget = glade_xml_get_widget (gui, "magic_spacebar_checkbox"); + widget = e_builder_get_widget (prefs->builder, "magic_spacebar_checkbox"); e_mutual_binding_new ( shell_settings, "mail-magic-spacebar", widget, "active"); widget = e_charset_combo_box_new (); - container = glade_xml_get_widget (gui, "hboxDefaultCharset"); + container = e_builder_get_widget (prefs->builder, "hboxDefaultCharset"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); e_mutual_binding_new ( shell_settings, "mail-charset", widget, "charset"); - widget = glade_xml_get_widget (gui, "chkHighlightCitations"); + widget = e_builder_get_widget (prefs->builder, "chkHighlightCitations"); e_mutual_binding_new ( shell_settings, "mail-mark-citations", widget, "active"); - widget = glade_xml_get_widget (gui, "colorButtonHighlightCitations"); + widget = e_builder_get_widget (prefs->builder, "colorButtonHighlightCitations"); e_mutual_binding_new ( shell_settings, "mail-mark-citations", widget, "sensitive"); @@ -933,35 +938,35 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, e_binding_transform_color_to_string, NULL, NULL); - widget = glade_xml_get_widget (gui, "chkEnableSearchFolders"); + widget = e_builder_get_widget (prefs->builder, "chkEnableSearchFolders"); e_mutual_binding_new ( shell_settings, "mail-enable-search-folders", widget, "active"); /* Deleting Mail */ - widget = glade_xml_get_widget (gui, "chkEmptyTrashOnExit"); + widget = e_builder_get_widget (prefs->builder, "chkEmptyTrashOnExit"); e_mutual_binding_new ( shell_settings, "mail-empty-trash-on-exit", widget, "active"); - widget = glade_xml_get_widget (gui, "comboboxEmptyTrashDays"); + widget = e_builder_get_widget (prefs->builder, "comboboxEmptyTrashDays"); e_mutual_binding_new ( shell_settings, "mail-empty-trash-on-exit", widget, "sensitive"); emmp_empty_trash_init (prefs, GTK_COMBO_BOX (widget)); - widget = glade_xml_get_widget (gui, "chkConfirmExpunge"); + widget = e_builder_get_widget (prefs->builder, "chkConfirmExpunge"); e_mutual_binding_new ( shell_settings, "mail-confirm-expunge", widget, "active"); /* Mail Fonts */ - widget = glade_xml_get_widget (gui, "radFontUseSame"); + widget = e_builder_get_widget (prefs->builder, "radFontUseSame"); e_mutual_binding_new_with_negation ( shell_settings, "mail-use-custom-fonts", widget, "active"); - widget = glade_xml_get_widget (gui, "FontFixed"); + widget = e_builder_get_widget (prefs->builder, "FontFixed"); e_mutual_binding_new ( shell_settings, "mail-font-monospace", widget, "font-name"); @@ -969,7 +974,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, shell_settings, "mail-use-custom-fonts", widget, "sensitive"); - widget = glade_xml_get_widget (gui, "FontVariable"); + widget = e_builder_get_widget (prefs->builder, "FontVariable"); e_mutual_binding_new ( shell_settings, "mail-font-variable", widget, "font-name"); @@ -983,17 +988,17 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL); val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL); - prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever")); + prefs->images_never = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesNever")); gtk_toggle_button_set_active (prefs->images_never, val == MAIL_CONFIG_HTTP_NEVER); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->images_never, FALSE); - prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes")); + prefs->images_sometimes = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesSometimes")); gtk_toggle_button_set_active (prefs->images_sometimes, val == MAIL_CONFIG_HTTP_SOMETIMES); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->images_sometimes, FALSE); - prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways")); + prefs->images_always = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesAlways")); gtk_toggle_button_set_active (prefs->images_always, val == MAIL_CONFIG_HTTP_ALWAYS); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->images_always, FALSE); @@ -1002,17 +1007,17 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, g_signal_connect (prefs->images_sometimes, "toggled", G_CALLBACK (http_images_changed), prefs); g_signal_connect (prefs->images_always, "toggled", G_CALLBACK (http_images_changed), prefs); - widget = glade_xml_get_widget (gui, "chkShowAnimatedImages"); + widget = e_builder_get_widget (prefs->builder, "chkShowAnimatedImages"); e_mutual_binding_new ( shell_settings, "mail-show-animated-images", widget, "active"); - widget = glade_xml_get_widget (gui, "chkPromptWantHTML"); + widget = e_builder_get_widget (prefs->builder, "chkPromptWantHTML"); e_mutual_binding_new ( shell_settings, "mail-confirm-unwanted-html", widget, "active"); - container = glade_xml_get_widget (gui, "labels-alignment"); + container = e_builder_get_widget (prefs->builder, "labels-alignment"); widget = e_mail_label_manager_new (); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); @@ -1024,12 +1029,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* headers */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL); - widget = glade_xml_get_widget (gui, "photo_show"); + widget = e_builder_get_widget (prefs->builder, "photo_show"); e_mutual_binding_new ( shell_settings, "mail-show-sender-photo", widget, "active"); - widget = glade_xml_get_widget (gui, "photo_local"); + widget = e_builder_get_widget (prefs->builder, "photo_local"); e_mutual_binding_new ( shell_settings, "mail-show-sender-photo", widget, "sensitive"); @@ -1038,17 +1043,17 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget, "active"); /* always de-sensitised until the user types something in the entry */ - prefs->add_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersAdd")); + prefs->add_header = GTK_BUTTON (e_builder_get_widget (prefs->builder, "cmdHeadersAdd")); gtk_widget_set_sensitive ((GtkWidget *) prefs->add_header, FALSE); /* always de-sensitised until the user selects a header in the list */ - prefs->remove_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersRemove")); + prefs->remove_header = GTK_BUTTON (e_builder_get_widget (prefs->builder, "cmdHeadersRemove")); gtk_widget_set_sensitive ((GtkWidget *) prefs->remove_header, FALSE); - prefs->entry_header = GTK_ENTRY (glade_xml_get_widget (gui, "txtHeaders")); + prefs->entry_header = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtHeaders")); gtk_widget_set_sensitive ((GtkWidget *) prefs->entry_header, !locked); - prefs->header_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "treeHeaders")); + prefs->header_list = GTK_TREE_VIEW (e_builder_get_widget (prefs->builder, "treeHeaders")); gtk_widget_set_sensitive ((GtkWidget *) prefs->header_list, !locked); selection = gtk_tree_view_get_selection (prefs->header_list); @@ -1142,10 +1147,9 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, g_slist_free (header_add_list); /* date/time format */ - table = glade_xml_get_widget (gui, "datetime_format_table"); - - e_datetime_format_add_setup_widget (table, 2, "mail", "table", DTFormatKindDateTime, _("_Table column:")); - e_datetime_format_add_setup_widget (table, 0, "mail", "header", DTFormatKindDateTime, _("_Date header:")); + table = e_builder_get_widget (prefs->builder, "datetime_format_table"); + e_datetime_format_add_setup_widget (table, 0, "mail", "header", DTFormatKindDateTime, _("Date header:")); + e_datetime_format_add_setup_widget (table, 1, "mail", "table", DTFormatKindDateTime, _("Table column:")); widget = gtk_check_button_new_with_mnemonic (_("Show _original header value")); gtk_widget_show (widget); gtk_table_attach ((GtkTable *) table, widget, 0, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 12, 0); @@ -1154,33 +1158,33 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget, "active"); /* Junk prefs */ - widget = glade_xml_get_widget (gui, "chkCheckIncomingMail"); + widget = e_builder_get_widget (prefs->builder, "chkCheckIncomingMail"); e_mutual_binding_new ( shell_settings, "mail-check-for-junk", widget, "active"); - widget = glade_xml_get_widget (gui, "junk_empty_check"); + widget = e_builder_get_widget (prefs->builder, "junk_empty_check"); e_mutual_binding_new ( shell_settings, "mail-empty-junk-on-exit", widget, "active"); - widget = glade_xml_get_widget (gui, "junk_empty_combobox"); + widget = e_builder_get_widget (prefs->builder, "junk_empty_combobox"); e_mutual_binding_new ( shell_settings, "mail-empty-junk-on-exit", widget, "sensitive"); emmp_empty_junk_init (prefs, GTK_COMBO_BOX (widget)); - prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin")); - prefs->plugin_status = GTK_LABEL (glade_xml_get_widget (gui, "plugin_status")); - prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image")); - junk_plugin_setup (GTK_WIDGET (prefs->default_junk_plugin), prefs); - - prefs->junk_header_check = (GtkToggleButton *)glade_xml_get_widget (gui, "junk_header_check"); - prefs->junk_header_tree = (GtkTreeView *)glade_xml_get_widget (gui, "junk_header_tree"); - prefs->junk_header_add = (GtkButton *)glade_xml_get_widget (gui, "junk_header_add"); - prefs->junk_header_remove = (GtkButton *)glade_xml_get_widget (gui, "junk_header_remove"); - prefs->junk_book_lookup = (GtkToggleButton *)glade_xml_get_widget (gui, "lookup_book"); - prefs->junk_lookup_local_only = (GtkToggleButton *)glade_xml_get_widget (gui, "junk_lookup_local_only"); + prefs->default_junk_plugin = GTK_COMBO_BOX (e_builder_get_widget (prefs->builder, "default_junk_plugin")); + prefs->plugin_status = GTK_LABEL (e_builder_get_widget (prefs->builder, "plugin_status")); + prefs->plugin_image = GTK_IMAGE (e_builder_get_widget (prefs->builder, "plugin_image")); + junk_plugin_setup (prefs->default_junk_plugin, prefs); + + prefs->junk_header_check = (GtkToggleButton *)e_builder_get_widget (prefs->builder, "junk_header_check"); + prefs->junk_header_tree = (GtkTreeView *)e_builder_get_widget (prefs->builder, "junk_header_tree"); + prefs->junk_header_add = (GtkButton *)e_builder_get_widget (prefs->builder, "junk_header_add"); + prefs->junk_header_remove = (GtkButton *)e_builder_get_widget (prefs->builder, "junk_header_remove"); + prefs->junk_book_lookup = (GtkToggleButton *)e_builder_get_widget (prefs->builder, "lookup_book"); + prefs->junk_lookup_local_only = (GtkToggleButton *)e_builder_get_widget (prefs->builder, "junk_lookup_local_only"); toggle_button_init (prefs, prefs->junk_book_lookup, FALSE, "/apps/evolution/mail/junk/lookup_addressbook", G_CALLBACK (junk_book_lookup_button_toggled)); diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h index 01f823b11e..8ad6ad2f64 100644 --- a/modules/mail/em-mailer-prefs.h +++ b/modules/mail/em-mailer-prefs.h @@ -24,7 +24,6 @@ #define EM_MAILER_PREFS_H #include <gtk/gtk.h> -#include <glade/glade.h> #include <gconf/gconf-client.h> #include <shell/e-shell.h> @@ -62,7 +61,7 @@ struct _EMMailerPrefsHeader { struct _EMMailerPrefs { GtkVBox parent_object; - GladeXML *gui; + GtkBuilder *builder; GConfClient *gconf; /* General tab */ diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c index 5c6c511b72..baed9ca948 100644 --- a/modules/mail/em-network-prefs.c +++ b/modules/mail/em-network-prefs.c @@ -34,15 +34,16 @@ #include <gdk/gdkkeysyms.h> #include <gconf/gconf-client.h> -#include <glade/glade.h> #include <glib/gstdio.h> +#include "e-util/e-util.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" #include "mail-config.h" #include "em-config.h" +#include "em-folder-selection-button.h" #define d(x) @@ -161,7 +162,7 @@ emnp_widget_glade(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget * { EMNetworkPrefs *prefs = data; - return glade_xml_get_widget(prefs->gui, item->label); + return e_builder_get_widget(prefs->builder, item->label); } static void @@ -295,23 +296,21 @@ static void em_network_prefs_construct (EMNetworkPrefs *prefs) { GtkWidget *toplevel; - GladeXML *gui; GSList* l; gchar *buf; EMConfig *ec; EMConfigTargetPrefs *target; gboolean locked; gint i, val, port; - gchar *gladefile; prefs->gconf = mail_config_get_gconf_client (); - gladefile = g_build_filename (EVOLUTION_GLADEDIR, - "mail-config.glade", - NULL); - gui = glade_xml_new (gladefile, "network_preferences_toplevel", NULL); - prefs->gui = gui; - g_free (gladefile); + /* Make sure our custom widget classes are registered with + * GType before we load the GtkBuilder definition file. */ + EM_TYPE_FOLDER_SELECTION_BUTTON; + + prefs->builder = gtk_builder_new (); + e_load_ui_builder_definition (prefs->builder, "mail-config.ui"); /** @HookPoint-EMConfig: Network Preferences * @Id: org.gnome.evolution.mail.networkPrefs @@ -338,14 +337,14 @@ em_network_prefs_construct (EMNetworkPrefs *prefs) if (val == NETWORK_PROXY_AUTOCONFIG) val = NETWORK_PROXY_SYS_SETTINGS; - prefs->sys_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoSysSettings")); + prefs->sys_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoSysSettings")); gtk_toggle_button_set_active (prefs->sys_proxy, val == NETWORK_PROXY_SYS_SETTINGS); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->sys_proxy, FALSE); d(g_print ("Sys settings ----!!! \n")); - prefs->no_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoNoProxy")); + prefs->no_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoNoProxy")); gtk_toggle_button_set_active (prefs->no_proxy, val == NETWORK_PROXY_DIRECT_CONNECTION); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->no_proxy, FALSE); @@ -354,8 +353,8 @@ em_network_prefs_construct (EMNetworkPrefs *prefs) /* no auto-proxy at the moment */ #if 0 - prefs->auto_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoAutoConfig")); - prefs->auto_proxy_url = GTK_ENTRY (glade_xml_get_widget (gui, "txtAutoConfigUrl")); + prefs->auto_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoAutoConfig")); + prefs->auto_proxy_url = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAutoConfigUrl")); gtk_toggle_button_set_active (prefs->auto_proxy, val == NETWORK_PROXY_AUTOCONFIG); @@ -366,29 +365,29 @@ em_network_prefs_construct (EMNetworkPrefs *prefs) d(g_print ("Auto config settings ----!!! \n")); - prefs->manual_proxy = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "rdoManualProxy")); - prefs->http_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtHttpHost")); - prefs->https_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtHttpsHost")); - prefs->ignore_hosts = GTK_ENTRY (glade_xml_get_widget (gui, "txtIgnoreHosts")); - prefs->http_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnHttpPort")); - prefs->https_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnHttpsPort")); - prefs->lbl_http_host = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpHost")); - prefs->lbl_http_port = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpPort")); - prefs->lbl_https_host = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpsHost")); - prefs->lbl_https_port = GTK_LABEL (glade_xml_get_widget (gui, "lblHttpsPort")); - prefs->lbl_ignore_hosts = GTK_LABEL (glade_xml_get_widget (gui, "lblIgnoreHosts")); - prefs->use_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkUseAuth")); + prefs->manual_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoManualProxy")); + prefs->http_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtHttpHost")); + prefs->https_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtHttpsHost")); + prefs->ignore_hosts = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtIgnoreHosts")); + prefs->http_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnHttpPort")); + prefs->https_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnHttpsPort")); + prefs->lbl_http_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpHost")); + prefs->lbl_http_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpPort")); + prefs->lbl_https_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpsHost")); + prefs->lbl_https_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpsPort")); + prefs->lbl_ignore_hosts = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblIgnoreHosts")); + prefs->use_auth = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "chkUseAuth")); toggle_button_init (prefs, prefs->use_auth, GCONF_E_USE_AUTH_KEY); - prefs->lbl_auth_user = GTK_LABEL (glade_xml_get_widget (gui, "lblAuthUser")); - prefs->lbl_auth_pwd = GTK_LABEL (glade_xml_get_widget (gui, "lblAuthPwd")); - prefs->auth_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthUser")); - prefs->auth_pwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthPwd")); + prefs->lbl_auth_user = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblAuthUser")); + prefs->lbl_auth_pwd = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblAuthPwd")); + prefs->auth_user = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAuthUser")); + prefs->auth_pwd = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAuthPwd")); #if 0 - prefs->socks_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSocksHost")); - prefs->socks_port = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spnSocksPort")); - prefs->lbl_socks_host = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksHost")); - prefs->lbl_socks_port = GTK_LABEL (glade_xml_get_widget (gui, "lblSocksPort")); + prefs->socks_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtSocksHost")); + prefs->socks_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnSocksPort")); + prefs->lbl_socks_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblSocksHost")); + prefs->lbl_socks_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblSocksPort")); g_signal_connect (prefs->socks_host, "changed", G_CALLBACK(widget_entry_changed_cb), GCONF_E_SOCKS_HOST_KEY); g_signal_connect (prefs->socks_port, "value_changed", diff --git a/modules/mail/em-network-prefs.h b/modules/mail/em-network-prefs.h index 057247b750..c7a70a803a 100644 --- a/modules/mail/em-network-prefs.h +++ b/modules/mail/em-network-prefs.h @@ -24,7 +24,6 @@ #define EM_NETWORK_PREFS_H #include <gtk/gtk.h> -#include <glade/glade.h> #include <gconf/gconf-client.h> /* Standard GObject macros */ @@ -63,7 +62,7 @@ struct _EMNetworkPrefs { GConfClient *gconf; - GladeXML *gui; + GtkBuilder *builder; /* Default Behavior */ GtkToggleButton *sys_proxy; |