diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in.in | 12 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 38 | ||||
-rw-r--r-- | calendar/gui/calendar-config-keys.h | 1 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 15 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 3 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 60 |
6 files changed, 71 insertions, 58 deletions
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in.in b/calendar/gui/apps_evolution_calendar.schemas.in.in index 4bdac3a82f..70e45dc057 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in.in @@ -230,7 +230,17 @@ <long>Position of the vertical pane, between the view and the date navigator calendar and task list in the month view, in pixels.</long> </locale> </schema> - + <schema> + <key>/schemas/apps/evolution/calendar/display/tag_vpane_position</key> + <applyto>/apps/evolution/calendar/display/tag_vpane_position</applyto> + <owner>evolution-calendar</owner> + <type>float</type> + <default>0.5</default> + <locale name="C"> + <short>Month view vertical pane position </short> + <long>Position of the vertical pane, between the view and the date navigator calendar and task list in the month view, in pixels.</long> + </locale> + </schema> <schema> <key>/schemas/apps/evolution/calendar/display/show_task_preview</key> <applyto>/apps/evolution/calendar/display/show_task_preview</applyto> diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 5b01f5563e..2cc987e31d 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -104,6 +104,8 @@ typedef struct EUserCreatableItemsHandler *creatable_items_handler; EActivityHandler *activity_handler; + + float vpane_pos; } CalendarComponentView; struct _CalendarComponentPrivate { @@ -127,6 +129,22 @@ struct _CalendarComponentPrivate { extern ECompEditorRegistry *comp_editor_registry; static void +calcomp_vpane_realized (GtkWidget *vpane, CalendarComponentView *view) +{ + gtk_paned_set_position (GTK_PANED (vpane), view->vpane_pos*vpane->allocation.height); +} + +static gboolean +calcomp_vpane_resized (GtkWidget *vpane, GdkEventButton *e, CalendarComponentView *view) +{ + + view->vpane_pos = gtk_paned_get_position (GTK_PANED (vpane)); + calendar_config_set_tag_vpane_pos (view->vpane_pos/(float)vpane->allocation.height); + + return FALSE; +} + +static void ensure_sources (CalendarComponent *component) { GSList *groups; @@ -1248,7 +1266,7 @@ create_component_view (CalendarComponent *calendar_component) { CalendarComponentPrivate *priv; CalendarComponentView *component_view; - GtkWidget *selector_scrolled_window, *vbox; + GtkWidget *selector_scrolled_window, *vbox, *vpane; GtkWidget *statusbar_widget; guint not; AtkObject *a11y; @@ -1258,9 +1276,16 @@ create_component_view (CalendarComponent *calendar_component) /* Create the calendar component view */ component_view = g_new0 (CalendarComponentView, 1); + vpane = gtk_vpaned_new (); + g_signal_connect_after (vpane, "realize", + G_CALLBACK(calcomp_vpane_realized), component_view); + g_signal_connect (vpane, "button_release_event", + G_CALLBACK (calcomp_vpane_resized), component_view); + gtk_widget_show (vpane); /* Add the source lists */ component_view->source_list = g_object_ref (priv->source_list); component_view->task_source_list = g_object_ref (priv->task_source_list); + component_view->vpane_pos = calendar_config_get_tag_vpane_pos (); /* Create sidebar selector */ component_view->source_selector = e_source_selector_new (calendar_component->priv->source_list); @@ -1298,8 +1323,10 @@ create_component_view (CalendarComponent *calendar_component) gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0); gtk_widget_show (vbox); - - component_view->sidebar_control = bonobo_control_new (vbox); + + gtk_paned_pack1 (GTK_PANED (vpane), vbox, FALSE, TRUE); + + component_view->sidebar_control = bonobo_control_new (vpane); /* Create main view */ component_view->view_control = control_factory_new_control (); @@ -1308,9 +1335,11 @@ create_component_view (CalendarComponent *calendar_component) return NULL; } - + component_view->calendar = (GnomeCalendar *) bonobo_control_get_widget (component_view->view_control); + gtk_paned_pack2 (GTK_PANED (vpane), gnome_calendar_get_tag (component_view->calendar), FALSE, TRUE); + /* This signal is thrown if backends die - we update the selector */ g_signal_connect (component_view->calendar, "source_added", G_CALLBACK (source_added_cb), component_view); @@ -1616,6 +1645,7 @@ calendar_component_init (CalendarComponent *component) component->priv = priv; ensure_sources (component); + if (!e_cal_get_sources (&priv->task_source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) ; } diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h index 80a1eca606..2f85954ab7 100644 --- a/calendar/gui/calendar-config-keys.h +++ b/calendar/gui/calendar-config-keys.h @@ -55,6 +55,7 @@ G_BEGIN_DECLS #define CALENDAR_CONFIG_VPANE_POS CALENDAR_CONFIG_PREFIX "/display/vpane_position" #define CALENDAR_CONFIG_MONTH_HPANE_POS CALENDAR_CONFIG_PREFIX "/display/month_hpane_position" #define CALENDAR_CONFIG_MONTH_VPANE_POS CALENDAR_CONFIG_PREFIX "/display/month_vpane_position" +#define CALENDAR_CONFIG_TAG_VPANE_POS CALENDAR_CONFIG_PREFIX "/display/tag_vpane_position" #define CALENDAR_CONFIG_TASK_PREVIEW CALENDAR_CONFIG_PREFIX "/display/show_task_preview" #define CALENDAR_CONFIG_TASK_VPANE_POS CALENDAR_CONFIG_PREFIX "/display/task_vpane_position" #define CALENDAR_CONFIG_COMPRESS_WEEKEND CALENDAR_CONFIG_PREFIX "/display/compress_weekend" diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 2377f237ed..2441b71010 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -808,6 +808,21 @@ calendar_config_set_month_vpane_pos (gint vpane_pos) gconf_client_set_int (config, CALENDAR_CONFIG_MONTH_VPANE_POS, vpane_pos, NULL); } +float +calendar_config_get_tag_vpane_pos (void) +{ + calendar_config_init (); + + return gconf_client_get_float (config, CALENDAR_CONFIG_TAG_VPANE_POS, NULL); +} + + +void +calendar_config_set_tag_vpane_pos (float vpane_pos) +{ + gconf_client_set_float (config, CALENDAR_CONFIG_TAG_VPANE_POS, vpane_pos, NULL); +} + /* The current list of task lists selected */ GSList * calendar_config_get_tasks_selected (void) diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index d4f6f9d52b..9b97c1e6c2 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -172,6 +172,9 @@ void calendar_config_set_month_hpane_pos (gint hpane_pos); gint calendar_config_get_month_vpane_pos (void); void calendar_config_set_month_vpane_pos (gint vpane_pos); +float calendar_config_get_tag_vpane_pos (void); +void calendar_config_set_tag_vpane_pos (float vpane_pos); + /* The current list of task lists selected */ GSList *calendar_config_get_tasks_selected (void); void calendar_config_set_tasks_selected (GSList *selected); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 06de9fe6d9..0e0b92c22a 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -114,7 +114,6 @@ struct _GnomeCalendarPrivate { GtkWidget *hpane; GtkWidget *notebook; - GtkWidget *vpane; ECalendar *date_navigator; EMiniCalendarConfig *date_navigator_config; @@ -155,9 +154,7 @@ struct _GnomeCalendarPrivate { calendar month widths & heights in the date navigator, so that they will work OK after theme changes. */ gint hpane_pos; - gint vpane_pos; gint hpane_pos_month_view; - gint vpane_pos_month_view; /* The signal handler id for our GtkCalendar "day_selected" handler. */ guint day_selected_id; @@ -218,8 +215,6 @@ static void update_view_times (GnomeCalendar *gcal, time_t start_time); static void gnome_calendar_update_date_navigator (GnomeCalendar *gcal); static void gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal); -static void gnome_calendar_vpane_realized (GtkWidget *w, GnomeCalendar *gcal); -static gboolean gnome_calendar_vpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal); static void gnome_calendar_date_navigator_scrolled (GtkWidget *widget, GdkEventScroll *event, gpointer user_data); static gboolean gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal); @@ -1226,9 +1221,7 @@ setup_config (GnomeCalendar *calendar) /* Pane positions */ priv->hpane_pos = calendar_config_get_hpane_pos (); - priv->vpane_pos = calendar_config_get_vpane_pos (); priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos (); - priv->vpane_pos_month_view = calendar_config_get_month_vpane_pos (); } static void @@ -1328,6 +1321,12 @@ view_done_cb (ECalModel *model, ECalendarStatus status, ECalSourceType type, Gno } +GtkWidget * +gnome_calendar_get_tag (GnomeCalendar *gcal) +{ + return gcal->priv->date_navigator; +} + static void setup_widgets (GnomeCalendar *gcal) { @@ -1368,15 +1367,6 @@ setup_widgets (GnomeCalendar *gcal) gtk_widget_show (priv->notebook); gtk_paned_pack1 (GTK_PANED (priv->hpane), priv->notebook, FALSE, TRUE); - /* The VPaned widget, to contain the GtkCalendar & ToDo list. */ - priv->vpane = gtk_vpaned_new (); - g_signal_connect_after (priv->vpane, "realize", - G_CALLBACK(gnome_calendar_vpane_realized), gcal); - g_signal_connect (priv->vpane, "button_release_event", - G_CALLBACK (gnome_calendar_vpane_resized), gcal); - gtk_widget_show (priv->vpane); - gtk_paned_pack2 (GTK_PANED (priv->hpane), priv->vpane, TRUE, TRUE); - /* The ECalendar. */ w = e_calendar_new (); priv->date_navigator = E_CALENDAR (w); @@ -1388,8 +1378,6 @@ setup_widgets (GnomeCalendar *gcal) (ECalendarItemGetTimeCallback) get_current_time, gcal, NULL); - gtk_paned_pack1 (GTK_PANED (priv->vpane), w, FALSE, TRUE); - g_signal_connect (priv->date_navigator->calitem, "selection_changed", G_CALLBACK (gnome_calendar_on_date_navigator_selection_changed), gcal); g_signal_connect (priv->date_navigator->calitem, "date_range_changed", @@ -1400,7 +1388,7 @@ setup_widgets (GnomeCalendar *gcal) /* The ToDo list. */ priv->todo = e_calendar_table_new (); priv->todo_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->todo)); - gtk_paned_pack2 (GTK_PANED (priv->vpane), priv->todo, TRUE, TRUE); + gtk_paned_pack2 (GTK_PANED (priv->hpane), priv->todo, TRUE, TRUE); gtk_widget_show (priv->todo); filename = g_build_filename (calendar_component_peek_config_directory (calendar_component_peek ()), @@ -2333,10 +2321,8 @@ gnome_calendar_set_pane_positions (GnomeCalendar *gcal) if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) { gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view); - gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view); } else { gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos); - gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos); } } @@ -3141,38 +3127,6 @@ gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal) } } -static void -gnome_calendar_vpane_realized (GtkWidget *w, GnomeCalendar *gcal) -{ - GnomeCalendarPrivate *priv; - - priv = gcal->priv; - - if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) { - gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view); - } else { - gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos); - } -} - -static gboolean -gnome_calendar_vpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal) -{ - GnomeCalendarPrivate *priv; - - priv = gcal->priv; - - if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) { - priv->vpane_pos_month_view = gtk_paned_get_position (GTK_PANED (priv->vpane)); - calendar_config_set_month_vpane_pos (priv->vpane_pos_month_view); - } else { - priv->vpane_pos = gtk_paned_get_position (GTK_PANED (priv->vpane)); - calendar_config_set_vpane_pos (priv->vpane_pos); - } - - return FALSE; -} - static void gnome_calendar_date_navigator_scrolled (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { |