diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-12-17 21:36:07 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-12-17 21:36:07 +0800 |
commit | 31641a0c2b522d5ac1da0a0764eadfce92400412 (patch) | |
tree | 9a6f56b85e41f519dc1c81248b2cb027dfb3a25d /calendar | |
parent | 2e449b7753660adbb8614a22fdf38e693e91ae86 (diff) | |
download | gsoc2013-evolution-31641a0c2b522d5ac1da0a0764eadfce92400412.tar.gz gsoc2013-evolution-31641a0c2b522d5ac1da0a0764eadfce92400412.tar.zst gsoc2013-evolution-31641a0c2b522d5ac1da0a0764eadfce92400412.zip |
call calendar_control_sensitize_calendar_commands when the primary
2003-12-17 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-component.c (update_uri_for_primary_selection): call
calendar_control_sensitize_calendar_commands when the primary selection
changes.
(impl_createControls): keep the view_control in the private structure and
use control_factory_new_control() to create the control.
(control_activate_cb): removed unneeded function.
* gui/tasks-component.c (impl_createControls): use tasks_control_new to
create the tasks view control.
(control_activate_cb): removed unneeded function.
svn path=/trunk/; revision=23962
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 39 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 34 |
3 files changed, 29 insertions, 55 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index eea7db533c..5b80430a7e 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2003-12-17 Rodrigo Moya <rodrigo@ximian.com> + * gui/calendar-component.c (update_uri_for_primary_selection): call + calendar_control_sensitize_calendar_commands when the primary selection + changes. + (impl_createControls): keep the view_control in the private structure and + use control_factory_new_control() to create the control. + (control_activate_cb): removed unneeded function. + + * gui/tasks-component.c (impl_createControls): use tasks_control_new to + create the tasks view control. + (control_activate_cb): removed unneeded function. + * gui/gnome-cal.c (gnome_calendar_add_event_uri): check the return value from e_cal_new_from_uri. diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 1cad66d98c..0efea35e82 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -33,6 +33,7 @@ #include "calendar-config.h" #include "calendar-component.h" #include "calendar-commands.h" +#include "control-factory.h" #include "gnome-cal.h" #include "migration.h" #include "e-comp-editor-registry.h" @@ -62,6 +63,8 @@ struct _CalendarComponentPrivate { GnomeCalendar *calendar; GtkWidget *source_selector; + BonoboControl *view_control; + ECal *create_ecal; GList *notifications; @@ -191,7 +194,9 @@ update_uri_for_primary_selection (CalendarComponent *calendar_component) uri = e_source_get_uri (source); gnome_calendar_set_default_uri (priv->calendar, uri); g_free (uri); - + + calendar_control_sensitize_calendar_commands (priv->view_control, priv->calendar, TRUE); + /* Save the selection for next time we start up */ calendar_config_set_primary_calendar (e_source_peek_uid (source)); } @@ -515,19 +520,6 @@ impl_finalize (GObject *object) /* Evolution::Component CORBA methods. */ static void -control_activate_cb (BonoboControl *control, gboolean activate, gpointer data) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - if (activate) - calendar_control_activate (control, gcal); - else - calendar_control_deactivate (control, gcal); -} - -static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_sidebar_control, Bonobo_Control *corba_view_control, @@ -539,7 +531,6 @@ impl_createControls (PortableServer_Servant servant, GtkWidget *selector_scrolled_window; GtkWidget *statusbar_widget; BonoboControl *sidebar_control; - BonoboControl *view_control; BonoboControl *statusbar_control; guint not; @@ -562,24 +553,14 @@ impl_createControls (PortableServer_Servant servant, /* Create main calendar view */ /* FIXME Instead of returning, we should make a control with a * label describing the problem */ - priv->calendar = GNOME_CALENDAR (gnome_calendar_new ()); - if (!priv->calendar) { - g_warning (G_STRLOC ": could not create the calendar widget!"); - bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed); - return; - } - - gtk_widget_show (GTK_WIDGET (priv->calendar)); - - view_control = bonobo_control_new (GTK_WIDGET (priv->calendar)); - if (!view_control) { + priv->view_control = control_factory_new_control (); + if (!priv->view_control) { g_warning (G_STRLOC ": could not create the control!"); bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed); return; } - g_object_set_data (G_OBJECT (priv->calendar), "control", view_control); - g_signal_connect (view_control, "activate", G_CALLBACK (control_activate_cb), priv->calendar); + priv->calendar = (GnomeCalendar *) bonobo_control_get_widget (priv->view_control); g_signal_connect_object (priv->source_selector, "selection_changed", G_CALLBACK (source_selection_changed_cb), @@ -611,7 +592,7 @@ impl_createControls (PortableServer_Servant servant, /* Return the controls */ *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); - *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev); + *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (priv->view_control), ev); *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev); } diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index db7864bdd7..bda28845e2 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -66,8 +66,10 @@ struct _TasksComponentPrivate { ETasks *tasks; GtkWidget *source_selector; + BonoboControl *view_control; + ECal *create_ecal; - + GList *notifications; }; @@ -478,17 +480,6 @@ impl_finalize (GObject *object) /* Evolution::Component CORBA methods */ static void -control_activate_cb (BonoboControl *control, gboolean activate, gpointer data) -{ - ETasks *tasks = data; - - if (activate) - tasks_control_activate (control, tasks); - else - tasks_control_deactivate (control, tasks); -} - -static void impl_createControls (PortableServer_Servant servant, Bonobo_Control *corba_sidebar_control, Bonobo_Control *corba_view_control, @@ -498,7 +489,7 @@ impl_createControls (PortableServer_Servant servant, TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant)); TasksComponentPrivate *priv; GtkWidget *selector_scrolled_window; - BonoboControl *sidebar_control, *view_control; + BonoboControl *sidebar_control; guint not; priv = component->priv; @@ -518,23 +509,14 @@ impl_createControls (PortableServer_Servant servant, sidebar_control = bonobo_control_new (selector_scrolled_window); /* create the tasks view */ - priv->tasks = E_TASKS (e_tasks_new ()); - if (!priv->tasks) { - g_warning (G_STRLOC ": could not create the control!"); - bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed); - return; - } - - gtk_widget_show (GTK_WIDGET (priv->tasks)); - - view_control = bonobo_control_new (GTK_WIDGET (priv->tasks)); - if (!view_control) { + priv->view_control = tasks_control_new (); + if (!priv->view_control) { g_warning (G_STRLOC ": could not create the control!"); bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed); return; } - g_signal_connect (view_control, "activate", G_CALLBACK (control_activate_cb), priv->tasks); + priv->tasks = (ETasks *) bonobo_control_get_widget (priv->view_control); g_signal_connect_object (priv->source_selector, "selection_changed", G_CALLBACK (source_selection_changed_cb), @@ -561,7 +543,7 @@ impl_createControls (PortableServer_Servant servant, /* Return the controls */ *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); - *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev); + *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (priv->view_control), ev); /* The tasks component doesn't use the status bar so just return an empty label. */ { |