From bc80332460c353e391cd620f2cc51f7b56eef4de Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 26 Jan 2009 18:49:51 +0000 Subject: Miscellaneous stuff. svn path=/branches/kill-bonobo/; revision=37134 --- addressbook/conduit/address-conduit.c | 1 - .../GNOME_Evolution_Addressbook.server.in.in | 136 -------------- addressbook/gui/component/Makefile.am | 9 - addressbook/gui/component/e-book-shell-content.c | 2 +- .../gui/component/e-book-shell-view-actions.c | 4 +- addressbook/gui/component/eab-composer-util.c | 19 +- addressbook/gui/component/eab-composer-util.h | 9 +- .../printing/test-contact-print-style-editor.c | 54 ++---- addressbook/printing/test-print.c | 35 ++-- composer/e-msg-composer.c | 12 +- doc/reference/shell/eshell-sections.txt | 6 + doc/reference/shell/tmpl/e-shell-sidebar.sgml | 5 + mail/e-mail-reader-utils.c | 9 +- mail/e-mail-reader.c | 8 +- mail/e-mail-shell-module.c | 8 +- mail/em-account-editor.c | 4 +- mail/em-mailer-prefs.c | 2 +- mail/em-network-prefs.c | 2 - mail/mail-component-factory.c | 125 ------------- mail/mail-config.c | 7 +- mail/mail-folder-cache.c | 1 - mail/mail-mt.c | 1 - mail/mail-session.c | 7 - mail/mail-session.h | 3 - shell/e-shell-settings.c | 200 +++++++++++++++++++++ shell/e-shell-settings.h | 20 +++ widgets/misc/e-attachment-bar.c | 101 ----------- widgets/misc/e-attachment-bar.h | 8 +- widgets/misc/e-charset-picker.c | 3 - widgets/misc/e-charset-picker.h | 1 - 30 files changed, 294 insertions(+), 508 deletions(-) delete mode 100644 addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in delete mode 100644 mail/mail-component-factory.c diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index e80d1c346e..3faf74242f 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -29,7 +29,6 @@ #define G_LOG_DOMAIN "eaddrconduit" -#include #include #include #include diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in deleted file mode 100644 index 823d5bd89f..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index ad603bf9b4..52a99e4901 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -98,23 +98,14 @@ install-data-local: fi endif -server_in_files = GNOME_Evolution_Addressbook.server.in.in -server_DATA = $(server_in_files:.server.in.in=.server) -@EVO_SERVER_RULE@ -@INTLTOOL_SERVER_RULE@ - glade_DATA = \ ldap-config.glade -BUILT_SOURCES = $(server_DATA) -CLEANFILES = $(BUILT_SOURCES) - DISTCLEANFILES = $(schema_DATA) EXTRA_DIST = \ $(glade_DATA) \ $(schema_in_files) \ - $(server_in_files) \ openldap-extract.h dist-hook: diff --git a/addressbook/gui/component/e-book-shell-content.c b/addressbook/gui/component/e-book-shell-content.c index 52549f0122..8830c797e0 100644 --- a/addressbook/gui/component/e-book-shell-content.c +++ b/addressbook/gui/component/e-book-shell-content.c @@ -50,7 +50,7 @@ book_shell_content_send_message_cb (EBookShellContent *book_shell_content, { GList node = { destination, NULL, NULL }; - eab_send_message (&node, EAB_DISPOSITION_AS_TO); + eab_send_as_to (&node); } static void diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c index 016563845b..36c04eaf6b 100644 --- a/addressbook/gui/component/e-book-shell-view-actions.c +++ b/addressbook/gui/component/e-book-shell-view-actions.c @@ -306,7 +306,7 @@ action_contact_forward_cb (GtkAction *action, iter->data = destination; } - eab_send_message (list, EAB_DISPOSITION_AS_ATTACHMENT); + eab_send_as_attachment (list); g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list); } @@ -488,7 +488,7 @@ action_contact_send_message_cb (GtkAction *action, iter->data = destination; } - eab_send_message (list, EAB_DISPOSITION_AS_TO); + eab_send_as_to (list); g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list); } diff --git a/addressbook/gui/component/eab-composer-util.c b/addressbook/gui/component/eab-composer-util.c index c69375a0b9..b7daa3dddc 100644 --- a/addressbook/gui/component/eab-composer-util.c +++ b/addressbook/gui/component/eab-composer-util.c @@ -27,7 +27,7 @@ #include "addressbook/util/eab-book-util.h" #include "addressbook/gui/widgets/eab-gui-util.h" -static void +void eab_send_as_to (GList *destinations) { EMsgComposer *composer; @@ -108,7 +108,7 @@ get_email (EContact *contact, EContactField field_id, gchar **to_free) return value; } -static void +void eab_send_as_attachment (GList *destinations) { EMsgComposer *composer; @@ -195,18 +195,3 @@ eab_send_as_attachment (GList *destinations) gtk_widget_show (GTK_WIDGET (composer)); } - -void -eab_send_message (GList *destinations, - EABDisposition disposition) -{ - switch (disposition) { - case EAB_DISPOSITION_AS_TO: - eab_send_as_to (destinations); - break; - - case EAB_DISPOSITION_AS_ATTACHMENT: - eab_send_as_attachment (destinations); - break; - } -} diff --git a/addressbook/gui/component/eab-composer-util.h b/addressbook/gui/component/eab-composer-util.h index 4e9ce581d0..ffee76b2b7 100644 --- a/addressbook/gui/component/eab-composer-util.h +++ b/addressbook/gui/component/eab-composer-util.h @@ -23,13 +23,8 @@ G_BEGIN_DECLS -typedef enum { - EAB_DISPOSITION_AS_ATTACHMENT, - EAB_DISPOSITION_AS_TO, -} EABDisposition; - -void eab_send_message (GList *destinations, - EABDisposition disposition); +void eab_send_as_to (GList *destinations); +void eab_send_as_attachment (GList *destinations); G_END_DECLS diff --git a/addressbook/printing/test-contact-print-style-editor.c b/addressbook/printing/test-contact-print-style-editor.c index 2ca9afb159..de9fd6b6d6 100644 --- a/addressbook/printing/test-contact-print-style-editor.c +++ b/addressbook/printing/test-contact-print-style-editor.c @@ -24,51 +24,35 @@ #include #include -#include -#include -#include #include "e-contact-print-style-editor.h" -/* This is a horrible thing to do, but it is just a test. */ -static GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) +int +main (int argc, char *argv[]) { - static int count = 2; - count --; - if ( count <= 0 ) - exit(0); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ + GtkWidget *editor; + GtkWidget *window; + const gchar *title; - gnome_program_init ("Contact Print Style Editor Test", VERSION, - LIBGNOMEUI_MODULE, - argc, argv, - NULL); + title = "Contact Print Style Editor Test"; - glade_init (); + gtk_init (&argc, &argv); - app = gnome_app_new("Contact Print Style Editor Test", NULL); + glade_init (); - editor = e_contact_print_style_editor_new(""); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), title); - gnome_app_set_contents( GNOME_APP( app ), editor ); + editor = e_contact_print_style_editor_new (""); + gtk_container_add (GTK_CONTAINER (window), editor); - /* Connect the signals */ - g_signal_connect( app, "destroy", - G_CALLBACK ( destroy_callback ), - ( gpointer ) app ); + g_signal_connect ( + window, "delete-event", + G_CALLBACK (gtk_main_quit), NULL); - gtk_widget_show_all( app ); + gtk_widget_show_all (window); - bonobo_main(); + gtk_main (); - /* Not reached. */ - return 0; + /* Not reached. */ + return 0; } diff --git a/addressbook/printing/test-print.c b/addressbook/printing/test-print.c index 2c658840e6..3c02834de3 100644 --- a/addressbook/printing/test-print.c +++ b/addressbook/printing/test-print.c @@ -24,35 +24,28 @@ #include #include -#include #include -#include #include "e-contact-print.h" -int main( int argc, char *argv[] ) +int +main (int argc, char *argv[]) { - GList *shown_fields = NULL; + GList *shown_fields = NULL; - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ + gtk_init (&argc, &argv); - gnome_program_init ("Contact Print Test", VERSION, - LIBGNOMEUI_MODULE, - argc, argv, - NULL); + glade_init (); - glade_init (); + shown_fields = g_list_append (shown_fields, "First field"); + shown_fields = g_list_append (shown_fields, "Second field"); + shown_fields = g_list_append (shown_fields, "Third field"); + shown_fields = g_list_append (shown_fields, "Fourth field"); - shown_fields = g_list_append(shown_fields, "First field"); - shown_fields = g_list_append(shown_fields, "Second field"); - shown_fields = g_list_append(shown_fields, "Third field"); - shown_fields = g_list_append(shown_fields, "Fourth field"); + /* does nothing */ + e_contact_print (NULL, NULL, NULL, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); - /* does nothing */ - e_contact_print (NULL, NULL, NULL, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + gtk_main (); - bonobo_main(); - - /* Not reached. */ - return 0; + /* Not reached. */ + return 0; } diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 3e2faf1cfe..eba55d53b2 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1375,9 +1375,8 @@ set_editor_text (EMsgComposer *composer, */ - g_object_get ( - shell_settings, "composer-top-signature", - &reply_signature_on_top, NULL); + reply_signature_on_top = e_shell_settings_get_boolean ( + shell_settings, "composer-top-signature"); if (set_signature && reply_signature_on_top) { gchar *tmp = NULL; @@ -2099,12 +2098,13 @@ msg_composer_constructor (GType type, /* Honor User Preferences */ - g_object_get (shell_settings, "composer-format-html", &active, NULL); + active = e_shell_settings_get_boolean ( + shell_settings, "composer-format-html"); gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), active); action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT)); - g_object_get ( - shell_settings, "composer-request-receipt", &active, NULL); + active = e_shell_settings_get_boolean ( + shell_settings, "composer-request-receipt"); gtk_toggle_action_set_active (action, active); spell_languages = e_load_spell_languages (); diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index 8e0d7723f9..67d2b88aa1 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -122,6 +122,12 @@ EShellModulePrivate EShellSettings e_shell_settings_install_property e_shell_settings_bind_to_gconf +e_shell_settings_get_boolean +e_shell_settings_set_boolean +e_shell_settings_get_int +e_shell_settings_set_int +e_shell_settings_get_string +e_shell_settings_set_string E_SHELL_SETTINGS E_IS_SHELL_SETTINGS diff --git a/doc/reference/shell/tmpl/e-shell-sidebar.sgml b/doc/reference/shell/tmpl/e-shell-sidebar.sgml index 6e3d22d620..7895a61172 100644 --- a/doc/reference/shell/tmpl/e-shell-sidebar.sgml +++ b/doc/reference/shell/tmpl/e-shell-sidebar.sgml @@ -23,6 +23,11 @@ EShellSidebar + + + + + diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 419581683d..b0c3edff2d 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -87,9 +87,8 @@ e_mail_reader_confirm_delete (EMailReader *reader) folder = message_list->folder; - g_object_get ( - shell_settings, "mail-prompt-delete-in-vfolder", - &prompt_delete_in_vfolder, NULL); + prompt_delete_in_vfolder = e_shell_settings_get_boolean ( + shell_settings, "mail-prompt-delete-in-vfolder"); if (!CAMEL_IS_VEE_STORE (folder->parent_store)) return TRUE; @@ -114,11 +113,11 @@ e_mail_reader_confirm_delete (EMailReader *reader) response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_OK) - g_object_set ( + e_shell_settings_set_boolean ( shell_settings, "mail-prompt-delete-in-vfolder", gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON (check_button)), NULL); + GTK_TOGGLE_BUTTON (check_button))); gtk_widget_destroy (dialog); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index f32d389bb6..1d39309361 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1846,10 +1846,10 @@ mail_reader_message_loaded_cb (CamelFolder *folder, e_shell_event (shell, "mail-icon", "evolution-mail"); /* Determine whether to mark the message as read. */ - g_object_get ( - shell_settings, - "mail-mark-seen", &mark_read, - "mail-mark-seen-timeout", &timeout_interval, NULL); + mark_read = e_shell_settings_get_boolean ( + shell_settings, "mail-mark-seen"); + timeout_interval = e_shell_settings_get_int ( + shell_settings, "mail-mark-seen-timeout"); g_object_set_data_full ( G_OBJECT (reader), "mark-read-uid", diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 58be6a094d..e8893bbbdc 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -819,10 +819,12 @@ e_shell_module_init (GTypeModule *type_module) { EShell *shell; EShellModule *shell_module; + EShellSettings *shell_settings; gboolean enable_search_folders; shell_module = E_SHELL_MODULE (type_module); shell = e_shell_module_get_shell (shell_module); + shell_settings = e_shell_get_shell_settings (shell); e_shell_module_set_info ( shell_module, &module_info, @@ -892,10 +894,8 @@ e_shell_module_init (GTypeModule *type_module) e_mail_shell_module_init_settings (shell); mail_shell_module_init_preferences (shell); - g_object_get ( - e_shell_get_shell_settings (shell), - "mail-enable-search-folders", - &enable_search_folders, NULL); + enable_search_folders = e_shell_settings_get_boolean ( + shell_settings, "mail-enable-search-folders"); if (enable_search_folders) vfolder_load_storage (); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 3174deaed9..965d4807c6 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -670,8 +670,8 @@ emae_signature_new(GtkWidget *w, EMAccountEditor *emae) shell_settings = e_shell_get_shell_settings (shell); parent = gtk_widget_get_toplevel (w); - g_object_get ( - shell_settings, "composer-format-html", &html_mode, NULL); + html_mode = e_shell_settings_get_boolean ( + shell_settings, "composer-format-html"); em_composer_prefs_new_signature (GTK_WINDOW (parent), html_mode); } diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c index e0044ed082..984dbad429 100644 --- a/mail/em-mailer-prefs.c +++ b/mail/em-mailer-prefs.c @@ -25,6 +25,7 @@ #endif #include +#include #include "em-mailer-prefs.h" #include "em-format.h" @@ -33,7 +34,6 @@ #include #include #include "misc/e-charset-picker.h" -#include #include diff --git a/mail/em-network-prefs.c b/mail/em-network-prefs.c index b5ca55d451..eeed589cb8 100644 --- a/mail/em-network-prefs.c +++ b/mail/em-network-prefs.c @@ -32,8 +32,6 @@ #include "em-network-prefs.h" -#include - #include #include #include diff --git a/mail/mail-component-factory.c b/mail/mail-component-factory.c deleted file mode 100644 index a3de3be8b9..0000000000 --- a/mail/mail-component-factory.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Ettore Perazzoli - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "mail-component.h" -#include "em-account-prefs.h" -#include "em-mailer-prefs.h" -#include "em-composer-prefs.h" -#include "em-network-prefs.h" - -#include "mail-config-factory.h" -#include "mail-config.h" -#include "mail-mt.h" - -#include "em-popup.h" -#include "em-menu.h" -#include "em-event.h" -#include "em-config.h" -#include "em-format-hook.h" -#include "em-junk-hook.h" -#include "em-format-html-display.h" - -#include "importers/mail-importer.h" -#include "e-util/e-import.h" - -#include -#include - -#include - -/* TODO: clean up these definitions */ - -#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory:" BASE_VERSION -#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_Component:" BASE_VERSION -#define FOLDER_INFO_ID "OAFIID:GNOME_Evolution_FolderInfo:" BASE_VERSION - -static BonoboObject * -factory(BonoboGenericFactory *factory, const char *component_id, void *closure) -{ - BonoboObject *o; - - if (strcmp (component_id, COMPONENT_ID) == 0) { - MailComponent *component = mail_component_peek (); - - bonobo_object_ref (BONOBO_OBJECT (component)); - return BONOBO_OBJECT (component); - } else if (strcmp (component_id, EM_ACCOUNT_PREFS_CONTROL_ID) == 0 - || strcmp (component_id, EM_MAILER_PREFS_CONTROL_ID) == 0 - || strcmp (component_id, EM_COMPOSER_PREFS_CONTROL_ID) == 0 - || strcmp (component_id, EM_NETWORK_PREFS_CONTROL_ID) == 0) { - return mail_config_control_factory_cb (factory, component_id, CORBA_OBJECT_NIL); - } - - o = mail_importer_factory_cb(factory, component_id, NULL); - if (o == NULL) - g_warning (FACTORY_ID ": Don't know what to do with %s", component_id); - - return o; -} - -static Bonobo_Unknown -make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_Environment *ev) -{ - static int init = 0; - - if (!init) { - EImportClass *klass; - - init = 1; - - mail_config_init(); - mail_msg_init(); - -// e_plugin_hook_register_type(em_popup_hook_get_type()); -// e_plugin_hook_register_type(em_menu_hook_get_type()); -// e_plugin_hook_register_type(em_config_hook_get_type()); -// -// em_format_hook_register_type(em_format_get_type()); -// em_format_hook_register_type(em_format_html_get_type()); -// em_format_hook_register_type(em_format_html_display_get_type()); -// em_junk_hook_register_type(emj_get_type()); -// -// e_plugin_hook_register_type(em_format_hook_get_type()); -// e_plugin_hook_register_type(em_event_hook_get_type()); -// e_plugin_hook_register_type(em_junk_hook_get_type()); -// -// klass = g_type_class_ref(e_import_get_type()); -// e_import_class_add_importer(klass, mbox_importer_peek(), NULL, NULL); -// e_import_class_add_importer(klass, elm_importer_peek(), NULL, NULL); -// e_import_class_add_importer(klass, pine_importer_peek(), NULL, NULL); - } - - return bonobo_shlib_factory_std (FACTORY_ID, poa, impl_ptr, factory, NULL, ev); -} - -static BonoboActivationPluginObject plugin_list[] = { - { FACTORY_ID, make_factory}, - { NULL } -}; - -const BonoboActivationPlugin Bonobo_Plugin_info = { - plugin_list, "Evolution Mail component factory" -}; diff --git a/mail/mail-config.c b/mail/mail-config.c index 29e74cfe00..cb36ee6d60 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -37,6 +37,7 @@ #include #include +#include #ifndef G_OS_WIN32 #include @@ -48,12 +49,6 @@ #include #include -#include -#include -#include -#include -#include - #include #include #include diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 06335a515b..8282625f7d 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 1853c49ce8..f4780c96bb 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -1071,6 +1071,5 @@ set_stop (int sensitive) if (last == sensitive) return; - /*bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", sensitive ? "1" : "0", NULL);*/ last = sensitive; } diff --git a/mail/mail-session.c b/mail/mail-session.c index e4af8e1c29..6529cde8f1 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -783,13 +783,6 @@ mail_session_set_interactive (gboolean interactive) } } -void -mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path) -{ - e_passwords_forget_passwords (); -} - void mail_session_flush_filter_log (void) { diff --git a/mail/mail-session.h b/mail/mail-session.h index a885081327..5998c9b91c 100644 --- a/mail/mail-session.h +++ b/mail/mail-session.h @@ -24,7 +24,6 @@ #define MAIL_SESSION_H #include -#include #include #include @@ -43,8 +42,6 @@ gboolean mail_session_accept_dialog (const char *prompt, const char *key, gboolean async); char *mail_session_get_password (const char *url); void mail_session_add_password (const char *url, const char *passwd); -void mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path); void mail_session_remember_password (const char *url); void mail_session_forget_password (const char *key); diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c index d0c678baa9..b494aa17c8 100644 --- a/shell/e-shell-settings.c +++ b/shell/e-shell-settings.c @@ -142,6 +142,15 @@ e_shell_settings_get_type (void) return type; } +/** + * e_shell_settings_install_property: + * @pspec: a #GParamSpec + * + * Installs a new class property for #EShellSettings. This is usually + * done during initialization of a #EShellModule or plugin, followed by + * a call to e_shell_settings_bind_to_gconf() to bind the property to a + * GConf key. + **/ void e_shell_settings_install_property (GParamSpec *pspec) { @@ -186,6 +195,23 @@ e_shell_settings_install_property (GParamSpec *pspec) } } +/** + * e_shell_settings_bind_to_gconf: + * @shell_settings: an #EShellSettings + * @property_name: the name of the property to bind + * @gconf_key: the GConf key to bind the property to + * + * Binds @property_name to @gconf_key, causing them to have the same value + * at all times. + * + * The types of @property_name and @gconf_key should be compatible. Floats + * and doubles, and ints, uints, longs, unlongs, int64s, uint64s, chars, + * uchars and enums can be matched up. Booleans and strings can only be + * matched to their respective types. + * + * On calling this function, @property_name is initialized to the current + * value of @gconf_key. + **/ void e_shell_settings_bind_to_gconf (EShellSettings *shell_settings, const gchar *property_name, @@ -199,3 +225,177 @@ e_shell_settings_bind_to_gconf (EShellSettings *shell_settings, gconf_bridge_get (), gconf_key, G_OBJECT (shell_settings), property_name); } + +/** + * e_shell_settings_get_boolean: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * + * Return the contents of an #EShellSettings property of type + * #G_TYPE_BOOLEAN. + * + * Returns: boolean contents of @property_name + **/ +gboolean +e_shell_settings_get_boolean (EShellSettings *shell_settings, + const gchar *property_name) +{ + GObject *object; + GValue value = { 0, }; + gboolean v_boolean; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), FALSE); + g_return_val_if_fail (property_name != NULL, FALSE); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_BOOLEAN); + g_object_get_property (object, property_name, &value); + v_boolean = g_value_get_boolean (&value); + g_value_unset (&value); + + return v_boolean; +} + +/** + * e_shell_settings_set_boolean: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * @v_boolean: boolean value to be set + * + * Sets the contents of an #EShellSettings property of type #G_TYPE_BOOLEAN + * to @v_boolean. If @property_name is bound to a GConf key, the GConf key + * will also be set to @v_boolean. + **/ +void +e_shell_settings_set_boolean (EShellSettings *shell_settings, + const gchar *property_name, + gboolean v_boolean) +{ + GObject *object; + GValue value = { 0, }; + + g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); + g_return_if_fail (property_name != NULL); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, v_boolean); + g_object_set_property (object, property_name, &value); + g_value_unset (&value); +} + +/** + * e_shell_settings_get_int: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * + * Returns the contents of an #EShellSettings property of type + * #G_TYPE_INT. + * + * Returns: integer contents of @property_name + **/ +gint +e_shell_settings_get_int (EShellSettings *shell_settings, + const gchar *property_name) +{ + GObject *object; + GValue value = { 0, }; + gint v_int; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), 0); + g_return_val_if_fail (property_name != NULL, 0); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_INT); + g_object_get_property (object, property_name, &value); + v_int = g_value_get_int (&value); + g_value_unset (&value); + + return v_int; +} + +/** + * e_shell_settings_set_int: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * @v_int: integer value to be set + * + * Sets the contents of an #EShellSettings property of type #G_TYPE_INT + * to @v_int. If @property_name is bound to a GConf key, the GConf key + * will also be set to @v_int. + **/ +void +e_shell_settings_set_int (EShellSettings *shell_settings, + const gchar *property_name, + gint v_int) +{ + GObject *object; + GValue value = { 0, }; + + g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); + g_return_if_fail (property_name != NULL); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_INT); + g_value_set_int (&value, v_int); + g_object_set_property (object, property_name, &value); + g_value_unset (&value); +} + +/** + * e_shell_settings_get_string: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * + * Returns the contents of an #EShellSettings property of type + * #G_TYPE_STRING. The returned string should be freed using g_free(). + * + * Returns: string contents of @property_name + **/ +gchar * +e_shell_settings_get_string (EShellSettings *shell_settings, + const gchar *property_name) +{ + GObject *object; + GValue value = { 0, }; + gchar *v_string; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); + g_return_val_if_fail (property_name != NULL, NULL); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_STRING); + g_object_get_property (object, property_name, &value); + v_string = g_value_dup_string (&value); + g_value_unset (&value); + + return v_string; +} + +/** + * e_shell_settings_set_string: + * @shell_settings: an #EShellSettings + * @property_name: an installed property name + * @v_string: string to be set + * + * Sets the contents of an #EShellSettings property of type #G_TYPE_STRING + * to @v_string. If @property_name is bound to a GConf key, the GConf key + * will also be set to @v_string. + **/ +void +e_shell_settings_set_string (EShellSettings *shell_settings, + const gchar *property_name, + const gchar *v_string) +{ + GObject *object; + GValue value = { 0, }; + + g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); + g_return_if_fail (property_name != NULL); + + object = G_OBJECT (shell_settings); + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, v_string); + g_object_set_property (object, property_name, &value); + g_value_unset (&value); +} diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h index b01d7fe327..6c9bfabeb6 100644 --- a/shell/e-shell-settings.h +++ b/shell/e-shell-settings.h @@ -77,6 +77,26 @@ void e_shell_settings_bind_to_gconf (EShellSettings *shell_settings, const gchar *property_name, const gchar *gconf_key); +/* Getters and setters for common EShellSettings property types. + * Add more types as needed. If GObject ever adds similar functions, + * kill these. */ + +gboolean e_shell_settings_get_boolean (EShellSettings *shell_settings, + const gchar *property_name); +void e_shell_settings_set_boolean (EShellSettings *shell_settings, + const gchar *property_name, + gboolean v_boolean); +gint e_shell_settings_get_int (EShellSettings *shell_settings, + const gchar *property_name); +void e_shell_settings_set_int (EShellSettings *shell_settings, + const gchar *property_name, + gint v_int); +gchar * e_shell_settings_get_string (EShellSettings *shell_settings, + const gchar *property_name); +void e_shell_settings_set_string (EShellSettings *shell_settings, + const gchar *property_name, + const gchar *v_string); + G_END_DECLS #endif /* E_SHELL_SETTINGS_H */ diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c index 2da9d3541c..316aa85a0e 100644 --- a/widgets/misc/e-attachment-bar.c +++ b/widgets/misc/e-attachment-bar.c @@ -76,9 +76,6 @@ static GnomeIconListClass *parent_class = NULL; struct _EAttachmentBarPrivate { GtkWidget *attach; /* attachment file dialogue, if active */ - /* Recent documents. Use this widget directly when bonoboui is obsoleted */ - GtkWidget *recent; - gboolean batch_unref; GPtrArray *attachments; char *path; @@ -791,9 +788,6 @@ destroy (GtkObject *object) if (priv->attach) gtk_widget_destroy (priv->attach); - if (priv->recent) - gtk_widget_destroy (priv->recent); - if (priv->path) g_free (priv->path); @@ -1065,14 +1059,6 @@ init (EAttachmentBar *bar) priv->batch_unref = FALSE; priv->attachments = g_ptr_array_new (); - priv->recent = gtk_recent_chooser_menu_new (); - gtk_recent_chooser_menu_set_show_numbers (GTK_RECENT_CHOOSER_MENU (priv->recent), TRUE); - gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (priv->recent), GTK_RECENT_SORT_MRU); - gtk_recent_chooser_set_show_not_found (GTK_RECENT_CHOOSER (priv->recent), FALSE); - gtk_recent_chooser_set_show_private (GTK_RECENT_CHOOSER (priv->recent), FALSE); - gtk_recent_chooser_set_show_icons (GTK_RECENT_CHOOSER (priv->recent), TRUE); - gtk_recent_chooser_set_show_tips (GTK_RECENT_CHOOSER (priv->recent), TRUE); - priv->path = NULL; bar->priv = priv; @@ -1297,7 +1283,6 @@ void e_attachment_bar_refresh (EAttachmentBar *bar) { update (bar); - } int @@ -1352,92 +1337,6 @@ e_attachment_bar_attach_mime_part (EAttachmentBar *bar, CamelMimePart *part) add_from_mime_part (bar, part); } -/* FIXME: Remove this API if nobody uses it */ -void -e_attachment_bar_bonobo_ui_populate_with_recent (BonoboUIComponent *uic, const char *path, - EAttachmentBar *bar, - BonoboUIVerbFn verb_cb, gpointer user_data) -{ - struct _EAttachmentBarPrivate *priv; - GList *items, *l; - gint limit, i; - GString *menuitems; - char *encoded_label, *label; - - g_return_if_fail (E_IS_ATTACHMENT_BAR (bar)); - - priv = bar->priv; - limit = gtk_recent_chooser_get_limit (GTK_RECENT_CHOOSER (priv->recent)); - items = gtk_recent_chooser_get_items (GTK_RECENT_CHOOSER (priv->recent)); - - menuitems = g_string_new ("\n"); - - for (l = g_list_first (items), i = 1; l && i <= limit; l = l->next, ++i) { - GtkRecentInfo *info = ((GtkRecentInfo *)(l->data)); - const gchar *info_dn = gtk_recent_info_get_display_name (info); - char *display_name, *u; - - /* escape _'s in the display name so that it doesn't become an underline in a GtkLabel */ - if ((u = strchr (info_dn, '_'))) { - int extra = 1; - char *d; - const char *s; - - while ((u = strchr (u + 1, '_'))) - extra++; - - d = display_name = g_alloca (strlen (info_dn) + extra + 1); - s = info_dn; - while (*s != '\0') { - if (*s == '_') - *d++ = '_'; - *d++ = *s++; - } - *d = '\0'; - } else - display_name = (char *) info_dn; - - /* Add menu item */ - label = g_strdup (display_name); - encoded_label = bonobo_ui_util_encode_str (label); - g_string_append_printf (menuitems, - " \n", - i, encoded_label); - g_free (encoded_label); - g_free (label); - } - - g_string_append (menuitems, "\n"); - - bonobo_ui_component_set (uic, path, menuitems->str, NULL); - - g_string_free (menuitems, TRUE); - - /* Add uri prop */ - for (l = g_list_first (items), i = 1; l && i <= limit; l = l->next, ++i) { - GtkRecentInfo *info = ((GtkRecentInfo *)(l->data)); - const gchar *info_uri = gtk_recent_info_get_uri (info); - label = g_strdup_printf ("/commands/Recent-%d", i); - bonobo_ui_component_set_prop (uic, label, "uri", info_uri, NULL); - g_free (label); - } - - /* Add verb */ - for (l = g_list_first (items), i = 1; l && i <= limit; l = l->next, ++i) { - label = g_strdup_printf ("Recent-%d", i); - bonobo_ui_component_add_verb (uic, label, verb_cb, user_data); - g_free (label); - } - - for (l = g_list_first (items); l; l = l->next) - gtk_recent_info_unref ((GtkRecentInfo *)(l->data)); - g_list_free (items); -} - static void action_recent_cb (GtkAction *action, EAttachmentBar *attachment_bar) diff --git a/widgets/misc/e-attachment-bar.h b/widgets/misc/e-attachment-bar.h index 7f8b4795d1..363b7f0fb8 100644 --- a/widgets/misc/e-attachment-bar.h +++ b/widgets/misc/e-attachment-bar.h @@ -24,11 +24,9 @@ #ifndef __E_ATTACHMENT_BAR_H__ #define __E_ATTACHMENT_BAR_H__ +#include #include -#include -#include - #include #include "e-attachment.h" @@ -85,10 +83,6 @@ GSList *e_attachment_bar_get_selected (EAttachmentBar *bar); void e_attachment_bar_set_width(EAttachmentBar *bar, int bar_width); GSList * e_attachment_bar_get_all_attachments (EAttachmentBar *bar); void e_attachment_bar_create_attachment_cache (EAttachment *attachment); -void -e_attachment_bar_bonobo_ui_populate_with_recent (BonoboUIComponent *uic, const char *path, - EAttachmentBar *bar, - BonoboUIVerbFn verb_cb, gpointer user_data); GtkAction * e_attachment_bar_recent_action_new (EAttachmentBar *bar, const gchar *action_name, diff --git a/widgets/misc/e-charset-picker.c b/widgets/misc/e-charset-picker.c index ade1c186a6..6b30b3b11c 100644 --- a/widgets/misc/e-charset-picker.c +++ b/widgets/misc/e-charset-picker.c @@ -31,9 +31,6 @@ #include -#include -#include - typedef enum { E_CHARSET_UNKNOWN, E_CHARSET_ARABIC, diff --git a/widgets/misc/e-charset-picker.h b/widgets/misc/e-charset-picker.h index 21643ccf99..1521a2dbb0 100644 --- a/widgets/misc/e-charset-picker.h +++ b/widgets/misc/e-charset-picker.h @@ -22,7 +22,6 @@ #define E_CHARSETPICKER_H #include -#include G_BEGIN_DECLS -- cgit v1.2.3