aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@novell.com>2004-12-23 10:42:11 +0800
committerHans Petter <hansp@src.gnome.org>2004-12-23 10:42:11 +0800
commit0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd (patch)
tree6760945610b66dd0d86387a7c0b5df7b671ebc7d /calendar
parentd21af5dbf4433cdff8b1aacad13eff48ebcad9c5 (diff)
downloadgsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.gz
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.zst
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.zip
Unref the name selector. (e_contact_list_editor_save_contact): Fix a
2004-12-22 Hans Petter Jansson <hpj@novell.com> * addressbook/gui/contact-list-editor/e-contact-list-editor.c (e_contact_list_editor_dispose): Unref the name selector. (e_contact_list_editor_save_contact): Fix a warning. (add_to_model): Take a list instead of a vector of destinations. (select_names_ok_cb): Adapt to new name selector. (setup_corba): Renamed to setup_name_selector () and adapted. (select_cb): Adapt to new name selector. * addressbook/gui/contact-list-editor/e-contact-list-editor.h: Adapt to new name selector and remove CORBA/Bonobo. * addressbook/gui/widgets/eab-popup.c (eabp_target_free) (eabp_popup_target_new_select_names): #ifdef out code that depended on the old name selector. 2004-12-22 Hans Petter Jansson <hpj@novell.com> * calendar/gui/Makefile.am (IDLS) (SELECT_NAMES_IDL_GENERATED_H) (SELECT_NAMES_IDL_GENERATED_C) (SELECT_NAMES_IDL_GENERATED) (IDL_GENERATED): Remove the addressbook IDL. * calendar/gui/e-meeting-list-view.c (e_meeting_list_finalize) (add_section) (e_meeting_list_view_init) (process_section) (name_selector_dialog_close_cb) (get_select_name_dialog): Adapt to new ENameSelector. * calendar/gui/e-select-names-editable.c (esne_start_editing) (esne_finalize) (esne_init) (e_select_names_editable_get_type) (entry_activate) (e_select_names_editable_construct) (e_select_names_editable_get_address) (e_select_names_editable_get_name) (e_select_names_editable_set_address): Adapt to new ENameSelector. * calendar/gui/e-select-names-renderer.c (e_select_names_renderer_editing_done) (e_select_names_renderer_activated) (e_select_names_renderer_start_editing): Adapt to new ENameSelector. * calendar/gui/dialogs/alarm-dialog.c (malarm_widgets_to_alarm) (addressbook_clicked_cb) (addressbook_response_cb) (setup_select_names) (check_custom_email) (malarm_addresses_changed_cb): Adapt to new ENameSelector. * calendar/gui/dialogs/e-delegate-dialog.c (e_delegate_dialog_finalize) (e_delegate_dialog_construct) (addressbook_clicked_cb) (addressbook_response_cb) (e_delegate_dialog_get_delegate) (e_delegate_dialog_get_delegate_name): Adapt to new ENameSelector. 2004-12-22 Hans Petter Jansson <hpj@novell.com> * composer/e-msg-composer-hdrs.c (addressbook_dialog_response) (setup_corba) (setup_name_selector) (address_button_clicked_cb) (addressbook_entry_changed) (create_addressbook_entry) (destroy) (e_msg_composer_hdrs_new) (destinations_to_name_selector_entry) (e_msg_composer_hdrs_set_to) (e_msg_composer_hdrs_set_cc) (e_msg_composer_hdrs_set_bcc) (destination_list_to_destv) (e_msg_composer_hdrs_get_to) (e_msg_composer_hdrs_get_cc) (e_msg_composer_hdrs_get_bcc): Adapt to new ENameSelector. svn path=/trunk/; revision=28186
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog43
-rw-r--r--calendar/gui/Makefile.am21
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c109
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c131
-rw-r--r--calendar/gui/e-meeting-list-view.c155
-rw-r--r--calendar/gui/e-select-names-editable.c88
-rw-r--r--calendar/gui/e-select-names-editable.h6
-rw-r--r--calendar/gui/e-select-names-renderer.c14
8 files changed, 270 insertions, 297 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index cc97a2a5dc..62d6ec54d9 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,46 @@
+2004-12-22 Hans Petter Jansson <hpj@novell.com>
+
+ * gui/Makefile.am (IDLS)
+ (SELECT_NAMES_IDL_GENERATED_H)
+ (SELECT_NAMES_IDL_GENERATED_C)
+ (SELECT_NAMES_IDL_GENERATED)
+ (IDL_GENERATED): Remove the addressbook IDL.
+
+ * gui/e-meeting-list-view.c (e_meeting_list_finalize)
+ (add_section)
+ (e_meeting_list_view_init)
+ (process_section)
+ (name_selector_dialog_close_cb)
+ (get_select_name_dialog): Adapt to new ENameSelector.
+
+ * gui/e-select-names-editable.c (esne_start_editing)
+ (esne_finalize)
+ (esne_init)
+ (e_select_names_editable_get_type)
+ (entry_activate)
+ (e_select_names_editable_construct)
+ (e_select_names_editable_get_address)
+ (e_select_names_editable_get_name)
+ (e_select_names_editable_set_address): Adapt to new ENameSelector.
+
+ * gui/e-select-names-renderer.c (e_select_names_renderer_editing_done)
+ (e_select_names_renderer_activated)
+ (e_select_names_renderer_start_editing): Adapt to new ENameSelector.
+
+ * gui/dialogs/alarm-dialog.c (malarm_widgets_to_alarm)
+ (addressbook_clicked_cb)
+ (addressbook_response_cb)
+ (setup_select_names)
+ (check_custom_email)
+ (malarm_addresses_changed_cb): Adapt to new ENameSelector.
+
+ * gui/dialogs/e-delegate-dialog.c (e_delegate_dialog_finalize)
+ (e_delegate_dialog_construct)
+ (addressbook_clicked_cb)
+ (addressbook_response_cb)
+ (e_delegate_dialog_get_delegate)
+ (e_delegate_dialog_get_delegate_name): Adapt to new ENameSelector.
+
2004-12-22 JP Rosevear <jpr@novell.com>
* gui/e-meeting-store.c (freebusy_async): prevent compare against
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index fecdaa5cbc..555be8e0ac 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -2,8 +2,7 @@
IDLS = \
$(top_srcdir)/composer/Evolution-Composer.idl \
- $(top_srcdir)/calendar/idl/evolution-calendar.idl \
- $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
+ $(top_srcdir)/calendar/idl/evolution-calendar.idl
CALENDAR_IDL_GENERATED_H = \
evolution-calendar.h
@@ -33,23 +32,7 @@ $(COMPOSER_IDL_GENERATED_H): $(IDLS)
$(srcdir)/../../composer/Evolution-Composer.idl
$(COMPOSER_IDL_GENERATED_C): $(COMPOSER_IDL_GENERATED_H)
-# SelectNames IDL files
-
-SELECT_NAMES_IDL_GENERATED_H = \
- Evolution-Addressbook-SelectNames.h
-SELECT_NAMES_IDL_GENERATED_C = \
- Evolution-Addressbook-SelectNames-common.c \
- Evolution-Addressbook-SelectNames-skels.c \
- Evolution-Addressbook-SelectNames-stubs.c
-SELECT_NAMES_IDL_GENERATED = $(SELECT_NAMES_IDL_GENERATED_C) $(SELECT_NAMES_IDL_GENERATED_H)
-
-$(SELECT_NAMES_IDL_GENERATED_H): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
- $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
-$(SELECT_NAMES_IDL_GENERATED_C): $(SELECT_NAMES_IDL_GENERATED_H)
-
-
-IDL_GENERATED = $(CALENDAR_IDL_GENERATED) $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
+IDL_GENERATED = $(CALENDAR_IDL_GENERATED) $(COMPOSER_IDL_GENERATED)
# The marshallers
MARSHAL_GENERATED = e-calendar-marshal.c e-calendar-marshal.h
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index de0469617b..6cdc789eab 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -52,7 +52,7 @@
#include "e-util/e-dialog-widgets.h"
#include "e-util/e-icon-factory.h"
#include <libebook/e-destination.h>
-#include "Evolution-Addressbook-SelectNames.h"
+#include <libedataserverui/e-name-selector.h>
#include "../calendar-config.h"
#include "comp-editor-util.h"
#include "alarm-dialog.h"
@@ -105,15 +105,16 @@ typedef struct {
GtkWidget *malarm_addressbook;
GtkWidget *malarm_message;
GtkWidget *malarm_description;
- GNOME_Evolution_Addressbook_SelectNames corba_select_names;
/* Procedure alarm widgets */
GtkWidget *palarm_group;
GtkWidget *palarm_program;
GtkWidget *palarm_args;
+
+ /* Addressbook name selector */
+ ENameSelector *name_selector;
} Dialog;
-#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION
static const char *section_name = "Send To";
/* "relative" types */
@@ -344,21 +345,24 @@ malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
EDestination **destv;
GtkTextBuffer *text_buffer;
GtkTextIter text_iter_start, text_iter_end;
+ ENameSelectorModel *name_selector_model;
+ EDestinationStore *destination_store;
+ GList *destinations;
icalcomponent *icalcomp;
icalproperty *icalprop;
+ GList *l;
int i;
/* Attendees */
- bonobo_widget_get_property (BONOBO_WIDGET (dialog->malarm_addresses), "destinations",
- TC_CORBA_string, &str, NULL);
- destv = e_destination_importv (str);
- g_free (str);
-
- for (i = 0; destv[i] != NULL; i++) {
+ name_selector_model = e_name_selector_peek_model (dialog->name_selector);
+ e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store);
+ destinations = e_destination_store_list_destinations (destination_store);
+
+ for (l = destinations; l; l = g_list_next (l)) {
EDestination *dest;
ECalComponentAttendee *a;
- dest = destv[i];
+ dest = l->data;
a = g_new0 (ECalComponentAttendee, 1);
a->value = e_destination_get_email (dest);
@@ -370,7 +374,7 @@ malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
e_cal_component_alarm_set_attendee_list (alarm, attendee_list);
e_cal_component_free_attendee_list (attendee_list);
- e_destination_freev (destv);
+ g_list_free (destinations);
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->malarm_message)))
return;
@@ -616,48 +620,45 @@ static void
addressbook_clicked_cb (GtkWidget *widget, gpointer data)
{
Dialog *dialog = data;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
+ ENameSelectorDialog *name_selector_dialog;
- GNOME_Evolution_Addressbook_SelectNames_activateDialog (dialog->corba_select_names,
- section_name, &ev);
-
- CORBA_exception_free (&ev);
+ name_selector_dialog = e_name_selector_peek_dialog (dialog->name_selector);
+ gtk_widget_show (GTK_WIDGET (name_selector_dialog));
+}
+
+static void
+addressbook_response_cb (GtkWidget *widget, gint response, gpointer data)
+{
+ Dialog *dialog = data;
+ ENameSelectorDialog *name_selector_dialog;
+
+ name_selector_dialog = e_name_selector_peek_dialog (dialog->name_selector);
+ gtk_widget_hide (GTK_WIDGET (name_selector_dialog));
}
static gboolean
setup_select_names (Dialog *dialog)
{
- Bonobo_Control corba_control;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- dialog->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
- if (BONOBO_EX (&ev))
- return FALSE;
-
- GNOME_Evolution_Addressbook_SelectNames_addSection (dialog->corba_select_names,
- section_name, section_name, &ev);
- if (BONOBO_EX (&ev))
- return FALSE;
+ ENameSelectorModel *name_selector_model;
+ ENameSelectorDialog *name_selector_dialog;
- corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (dialog->corba_select_names,
- section_name, &ev);
+ dialog->name_selector = e_name_selector_new ();
+ name_selector_model = e_name_selector_peek_model (dialog->name_selector);
- if (BONOBO_EX (&ev))
- return FALSE;
-
- CORBA_exception_free (&ev);
+ e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
- dialog->malarm_addresses = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
+ dialog->malarm_addresses =
+ GTK_WIDGET (e_name_selector_peek_section_entry (dialog->name_selector, section_name));
gtk_widget_show (dialog->malarm_addresses);
gtk_box_pack_end_defaults (GTK_BOX (dialog->malarm_address_group), dialog->malarm_addresses);
gtk_signal_connect (GTK_OBJECT (dialog->malarm_addressbook), "clicked",
GTK_SIGNAL_FUNC (addressbook_clicked_cb), dialog);
+ name_selector_dialog = e_name_selector_peek_dialog (dialog->name_selector);
+ g_signal_connect (name_selector_dialog, "response",
+ G_CALLBACK (addressbook_response_cb), dialog);
+
return TRUE;
}
@@ -774,31 +775,29 @@ check_custom_email (Dialog *dialog)
char *str;
GtkTextBuffer *text_buffer;
GtkTextIter text_iter_start, text_iter_end;
- EDestination **destv;
+ ENameSelectorModel *name_selector_model;
+ EDestinationStore *destination_store;
+ GList *destinations;
gboolean sens;
- bonobo_widget_get_property (BONOBO_WIDGET (dialog->malarm_addresses), "destinations",
- TC_CORBA_string, &str, NULL);
- destv = e_destination_importv (str);
- g_free (str);
-
+ name_selector_model = e_name_selector_peek_model (dialog->name_selector);
+ e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store);
+ destinations = e_destination_store_list_destinations (destination_store);
+
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description));
gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start);
gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end);
str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);
- sens = (destv != NULL) && (e_dialog_toggle_get (dialog->malarm_message) ? str && *str : TRUE);
+ sens = (destinations != NULL) && (e_dialog_toggle_get (dialog->malarm_message) ? str && *str : TRUE);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens);
- e_destination_freev (destv);
+ g_list_free (destinations);
}
static void
-malarm_addresses_changed_cb (BonoboListener *listener,
- const char *event_name,
- const CORBA_any *arg,
- CORBA_Environment *ev,
- gpointer data)
+malarm_addresses_changed_cb (GtkWidget *editable,
+ gpointer data)
{
Dialog *dialog = data;
@@ -905,12 +904,8 @@ init_widgets (Dialog *dialog)
g_signal_connect (G_OBJECT (text_buffer), "changed",
G_CALLBACK (malarm_description_changed_cb), dialog);
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (dialog->malarm_addresses));
- pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
-
- bonobo_event_source_client_add_listener (pb, malarm_addresses_changed_cb,
- "Bonobo/Property:change:entry_changed",
- NULL, dialog);
+ g_signal_connect (dialog->malarm_addresses, "changed",
+ G_CALLBACK (malarm_addresses_changed_cb), dialog);
}
gboolean
diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
index 9fd15651dd..cd0c768c63 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -23,10 +23,6 @@
#include <config.h>
#endif
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-widget.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkcombo.h>
#include <gtk/gtkentry.h>
@@ -36,7 +32,7 @@
#include <glade/glade.h>
#include <widgets/misc/e-map.h>
#include <libebook/e-destination.h>
-#include "Evolution-Addressbook-SelectNames.h"
+#include <libedataserverui/e-name-selector.h>
#include "e-delegate-dialog.h"
struct _EDelegateDialogPrivate {
@@ -51,17 +47,17 @@ struct _EDelegateDialogPrivate {
GtkWidget *hbox;
GtkWidget *addressbook;
- GNOME_Evolution_Addressbook_SelectNames corba_select_names;
+ ENameSelector *name_selector;
GtkWidget *entry;
};
-#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION
static const char *section_name = "Delegate To";
static void e_delegate_dialog_finalize (GObject *object);
static gboolean get_widgets (EDelegateDialog *edd);
static void addressbook_clicked_cb (GtkWidget *widget, gpointer data);
+static void addressbook_response_cb (GtkWidget *widget, gint response, gpointer data);
G_DEFINE_TYPE (EDelegateDialog, e_delegate_dialog, G_TYPE_OBJECT);
@@ -102,6 +98,8 @@ e_delegate_dialog_finalize (GObject *object)
edd = E_DELEGATE_DIALOG (object);
priv = edd->priv;
+ g_object_unref (priv->name_selector);
+
/* Destroy the actual dialog. */
dialog = e_delegate_dialog_get_toplevel (edd);
gtk_widget_destroy (dialog);
@@ -121,10 +119,10 @@ EDelegateDialog *
e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char *address)
{
EDelegateDialogPrivate *priv;
+ EDestinationStore *destination_store;
EDestination *dest;
- EDestination *destv[2] = {NULL, NULL};
- Bonobo_Control corba_control;
- CORBA_Environment ev;
+ ENameSelectorModel *name_selector_model;
+ ENameSelectorDialog *name_selector_dialog;
char *str;
g_return_val_if_fail (edd != NULL, NULL);
@@ -145,48 +143,32 @@ e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char
g_message ("e_delegate_dialog_construct(): Could not find all widgets in the XML file!");
goto error;
}
-
- CORBA_exception_init (&ev);
-
- priv->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
- GNOME_Evolution_Addressbook_SelectNames_addSectionWithLimit (priv->corba_select_names,
- section_name,
- section_name,
- 1, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("e_delegate_dialog_construct(): Unable to add section!");
- goto error;
- }
- corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (priv->corba_select_names,
- section_name, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("e_delegate_dialog_construct(): Unable to get addressbook entry!");
- goto error;
- }
-
- CORBA_exception_free (&ev);
+ priv->name_selector = e_name_selector_new ();
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+ e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
- priv->entry = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
+ priv->entry = GTK_WIDGET (e_name_selector_peek_section_entry (priv->name_selector, section_name));
gtk_widget_show (priv->entry);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->entry, TRUE, TRUE, 6);
dest = e_destination_new ();
- destv[0] = dest;
+
if (name != NULL && *name)
e_destination_set_name (dest, name);
if (address != NULL && *address)
e_destination_set_email (dest, address);
- str = e_destination_exportv(destv);
- bonobo_widget_set_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, str, NULL);
- g_free(str);
+
+ e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store);
+ e_destination_store_append_destination (destination_store, dest);
g_object_unref (dest);
g_signal_connect((priv->addressbook), "clicked",
G_CALLBACK (addressbook_clicked_cb), edd);
+ name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector);
+ g_signal_connect (name_selector_dialog, "response", G_CALLBACK (addressbook_response_cb), edd);
+
return edd;
error:
@@ -218,17 +200,26 @@ addressbook_clicked_cb (GtkWidget *widget, gpointer data)
{
EDelegateDialog *edd = data;
EDelegateDialogPrivate *priv;
- CORBA_Environment ev;
+ ENameSelectorDialog *name_selector_dialog;
priv = edd->priv;
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_SelectNames_activateDialog (priv->corba_select_names, section_name, &ev);
-
- CORBA_exception_free (&ev);
+ name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector);
+ gtk_widget_show (GTK_WIDGET (name_selector_dialog));
}
+static void
+addressbook_response_cb (GtkWidget *widget, gint response, gpointer data)
+{
+ EDelegateDialog *edd = data;
+ EDelegateDialogPrivate *priv;
+ ENameSelectorDialog *name_selector_dialog;
+
+ priv = edd->priv;
+
+ name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector);
+ gtk_widget_hide (GTK_WIDGET (name_selector_dialog));
+}
/**
* e_delegate_dialog_new:
@@ -251,25 +242,30 @@ char *
e_delegate_dialog_get_delegate (EDelegateDialog *edd)
{
EDelegateDialogPrivate *priv;
- EDestination **destv;
- char *string = NULL;
+ ENameSelectorModel *name_selector_model;
+ EDestinationStore *destination_store;
+ GList *destinations;
+ EDestination *destination;
g_return_val_if_fail (edd != NULL, NULL);
g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
priv = edd->priv;
-
- bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
-
- if (destv && destv[0] != NULL) {
+
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+ e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store);
+ destinations = e_destination_store_list_destinations (destination_store);
+ if (!destinations)
+ return NULL;
+
+ destination = destinations->data;
+
+ if (destination) {
g_free (priv->address);
- priv->address = g_strdup (e_destination_get_email (destv[0]));
- g_free (destv);
+ priv->address = g_strdup (e_destination_get_email (destination));
}
- g_free (string);
-
+ g_list_free (destinations);
return g_strdup (priv->address);
}
@@ -278,27 +274,30 @@ char *
e_delegate_dialog_get_delegate_name (EDelegateDialog *edd)
{
EDelegateDialogPrivate *priv;
- EDestination **destv;
- char *string = NULL;
+ ENameSelectorModel *name_selector_model;
+ EDestinationStore *destination_store;
+ GList *destinations;
+ EDestination *destination;
g_return_val_if_fail (edd != NULL, NULL);
g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
priv = edd->priv;
- bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
-
- g_message ("importv: [%s]", string);
-
- if (destv && destv[0] != NULL) {
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+ e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store);
+ destinations = e_destination_store_list_destinations (destination_store);
+ if (!destinations)
+ return NULL;
+
+ destination = destinations->data;
+
+ if (destination) {
g_free (priv->name);
- priv->name = g_strdup (e_destination_get_name (destv[0]));
- g_free (destv);
+ priv->name = g_strdup (e_destination_get_name (destination));
}
- g_free (string);
-
+ g_list_free (destinations);
return g_strdup (priv->name);
}
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 64e04baf4c..a3965da4af 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -39,23 +39,23 @@
#include <libecal/e-cal-component.h>
#include <libecal/e-cal-util.h>
#include <libecal/e-cal-time-util.h>
-#include "Evolution-Addressbook-SelectNames.h"
+#include <libedataserverui/e-name-selector.h>
#include "calendar-config.h"
#include "e-meeting-list-view.h"
#include <misc/e-cell-renderer-combo.h>
#include <libebook/e-destination.h>
#include "e-select-names-renderer.h"
-#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION
-
struct _EMeetingListViewPrivate {
EMeetingStore *store;
- GNOME_Evolution_Addressbook_SelectNames corba_select_names;
+ ENameSelector *name_selector;
};
#define BUF_SIZE 1024
+static void name_selector_dialog_close_cb (ENameSelectorDialog *dialog, gint response, gpointer data);
+
static char *sections[] = {N_("Chair Persons"),
N_("Required Participants"),
N_("Optional Participants"),
@@ -75,12 +75,8 @@ e_meeting_list_view_finalize (GObject *obj)
EMeetingListView *view = E_MEETING_LIST_VIEW (obj);
EMeetingListViewPrivate *priv = view->priv;
- if (priv->corba_select_names != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (priv->corba_select_names, &ev);
- CORBA_exception_free (&ev);
- }
+ if (priv->name_selector)
+ g_object_unref (priv->name_selector);
g_free (priv);
@@ -100,15 +96,35 @@ e_meeting_list_view_class_init (EMeetingListViewClass *klass)
static void
+add_section (ENameSelector *name_selector, const char *name)
+{
+ ENameSelectorModel *name_selector_model;
+
+ name_selector_model = e_name_selector_peek_model (name_selector);
+ e_name_selector_model_add_section (name_selector_model, name, gettext (name), NULL);
+}
+
+static void
e_meeting_list_view_init (EMeetingListView *view)
{
EMeetingListViewPrivate *priv;
+ ENameSelectorDialog *name_selector_dialog;
+ gint i;
priv = g_new0 (EMeetingListViewPrivate, 1);
view->priv = priv;
- priv->corba_select_names = CORBA_OBJECT_NIL;
+ priv->name_selector = e_name_selector_new ();
+
+ for (i = 0; sections [i]; i++)
+ add_section (priv->name_selector, sections [i]);
+
+ name_selector_dialog = e_name_selector_peek_dialog (view->priv->name_selector);
+ gtk_window_set_title (GTK_WINDOW (name_selector_dialog), _("Required Participants"));
+ g_signal_connect (name_selector_dialog, "response",
+ G_CALLBACK (name_selector_dialog_close_cb), view);
+
}
static GList *
@@ -307,17 +323,18 @@ e_meeting_list_view_edit (EMeetingListView *emlv, EMeetingAttendee *attendee)
}
static void
-process_section (EMeetingListView *view, EDestination **cards, icalparameter_role role)
+process_section (EMeetingListView *view, GList *destinations, icalparameter_role role)
{
EMeetingListViewPrivate *priv;
- int i;
+ GList *l;
priv = view->priv;
- for (i = 0; cards[i] != NULL; i++) {
+ for (l = destinations; l; l = g_list_next (l)) {
+ EDestination *destination = l->data;
const char *name, *attendee = NULL;
char *attr = NULL;
- name = e_destination_get_name (cards[i]);
+ name = e_destination_get_name (destination);
/* Get the field as attendee from the backend */
if (e_cal_get_ldap_attribute (e_meeting_store_get_e_cal (priv->store),
@@ -328,7 +345,7 @@ process_section (EMeetingListView *view, EDestination **cards, icalparameter_rol
/* FIXME: this does not work, have to use first
e_destination_use_contact() */
- contact = e_destination_get_contact (cards[i]);
+ contact = e_destination_get_contact (destination);
if (contact) {
attendee = e_contact_get (contact, E_CONTACT_FREEBUSY_URL);
if (!attendee)
@@ -339,7 +356,7 @@ process_section (EMeetingListView *view, EDestination **cards, icalparameter_rol
/* If we couldn't get the attendee prior, get the email address as the default */
if (attendee == NULL || *attendee == '\0') {
- attendee = e_destination_get_email (cards[i]);
+ attendee = e_destination_get_email (destination);
}
if (attendee == NULL || *attendee == '\0')
@@ -358,105 +375,35 @@ process_section (EMeetingListView *view, EDestination **cards, icalparameter_rol
}
static void
-select_names_ok_cb (BonoboListener *listener, const char *event_name, const CORBA_any *arg, CORBA_Environment *ev, gpointer data)
-{
- EMeetingListView *view = E_MEETING_LIST_VIEW (data);
- int i;
-
- for (i = 0; sections[i] != NULL; i++) {
- EDestination **destv;
- char *string = NULL;
- Bonobo_Control corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection
- (view->priv->corba_select_names, sections[i], ev);
- GtkWidget *control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
-
- bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations",
- TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
- if (destv) {
- process_section (view, destv, roles[i]);
- g_free (destv);
- }
- }
-}
-
-static void
-add_section (GNOME_Evolution_Addressbook_SelectNames corba_select_names, const char *name)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_SelectNames_addSection (
- corba_select_names, name, gettext (name), &ev);
-
- CORBA_exception_free (&ev);
-}
-
-static gboolean
-get_select_name_dialog (EMeetingListView *view)
+name_selector_dialog_close_cb (ENameSelectorDialog *dialog, gint response, gpointer data)
{
- EMeetingListViewPrivate *priv;
- CORBA_Environment ev;
+ EMeetingListView *view = E_MEETING_LIST_VIEW (data);
+ ENameSelectorModel *name_selector_model;
int i;
-
- priv = view->priv;
-
- CORBA_exception_init (&ev);
- if (priv->corba_select_names != CORBA_OBJECT_NIL) {
- int i;
-
- for (i = 0; sections[i] != NULL; i++) {
- GtkWidget *control_widget;
- Bonobo_Control corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection
- (priv->corba_select_names, sections[i], &ev);
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
-
- bonobo_widget_set_property (BONOBO_WIDGET (control_widget), "text", TC_CORBA_string, "", NULL);
- }
- CORBA_exception_free (&ev);
-
- return TRUE;
- }
+ name_selector_model = e_name_selector_peek_model (view->priv->name_selector);
- priv->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
+ for (i = 0; sections[i] != NULL; i++) {
+ EDestinationStore *destination_store;
+ GList *destinations;
- for (i = 0; sections[i] != NULL; i++)
- add_section (priv->corba_select_names, sections[i]);
+ e_name_selector_model_peek_section (name_selector_model, sections [i],
+ NULL, &destination_store);
+ g_assert (destination_store);
- bonobo_event_source_client_add_listener (priv->corba_select_names,
- (BonoboListenerCallbackFn) select_names_ok_cb,
- "GNOME/Evolution:ok:dialog", NULL, view);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return FALSE;
+ destinations = e_destination_store_list_destinations (destination_store);
+ process_section (view, destinations, roles [i]);
+ g_list_free (destinations);
}
- CORBA_exception_free (&ev);
-
- return TRUE;
+ gtk_widget_hide (GTK_WIDGET (dialog));
}
void
e_meeting_list_view_invite_others_dialog (EMeetingListView *view)
{
- CORBA_Environment ev;
-
- if (!get_select_name_dialog (view))
- return;
-
- CORBA_exception_init (&ev);
+ ENameSelectorDialog *dialog;
- GNOME_Evolution_Addressbook_SelectNames_activateDialog (
- view->priv->corba_select_names, _("Required Participants"), &ev);
-
- CORBA_exception_free (&ev);
+ dialog = e_name_selector_peek_dialog (view->priv->name_selector);
+ gtk_widget_show (GTK_WIDGET (dialog));
}
-
diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c
index c195b8a55e..249d20d328 100644
--- a/calendar/gui/e-select-names-editable.c
+++ b/calendar/gui/e-select-names-editable.c
@@ -23,32 +23,25 @@
#include <config.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkcelleditable.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-widget.h>
#include <libebook/e-destination.h>
+#include <libedataserverui/e-select-names-entry.h>
#include "e-select-names-editable.h"
-#include "Evolution-Addressbook-SelectNames.h"
-
-#define SELECT_NAMES_OAFIID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION
struct _ESelectNamesEditablePriv {
- GNOME_Evolution_Addressbook_SelectNames select_names;
- Bonobo_Control control;
- Bonobo_PropertyBag bag;
+
};
-static BonoboWidgetClass *parent_class;
+static ENameSelectorEntryClass *parent_class;
static void
esne_start_editing (GtkCellEditable *cell_editable, GdkEvent *event)
{
ESelectNamesEditable *esne = E_SELECT_NAMES_EDITABLE (cell_editable);
- BonoboControlFrame *cf;
/* Grab the focus */
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (cell_editable));
- bonobo_control_frame_control_activate (cf);
+
+ /* TODO */
}
static void
@@ -62,14 +55,6 @@ esne_finalize (GObject *obj)
{
ESelectNamesEditable *esne = (ESelectNamesEditable *) obj;
- if (esne->priv->select_names != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (esne->priv->select_names, NULL);
- esne->priv->select_names = CORBA_OBJECT_NIL;
-
- if (esne->priv->bag != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (esne->priv->bag, NULL);
- esne->priv->bag = CORBA_OBJECT_NIL;
-
g_free (esne->priv);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -80,10 +65,6 @@ static void
esne_init (ESelectNamesEditable *esne)
{
esne->priv = g_new0 (ESelectNamesEditablePriv, 1);
-
- esne->priv->select_names = CORBA_OBJECT_NIL;
- esne->priv->control = CORBA_OBJECT_NIL;
- esne->priv->bag = CORBA_OBJECT_NIL;
}
static void
@@ -91,7 +72,7 @@ esne_class_init (GObjectClass *klass)
{
klass->finalize = esne_finalize;
- parent_class = BONOBO_WIDGET_CLASS (g_type_class_peek_parent (klass));
+ parent_class = E_NAME_SELECTOR_ENTRY_CLASS (g_type_class_peek_parent (klass));
}
GType
@@ -118,7 +99,7 @@ e_select_names_editable_get_type (void)
NULL
};
- esne_type = g_type_register_static (BONOBO_TYPE_WIDGET, "ESelectNamesEditable", &esne_info, 0);
+ esne_type = g_type_register_static (E_TYPE_NAME_SELECTOR_ENTRY, "ESelectNamesEditable", &esne_info, 0);
g_type_add_interface_static (esne_type, GTK_TYPE_CELL_EDITABLE, &cell_editable_info);
}
@@ -127,7 +108,7 @@ e_select_names_editable_get_type (void)
}
static void
-entry_activate (BonoboListener *listener, const char *event_name, const CORBA_any *arg, CORBA_Environment *ev, gpointer esne)
+entry_activate (ESelectNamesEditable *esne)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (esne));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (esne));
@@ -136,6 +117,11 @@ entry_activate (BonoboListener *listener, const char *event_name, const CORBA_an
ESelectNamesEditable *
e_select_names_editable_construct (ESelectNamesEditable *esne)
{
+ g_signal_connect (esne, "activate", G_CALLBACK (entry_activate), esne);
+
+ return esne;
+
+#if 0
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -170,6 +156,7 @@ e_select_names_editable_construct (ESelectNamesEditable *esne)
NULL, esne);
return esne;
+#endif
}
ESelectNamesEditable *
@@ -191,44 +178,65 @@ e_select_names_editable_new ()
gchar *
e_select_names_editable_get_address (ESelectNamesEditable *esne)
{
- EDestination **dest;
+ EDestinationStore *destination_store;
+ GList *destinations;
+ EDestination *destination;
gchar *dest_str;
gchar *result = NULL;
g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
- dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL);
- dest = e_destination_importv (dest_str);
- if (dest)
- result = g_strdup (e_destination_get_email (*dest));
- e_destination_freev (dest);
+ destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+ destinations = e_destination_store_list_destinations (destination_store);
+ if (!destinations)
+ return NULL;
+ destination = destinations->data;
+ result = g_strdup (e_destination_get_email (destination));
+ g_list_free (destinations);
return result;
}
gchar *
e_select_names_editable_get_name (ESelectNamesEditable *esne)
{
- EDestination **dest;
+ EDestinationStore *destination_store;
+ GList *destinations;
+ EDestination *destination;
gchar *dest_str;
gchar *result = NULL;
g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
- dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL);
- dest = e_destination_importv (dest_str);
- if (dest)
- result = g_strdup (e_destination_get_name (*dest));
- e_destination_freev (dest);
+ destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+ destinations = e_destination_store_list_destinations (destination_store);
+ if (!destinations)
+ return NULL;
+ destination = destinations->data;
+ result = g_strdup (e_destination_get_name (destination));
+ g_list_free (destinations);
return result;
}
void
e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *text)
{
+ EDestinationStore *destination_store;
+ GList *destinations;
+ EDestination *destination;
+ gchar *dest_str;
+ gchar *result = NULL;
+
g_return_if_fail (E_IS_SELECT_NAMES_EDITABLE (esne));
- bonobo_pbclient_set_string (esne->priv->bag, "addresses", text, NULL);
+ destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+ destinations = e_destination_store_list_destinations (destination_store);
+ if (!destinations)
+ return;
+
+ destination = destinations->data;
+ e_destination_set_address (destination, text);
+ g_list_free (destinations);
}
diff --git a/calendar/gui/e-select-names-editable.h b/calendar/gui/e-select-names-editable.h
index 867118fe9e..f361c48cd8 100644
--- a/calendar/gui/e-select-names-editable.h
+++ b/calendar/gui/e-select-names-editable.h
@@ -23,7 +23,7 @@
#ifndef __E_SELECT_NAMES_EDITABLE_H__
#define __E_SELECT_NAMES_EDITABLE_H__
-#include <bonobo/bonobo-widget.h>
+#include <libedataserverui/e-name-selector-entry.h>
G_BEGIN_DECLS
@@ -40,14 +40,14 @@ typedef struct _ESelectNamesEditablePriv ESelectNamesEditablePriv;
struct _ESelectNamesEditable
{
- BonoboWidget parent;
+ ENameSelectorEntry parent;
ESelectNamesEditablePriv *priv;
};
struct _ESelectNamesEditableClass
{
- BonoboWidgetClass parent_class;
+ ENameSelectorEntryClass parent_class;
};
GType e_select_names_editable_get_type (void);
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index 0ee5ea2455..5a8e3316a7 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -53,11 +53,9 @@ static void
e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRenderer *cell)
{
gchar *new_address, *new_name;
- BonoboControlFrame *cf;
/* We don't need to listen for the de-activation any more */
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (editable));
- g_signal_handlers_disconnect_matched (G_OBJECT (cf), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cell);
+ g_signal_handlers_disconnect_matched (editable, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cell);
new_address = e_select_names_editable_get_address (E_SELECT_NAMES_EDITABLE (editable));
new_name = e_select_names_editable_get_name (E_SELECT_NAMES_EDITABLE (editable));
@@ -70,10 +68,9 @@ e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRen
}
static void
-e_select_names_renderer_activated (BonoboControlFrame *cf, gboolean activated, ESelectNamesRenderer *cell)
+e_select_names_renderer_activated (ESelectNamesEditable *editable, ESelectNamesRenderer *cell)
{
- if (!activated)
- e_select_names_renderer_editing_done (GTK_CELL_EDITABLE (cell->priv->editable), cell);
+ e_select_names_renderer_editing_done (GTK_CELL_EDITABLE (cell->priv->editable), cell);
}
static GtkCellEditable *
@@ -83,7 +80,6 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, G
ESelectNamesRenderer *sn_cell = E_SELECT_NAMES_RENDERER (cell);
GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell);
ESelectNamesEditable *editable;
- BonoboControlFrame *cf;
if (!text_cell->editable)
return NULL;
@@ -94,11 +90,13 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, G
g_signal_connect (editable, "editing_done", G_CALLBACK (e_select_names_renderer_editing_done), sn_cell);
+#if 0
/* Listen for de-activation/loss of focus */
cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (editable));
bonobo_control_frame_set_autoactivate (cf, TRUE);
+#endif
- g_signal_connect (cf, "activated", G_CALLBACK (e_select_names_renderer_activated), sn_cell);
+ g_signal_connect (editable, "activate", G_CALLBACK (e_select_names_renderer_activated), sn_cell);
sn_cell->priv->editable = g_object_ref (editable);
sn_cell->priv->path = g_strdup (path);