diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-03-13 12:56:01 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-03-13 12:56:01 +0800 |
commit | 444f922980fcafd58659ed435aa50dfa86463951 (patch) | |
tree | d18fba3d621ab210d3b8bd27c4220555cc7a9621 /addressbook | |
parent | d5ba94f758a5206dc7cd5b0cd222bb2c3d348ebe (diff) | |
download | gsoc2013-evolution-444f922980fcafd58659ed435aa50dfa86463951.tar.gz gsoc2013-evolution-444f922980fcafd58659ed435aa50dfa86463951.tar.zst gsoc2013-evolution-444f922980fcafd58659ed435aa50dfa86463951.zip |
Remove verb "AddressbookConfig". (config_cb): Removed.
* gui/component/addressbook.c: Remove verb "AddressbookConfig".
(config_cb): Removed.
* gui/component/addressbook-config.c: Remove `dialog' member from
`AddresbookDialog'. Instead, add a `config_control' member.
(config_control_new): New.
(addressbook_config): Removed.
(addressbook_config_register_factory): New.
(config_control_factory_fn): New, factory function for the
ConfigControl page.
(addressbook_source_edit_changed): Don't change the sensitivity of
the dialog. Rather, invoke ::changed on the ConfigPage.
(auth_checkbutton_changed): No need to manually change the
sensitiviness of the buttons here either.
(add_source_clicked): Likewise, just invoke
evolution_config_control_changed().
(edit_source_clicked): Likewise.
(addressbook_dialog_close): Removed.
(config_control_destroy_callback): New, callback for when the
config control gets destroyed.
(addressbook_dialog_apply): Removed.
(config_control_apply_callback): New callback for
EvolutionConfigControl::apply.
(addressbook_dialog_ok): Removed.
(addressbook_config_control_new): Set up ->config_control and
connect the signals.
* gui/component/addressbook-config.glade: Call the main hbox in
the addressbook_sources dialog `addressbook_sources_main_hbox'.
* gui/component/addressbook-component.c (owner_set_cb): Call
`addresbook_config_register_factory'.
* gui/component/GNOME_Evolution_Addressbook.oaf.in: Add items for
OAFIID:GNOME_Evolution_Addresbook_ConfigControl and
OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory.
svn path=/trunk/; revision=16136
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 39 | ||||
-rw-r--r-- | addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in | 32 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 2 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-config.c | 131 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-config.glade | 4 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-config.h | 7 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 8 |
7 files changed, 171 insertions, 52 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 6540241277..2785ce3875 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,42 @@ +2002-03-12 Ettore Perazzoli <ettore@ximian.com> + + * gui/component/addressbook.c: Remove verb "AddressbookConfig". + (config_cb): Removed. + + * gui/component/addressbook-config.c: Remove `dialog' member from + `AddresbookDialog'. Instead, add a `config_control' member. + (config_control_new): New. + (addressbook_config): Removed. + (addressbook_config_register_factory): New. + (config_control_factory_fn): New, factory function for the + ConfigControl page. + (addressbook_source_edit_changed): Don't change the sensitivity of + the dialog. Rather, invoke ::changed on the ConfigPage. + (auth_checkbutton_changed): No need to manually change the + sensitiviness of the buttons here either. + (add_source_clicked): Likewise, just invoke + evolution_config_control_changed(). + (edit_source_clicked): Likewise. + (addressbook_dialog_close): Removed. + (config_control_destroy_callback): New, callback for when the + config control gets destroyed. + (addressbook_dialog_apply): Removed. + (config_control_apply_callback): New callback for + EvolutionConfigControl::apply. + (addressbook_dialog_ok): Removed. + (addressbook_config_control_new): Set up ->config_control and + connect the signals. + + * gui/component/addressbook-config.glade: Call the main hbox in + the addressbook_sources dialog `addressbook_sources_main_hbox'. + + * gui/component/addressbook-component.c (owner_set_cb): Call + `addresbook_config_register_factory'. + + * gui/component/GNOME_Evolution_Addressbook.oaf.in: Add items for + OAFIID:GNOME_Evolution_Addresbook_ConfigControl and + OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory. + 2002-03-11 Chris Toshok <toshok@ximian.com> * gui/component/select-names/e-select-names.c (update_query): diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in index b050e8ebb8..8be4e79aac 100644 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in +++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in @@ -131,4 +131,36 @@ </oaf_server> +<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory" + type="exe" + location="evolution-addressbook"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/ObjectFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + _value="Factory for the configuration control for the Evolution Addressbook."/> + +</oaf_server> + +<oaf_server iid="OAFIID:GNOME_Evolution_Addresbook_ConfigControl" + type="factory" + location="OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> + </oaf_attribute> + + <oaf_attribute name="evolution:config_item:title" type="string" + _value="LDAP Sources"/> + + <oaf_attribute name="evolution:config_item:description" type="string" + _value="This page can be used to configure access to LDAP servers"/> + + <oaf_attribute name="description" type="string" + _value="Configuration control for the Evolution Addressbook."/> + +</oaf_server> + </oaf_info> diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 7ff0f05770..c3f73a4262 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -367,6 +367,8 @@ owner_set_cb (EvolutionShellComponent *shell_component, if (global_shell_client == NULL) global_shell_client = shell_client; + addressbook_config_register_factory (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client))); + addressbook_storage_setup (shell_component, evolution_homedir); } diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index d575d33db6..9b898f336e 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -2,19 +2,31 @@ #include <config.h> -#include <glib.h> +#include "addressbook-config.h" + +#include "addressbook-storage.h" + +#include "evolution-config-control.h" + +#include <gal/widgets/e-unicode.h> +#include <e-util/e-html-utils.h> + +#include <gtkhtml/gtkhtml.h> + #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-stock.h> + +#include <bonobo/bonobo-generic-factory.h> + #include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <gtkhtml/gtkhtml.h> -#include <e-util/e-html-utils.h> -#include "addressbook-config.h" -#include "addressbook-storage.h" + #include <stdlib.h> + +#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory" + typedef struct _AddressbookSourceDialog AddressbookSourceDialog; typedef struct _AddressbookSourcePageItem AddressbookSourcePageItem; @@ -87,6 +99,7 @@ auth_checkbutton_changed (GtkWidget *item, AddressbookSourceDialog *dialog) /* make sure the change is reflected by the state of the dialog's OK button */ addressbook_source_edit_changed (item, dialog); + gtk_widget_set_sensitive (dialog->auth_optionmenu, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton))); gtk_widget_set_sensitive (dialog->auth_notebook, @@ -347,9 +360,12 @@ addressbook_create_new_source (const char *new_source, GtkWidget *parent) typedef struct { + EvolutionConfigControl *config_control; + GtkWidget *page; + GladeXML *gui; GNOME_Evolution_Shell shell; - GtkWidget *dialog; + GtkWidget *clistSources; GtkWidget *addSource; GtkWidget *editSource; @@ -371,7 +387,7 @@ add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) { AddressbookSourceDialog *sdialog; - sdialog = addressbook_config_source_with_gui (dialog->gui, NULL, dialog->dialog); + sdialog = addressbook_config_source_with_gui (dialog->gui, NULL, dialog->page); if (sdialog->id == 0) { /* Ok was clicked */ AddressbookSource *source = addressbook_source_copy(sdialog->source); @@ -383,8 +399,8 @@ add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) row = e_utf8_gtk_clist_append (GTK_CLIST(dialog->clistSources), text); gtk_clist_set_row_data_full (GTK_CLIST(dialog->clistSources), row, source, (GtkDestroyNotify) addressbook_source_free); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE); + + evolution_config_control_changed (dialog->config_control); update_sensitivity (dialog); } } @@ -397,7 +413,7 @@ edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) source = gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row); - sdialog = addressbook_config_source_with_gui (dialog->gui, source, dialog->dialog); + sdialog = addressbook_config_source_with_gui (dialog->gui, source, dialog->page); if (sdialog->id == 0) { /* Ok was clicked */ source = addressbook_source_copy(sdialog->source); @@ -405,8 +421,9 @@ edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 0, source->name); e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 1, source->host); gtk_clist_set_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row, source); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE); + + evolution_config_control_changed (dialog->config_control); + update_sensitivity (dialog); } } @@ -416,8 +433,9 @@ delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) { gtk_clist_remove (GTK_CLIST (dialog->clistSources), dialog->source_row); dialog->source_row = -1; - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE); + + evolution_config_control_changed (dialog->config_control); + update_sensitivity (dialog); } @@ -431,18 +449,26 @@ sources_select_row (GtkWidget *widget, gint row, gint column, } static void -addressbook_dialog_close (GtkWidget *w, AddressbookDialog *dialog) +config_control_destroy_callback (EvolutionConfigControl *config_control, + void *data) { - gtk_widget_destroy (dialog->dialog); + AddressbookDialog *dialog; + + dialog = (AddressbookDialog *) data; + gtk_object_unref (GTK_OBJECT (dialog->gui)); g_free (dialog); } static void -addressbook_dialog_apply (GtkWidget *w, AddressbookDialog *dialog) +config_control_apply_callback (EvolutionConfigControl *config_control, + void *data) { + AddressbookDialog *dialog; int i; + dialog = (AddressbookDialog *) data; + addressbook_storage_clear_sources(); for (i = 0; i < GTK_CLIST(dialog->clistSources)->rows; i ++) { @@ -451,20 +477,10 @@ addressbook_dialog_apply (GtkWidget *w, AddressbookDialog *dialog) } addressbook_storage_write_sources(); - - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, FALSE); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, FALSE); } -static void -addressbook_dialog_ok (GtkWidget *w, AddressbookDialog *dialog) -{ - addressbook_dialog_apply(w, dialog); - addressbook_dialog_close(w, dialog); -} - -void -addressbook_config (GNOME_Evolution_Shell shell) +static EvolutionConfigControl * +config_control_new (GNOME_Evolution_Shell shell) { AddressbookDialog *dialog; GladeXML *gui; @@ -479,7 +495,18 @@ addressbook_config (GNOME_Evolution_Shell shell) dialog->gui = gui; dialog->shell = shell; - dialog->dialog = glade_xml_get_widget (gui, "addressbook_sources"); + dialog->page = glade_xml_get_widget (gui, "addressbook_sources_main_hbox"); + + gtk_widget_ref (dialog->page); + gtk_container_remove (GTK_CONTAINER (dialog->page->parent), dialog->page); + + dialog->config_control = evolution_config_control_new (dialog->page); + gtk_signal_connect (GTK_OBJECT (dialog->config_control), "apply", + GTK_SIGNAL_FUNC (config_control_apply_callback), dialog); + gtk_signal_connect (GTK_OBJECT (dialog->config_control), "destroy", + GTK_SIGNAL_FUNC (config_control_destroy_callback), dialog); + + gtk_widget_unref (dialog->page); clist = glade_xml_get_widget (gui, "clistSources"); dialog->clistSources = clist; @@ -502,8 +529,6 @@ addressbook_config (GNOME_Evolution_Shell shell) GTK_SIGNAL_FUNC (delete_source_clicked), dialog); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, FALSE); - gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, FALSE); update_sensitivity (dialog); l = addressbook_storage_get_sources (); @@ -525,14 +550,40 @@ addressbook_config (GNOME_Evolution_Shell shell) GTK_SIGNAL_FUNC (sources_select_row), dialog); - gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog), - 0 /* OK */, addressbook_dialog_ok, dialog); + return dialog->config_control; +} + + +/* Implementation of the factory for the configuration control. */ - gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog), - 1 /* APPLY */, addressbook_dialog_apply, dialog); +static BonoboGenericFactory *factory = NULL; + +static BonoboObject * +config_control_factory_fn (BonoboGenericFactory *factory, + void *data) +{ + GNOME_Evolution_Shell shell; + EvolutionConfigControl *control; - gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog), - 2 /* CLOSE */, addressbook_dialog_close, dialog); + shell = (GNOME_Evolution_Shell) data; - gnome_dialog_run (GNOME_DIALOG(dialog->dialog)); + control = config_control_new (shell); + return BONOBO_OBJECT (control); +} + +gboolean +addressbook_config_register_factory (GNOME_Evolution_Shell shell) +{ + g_return_val_if_fail (shell != CORBA_OBJECT_NIL, FALSE); + + factory = bonobo_generic_factory_new (CONFIG_CONTROL_FACTORY_ID, + config_control_factory_fn, + shell); + + if (factory != NULL) { + return TRUE; + } else { + g_warning ("Cannot register factory %s", CONFIG_CONTROL_FACTORY_ID); + return FALSE; + } } diff --git a/addressbook/gui/component/addressbook-config.glade b/addressbook/gui/component/addressbook-config.glade index 23ef8105a5..7396c3c818 100644 --- a/addressbook/gui/component/addressbook-config.glade +++ b/addressbook/gui/component/addressbook-config.glade @@ -76,7 +76,7 @@ <widget> <class>GtkNotebook</class> - <name>notebook2</name> + <name>main_notebook</name> <can_focus>True</can_focus> <show_tabs>True</show_tabs> <show_border>True</show_border> @@ -1071,7 +1071,7 @@ Sub <widget> <class>GtkHBox</class> - <name>hbox3</name> + <name>addressbook_sources_main_hbox</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <child> diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h index b0adbd7330..e1bdc18bae 100644 --- a/addressbook/gui/component/addressbook-config.h +++ b/addressbook/gui/component/addressbook-config.h @@ -25,7 +25,10 @@ #include "addressbook-storage.h" -void addressbook_config (GNOME_Evolution_Shell shell); -void addressbook_create_new_source (const char *new_source, GtkWidget *parent); +void addressbook_config (GNOME_Evolution_Shell shell); +void addressbook_create_new_source (const char *new_source, + GtkWidget *parent); + +gboolean addressbook_config_register_factory (GNOME_Evolution_Shell shell); #endif /* __ADDRESSBOOK_CONFIG_H__ */ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 72cf16cdeb..956edc915a 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -123,12 +123,6 @@ view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) } static void -config_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - addressbook_config (NULL /* XXX */); -} - -static void search_cb (BonoboUIComponent *uih, void *user_data, const char *path) { AddressbookView *view = (AddressbookView *) user_data; @@ -349,8 +343,6 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb), BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb), - BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb), - BONOBO_UI_UNSAFE_VERB ("ContactNew", new_contact_cb), BONOBO_UI_UNSAFE_VERB ("ContactNewList", new_contact_list_cb), BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb), |