aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-meeting-list-view.c
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/gui/e-meeting-list-view.c
parentd21af5dbf4433cdff8b1aacad13eff48ebcad9c5 (diff)
downloadgsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.gz
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.bz2
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.lz
gsoc2013-evolution-0eabd23e17847dc35b67f6ef4cd84af0a25e5dcd.tar.xz
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/gui/e-meeting-list-view.c')
-rw-r--r--calendar/gui/e-meeting-list-view.c155
1 files changed, 51 insertions, 104 deletions
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));
}
-