diff options
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 41 | ||||
-rw-r--r-- | my-evolution/GNOME_Evolution_Summary.oaf.in | 56 | ||||
-rw-r--r-- | my-evolution/e-summary-factory.c | 7 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.c | 247 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.h | 17 | ||||
-rw-r--r-- | my-evolution/e-summary.c | 1 | ||||
-rw-r--r-- | my-evolution/e-summary.h | 1 | ||||
-rw-r--r-- | my-evolution/my-evolution.glade | 18 |
8 files changed, 242 insertions, 146 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 4ebee50060..06672392e0 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,44 @@ +2002-03-14 Ettore Perazzoli <ettore@ximian.com> + + * e-summary-factory.c (e_summary_factory_new_control): Call + `e_summary_preferences_register_config_control_factory()'. + + * e-summary-preferences.c: Remove member `box' from struct + PropertyData. Added member `config_control'. + (e_summary_configure): Removed. + (property_box_destroy_cb): Removed. + (property_box_clicked_cb): Removed. + (property_box_apply_cb): New. + (config_control_destroy_cb): New. + (factory_fn): New, factory function for the + EvolutionConfigControl. + (e_summary_preferences_register_config_control_factory): New. + (mail_show_full_path_toggled_cb): Invoke ::changed on + pd->config_control. + (add_dialog_clicked_cb): Likewise. + (rdf_refresh_value_changed_cb): Likewise. + (rdf_limit_value_changed_cb): Likewise. + (mail_etable_item_changed_cb): Likewise. + (rdf_etable_item_changed_cb): Likewise. + (weather_etable_item_changed_cb): Likewise. + (weather_refresh_value_changed_cb): Likewise. + (weather_metric_toggled_cb): Likewise. + (weather_imperial_toggled_cb): Likewise. + (calendar_one_toggled_cb): Likewise. + (calendar_five_toggled_cb): Likewise. + (calendar_week_toggled_cb): Likewise. + (calendar_month_toggled_cb): Likewise. + (calendar_all_toggled_cb): Likewise. + (calendar_today_toggled_cb): Likewise. + (config_control_destroy_cb): Don't set ->prefs_window to NULL. + + * my-evolution.glade: Renamed "notebook2" to "notebook". Also + change its parent into a GtkWindow as libglade seems to have some + kind of problem with the GnomePropertyBox [glade_xml_get_widget() + for "notebook" always returned NULL]. + + * e-summary.h: Remove member `prefs_window' from `ESummary'. + 2002-02-14 Radek Doulik <rodo@ximian.com> * e-summary-tasks.c (sort_uids): fix case when priority is diff --git a/my-evolution/GNOME_Evolution_Summary.oaf.in b/my-evolution/GNOME_Evolution_Summary.oaf.in index 4c4e42e2b8..d360e0e10b 100644 --- a/my-evolution/GNOME_Evolution_Summary.oaf.in +++ b/my-evolution/GNOME_Evolution_Summary.oaf.in @@ -1,18 +1,52 @@ <oaf_info> -<oaf_server iid="OAFIID:GNOME_Evolution_Summary_ShellComponent" - type="exe" - location="evolution-executive-summary"> + <oaf_server iid="OAFIID:GNOME_Evolution_Summary_ShellComponent" + type="exe" + location="evolution-executive-summary"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> + </oaf_attribute> - <oaf_attribute name="description" type="string" - _value="Evolution component for the executive summary."/> + <oaf_attribute name="description" type="string" + _value="Evolution component for the executive summary."/> - <oaf_attribute name="evolution:shell-component-icon" type="string" - value="evolution-today.png"/> -</oaf_server> + <oaf_attribute name="evolution:shell-component-icon" type="string" + value="evolution-today.png"/> + </oaf_server> + + <oaf_server iid="OAFIID:GNOME_Evolution_Summary_ConfigControlFactory" + type="exe" + location="evolution-executive-summary"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + _value="Factory for Evolution Summary's configuration control."/> + </oaf_server> + + <oaf_server iid="OAFIID:GNOME_Evolution_Summary_ConfigControl" + type="factory" + location="OAFIID:GNOME_Evolution_Summary_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="Summary Preferences"/> + + <oaf_attribute name="evolution:config_item:description" type="string" + _value="This page can be used to control the appearance of the Evolution Summary"/> + + <oaf_attribute name="evolution:config_item:icon_name" type="string" + value="evolution-today.png"/> + + <oaf_attribute name="description" type="string" + _value="Configuration control for the Evolution Summary."/> + + </oaf_server> </oaf_info> diff --git a/my-evolution/e-summary-factory.c b/my-evolution/e-summary-factory.c index 9344f70016..cdf813aaf7 100644 --- a/my-evolution/e-summary-factory.c +++ b/my-evolution/e-summary-factory.c @@ -39,7 +39,6 @@ BonoboUIVerb verbs[] = { BONOBO_UI_VERB ("PrintMyEvolution", e_summary_print), - BONOBO_UI_VERB ("ToolsSettings", e_summary_configure), BONOBO_UI_VERB ("Reload", e_summary_reload), BONOBO_UI_VERB_END }; @@ -47,7 +46,6 @@ BonoboUIVerb verbs[] = { static EPixmap pixmaps [] = { E_PIXMAP ("/commands/PrintMyEvolution", "print.xpm"), - E_PIXMAP ("/commands/ToolsSettings", "configure_16_mail.xpm"), E_PIXMAP ("/Toolbar/PrintMyEvolution", "buttons/print.png"), E_PIXMAP_END }; @@ -153,5 +151,10 @@ e_summary_factory_new_control (const char *uri, gtk_signal_connect (GTK_OBJECT (control), "destroy", control_destroy_cb, summary); + /* FIXME: We register the factory here as it needs the summary object. + Sigh, this is really wrong. */ + + e_summary_preferences_register_config_control_factory (summary); + return control; } diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index a13804abda..ec3aa02327 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -38,6 +38,7 @@ #include <stdio.h> #include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-generic-factory.h> #include <bonobo/bonobo-moniker-util.h> #include <bonobo-conf/bonobo-config-database.h> @@ -45,6 +46,12 @@ #include "e-summary-preferences.h" #include "e-summary-table.h" +#include "evolution-config-control.h" + + +#define FACTORY_ID "OAFIID:GNOME_Evolution_Summary_ConfigControlFactory" + + static void make_initial_mail_list (ESummaryPrefs *prefs) { @@ -424,8 +431,9 @@ struct _CalendarPage { }; typedef struct _PropertyData { + EvolutionConfigControl *config_control; + ESummary *summary; - GnomePropertyBox *box; GtkWidget *new_url_entry, *new_name_entry; GladeXML *xml; @@ -673,7 +681,8 @@ mail_show_full_path_toggled_cb (GtkToggleButton *tb, PropertyData *pd) { pd->summary->preferences->show_full_path = gtk_toggle_button_get_active (tb); - gnome_property_box_changed (pd->box); + + evolution_config_control_changed (pd->config_control); } #if 0 @@ -714,8 +723,7 @@ add_dialog_clicked_cb (GnomeDialog *dialog, gtk_clist_set_row_data (GTK_CLIST (pd->rdf->shown), row, pd->summary->preferences->rdf_urls); - - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); gnome_dialog_close (dialog); } @@ -767,7 +775,7 @@ rdf_refresh_value_changed_cb (GtkAdjustment *adj, PropertyData *pd) { pd->summary->preferences->rdf_refresh_time = (int) adj->value; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -775,7 +783,7 @@ rdf_limit_value_changed_cb (GtkAdjustment *adj, PropertyData *pd) { pd->summary->preferences->limit = (int) adj->value; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -783,7 +791,7 @@ mail_etable_item_changed_cb (ESummaryTable *est, ETreePath path, PropertyData *pd) { - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -791,7 +799,7 @@ rdf_etable_item_changed_cb (ESummaryTable *est, ETreePath path, PropertyData *pd) { - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -799,7 +807,7 @@ weather_etable_item_changed_cb (ESummaryTable *est, ETreePath path, PropertyData *pd) { - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -807,7 +815,7 @@ weather_refresh_value_changed_cb (GtkAdjustment *adj, PropertyData *pd) { pd->summary->preferences->weather_refresh_time = (int) adj->value; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -819,7 +827,7 @@ weather_metric_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->units = UNITS_METRIC; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -831,7 +839,7 @@ weather_imperial_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->units = UNITS_IMPERIAL; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } @@ -844,7 +852,7 @@ calendar_one_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_DAY; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -856,7 +864,7 @@ calendar_five_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->days = E_SUMMARY_CALENDAR_FIVE_DAYS; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -868,7 +876,7 @@ calendar_week_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_WEEK; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -880,7 +888,7 @@ calendar_month_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_MONTH; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -892,7 +900,7 @@ calendar_all_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static void @@ -904,7 +912,7 @@ calendar_today_toggled_cb (GtkToggleButton *tb, } pd->summary->preferences->show_tasks = E_SUMMARY_CALENDAR_TODAYS_TASKS; - gnome_property_box_changed (pd->box); + evolution_config_control_changed (pd->config_control); } static gboolean @@ -1097,142 +1105,157 @@ maybe_add_to_shown (gpointer key, } } + +/* Prototypes to shut gcc up */ +GtkWidget *e_summary_preferences_make_mail_table (PropertyData *pd); +GtkWidget *e_summary_preferences_make_rdf_table (PropertyData *pd); +GtkWidget *e_summary_preferences_make_weather_table (PropertyData *pd); +GtkWidget * +e_summary_preferences_make_mail_table (PropertyData *pd) +{ + return e_summary_table_new (g_hash_table_new (NULL, NULL)); +} + +GtkWidget * +e_summary_preferences_make_rdf_table (PropertyData *pd) +{ + return e_summary_table_new (g_hash_table_new (NULL, NULL)); +} + +GtkWidget * +e_summary_preferences_make_weather_table (PropertyData *pd) +{ + return e_summary_table_new (g_hash_table_new (NULL, NULL)); +} + + +/* The factory for the ConfigControl. */ + static void -property_box_clicked_cb (GnomeDialog *dialog, - int page_num, - PropertyData *pd) +config_control_apply_cb (EvolutionConfigControl *control, + void *data) { - if (page_num == -1) { + PropertyData *pd; - /* RDFs */ - if (pd->rdf->tmp_list) { - free_str_list (pd->rdf->tmp_list); - g_list_free (pd->rdf->tmp_list); - pd->rdf->tmp_list = NULL; - } + pd = (PropertyData *) data; - /* Take each news feed which is on and add it - to the shown list */ - g_hash_table_foreach (pd->rdf->model, maybe_add_to_shown, &pd->rdf->tmp_list); + /* RDFs */ + if (pd->rdf->tmp_list) { + free_str_list (pd->rdf->tmp_list); + g_list_free (pd->rdf->tmp_list); + pd->rdf->tmp_list = NULL; + } - if (pd->summary->preferences->rdf_urls) { - free_str_list (pd->summary->preferences->rdf_urls); - g_list_free (pd->summary->preferences->rdf_urls); - } + /* Take each news feed which is on and add it + to the shown list */ + g_hash_table_foreach (pd->rdf->model, maybe_add_to_shown, &pd->rdf->tmp_list); - pd->summary->preferences->rdf_urls = copy_str_list (pd->rdf->tmp_list); + if (pd->summary->preferences->rdf_urls) { + free_str_list (pd->summary->preferences->rdf_urls); + g_list_free (pd->summary->preferences->rdf_urls); + } - /* Weather */ - if (pd->weather->tmp_list) { - free_str_list (pd->weather->tmp_list); - g_list_free (pd->weather->tmp_list); - pd->weather->tmp_list = NULL; - } - g_hash_table_foreach (pd->weather->model, maybe_add_to_shown, &pd->weather->tmp_list); + pd->summary->preferences->rdf_urls = copy_str_list (pd->rdf->tmp_list); + + /* Weather */ + if (pd->weather->tmp_list) { + free_str_list (pd->weather->tmp_list); + g_list_free (pd->weather->tmp_list); + pd->weather->tmp_list = NULL; + } + g_hash_table_foreach (pd->weather->model, maybe_add_to_shown, &pd->weather->tmp_list); - if (pd->summary->preferences->stations) { - free_str_list (pd->summary->preferences->stations); - g_list_free (pd->summary->preferences->stations); - } - pd->summary->preferences->stations = copy_str_list (pd->weather->tmp_list); + if (pd->summary->preferences->stations) { + free_str_list (pd->summary->preferences->stations); + g_list_free (pd->summary->preferences->stations); + } + pd->summary->preferences->stations = copy_str_list (pd->weather->tmp_list); - /* Folders */ - if (pd->mail->tmp_list) { - free_str_list (pd->mail->tmp_list); - g_list_free (pd->mail->tmp_list); - pd->mail->tmp_list = NULL; - } - g_hash_table_foreach (pd->mail->model, maybe_add_to_shown, &pd->mail->tmp_list); + /* Folders */ + if (pd->mail->tmp_list) { + free_str_list (pd->mail->tmp_list); + g_list_free (pd->mail->tmp_list); + pd->mail->tmp_list = NULL; + } + g_hash_table_foreach (pd->mail->model, maybe_add_to_shown, &pd->mail->tmp_list); - if (pd->summary->preferences->display_folders) { - free_str_list (pd->summary->preferences->display_folders); - g_list_free (pd->summary->preferences->display_folders); - } - pd->summary->preferences->display_folders = copy_str_list (pd->mail->tmp_list); - - e_summary_reconfigure (pd->summary); + if (pd->summary->preferences->display_folders) { + free_str_list (pd->summary->preferences->display_folders); + g_list_free (pd->summary->preferences->display_folders); } + pd->summary->preferences->display_folders = copy_str_list (pd->mail->tmp_list); + + e_summary_reconfigure (pd->summary); } static void -property_box_destroy_cb (GtkObject *object, - PropertyData *pd) +config_control_destroy_cb (EvolutionConfigControl *config_control, + void *data) { + PropertyData *pd; + + pd = (PropertyData *) data; + if (pd->summary->old_prefs != NULL) { e_summary_preferences_free (pd->summary->old_prefs); pd->summary->old_prefs = NULL; } e_summary_preferences_save (pd->summary->preferences); - pd->summary->prefs_window = NULL; free_property_dialog (pd); } -/* Prototypes to shut gcc up */ -GtkWidget *e_summary_preferences_make_mail_table (PropertyData *pd); -GtkWidget *e_summary_preferences_make_rdf_table (PropertyData *pd); -GtkWidget *e_summary_preferences_make_weather_table (PropertyData *pd); -GtkWidget * -e_summary_preferences_make_mail_table (PropertyData *pd) -{ - return e_summary_table_new (g_hash_table_new (NULL, NULL)); -} - -GtkWidget * -e_summary_preferences_make_rdf_table (PropertyData *pd) +static BonoboObject * +factory_fn (BonoboGenericFactory *generic_factory, + void *data) { - return e_summary_table_new (g_hash_table_new (NULL, NULL)); -} - -GtkWidget * -e_summary_preferences_make_weather_table (PropertyData *pd) -{ - return e_summary_table_new (g_hash_table_new (NULL, NULL)); -} - -void -e_summary_configure (BonoboUIComponent *component, - gpointer userdata, - const char *cname) -{ - ESummary *summary = userdata; + ESummary *summary; PropertyData *pd; + GtkWidget *widget; - if (summary->prefs_window != NULL) { - gdk_window_raise (summary->prefs_window->window); - gdk_window_show (summary->prefs_window->window); - return; - } + summary = E_SUMMARY (data); pd = g_new0 (PropertyData, 1); gtk_object_ref (GTK_OBJECT (summary)); pd->summary = summary; - if (summary->old_prefs != NULL) { + if (summary->old_prefs != NULL) e_summary_preferences_free (summary->old_prefs); - } summary->old_prefs = e_summary_preferences_copy (summary->preferences); pd->xml = glade_xml_new (EVOLUTION_GLADEDIR "/my-evolution.glade", NULL); - g_return_if_fail (pd->xml != NULL); - - pd->box = GNOME_PROPERTY_BOX (glade_xml_get_widget (pd->xml, "dialog1")); - gtk_widget_hide (pd->box->help_button); - summary->prefs_window = GTK_WIDGET (pd->box); + g_return_val_if_fail (pd->xml != NULL, NULL); - gtk_window_set_title (GTK_WINDOW (pd->box), _("Summary Settings")); - if (make_property_dialog (pd) == FALSE) { + widget = glade_xml_get_widget (pd->xml, "notebook"); + if (widget == NULL || ! make_property_dialog (pd)) { g_warning ("Missing some part of XML file"); free_property_dialog (pd); - return; + return NULL; } - gtk_signal_connect (GTK_OBJECT (pd->box), "apply", - GTK_SIGNAL_FUNC (property_box_clicked_cb), pd); - gtk_signal_connect (GTK_OBJECT (pd->box), "destroy", - GTK_SIGNAL_FUNC (property_box_destroy_cb), pd); - gtk_widget_show (GTK_WIDGET (pd->box)); + gtk_widget_ref (widget); + gtk_container_remove (GTK_CONTAINER (widget->parent), widget); + + gtk_widget_show (widget); + pd->config_control = evolution_config_control_new (widget); + + gtk_widget_unref (widget); + + gtk_signal_connect (GTK_OBJECT (pd->config_control), "apply", + GTK_SIGNAL_FUNC (config_control_apply_cb), pd); + gtk_signal_connect (GTK_OBJECT (pd->config_control), "destroy", + GTK_SIGNAL_FUNC (config_control_destroy_cb), pd); + + return BONOBO_OBJECT (pd->config_control); } +gboolean +e_summary_preferences_register_config_control_factory (ESummary *summary) +{ + if (bonobo_generic_factory_new (FACTORY_ID, factory_fn, summary) == NULL) + return FALSE; + + return TRUE; +} diff --git a/my-evolution/e-summary-preferences.h b/my-evolution/e-summary-preferences.h index ea53db5113..fe226995a9 100644 --- a/my-evolution/e-summary-preferences.h +++ b/my-evolution/e-summary-preferences.h @@ -25,13 +25,14 @@ #include <bonobo/bonobo-ui-component.h> -gboolean e_summary_preferences_restore (ESummaryPrefs *prefs); -void e_summary_preferences_save (ESummaryPrefs *prefs); -void e_summary_preferences_free (ESummaryPrefs *prefs); -ESummaryPrefs *e_summary_preferences_copy (ESummaryPrefs *prefs); -void e_summary_configure (BonoboUIComponent *component, - gpointer userdata, - const char *cname); -void e_summary_preferences_init (ESummary *summary); + +gboolean e_summary_preferences_restore (ESummaryPrefs *prefs); +void e_summary_preferences_save (ESummaryPrefs *prefs); +void e_summary_preferences_free (ESummaryPrefs *prefs); +ESummaryPrefs *e_summary_preferences_copy (ESummaryPrefs *prefs); +void e_summary_preferences_init (ESummary *summary); + +gboolean e_summary_preferences_register_config_control_factory (ESummary *summary); + #endif diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index c4d53dac91..6db05c9700 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -495,7 +495,6 @@ e_summary_init (ESummary *summary) priv->protocol_hash = NULL; priv->connections = NULL; - summary->prefs_window = NULL; e_summary_preferences_init (summary); CORBA_exception_init (&ev); diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h index febd81c997..cb5a6ece91 100644 --- a/my-evolution/e-summary.h +++ b/my-evolution/e-summary.h @@ -114,7 +114,6 @@ struct _ESummary { GNOME_Evolution_ShellView shell_view_interface; - GtkWidget *prefs_window; gboolean online; char *timezone; diff --git a/my-evolution/my-evolution.glade b/my-evolution/my-evolution.glade index 2fad405d58..2c823e6f39 100644 --- a/my-evolution/my-evolution.glade +++ b/my-evolution/my-evolution.glade @@ -13,19 +13,20 @@ </project> <widget> - <class>GnomePropertyBox</class> - <name>dialog1</name> - <width>592</width> + <class>GtkWindow</class> + <name>window1</name> + <visible>False</visible> + <title>window2</title> + <type>GTK_WINDOW_TOPLEVEL</type> <position>GTK_WIN_POS_NONE</position> <modal>False</modal> <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> + <allow_grow>True</allow_grow> <auto_shrink>False</auto_shrink> <widget> <class>GtkNotebook</class> - <child_name>GnomePropertyBox:notebook</child_name> - <name>notebook2</name> + <name>notebook</name> <can_focus>True</can_focus> <show_tabs>True</show_tabs> <show_border>True</show_border> @@ -34,11 +35,6 @@ <tab_hborder>2</tab_hborder> <tab_vborder>2</tab_vborder> <popup_enable>False</popup_enable> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> <widget> <class>GtkVBox</class> |