diff options
author | Larry Ewing <lewing@ximian.com> | 2004-01-13 00:51:55 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2004-01-13 00:51:55 +0800 |
commit | 922de49f1d4cdb6fe0044fd19d11f8ed5391a4fb (patch) | |
tree | 0fc7421b4e68123a10cda6898f1eadc1b82a9668 /mail/mail-component.c | |
parent | b84544d2cc122d6afc2721eb2a1366a6e3f2ba9c (diff) | |
download | gsoc2013-evolution-922de49f1d4cdb6fe0044fd19d11f8ed5391a4fb.tar.gz gsoc2013-evolution-922de49f1d4cdb6fe0044fd19d11f8ed5391a4fb.tar.zst gsoc2013-evolution-922de49f1d4cdb6fe0044fd19d11f8ed5391a4fb.zip |
fix up the controls factory location.
2004-01-12 Larry Ewing <lewing@ximian.com>
* GNOME_Evolution_Mail.server.in.in: fix up the controls factory
location.
* mail-component.c (mail_control_new): add new interface for
getting a mail control with a folder_uri property bag.
(get_prop): pbag get method.
(set_prop): pbag set method.
svn path=/trunk/; revision=24171
Diffstat (limited to 'mail/mail-component.c')
-rw-r--r-- | mail/mail-component.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/mail/mail-component.c b/mail/mail-component.c index 00715d7970..1faa15068d 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -235,6 +235,55 @@ folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, EMFol em_folder_view_set_folder_uri (view, uri); } +#define PROPERTY_FOLDER_URI "folder_uri" +#define PROPERTY_FOLDER_URI_IDX 1 + +static void +set_prop (BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + CORBA_Environment *ev, + gpointer user_data) +{ + EMFolderView *view = (EMFolderView *)bonobo_control_get_widget (user_data); + const gchar *uri; + + switch (arg_id) { + case PROPERTY_FOLDER_URI_IDX: + uri = BONOBO_ARG_GET_STRING (arg); + + g_warning ("XXX setting uri blah=\"%s\"\n", uri); + + em_folder_view_set_folder_uri (view, uri); + break; + default: + g_warning ("Unhandled arg %d\n", arg_id); + break; + } +} + +static void +get_prop (BonoboPropertyBag *bag, + BonoboArg *arg, + guint arg_id, + CORBA_Environment *ev, + gpointer user_data) +{ + GtkWidget *widget = bonobo_control_get_widget (user_data); + EMFolderView *view = (EMFolderView *)widget; + + switch (arg_id) { + case PROPERTY_FOLDER_URI_IDX: + if (view->folder_uri) + BONOBO_ARG_SET_STRING (arg, view->folder_uri); + else + BONOBO_ARG_SET_STRING (arg, ""); + break; + default: + g_warning ("Unhandled arg %d\n", arg_id); + } +} + static void view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderView *view) { @@ -512,6 +561,36 @@ mail_component_init (MailComponent *component) /* Public API. */ +BonoboControl * +mail_control_new (void) +{ + BonoboControl *view_control; + GtkWidget *view_widget; + BonoboPropertyBag *pbag; + + view_widget = em_folder_browser_new (); + gtk_widget_show (view_widget); + + view_control = bonobo_control_new (view_widget); + pbag = bonobo_property_bag_new (get_prop, set_prop, view_control); + + bonobo_property_bag_add (pbag, + PROPERTY_FOLDER_URI, + PROPERTY_FOLDER_URI_IDX, + BONOBO_ARG_STRING, + NULL, + _("URI of the mail source that the view will display"), + 0); + + bonobo_control_set_properties (view_control, + bonobo_object_corba_objref (BONOBO_OBJECT (pbag)), + NULL); + bonobo_object_unref (BONOBO_OBJECT (pbag)); + + g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget); + + return view_control; +} MailComponent * mail_component_peek (void) |