diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/folder-browser.c | 79 |
2 files changed, 62 insertions, 23 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index cd5838a142..4cea6c6a55 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-04-01 Michael Meeks <michael@helixcode.com> + + * folder-browser.c (folder_browser_properties_init): update to + new property (folder_browser_property_changed): kill. + (get_prop, set_prop): do the donkey work + make properly RW. + 2000-03-31 Dan Winship <danw@helixcode.com> * folder-browser-factory.c (folder_browser_set_shell): diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 426bfeafe9..5b75fd189d 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -21,8 +21,11 @@ static GtkObjectClass *folder_browser_parent_class; -#define PROPERTY_FOLDER_URI "folder_uri" -#define PROPERTY_MESSAGE_PREVIEW "message_preview" +#define PROPERTY_FOLDER_URI "folder_uri" +#define PROPERTY_MESSAGE_PREVIEW "message_preview" + +#define PROPERTY_FOLDER_URI_IDX 1 +#define PROPERTY_MESSAGE_PREVIEW_IDX 2 @@ -116,39 +119,69 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show g_warning ("FIXME: implement me"); } - + static void -folder_browser_property_changed (BonoboPropertyBag *properties, - const char *name, - const char *type, - gpointer old_value, - gpointer new_value, - gpointer user_data) +get_prop (BonoboPropertyBag *bag, + BonoboArg *arg, + guint arg_id, + gpointer user_data) { - FolderBrowser *folder_browser = FOLDER_BROWSER (user_data); + FolderBrowser *fb = user_data; - if (EQUAL (name, PROPERTY_FOLDER_URI)){ - folder_browser_set_uri (folder_browser, new_value); - return; - } else if (EQUAL (name, PROPERTY_MESSAGE_PREVIEW)){ - folder_browser_set_message_preview (folder_browser, *((gboolean *)new_value)); + switch (arg_id) { + + case PROPERTY_FOLDER_URI_IDX: + if (fb && fb->uri) + BONOBO_ARG_SET_STRING (arg, fb->uri); + else + BONOBO_ARG_SET_STRING (arg, ""); + break; + + case PROPERTY_MESSAGE_PREVIEW_IDX: + g_warning ("Implement me; no return value"); + BONOBO_ARG_SET_BOOLEAN (arg, FALSE); + break; + + default: + g_warning ("Unhandled arg %d\n", arg_id); + } +} + +static void +set_prop (BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + gpointer user_data) +{ + FolderBrowser *fb = user_data; + + switch (arg_id) { + + case PROPERTY_FOLDER_URI_IDX: + folder_browser_set_uri (fb, BONOBO_ARG_GET_STRING (arg)); + break; + + case PROPERTY_MESSAGE_PREVIEW_IDX: + folder_browser_set_message_preview (fb, BONOBO_ARG_GET_BOOLEAN (arg)); + break; + + default: + g_warning ("Unhandled arg %d\n", arg_id); + break; } } static void folder_browser_properties_init (FolderBrowser *fb) { - fb->properties = bonobo_property_bag_new (); + fb->properties = bonobo_property_bag_new (get_prop, set_prop, fb); bonobo_property_bag_add ( - fb->properties, PROPERTY_FOLDER_URI, "string", - NULL, NULL, _("The URI that the Folder Browser will display"), 0); + fb->properties, PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX, + BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser will display"), 0); bonobo_property_bag_add ( - fb->properties, PROPERTY_MESSAGE_PREVIEW, "boolean", - NULL, NULL, _("Whether a message preview should be shown"), 0); - - gtk_signal_connect (GTK_OBJECT (fb->properties), "value_changed", - folder_browser_property_changed, fb); + fb->properties, PROPERTY_MESSAGE_PREVIEW, PROPERTY_MESSAGE_PREVIEW_IDX, + BONOBO_ARG_BOOLEAN, NULL, _("Whether a message preview should be shown"), 0); } static void |