aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
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/dialogs
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/dialogs')
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c109
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c131
2 files changed, 117 insertions, 123 deletions
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);
}