diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-01-31 03:03:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-04-08 23:05:26 +0800 |
commit | 72797decc12602b181f69dba7c54df7a0d1b9326 (patch) | |
tree | ecd1314c92bc26b59647b351b2d47e446f4ed21d /calendar | |
parent | 3ba0b61f9f447b01c3a83bfb78ee33a45d413700 (diff) | |
download | gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.gz gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.bz2 gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.lz gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.xz gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.tar.zst gsoc2013-evolution-72797decc12602b181f69dba7c54df7a0d1b9326.zip |
Giant leap towards GSEAL compliance.
Diffstat (limited to 'calendar')
39 files changed, 875 insertions, 585 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index a6259d69ab..aa42987caa 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -232,6 +232,7 @@ dialog_destroyed_cb (GtkWidget *dialog, gpointer user_data) AlarmNotificationsDialog * notified_alarms_dialog_new (void) { + GtkWidget *container; GtkWidget *edit_btn; GtkWidget *snooze_btn; GtkWidget *image; @@ -298,8 +299,13 @@ notified_alarms_dialog_new (void) G_CALLBACK (tree_selection_changed_cb), an); gtk_widget_realize (an->dialog); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (an->dialog)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (an->dialog)->action_area), 12); + + container = gtk_dialog_get_action_area (GTK_DIALOG (an->dialog)); + gtk_container_set_border_width (GTK_CONTAINER (container), 12); + + container = gtk_dialog_get_content_area (GTK_DIALOG (an->dialog)); + gtk_container_set_border_width (GTK_CONTAINER (container), 0); + image = e_builder_get_widget (an->builder, "alarm-image"); gtk_image_set_from_icon_name ( GTK_IMAGE (image), "stock_alarm", GTK_ICON_SIZE_DIALOG); @@ -310,11 +316,7 @@ notified_alarms_dialog_new (void) g_signal_connect (G_OBJECT (an->dialog), "response", G_CALLBACK (dialog_response_cb), an); g_signal_connect (G_OBJECT (an->dialog), "destroy", G_CALLBACK (dialog_destroyed_cb), an); -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_realized (an->dialog)) -#else - if (!GTK_WIDGET_REALIZED (an->dialog)) -#endif gtk_widget_realize (an->dialog); gtk_window_set_icon_name (GTK_WINDOW (an->dialog), "stock_alarm"); diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 40853aa51b..afba3e4602 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -1654,6 +1654,7 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa, static void mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) { + GtkWidget *container; GtkWidget *dialog; GtkWidget *label; @@ -1674,7 +1675,9 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) "configured to send an email. Evolution will display\n" "a normal reminder dialog box instead.")); gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_box_pack_start (GTK_BOX (container), label, TRUE, TRUE, 4); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -1684,7 +1687,10 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) static gboolean procedure_notification_dialog (const gchar *cmd, const gchar *url) { - GtkWidget *dialog, *label, *checkbox; + GtkWidget *container; + GtkWidget *dialog; + GtkWidget *label; + GtkWidget *checkbox; gchar *str; gint btn; @@ -1708,15 +1714,15 @@ procedure_notification_dialog (const gchar *cmd, const gchar *url) gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - label, TRUE, TRUE, 4); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_box_pack_start (GTK_BOX (container), label, TRUE, TRUE, 4); g_free (str); checkbox = gtk_check_button_new_with_label (_("Do not ask me about this program again.")); gtk_widget_show (checkbox); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - checkbox, TRUE, TRUE, 4); + gtk_box_pack_start (GTK_BOX (container), checkbox, TRUE, TRUE, 4); /* Run the dialog */ btn = gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index a8fa9aef72..e8cbc72436 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -483,6 +483,7 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list) /* format is "str1\0str2\0...strN\0" */ GSList *p; GByteArray *array; + GdkAtom target; g_return_if_fail (data != NULL); @@ -497,7 +498,8 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list) g_byte_array_append (array, c, strlen ((const gchar *) c) + 1); } - gtk_selection_data_set (data, data->target, 8, array->data, array->len); + target = gtk_selection_data_get_target (data); + gtk_selection_data_set (data, target, 8, array->data, array->len); g_byte_array_free (array, TRUE); } @@ -512,17 +514,22 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list) * @return Newly allocated GSList of strings. **/ GSList * -cal_comp_selection_get_string_list (GtkSelectionData *data) +cal_comp_selection_get_string_list (GtkSelectionData *selection_data) { /* format is "str1\0str2\0...strN\0" */ gchar *inptr, *inend; GSList *list; + const guchar *data; + gint length; - g_return_val_if_fail (data != NULL, NULL); + g_return_val_if_fail (selection_data != NULL, NULL); + + data = gtk_selection_data_get_data (selection_data); + length = gtk_selection_data_get_length (selection_data); list = NULL; - inptr = (gchar *)data->data; - inend = (gchar *)(data->data + data->length); + inptr = (gchar *) data; + inend = (gchar *) (data + length); while (inptr < inend) { gchar *start = inptr; diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index f7d5443da0..9fe23fe525 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -1209,6 +1209,7 @@ gboolean alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) { Dialog dialog; + GtkWidget *container; gint response_id; g_return_val_if_fail (alarm != NULL, FALSE); @@ -1234,8 +1235,12 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) alarm_to_dialog (&dialog); gtk_widget_ensure_style (dialog.toplevel); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); + + container = gtk_dialog_get_action_area (GTK_DIALOG (dialog.toplevel)); + gtk_container_set_border_width (GTK_CONTAINER (container), 12); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog.toplevel)); + gtk_container_set_border_width (GTK_CONTAINER (container), 0); gtk_window_set_icon_name ( GTK_WINDOW (dialog.toplevel), "x-office-calendar"); diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index c350b4774d..b8588d666d 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -261,6 +261,7 @@ gboolean alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) { Dialog dialog; + GtkWidget *container; gint response_id; dialog.ecal = ecal; @@ -279,14 +280,19 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) sensitize_buttons (&dialog); gtk_widget_ensure_style (dialog.toplevel); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); + + container = gtk_dialog_get_action_area (GTK_DIALOG (dialog.toplevel)); + gtk_container_set_border_width (GTK_CONTAINER (container), 12); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog.toplevel)); + gtk_container_set_border_width (GTK_CONTAINER (container), 0); gtk_window_set_icon_name ( GTK_WINDOW (dialog.toplevel), "x-office-calendar"); - gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), - GTK_WINDOW (parent)); + gtk_window_set_transient_for ( + GTK_WINDOW (dialog.toplevel), + GTK_WINDOW (parent)); response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); gtk_widget_hide (dialog.toplevel); diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index be531314ee..ecdaf58762 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -166,12 +166,12 @@ delete_component_dialog (ECalComponent *comp, } static void -cb_toggled_cb (GtkWidget *toggle, gpointer data) +cb_toggled_cb (GtkToggleButton *toggle, gpointer data) { gboolean active = FALSE; GtkWidget *entry = (GtkWidget *) data; - active = GTK_TOGGLE_BUTTON (toggle)->active; + active = gtk_toggle_button_get_active (toggle); gtk_widget_set_sensitive (entry, active); } @@ -208,8 +208,8 @@ prompt_retract_dialog (ECalComponent *comp, gchar **retract_text, GtkWidget *par gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); - gtk_box_set_spacing ((GtkBox *) (GTK_DIALOG (dialog)->vbox), 12); - vbox = GTK_WIDGET (GTK_DIALOG (dialog)->vbox); + vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_box_set_spacing (GTK_BOX (vbox), 12); cb = gtk_check_button_new_with_mnemonic (_("_Delete this item from all other recipient's mailboxes?")); gtk_container_add (GTK_CONTAINER (vbox), cb); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 1a5f6d67fd..dd292eff99 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -108,6 +108,7 @@ create_schedule_page (CompEditor *editor) EventEditorPrivate *priv; ENameSelector *name_selector; CompEditorPage *page; + GtkWidget *content_area; priv = EVENT_EDITOR_GET_PRIVATE (editor); @@ -115,6 +116,9 @@ create_schedule_page (CompEditor *editor) _("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); + content_area = + gtk_dialog_get_content_area (GTK_DIALOG (priv->sched_window)); + g_signal_connect ( priv->sched_window, "response", G_CALLBACK (gtk_widget_hide), NULL); @@ -125,7 +129,7 @@ create_schedule_page (CompEditor *editor) priv->sched_page = schedule_page_new (priv->model, editor); page = COMP_EDITOR_PAGE (priv->sched_page); gtk_container_add ( - GTK_CONTAINER (GTK_DIALOG (priv->sched_window)->vbox), + GTK_CONTAINER (content_area), comp_editor_page_get_widget (page)); name_selector = event_page_get_name_selector (priv->event_page); @@ -267,6 +271,7 @@ event_editor_constructor (GType type, CompEditorPage *page; EventEditorPrivate *priv; GtkActionGroup *action_group; + GtkWidget *content_area; ECal *client; gboolean is_meeting; @@ -300,10 +305,13 @@ event_editor_constructor (GType type, priv->recur_window, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); + content_area = + gtk_dialog_get_content_area (GTK_DIALOG (priv->recur_window)); + priv->recur_page = recurrence_page_new (editor); page = COMP_EDITOR_PAGE (priv->recur_page); gtk_container_add ( - GTK_CONTAINER ((GTK_DIALOG (priv->recur_window)->vbox)), + GTK_CONTAINER (content_area), comp_editor_page_get_widget (page)); gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->recur_window))); comp_editor_append_page (editor, page, NULL, FALSE); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index a74cb64991..f3ae17db1e 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2133,6 +2133,7 @@ get_widgets (EventPage *epage) EventPagePrivate *priv; GSList *accel_groups; GtkAction *action; + GtkWidget *parent; GtkWidget *toplevel; GtkWidget *sw; @@ -2174,7 +2175,8 @@ get_widgets (EventPage *epage) priv->attendees_label = GW ("attendees-label"); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); priv->categories = GW ("categories"); priv->categories_btn = GW ("categories-button"); @@ -2455,11 +2457,7 @@ safe_to_process_date_changed_signal (GtkWidget *dedit_widget) entry = e_date_edit_get_entry (dedit); -#if GTK_CHECK_VERSION(2,19,7) return !entry || !gtk_widget_has_focus (entry); -#else - return !entry || !GTK_WIDGET_HAS_FOCUS (entry); -#endif } /* Callback used when the start date widget change. We check that the diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 269caba5d6..b8567a615a 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -765,6 +765,7 @@ get_widgets (MemoPage *mpage) MemoPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; + GtkWidget *parent; priv = mpage->priv; @@ -784,7 +785,8 @@ get_widgets (MemoPage *mpage) page->accel_group = g_object_ref (accel_groups->data); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); priv->info_hbox = GW ("generic-info"); priv->info_icon = GW ("generic-info-image"); diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index 0d9197546b..7793647723 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -40,6 +40,7 @@ recur_component_dialog (ECal *client, gchar *str; GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox; GtkWidget *placeholder, *vbox; + GtkWidget *content_area; ECalComponentVType vtype; gboolean ret; @@ -72,8 +73,10 @@ recur_component_dialog (ECal *client, g_free (str); gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + hbox = gtk_hbox_new (FALSE, 12); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); placeholder = gtk_label_new (""); gtk_widget_set_size_request (placeholder, 48, 48); @@ -105,7 +108,7 @@ recur_component_dialog (ECal *client, gtk_widget_show_all (hbox); placeholder = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), placeholder, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (content_area), placeholder, FALSE, FALSE, 0); gtk_widget_show (placeholder); ret = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK; diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 578f98929c..bd2eea61e9 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -532,6 +532,7 @@ sensitize_recur_widgets (RecurrencePage *rpage) CompEditor *editor; CompEditorFlags flags; gboolean recurs, sens = TRUE; + GtkWidget *child; GtkWidget *label; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); @@ -548,8 +549,9 @@ sensitize_recur_widgets (RecurrencePage *rpage) else gtk_widget_set_sensitive (priv->preview_calendar, TRUE && sens); - if (GTK_BIN (priv->custom_warning_bin)->child) - gtk_widget_destroy (GTK_BIN (priv->custom_warning_bin)->child); + child = gtk_bin_get_child (GTK_BIN (priv->custom_warning_bin)); + if (child != NULL) + gtk_widget_destroy (child); if (recurs && priv->custom) { gtk_widget_set_sensitive (priv->params, FALSE); @@ -681,7 +683,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) guint8 day_mask; gint i; - g_return_if_fail (GTK_BIN (priv->special)->child != NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) != NULL); g_return_if_fail (priv->weekday_picker != NULL); g_return_if_fail (IS_WEEKDAY_PICKER (priv->weekday_picker)); @@ -717,7 +719,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) enum month_num_options month_num; enum month_day_options month_day; - g_return_if_fail (GTK_BIN (priv->special)->child != NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) != NULL); g_return_if_fail (priv->month_day_combo != NULL); g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_day_combo)); g_return_if_fail (priv->month_num_combo != NULL); @@ -901,11 +903,7 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp) e_cal_component_set_exdate_list (comp, list); e_cal_component_free_exdate_list (list); -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (priv->ending_combo) && gtk_widget_get_sensitive (priv->ending_combo) && -#else - if (GTK_WIDGET_VISIBLE (priv->ending_combo) && GTK_WIDGET_IS_SENSITIVE (priv->ending_combo) && -#endif e_dialog_combo_box_get (priv->ending_combo, ending_types_map) == ENDING_UNTIL) { /* check whether the "until" date is in the future */ struct icaltimetype tt; @@ -950,7 +948,7 @@ make_weekly_special (RecurrencePage *rpage) priv = rpage->priv; - g_return_if_fail (GTK_BIN (priv->special)->child == NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) == NULL); g_return_if_fail (priv->weekday_picker == NULL); /* Create the widgets */ @@ -1228,7 +1226,7 @@ make_monthly_special (RecurrencePage *rpage) priv = rpage->priv; - g_return_if_fail (GTK_BIN (priv->special)->child == NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) == NULL); g_return_if_fail (priv->month_day_combo == NULL); /* Create the widgets */ @@ -1282,6 +1280,7 @@ make_recurrence_special (RecurrencePage *rpage) { RecurrencePagePrivate *priv; icalrecurrencetype_frequency frequency; + GtkWidget *child; priv = rpage->priv; @@ -1289,8 +1288,10 @@ make_recurrence_special (RecurrencePage *rpage) gtk_widget_destroy (priv->month_num_combo); priv->month_num_combo = NULL; } - if (GTK_BIN (priv->special)->child != NULL) { - gtk_widget_destroy (GTK_BIN (priv->special)->child); + + child = gtk_bin_get_child (GTK_BIN (priv->special)); + if (child != NULL) { + gtk_widget_destroy (child); priv->weekday_picker = NULL; priv->month_day_combo = NULL; @@ -1345,7 +1346,7 @@ make_ending_until_special (RecurrencePage *rpage) EDateEdit *de; ECalComponentDateTime dt_start; - g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->ending_special)) == NULL); g_return_if_fail (priv->ending_date_edit == NULL); editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); @@ -1394,7 +1395,7 @@ make_ending_count_special (RecurrencePage *rpage) priv = rpage->priv; - g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL); + g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->ending_special)) == NULL); g_return_if_fail (priv->ending_count_spin == NULL); /* Create the widgets */ @@ -1435,11 +1436,13 @@ make_ending_special (RecurrencePage *rpage) { RecurrencePagePrivate *priv; enum ending_type ending_type; + GtkWidget *child; priv = rpage->priv; - if (GTK_BIN (priv->ending_special)->child != NULL) { - gtk_widget_destroy (GTK_BIN (priv->ending_special)->child); + child = gtk_bin_get_child (GTK_BIN (priv->ending_special)); + if (child != NULL) { + gtk_widget_destroy (child); priv->ending_date_edit = NULL; priv->ending_count_spin = NULL; @@ -1985,6 +1988,7 @@ get_widgets (RecurrencePage *rpage) RecurrencePagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; + GtkWidget *parent; priv = rpage->priv; @@ -2002,7 +2006,8 @@ get_widgets (RecurrencePage *rpage) page->accel_group = g_object_ref (accel_groups->data); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); priv->recurs = GW ("recurs"); priv->params = GW ("params"); @@ -2096,7 +2101,8 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE); gtk_widget_show (*date_edit); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6); + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_box_pack_start (GTK_BOX (container), *date_edit, FALSE, TRUE, 6); return dialog; } diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 2e13cba1b9..7cd177e410 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -307,6 +307,7 @@ get_widgets (SchedulePage *spage) SchedulePagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; + GtkWidget *parent; priv = spage->priv; @@ -324,7 +325,8 @@ get_widgets (SchedulePage *spage) page->accel_group = g_object_ref (accel_groups->data); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); #undef GW diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index a42501c9d6..d69fd0bdc9 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -108,6 +108,7 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo ECalComponentVType vtype; const gchar *id; GtkWidget *dialog, *sa_checkbox = NULL, *ona_checkbox = NULL; + GtkWidget *content_area; gboolean res; if (strip_alarms) @@ -155,11 +156,12 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo } dialog = e_alert_dialog_new_for_args (parent, id, NULL); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); if (strip_alarms) - sa_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Send my alarms with this event")); + sa_checkbox = add_checkbox (GTK_BOX (content_area), _("Send my alarms with this event")); if (only_new_attendees) - ona_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Notify new attendees _only")); + ona_checkbox = add_checkbox (GTK_BOX (content_area), _("Notify new attendees _only")); res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES; diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index c549633eb5..f84b07ecd3 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -448,6 +448,7 @@ get_widgets (TaskDetailsPage *tdpage) TaskDetailsPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; + GtkWidget *parent; priv = tdpage->priv; @@ -465,7 +466,8 @@ get_widgets (TaskDetailsPage *tdpage) page->accel_group = g_object_ref (accel_groups->data); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); priv->status_combo = GW ("status-combobox"); priv->priority_combo = GW ("priority-combobox"); @@ -661,6 +663,7 @@ static void init_widgets (TaskDetailsPage *tdpage) { TaskDetailsPagePrivate *priv; + GtkAdjustment *adjustment; priv = tdpage->priv; @@ -677,13 +680,15 @@ init_widgets (TaskDetailsPage *tdpage) /* Connect signals. The Status, Percent Complete & Date Completed properties are closely related so whenever one changes we may need to update the other 2. */ - g_signal_connect (GTK_COMBO_BOX (priv->status_combo), - "changed", - G_CALLBACK (status_changed), tdpage); + g_signal_connect ( + GTK_COMBO_BOX (priv->status_combo), "changed", + G_CALLBACK (status_changed), tdpage); - g_signal_connect((GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), - "value_changed", - G_CALLBACK (percent_complete_changed), tdpage); + adjustment = gtk_spin_button_get_adjustment ( + GTK_SPIN_BUTTON (priv->percent_complete)); + g_signal_connect ( + adjustment, "value_changed", + G_CALLBACK (percent_complete_changed), tdpage); /* Priority */ g_signal_connect_swapped ( diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 7aaa3c5afe..dcb7b86a2b 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -307,6 +307,7 @@ task_editor_init (TaskEditor *te) CompEditor *editor = COMP_EDITOR (te); GtkUIManager *ui_manager; GtkActionGroup *action_group; + GtkWidget *content_area; const gchar *id; GError *error = NULL; @@ -331,8 +332,10 @@ task_editor_init (TaskEditor *te) G_CALLBACK(gtk_widget_hide), NULL); te->priv->task_details_page = task_details_page_new (editor); + content_area = gtk_dialog_get_content_area ( + GTK_DIALOG (te->priv->task_details_page)); gtk_container_add ( - GTK_CONTAINER (GTK_DIALOG (te->priv->task_details_window)->vbox), + GTK_CONTAINER (content_area), comp_editor_page_get_widget ((CompEditorPage *) te->priv->task_details_page)); gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (te->priv->task_details_window))); comp_editor_append_page ( diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 623260cf46..8ac3860fac 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1332,6 +1332,7 @@ get_widgets (TaskPage *tpage) TaskPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; + GtkWidget *parent; GtkWidget *sw; GtkTreeSelection *selection; @@ -1349,7 +1350,8 @@ get_widgets (TaskPage *tpage) page->accel_group = g_object_ref (accel_groups->data); g_object_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); + parent = gtk_widget_get_parent (priv->main); + gtk_container_remove (GTK_CONTAINER (parent), priv->main); priv->info_hbox = e_builder_get_widget (priv->builder, "generic-info"); priv->info_icon = e_builder_get_widget (priv->builder, "generic-info-image"); diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index 0747b55b59..915c970871 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -105,12 +105,12 @@ calendar_selector_data_dropped (ESourceSelector *selector, GtkTreePath *path = NULL; ECal *client; icalcomponent *icalcomp; - const gchar *string; + const guchar *data; gboolean success = FALSE; gpointer object = NULL; - string = (const gchar *) selection_data->data; - icalcomp = icalparser_parse_string (string); + data = gtk_selection_data_get_data (selection_data); + icalcomp = icalparser_parse_string ((const gchar *) data); if (icalcomp == NULL) goto exit; diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index d99de8ae50..48b29337d5 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -1652,39 +1652,42 @@ get_label (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone) void e_calendar_view_move_tip (GtkWidget *widget, gint x, gint y) { - GtkRequisition requisition; - gint w, h; - GdkScreen *screen; - GdkScreen *pointer_screen; - gint monitor_num, px, py; - GdkRectangle monitor; - - screen = gtk_widget_get_screen (widget); - - gtk_widget_size_request (widget, &requisition); - w = requisition.width; - h = requisition.height; - - gdk_display_get_pointer (gdk_screen_get_display (screen), - &pointer_screen, &px, &py, NULL); - if (pointer_screen != screen) - { - px = x; - py = y; - } - monitor_num = gdk_screen_get_monitor_at_point (screen, px, py); - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - - if ((x + w) > monitor.x + monitor.width) - x -= (x + w) - (monitor.x + monitor.width); - else if (x < monitor.x) - x = monitor.x; - - if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height) - y = y - h - 36; - - gtk_window_move (GTK_WINDOW (widget), x, y); - gtk_widget_show (widget); + GtkAllocation allocation; + GtkRequisition requisition; + gint w, h; + GdkScreen *screen; + GdkScreen *pointer_screen; + gint monitor_num, px, py; + GdkRectangle monitor; + + screen = gtk_widget_get_screen (widget); + + gtk_widget_size_request (widget, &requisition); + w = requisition.width; + h = requisition.height; + + gdk_display_get_pointer ( + gdk_screen_get_display (screen), + &pointer_screen, &px, &py, NULL); + if (pointer_screen != screen) { + px = x; + py = y; + } + monitor_num = gdk_screen_get_monitor_at_point (screen, px, py); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + if ((x + w) > monitor.x + monitor.width) + x -= (x + w) - (monitor.x + monitor.width); + else if (x < monitor.x) + x = monitor.x; + + gtk_widget_get_allocation (widget, &allocation); + + if ((y + h + allocation.height + 4) > monitor.y + monitor.height) + y = y - h - 36; + + gtk_window_move (GTK_WINDOW (widget), x, y); + gtk_widget_show (widget); } /** @@ -1787,6 +1790,7 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data) ECalendarViewEvent *pevent; GtkStyle *style = gtk_widget_get_default_style (); GtkWidget *widget = (GtkWidget *) g_object_get_data (G_OBJECT (data->cal_view), "tooltip-window"); + GdkWindow *window; ECalComponent *newcomp = e_cal_component_new (); icaltimezone *zone, *default_zone; ECal *client = NULL; @@ -1946,7 +1950,8 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data) e_calendar_view_move_tip (pevent->tooltip, pevent->x +16, pevent->y+16); - gdk_keyboard_grab (pevent->tooltip->window, FALSE, GDK_CURRENT_TIME); + window = gtk_widget_get_window (pevent->tooltip); + gdk_keyboard_grab (window, FALSE, GDK_CURRENT_TIME); g_signal_connect (pevent->tooltip, "key-press-event", G_CALLBACK (tooltip_grab), data->cal_view); pevent->timeout = -1; diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 11baebf67b..757d4e90fd 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -279,11 +279,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item, g_object_get (G_OBJECT (event->canvas_item), "x_offset", &text_x_offset, NULL); /* Draw shadow around the event when selected */ -#if GTK_CHECK_VERSION(2,19,7) if (is_editing && (gtk_widget_has_focus (day_view->main_canvas))) { -#else - if (is_editing && (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))) { -#endif /* For embossing Item selection */ item_x -= 1; item_y -= 2; @@ -1103,11 +1099,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item, if (can_draw_in_region (draw_region, rect_x, rect_y, rect_width, rect_height)) { cairo_save (cr); -#if GTK_CHECK_VERSION(2,19,7) gdk_cairo_set_source_color (cr, &day_view->colors[gtk_widget_has_focus (GTK_WIDGET (day_view)) ? E_DAY_VIEW_COLOR_BG_SELECTED : E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]); -#else - gdk_cairo_set_source_color (cr, &day_view->colors[GTK_WIDGET_HAS_FOCUS(day_view) ? E_DAY_VIEW_COLOR_BG_SELECTED : E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]); -#endif cairo_rectangle (cr, rect_x, rect_y, rect_width, rect_height); cairo_fill (cr); cairo_restore (cr); diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 6f7b8313c0..edc446ac25 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -853,6 +853,7 @@ static void e_day_view_time_item_on_button_press (EDayViewTimeItem *time_item, GdkEvent *event) { + GdkWindow *window; EDayView *day_view; GnomeCanvas *canvas; gint row; @@ -868,14 +869,12 @@ e_day_view_time_item_on_button_press (EDayViewTimeItem *time_item, if (row == -1) return; -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); - if (gdk_pointer_grab (GTK_LAYOUT (canvas)->bin_window, FALSE, + window = gtk_layout_get_bin_window (GTK_LAYOUT (canvas)); + + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->button.time) == 0) { diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 4012ba6289..c4d30d6e8f 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -581,6 +581,7 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, GtkStyle *style; GdkGC *fg_gc; gchar buffer[128]; + GtkAllocation allocation; GdkRectangle clip_rect; gint canvas_width, canvas_height, left_edge, day, date_width, date_x; gint item_height, event_num; @@ -598,7 +599,9 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, style = gtk_widget_get_style (GTK_WIDGET (day_view)); fg_gc = style->fg_gc[GTK_STATE_NORMAL]; - canvas_width = GTK_WIDGET (canvas_item->canvas)->allocation.width; + gtk_widget_get_allocation ( + GTK_WIDGET (canvas_item->canvas), &allocation); + canvas_width = allocation.width; canvas_height = (show_dates ? 1 : (MAX (1, day_view->rows_in_top_display) + 1)) * day_view->top_row_height; left_edge = 0; item_height = day_view->top_row_height - E_DAY_VIEW_TOP_CANVAS_Y_GAP; @@ -648,11 +651,7 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, cairo_restore (cr); /* Draw the selection background. */ -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_has_focus (GTK_WIDGET (day_view)) -#else - if (GTK_WIDGET_HAS_FOCUS (day_view) -#endif && day_view->selection_start_day != -1) { gint start_col, end_col, rect_x, rect_y, rect_w, rect_h; @@ -684,9 +683,11 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, e_day_view_top_item_get_day_label (day_view, day, buffer, sizeof (buffer)); clip_rect.x = day_view->day_offsets[day] - x; clip_rect.y = 2 - y; - if (day_view->days_shown == 1) - clip_rect.width = day_view->top_canvas->allocation.width - day_view->day_offsets[day]; - else + if (day_view->days_shown == 1) { + gtk_widget_get_allocation ( + day_view->top_canvas, &allocation); + clip_rect.width = allocation.width - day_view->day_offsets[day]; + } else clip_rect.width = day_view->day_widths[day]; clip_rect.height = item_height - 2; diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 477068800d..d2a21f0097 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -983,6 +983,8 @@ e_day_view_init (EDayView *day_view) { gint day; GnomeCanvasGroup *canvas_group; + GtkAdjustment *adjustment; + GtkLayout *layout; GtkWidget *w; GTK_WIDGET_SET_FLAGS (day_view, GTK_CAN_FOCUS); @@ -1241,8 +1243,10 @@ e_day_view_init (EDayView *day_view) * Times Canvas */ day_view->time_canvas = e_canvas_new (); - gtk_layout_set_vadjustment (GTK_LAYOUT (day_view->time_canvas), - GTK_LAYOUT (day_view->main_canvas)->vadjustment); + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + layout = GTK_LAYOUT (day_view->time_canvas); + gtk_layout_set_vadjustment (layout, adjustment); gtk_table_attach (GTK_TABLE (day_view), day_view->time_canvas, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -1261,16 +1265,22 @@ e_day_view_init (EDayView *day_view) /* * Scrollbar. */ - day_view->mc_hscrollbar = gtk_hscrollbar_new (GTK_LAYOUT (day_view->main_canvas)->hadjustment); + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_hadjustment (layout); + day_view->mc_hscrollbar = gtk_hscrollbar_new (adjustment); gtk_table_attach (GTK_TABLE (day_view), day_view->mc_hscrollbar, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); gtk_widget_show (day_view->mc_hscrollbar); - day_view->tc_vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (day_view->top_canvas)->vadjustment); + layout = GTK_LAYOUT (day_view->top_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + day_view->tc_vscrollbar = gtk_vscrollbar_new (adjustment); gtk_table_attach (GTK_TABLE (day_view), day_view->tc_vscrollbar, 2, 3, 0, 1, 0, GTK_FILL, 0, 0); /* gtk_widget_show (day_view->tc_vscrollbar); */ - day_view->vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (day_view->main_canvas)->vadjustment); + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + day_view->vscrollbar = gtk_vscrollbar_new (adjustment); gtk_table_attach (GTK_TABLE (day_view), day_view->vscrollbar, 2, 3, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (day_view->vscrollbar); @@ -1325,8 +1335,10 @@ static void e_day_view_on_canvas_realized (GtkWidget *widget, EDayView *day_view) { - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, - NULL, FALSE); + GdkWindow *window; + + window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + gdk_window_set_back_pixmap (window, NULL, FALSE); } /** @@ -1408,12 +1420,14 @@ e_day_view_realize (GtkWidget *widget) { EDayView *day_view; GdkColormap *colormap; + GdkWindow *window; if (GTK_WIDGET_CLASS (e_day_view_parent_class)->realize) (*GTK_WIDGET_CLASS (e_day_view_parent_class)->realize)(widget); day_view = E_DAY_VIEW (widget); - day_view->main_gc = gdk_gc_new (widget->window); + window = gtk_widget_get_window (widget); + day_view->main_gc = gdk_gc_new (window); colormap = gtk_widget_get_colormap (widget); @@ -1450,21 +1464,25 @@ e_day_view_realize (GtkWidget *widget) static void e_day_view_set_colors(EDayView *day_view, GtkWidget *widget) { - day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING] = widget->style->base[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING] = widget->style->bg[GTK_STATE_ACTIVE]; - day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED] = widget->style->base[GTK_STATE_SELECTED]; - day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED]; - day_view->colors[E_DAY_VIEW_COLOR_BG_GRID] = widget->style->dark[GTK_STATE_NORMAL]; + GtkStyle *style; + + style = gtk_widget_get_style (widget); + + day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING] = style->base[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING] = style->bg[GTK_STATE_ACTIVE]; + day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED] = style->base[GTK_STATE_SELECTED]; + day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED] = style->bg[GTK_STATE_SELECTED]; + day_view->colors[E_DAY_VIEW_COLOR_BG_GRID] = style->dark[GTK_STATE_NORMAL]; day_view->colors[E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY] = get_today_background (day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING]); - day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS] = widget->style->dark[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED] = widget->style->bg[GTK_STATE_SELECTED]; - day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID] = widget->style->light[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR] = widget->style->base[GTK_STATE_SELECTED]; - day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND] = widget->style->bg[GTK_STATE_ACTIVE]; - day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL]; - day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE] = widget->style->dark[GTK_STATE_PRELIGHT]; + day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS] = style->dark[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED] = style->bg[GTK_STATE_SELECTED]; + day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID] = style->light[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR] = style->base[GTK_STATE_SELECTED]; + day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND] = style->base[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND] = style->bg[GTK_STATE_ACTIVE]; + day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE] = style->dark[GTK_STATE_PRELIGHT]; } static void @@ -1499,6 +1517,7 @@ e_day_view_unrealize (GtkWidget *widget) static GdkColor e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget *widget) { + GtkStyle *style; GdkColor bg_color; guint16 red, green, blue; gdouble cc = 65535.0; @@ -1518,15 +1537,18 @@ e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget * } } + style = gtk_widget_get_style (widget); + if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 )) - return widget->style->black; + return style->black; else - return widget->style->white; + return style->white; } static void e_day_view_update_top_scroll (EDayView *day_view, gboolean scroll_to_top) { + GtkAllocation allocation; gint top_rows, top_canvas_height; gdouble old_x2, old_y2, new_x2, new_y2; @@ -1545,7 +1567,8 @@ e_day_view_update_top_scroll (EDayView *day_view, gboolean scroll_to_top) /* Set the scroll region of the top canvas */ gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->top_canvas), NULL, NULL, &old_x2, &old_y2); - new_x2 = day_view->top_canvas->allocation.width - 1; + gtk_widget_get_allocation (day_view->top_canvas, &allocation); + new_x2 = allocation.width - 1; new_y2 = (MAX (1, day_view->rows_in_top_display) + 1) * day_view->top_row_height - 1; if (old_x2 != new_x2 || old_y2 != new_y2) { gnome_canvas_set_scroll_region (GNOME_CANVAS (day_view->top_canvas), @@ -1581,6 +1604,7 @@ e_day_view_style_set (GtkWidget *widget, PangoFontMetrics *font_metrics; PangoLayout *layout; gint week_day, event_num; + GtkAdjustment *adjustment; EDayViewEvent *event; GdkColor color; @@ -1639,16 +1663,25 @@ e_day_view_style_set (GtkWidget *widget, PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)) + PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) + E_DAY_VIEW_EVENT_BORDER_HEIGHT + E_DAY_VIEW_EVENT_Y_PAD * 2 + 2 /* FIXME */; - day_view->row_height = MAX (day_view->row_height, E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2); - GTK_LAYOUT (day_view->main_canvas)->vadjustment->step_increment = day_view->row_height; + day_view->row_height = + MAX (day_view->row_height, + E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2); + + adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (day_view->main_canvas)); + gtk_adjustment_set_step_increment (adjustment, day_view->row_height); day_view->top_row_height = PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)) + PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT * 2 + E_DAY_VIEW_LONG_EVENT_Y_PAD * 2 + E_DAY_VIEW_TOP_CANVAS_Y_GAP; - day_view->top_row_height = MAX (day_view->top_row_height, E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2 + E_DAY_VIEW_TOP_CANVAS_Y_GAP); - GTK_LAYOUT (day_view->top_canvas)->vadjustment->step_increment = day_view->top_row_height; + day_view->top_row_height = + MAX (day_view->top_row_height, + E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2 + + E_DAY_VIEW_TOP_CANVAS_Y_GAP); + + adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (day_view->top_canvas)); + gtk_adjustment_set_step_increment (adjustment, day_view->top_row_height); gtk_widget_set_size_request (day_view->top_dates_canvas, -1, day_view->top_row_height - 2); e_day_view_update_top_scroll (day_view, TRUE); @@ -1795,11 +1828,14 @@ e_day_view_recalc_cell_sizes (EDayView *day_view) gint day, max_width; struct tm date_tm; gchar buffer[128]; + GtkAllocation allocation; PangoContext *pango_context; PangoLayout *layout; gint pango_width; - g_return_if_fail (((GtkWidget*)day_view)->style != NULL); + g_return_if_fail (gtk_widget_get_style (GTK_WIDGET (day_view)) != NULL); + + gtk_widget_get_allocation (day_view->main_canvas, &allocation); /* Set up Pango prerequisites */ pango_context = gtk_widget_get_pango_context (GTK_WIDGET (day_view)); @@ -1808,7 +1844,7 @@ e_day_view_recalc_cell_sizes (EDayView *day_view) /* Calculate the column sizes, using floating point so that pixels get divided evenly. Note that we use one more element than the number of columns, to make it easy to get the column widths. */ - width = day_view->main_canvas->allocation.width; + width = allocation.width; if (day_view->days_shown == 1) width = MAX (width, day_view->max_cols * (E_DAY_VIEW_MIN_DAY_COL_WIDTH + E_DAY_VIEW_GAP_WIDTH) - E_DAY_VIEW_MIN_DAY_COL_WIDTH - 1); width /= day_view->days_shown; @@ -2980,25 +3016,34 @@ e_day_view_recalc_work_week (EDayView *day_view) static gboolean e_day_view_update_scroll_regions (EDayView *day_view) { + GtkAllocation main_canvas_allocation; + GtkAllocation time_canvas_allocation; gdouble old_x2, old_y2, new_x2, new_y2; gboolean need_reshape = FALSE; + gtk_widget_get_allocation ( + day_view->main_canvas, &main_canvas_allocation); + gtk_widget_get_allocation ( + day_view->time_canvas, &time_canvas_allocation); + /* Set the scroll region of the time canvas to its allocated width, but with the height the same as the main canvas. */ - gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->time_canvas), - NULL, NULL, &old_x2, &old_y2); - new_x2 = day_view->time_canvas->allocation.width - 1; + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (day_view->time_canvas), + NULL, NULL, &old_x2, &old_y2); + new_x2 = time_canvas_allocation.width - 1; new_y2 = MAX (day_view->rows * day_view->row_height, - day_view->main_canvas->allocation.height) - 1; + main_canvas_allocation.height) - 1; if (old_x2 != new_x2 || old_y2 != new_y2) gnome_canvas_set_scroll_region (GNOME_CANVAS (day_view->time_canvas), 0, 0, new_x2, new_y2); /* Set the scroll region of the main canvas to its allocated width, but with the height depending on the number of rows needed. */ - gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->main_canvas), - NULL, NULL, &old_x2, &old_y2); - new_x2 = day_view->main_canvas->allocation.width - 1; + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (day_view->main_canvas), + NULL, NULL, &old_x2, &old_y2); + new_x2 = main_canvas_allocation.width - 1; if (day_view->days_shown == 1) new_x2 = MAX (new_x2, day_view->max_cols * (E_DAY_VIEW_MIN_DAY_COL_WIDTH + E_DAY_VIEW_GAP_WIDTH) - E_DAY_VIEW_MIN_DAY_COL_WIDTH - 1); @@ -3009,7 +3054,7 @@ e_day_view_update_scroll_regions (EDayView *day_view) 0, 0, new_x2, new_y2); } - if (new_x2 <= day_view->main_canvas->allocation.width - 1) + if (new_x2 <= main_canvas_allocation.width - 1) gtk_widget_hide (day_view->mc_hscrollbar); else gtk_widget_show (day_view->mc_hscrollbar); @@ -3074,6 +3119,11 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, { gint event_x, event_y, day, event_num; ECalendarViewPosition pos; + GtkLayout *layout; + GdkWindow *window; + + layout = GTK_LAYOUT (widget); + window = gtk_layout_get_bin_window (layout); if (day_view->resize_event_num != -1) day_view->resize_event_num = -1; @@ -3083,9 +3133,8 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, /* Convert the coords to the main canvas window, or return if the window is not found. */ - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, - GTK_LAYOUT (widget)->bin_window, - &event_x, &event_y)) + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) event, window, &event_x, &event_y)) return FALSE; pos = e_day_view_convert_position_in_top_canvas (day_view, @@ -3120,14 +3169,10 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, return TRUE; } -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); - if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE, + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time) == 0) { @@ -3137,11 +3182,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, e_day_view_start_selection (day_view, day, -1); } } else if (event->button == 3) { -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); if (day < day_view->selection_start_day || day > day_view->selection_end_day) { @@ -3215,11 +3256,16 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, { gint event_x, event_y, row, day, event_num; ECalendarViewPosition pos; + GtkLayout *layout; + GdkWindow *window; #if 0 g_print ("In e_day_view_on_main_canvas_button_press\n"); #endif + layout = GTK_LAYOUT (widget); + window = gtk_layout_get_bin_window (layout); + if (day_view->resize_event_num != -1) day_view->resize_event_num = -1; @@ -3228,9 +3274,8 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, /* Convert the coords to the main canvas window, or return if the window is not found. */ - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, - GTK_LAYOUT (widget)->bin_window, - &event_x, &event_y)) + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) event, window, &event_x, &event_y)) return FALSE; /* Find out where the mouse is. */ @@ -3266,14 +3311,10 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, return TRUE; } -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view)) && !gtk_widget_has_focus (GTK_WIDGET (day_view->main_canvas))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view) && !GTK_WIDGET_HAS_FOCUS (day_view->main_canvas)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); - if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE, + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time) == 0) { @@ -3284,11 +3325,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, g_signal_emit_by_name (day_view, "selected_time_changed"); } } else if (event->button == 3) { -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); if ((day < day_view->selection_start_day || day > day_view->selection_end_day) @@ -3446,6 +3483,8 @@ e_day_view_on_long_event_click (EDayView *day_view, gint event_y) { EDayViewEvent *event; + GtkLayout *layout; + GdkWindow *window; gint start_day, end_day, day; gint item_x, item_y, item_w, item_h; @@ -3471,14 +3510,13 @@ e_day_view_on_long_event_click (EDayView *day_view, /* Grab the keyboard focus, so the event being edited is saved and we can use the Escape key to abort the resize. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); - if (gdk_pointer_grab (GTK_LAYOUT (day_view->top_canvas)->bin_window, FALSE, + layout = GTK_LAYOUT (day_view->top_canvas); + window = gtk_layout_get_bin_window (layout); + + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, bevent->time) == 0) { @@ -3521,6 +3559,8 @@ e_day_view_on_event_click (EDayView *day_view, gint event_y) { EDayViewEvent *event; + GtkLayout *layout; + GdkWindow *window; gint tmp_day, row, start_row; event = &g_array_index (day_view->events[day], EDayViewEvent, @@ -3545,14 +3585,13 @@ e_day_view_on_event_click (EDayView *day_view, /* Grab the keyboard focus, so the event being edited is saved and we can use the Escape key to abort the resize. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (day_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (day_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (day_view)); - if (gdk_pointer_grab (GTK_LAYOUT (day_view->main_canvas)->bin_window, FALSE, + layout = GTK_LAYOUT (day_view->main_canvas); + window = gtk_layout_get_bin_window (layout); + + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, bevent->time) == 0) { @@ -3791,16 +3830,18 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, gint event_x, event_y, canvas_x, canvas_y; gint day, event_num; GdkCursor *cursor; + GdkWindow *window; #if 0 g_print ("In e_day_view_on_top_canvas_motion\n"); #endif + window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + /* Convert the coords to the main canvas window, or return if the window is not found. */ - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) mevent, - GTK_LAYOUT (widget)->bin_window, - &event_x, &event_y)) + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) mevent, window, &event_x, &event_y)) return FALSE; canvas_x = event_x; @@ -3867,8 +3908,12 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, /* Only set the cursor if it is different to last one set. */ if (day_view->last_cursor_set_in_top_canvas != cursor) { + GdkWindow *window; + day_view->last_cursor_set_in_top_canvas = cursor; - gdk_window_set_cursor (widget->window, cursor); + + window = gtk_widget_get_window (widget); + gdk_window_set_cursor (window, cursor); } if (event && E_IS_TEXT (event->canvas_item) && E_TEXT (event->canvas_item)->editing) { @@ -3888,17 +3933,19 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, ECalendarViewPosition pos; gint event_x, event_y, canvas_x, canvas_y; gint row, day, event_num; + GdkWindow *window; GdkCursor *cursor; #if 0 g_print ("In e_day_view_on_main_canvas_motion\n"); #endif + window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + /* Convert the coords to the main canvas window, or return if the window is not found. */ - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) mevent, - GTK_LAYOUT (widget)->bin_window, - &event_x, &event_y)) + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) mevent, window, &event_x, &event_y)) return FALSE; canvas_x = event_x; @@ -3974,8 +4021,12 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, /* Only set the cursor if it is different to last one set. */ if (day_view->last_cursor_set_in_main_canvas != cursor) { + GdkWindow *window; + day_view->last_cursor_set_in_main_canvas = cursor; - gdk_window_set_cursor (widget->window, cursor); + + window = gtk_widget_get_window (widget); + gdk_window_set_cursor (window, cursor); } if (event && E_IS_TEXT (event->canvas_item) && E_TEXT (event->canvas_item)->editing) { @@ -4390,6 +4441,7 @@ e_day_view_finish_resize (EDayView *day_view) static void e_day_view_abort_resize (EDayView *day_view) { + GdkWindow *window; gint day, event_num; if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE) @@ -4405,16 +4457,16 @@ e_day_view_abort_resize (EDayView *day_view) gtk_widget_queue_draw (day_view->top_canvas); day_view->last_cursor_set_in_top_canvas = day_view->normal_cursor; - gdk_window_set_cursor (day_view->top_canvas->window, - day_view->normal_cursor); + window = gtk_widget_get_window (day_view->top_canvas); + gdk_window_set_cursor (window, day_view->normal_cursor); } else { e_day_view_reshape_day_event (day_view, day, event_num); e_day_view_reshape_main_canvas_resize_bars (day_view); gtk_widget_queue_draw (day_view->main_canvas); day_view->last_cursor_set_in_main_canvas = day_view->normal_cursor; - gdk_window_set_cursor (day_view->main_canvas->window, - day_view->normal_cursor); + window = gtk_widget_get_window (day_view->main_canvas); + gdk_window_set_cursor (window, day_view->normal_cursor); } } @@ -5843,24 +5895,50 @@ static void e_day_view_scroll (EDayView *day_view, gfloat pages_to_scroll) { - GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment; - gfloat new_value; + GtkLayout *layout; + GtkAdjustment *adjustment; + gdouble new_value; + gdouble page_size; + gdouble lower; + gdouble upper; + gdouble value; + + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + + page_size = gtk_adjustment_get_page_size (adjustment); + lower = gtk_adjustment_get_lower (adjustment); + upper = gtk_adjustment_get_upper (adjustment); + value = gtk_adjustment_get_value (adjustment); - new_value = adj->value - adj->page_size * pages_to_scroll; - new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); - gtk_adjustment_set_value (adj, new_value); + new_value = value - page_size * pages_to_scroll; + new_value = CLAMP (new_value, lower, upper - page_size); + gtk_adjustment_set_value (adjustment, new_value); } static void e_day_view_top_scroll (EDayView *day_view, gfloat pages_to_scroll) { - GtkAdjustment *adj = GTK_LAYOUT (day_view->top_canvas)->vadjustment; - gfloat new_value; + GtkLayout *layout; + GtkAdjustment *adjustment; + gdouble new_value; + gdouble page_size; + gdouble lower; + gdouble upper; + gdouble value; - new_value = adj->value - adj->page_size * pages_to_scroll; - new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); - gtk_adjustment_set_value (adj, new_value); + layout = GTK_LAYOUT (day_view->top_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + + page_size = gtk_adjustment_get_page_size (adjustment); + lower = gtk_adjustment_get_lower (adjustment); + upper = gtk_adjustment_get_upper (adjustment); + value = gtk_adjustment_get_value (adjustment); + + new_value = value - page_size * pages_to_scroll; + new_value = CLAMP (new_value, lower, upper - page_size); + gtk_adjustment_set_value (adjustment, new_value); } void @@ -5868,14 +5946,20 @@ e_day_view_ensure_rows_visible (EDayView *day_view, gint start_row, gint end_row) { - GtkAdjustment *adj; - gfloat value, min_value, max_value; + GtkLayout *layout; + GtkAdjustment *adjustment; + gdouble max_value; + gdouble min_value; + gdouble page_size; + gdouble value; - adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment; + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_vadjustment (layout); - value = adj->value; + value = gtk_adjustment_get_value (adjustment); + page_size = gtk_adjustment_get_page_size (adjustment); - min_value = (end_row + 1) * day_view->row_height - adj->page_size; + min_value = (end_row + 1) * day_view->row_height - page_size; if (value < min_value) value = min_value; @@ -5883,10 +5967,7 @@ e_day_view_ensure_rows_visible (EDayView *day_view, if (value > max_value) value = max_value; - if (value != adj->value) { - adj->value = value; - gtk_adjustment_value_changed (adj); - } + gtk_adjustment_set_value (adjustment, value); } static void @@ -6115,6 +6196,8 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, gint event_x, event_y, row, day, event_num; ECalendarViewPosition pos; gboolean main_canvas = TRUE; + GdkWindow *window; + GtkLayout *layout; if (day_view->editing_event_num != -1) break; @@ -6127,13 +6210,19 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, /* Convert the coords to the main canvas window, or return if the window is not found. */ - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, - GTK_LAYOUT (day_view->main_canvas)->bin_window, - &event_x, &event_y)) { + layout = GTK_LAYOUT (day_view->main_canvas); + window = gtk_layout_get_bin_window (layout); + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) event, + window, &event_x, &event_y)) { + main_canvas = FALSE; - if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, - GTK_LAYOUT (day_view->top_canvas)->bin_window, - &event_x, &event_y)) { + + layout = GTK_LAYOUT (day_view->top_canvas); + window = gtk_layout_get_bin_window (layout); + if (!e_day_view_convert_event_coords ( + day_view, (GdkEvent*) event, + window, &event_x, &event_y)) { return FALSE; } } @@ -6426,6 +6515,7 @@ static void e_day_view_on_editing_started (EDayView *day_view, GnomeCanvasItem *item) { + GtkAllocation allocation; gint day, event_num; if (!e_day_view_find_event_from_item (day_view, item, @@ -6448,6 +6538,8 @@ e_day_view_on_editing_started (EDayView *day_view, day_view->editing_event_day = day; day_view->editing_event_num = event_num; + gtk_widget_get_allocation (day_view->top_canvas, &allocation); + if (day == E_DAY_VIEW_LONG_EVENT) { gint item_x, item_y, item_w, item_h, scroll_y; gint start_day, end_day; @@ -6458,11 +6550,16 @@ e_day_view_on_editing_started (EDayView *day_view, &start_day, &end_day, &item_x, &item_y, &item_w, &item_h)) { + GtkLayout *layout; + GtkAdjustment *adjustment; + + layout = GTK_LAYOUT (day_view->top_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + /* and ensure it's visible too */ /*item_y = (event_num * (day_view->top_row_height + 1)) - 1;*/ - scroll_y = gtk_adjustment_get_value (GTK_LAYOUT (day_view->top_canvas)->vadjustment); - if (item_y + day_view->top_row_height > day_view->top_canvas->allocation.height + scroll_y || - item_y < scroll_y) + scroll_y = gtk_adjustment_get_value (adjustment); + if (item_y + day_view->top_row_height > allocation.height + scroll_y || item_y < scroll_y) gnome_canvas_scroll_to (GNOME_CANVAS (day_view->top_canvas), 0, item_y); } } else { @@ -6723,6 +6820,7 @@ e_day_view_check_auto_scroll (EDayView *day_view, gint event_x, gint event_y) { + GtkAllocation allocation; gint scroll_x, scroll_y; gnome_canvas_get_scroll_offsets (GNOME_CANVAS (day_view->main_canvas), @@ -6734,10 +6832,11 @@ e_day_view_check_auto_scroll (EDayView *day_view, day_view->last_mouse_x = event_x; day_view->last_mouse_y = event_y; + gtk_widget_get_allocation (day_view->main_canvas, &allocation); + if (event_y < E_DAY_VIEW_AUTO_SCROLL_OFFSET) e_day_view_start_auto_scroll (day_view, TRUE); - else if (event_y >= day_view->main_canvas->allocation.height - - E_DAY_VIEW_AUTO_SCROLL_OFFSET) + else if (event_y >= allocation.height - E_DAY_VIEW_AUTO_SCROLL_OFFSET) e_day_view_start_auto_scroll (day_view, FALSE); else e_day_view_stop_auto_scroll (day_view); @@ -6769,7 +6868,11 @@ e_day_view_auto_scroll_handler (gpointer data) EDayView *day_view; ECalendarViewPosition pos; gint scroll_x, scroll_y, new_scroll_y, canvas_x, canvas_y, row, day; - GtkAdjustment *adj; + GtkAdjustment *adjustment; + GtkLayout *layout; + gdouble step_increment; + gdouble page_size; + gdouble upper; g_return_val_if_fail (E_IS_DAY_VIEW (data), FALSE); @@ -6786,13 +6889,18 @@ e_day_view_auto_scroll_handler (gpointer data) gnome_canvas_get_scroll_offsets (GNOME_CANVAS (day_view->main_canvas), &scroll_x, &scroll_y); - adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment; + layout = GTK_LAYOUT (day_view->main_canvas); + adjustment = gtk_layout_get_vadjustment (layout); + + step_increment = gtk_adjustment_get_step_increment (adjustment); + page_size = gtk_adjustment_get_page_size (adjustment); + upper = gtk_adjustment_get_upper (adjustment); if (day_view->auto_scroll_up) - new_scroll_y = MAX (scroll_y - adj->step_increment, 0); + new_scroll_y = MAX (scroll_y - step_increment, 0); else - new_scroll_y = MIN (scroll_y + adj->step_increment, - adj->upper - adj->page_size); + new_scroll_y = MIN (scroll_y + step_increment, + upper - page_size); if (new_scroll_y != scroll_y) { /* NOTE: This reduces flicker, but only works if we don't use @@ -6950,9 +7058,12 @@ e_day_view_get_long_event_position (EDayView *day_view, } *item_x = day_view->day_offsets[*start_day] + E_DAY_VIEW_BAR_WIDTH; - if (day_view->days_shown == 1) - *item_w = day_view->top_canvas->allocation.width; - else + if (day_view->days_shown == 1) { + GtkAllocation allocation; + + gtk_widget_get_allocation (day_view->top_canvas, &allocation); + *item_w = allocation.width; + } else *item_w = day_view->day_offsets[*end_day + 1]; *item_w = MAX (*item_w - *item_x - E_DAY_VIEW_GAP_WIDTH, 0); *item_y = (event->start_row_or_col) * day_view->top_row_height; @@ -7561,15 +7672,17 @@ e_day_view_on_drag_data_get (GtkWidget *widget, if (comp_str) { ESource *source = e_cal_get_source (event->comp_data->client); const gchar *source_uid = e_source_peek_uid (source); + GdkAtom target; gchar *tmp; if (!source_uid) source_uid = ""; tmp = g_strconcat (source_uid, "\n", comp_str, NULL); + target = gtk_selection_data_get_target (selection_data); gtk_selection_data_set ( - selection_data, selection_data->target, - 8, (guchar *) tmp, strlen (tmp)); + selection_data, target, 8, + (guchar *) tmp, strlen (tmp)); g_free (tmp); } @@ -7583,7 +7696,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, - GtkSelectionData *data, + GtkSelectionData *selection_data, guint info, guint time, EDayView *day_view) @@ -7599,6 +7712,12 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, gboolean all_day_event; ECal *client; gboolean drag_from_same_window; + const guchar *data; + gint format, length; + + data = gtk_selection_data_get_data (selection_data); + format = gtk_selection_data_get_format (selection_data); + length = gtk_selection_data_get_length (selection_data); if (day_view->drag_event_day != -1) drag_from_same_window = TRUE; @@ -7608,8 +7727,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view))); /* Note that we only support DnD within the EDayView at present. */ - if ((data->length >= 0) && (data->format == 8) - && (day_view->drag_event_day != -1)) { + if (length >= 0 && format == 8 && day_view->drag_event_day != -1) { /* We are dragging in the same window */ pos = e_day_view_convert_position_in_top_canvas (day_view, @@ -7735,11 +7853,9 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, } } - if ((data->length >= 0) && (data->format == 8) - && !drag_from_same_window) { + if (length >= 0 && format == 8 && !drag_from_same_window) { /* We are dragging between different window */ - gchar *comp_str; icalcomponent *icalcomp; icalcomponent_kind kind; time_t dtstart; @@ -7751,8 +7867,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, if (pos == E_CALENDAR_VIEW_POS_OUTSIDE) goto error; - comp_str = (gchar *) data->data; - icalcomp = icalparser_parse_string ((const gchar *) comp_str); + icalcomp = icalparser_parse_string ((const gchar *) data); if (!icalcomp) goto error; @@ -7808,7 +7923,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, - GtkSelectionData *data, + GtkSelectionData *selection_data, guint info, guint time, EDayView *day_view) @@ -7823,6 +7938,12 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, time_t dt; ECal *client; gboolean drag_from_same_window; + const guchar *data; + gint format, length; + + data = gtk_selection_data_get_data (selection_data); + format = gtk_selection_data_get_format (selection_data); + length = gtk_selection_data_get_length (selection_data); if (day_view->drag_event_day != -1) drag_from_same_window = TRUE; @@ -7837,8 +7958,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, y += scroll_y; /* Note that we only support DnD within the EDayView at present. */ - if ((data->length >= 0) && (data->format == 8) - && (day_view->drag_event_day != -1)) { + if (length >= 0 && format == 8 && (day_view->drag_event_day != -1)) { /* We are dragging in the same window */ pos = e_day_view_convert_position_in_main_canvas (day_view, @@ -7940,11 +8060,9 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, } } - if ((data->length >= 0) && (data->format == 8) - && !drag_from_same_window) { + if (length >= 0 && format == 8 && !drag_from_same_window) { /* We are dragging between different window */ - gchar *comp_str; icalcomponent *icalcomp; icalcomponent_kind kind; time_t dtstart; @@ -7956,8 +8074,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, if (pos == E_CALENDAR_VIEW_POS_OUTSIDE) goto error; - comp_str = (gchar *) data->data; - icalcomp = icalparser_parse_string ((const gchar *) comp_str); + icalcomp = icalparser_parse_string ((const gchar *) data); if (!icalcomp) goto error; diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 6c4c2ad8dc..c7c81e12ce 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -203,7 +203,7 @@ e_meeting_time_selector_item_realize (GnomeCanvasItem *item) mts_item = E_MEETING_TIME_SELECTOR_ITEM (item); canvas = item->canvas; - window = GTK_WIDGET (canvas)->window; + window = gtk_widget_get_window (GTK_WIDGET (canvas)); mts_item->main_gc = gdk_gc_new (window); mts_item->stipple_gc = gdk_gc_new (window); @@ -976,8 +976,14 @@ e_meeting_time_selector_item_motion_notify (EMeetingTimeSelectorItem *mts_item, /* Only set the cursor if it is different to the last one we set. */ if (mts_item->last_cursor_set != cursor) { + GdkWindow *window; + GnomeCanvas *canvas; + mts_item->last_cursor_set = cursor; - gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas)->window, cursor); + + canvas = GNOME_CANVAS_ITEM (mts_item)->canvas; + window = gtk_widget_get_window (GTK_WIDGET (canvas)); + gdk_window_set_cursor (window, cursor); } return FALSE; @@ -1043,7 +1049,12 @@ e_meeting_time_selector_item_calculate_busy_range (EMeetingTimeSelector *mts, void e_meeting_time_selector_item_set_normal_cursor (EMeetingTimeSelectorItem *mts_item) { + GnomeCanvas *canvas; + GdkWindow *window; + g_return_if_fail (IS_E_MEETING_TIME_SELECTOR_ITEM (mts_item)); - gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas)->window, mts_item->normal_cursor); + canvas = GNOME_CANVAS_ITEM (mts_item)->canvas; + window = gtk_widget_get_window (GTK_WIDGET (canvas)); + gdk_window_set_cursor (window, mts_item->normal_cursor); } diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 1401bee284..1511482b6b 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -133,9 +133,9 @@ static void e_meeting_time_selector_options_menu_position_callback (GtkMenu *men gint *y, gboolean *push_in, gpointer user_data); -static void e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *button, +static void e_meeting_time_selector_on_zoomed_out_toggled (GtkCheckMenuItem *button, EMeetingTimeSelector *mts); -static void e_meeting_time_selector_on_working_hours_toggled (GtkWidget *button, +static void e_meeting_time_selector_on_working_hours_toggled (GtkCheckMenuItem *menuitem, EMeetingTimeSelector *mts); static void e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button, EMeetingTimeSelector *mts); @@ -403,6 +403,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em { GtkWidget *hbox, *vbox, *separator, *label, *table, *sw; GtkWidget *alignment, *child_hbox, *arrow, *menuitem; + GtkWidget *child; + GtkAdjustment *adjustment; + GtkLayout *layout; GSList *group; guint accel_key; time_t meeting_start_time; @@ -473,7 +476,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); - gtk_widget_set_child_visible (GTK_SCROLLED_WINDOW (sw)->vscrollbar, FALSE); + gtk_widget_set_child_visible ( + gtk_scrolled_window_get_vscrollbar ( + GTK_SCROLLED_WINDOW (sw)), FALSE); gtk_widget_show (sw); gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (mts->list_view)); @@ -512,18 +517,26 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em g_signal_connect (mts->display_main, "scroll-event", G_CALLBACK (e_meeting_time_selector_on_canvas_scroll_event), mts); - gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (sw), GTK_LAYOUT (mts->display_main)->vadjustment); + layout = GTK_LAYOUT (mts->display_main); - mts->hscrollbar = gtk_hscrollbar_new (GTK_LAYOUT (mts->display_main)->hadjustment); - GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->day_width; - gtk_table_attach (GTK_TABLE (mts), mts->hscrollbar, - 1, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); + adjustment = gtk_layout_get_vadjustment (layout); + gtk_scrolled_window_set_vadjustment ( + GTK_SCROLLED_WINDOW (sw), adjustment); + + adjustment = gtk_layout_get_hadjustment (layout); + mts->hscrollbar = gtk_hscrollbar_new (adjustment); + gtk_adjustment_set_step_increment (adjustment, mts->day_width); + gtk_table_attach ( + GTK_TABLE (mts), mts->hscrollbar, + 1, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_widget_show (mts->hscrollbar); - mts->vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (mts->display_main)->vadjustment); - GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height; - gtk_table_attach (GTK_TABLE (mts), mts->vscrollbar, - 4, 5, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0); + adjustment = gtk_layout_get_vadjustment (layout); + mts->vscrollbar = gtk_vscrollbar_new (adjustment); + gtk_adjustment_set_step_increment (adjustment, mts->row_height); + gtk_table_attach ( + GTK_TABLE (mts), mts->vscrollbar, + 4, 5, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (mts->vscrollbar); /* Create the item in the top canvas. */ @@ -600,7 +613,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em e_meeting_time_selector_options_menu_detacher); menuitem = gtk_check_menu_item_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _only working hours")); + child = gtk_bin_get_child (GTK_BIN (menuitem)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Show _only working hours")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), mts->working_hours_only); @@ -610,7 +624,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_widget_show (menuitem); menuitem = gtk_check_menu_item_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _zoomed out")); + child = gtk_bin_get_child (GTK_BIN (menuitem)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Show _zoomed out")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), mts->zoomed_out); @@ -625,7 +640,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_widget_show (menuitem); menuitem = gtk_menu_item_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Update free/busy")); + child = gtk_bin_get_child (GTK_BIN (menuitem)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Update free/busy")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem); g_signal_connect (menuitem, "activate", @@ -639,9 +655,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_widget_show (hbox); mts->autopick_down_button = gtk_button_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child), - _("_<<")); - accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child)); + child = gtk_bin_get_child (GTK_BIN (mts->autopick_down_button)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_<<")); + accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (child)); gtk_widget_add_accelerator (mts->autopick_down_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_down_button, TRUE, TRUE, 6); @@ -672,9 +688,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_widget_show (arrow); mts->autopick_up_button = gtk_button_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child), - _(">_>")); - accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child)); + child = gtk_bin_get_child (GTK_BIN (mts->autopick_up_button)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _(">_>")); + accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (child)); gtk_widget_add_accelerator (mts->autopick_up_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_up_button, TRUE, TRUE, 6); @@ -689,8 +705,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em menuitem = gtk_radio_menu_item_new_with_label (NULL, ""); mts->autopick_all_item = menuitem; + child = gtk_bin_get_child (GTK_BIN (menuitem)); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_All people and resources")); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_All people and resources")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); g_signal_connect (menuitem, "toggled", G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); @@ -698,8 +715,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em menuitem = gtk_radio_menu_item_new_with_label (group, ""); mts->autopick_all_people_one_resource_item = menuitem; + child = gtk_bin_get_child (GTK_BIN (menuitem)); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("All _people and one resource")); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("All _people and one resource")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); g_signal_connect (menuitem, "toggled", G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); @@ -707,8 +725,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em menuitem = gtk_radio_menu_item_new_with_label (group, ""); mts->autopick_required_people_item = menuitem; + child = gtk_bin_get_child (GTK_BIN (menuitem)); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Required people")); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Required people")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); g_signal_connect (menuitem, "activate", G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); @@ -716,7 +735,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em menuitem = gtk_radio_menu_item_new_with_label (group, ""); mts->autopick_required_people_one_resource_item = menuitem; - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Required people and _one resource")); + child = gtk_bin_get_child (GTK_BIN (menuitem)); + gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Required people and _one resource")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); g_signal_connect (menuitem, "activate", G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); @@ -830,12 +850,18 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em 8, 8); /* Connect handlers to the adjustments scroll the other items. */ - g_signal_connect (GTK_LAYOUT (mts->display_main)->hadjustment, "value_changed", - G_CALLBACK (e_meeting_time_selector_hadjustment_changed), mts); - g_signal_connect (GTK_LAYOUT (mts->display_main)->vadjustment, "value_changed", - G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts); - g_signal_connect (GTK_LAYOUT (mts->display_main)->vadjustment, "changed", - G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts); + layout = GTK_LAYOUT (mts->display_main); + adjustment = gtk_layout_get_hadjustment (layout); + g_signal_connect ( + adjustment, "value_changed", + G_CALLBACK (e_meeting_time_selector_hadjustment_changed), mts); + adjustment = gtk_layout_get_vadjustment (layout); + g_signal_connect ( + adjustment, "value_changed", + G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts); + g_signal_connect ( + adjustment, "changed", + G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts); e_meeting_time_selector_recalc_grid (mts); e_meeting_time_selector_ensure_meeting_time_shown (mts); @@ -881,28 +907,36 @@ e_meeting_time_selector_expose_key_color (GtkWidget *darea, GdkColor *color) { EMeetingTimeSelector * mts; + GtkAllocation allocation; + GdkWindow *window; + GtkStyle *style; GdkGC *gc; - gint width, height; + + style = gtk_widget_get_style (darea); + window = gtk_widget_get_window (darea); + gtk_widget_get_allocation (darea, &allocation); mts = g_object_get_data (G_OBJECT (darea), "data"); gc = mts->color_key_gc; - width = darea->allocation.width; - height = darea->allocation.height; - gtk_paint_shadow (darea->style, darea->window, GTK_STATE_NORMAL, - GTK_SHADOW_IN, NULL, NULL, NULL, 0, 0, width, height); + gtk_paint_shadow ( + style, window, GTK_STATE_NORMAL, + GTK_SHADOW_IN, NULL, NULL, NULL, 0, 0, + allocation.width, allocation.height); if (color) { gdk_gc_set_foreground (gc, color); - gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1, - width - 2, height - 2); + gdk_draw_rectangle ( + window, gc, TRUE, 1, 1, + allocation.width - 2, allocation.height - 2); } else { gdk_gc_set_foreground (gc, &mts->grid_color); gdk_gc_set_background (gc, &mts->stipple_bg_color); gdk_gc_set_stipple (gc, mts->stipple); gdk_gc_set_fill (gc, GDK_OPAQUE_STIPPLED); - gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1, - width - 2, height - 2); + gdk_draw_rectangle ( + window, gc, TRUE, 1, 1, + allocation.width - 2, allocation.height - 2); gdk_gc_set_fill (gc, GDK_SOLID); } @@ -1027,13 +1061,15 @@ static void e_meeting_time_selector_realize (GtkWidget *widget) { EMeetingTimeSelector *mts; + GdkWindow *window; if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize) (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize)(widget); mts = E_MEETING_TIME_SELECTOR (widget); - mts->color_key_gc = gdk_gc_new (widget->window); + window = gtk_widget_get_window (widget); + mts->color_key_gc = gdk_gc_new (window); } static void @@ -1065,10 +1101,11 @@ get_cell_height (GtkTreeView *tree) } static gboolean -style_change_idle_func (gpointer widget) +style_change_idle_func (EMeetingTimeSelector *mts) { - EMeetingTimeSelector *mts; EMeetingTime saved_time; + GtkAdjustment *adjustment; + GtkWidget *widget; gint hour, max_hour_width; /*int maxheight; */ PangoFontDescription *font_desc; @@ -1076,9 +1113,8 @@ style_change_idle_func (gpointer widget) PangoFontMetrics *font_metrics; PangoLayout *layout; - mts = E_MEETING_TIME_SELECTOR (widget); - /* Set up Pango prerequisites */ + widget = GTK_WIDGET (mts); font_desc = gtk_widget_get_style (widget)->font_desc; pango_context = gtk_widget_get_pango_context (widget); font_metrics = pango_context_get_metrics (pango_context, font_desc, @@ -1121,8 +1157,13 @@ style_change_idle_func (gpointer widget) gtk_widget_set_size_request (mts->attendees_vbox_spacer, 1, mts->row_height * 2 - 6); - GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->day_width; - GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height; + widget = mts->display_main; + + adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (widget)); + gtk_adjustment_set_step_increment (adjustment, mts->day_width); + + adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget)); + gtk_adjustment_set_step_increment (adjustment, mts->row_height); g_object_unref (layout); pango_font_metrics_unref (font_metrics); @@ -1142,7 +1183,8 @@ e_meeting_time_selector_style_set (GtkWidget *widget, (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->style_set)(widget, previous_style); if (!mts->style_change_idle_id) - mts->style_change_idle_id = g_idle_add (style_change_idle_func, widget); + mts->style_change_idle_id = g_idle_add ( + (GSourceFunc) style_change_idle_func, widget); } /* This draws a shadow around the top display and main display. */ @@ -1165,19 +1207,24 @@ e_meeting_time_selector_expose_event (GtkWidget *widget, static void e_meeting_time_selector_draw_shadow (EMeetingTimeSelector *mts) { - GtkWidget *widget; + GtkAllocation allocation; + GdkWindow *window; + GtkStyle *style; gint x, y, w, h; - widget = GTK_WIDGET (mts); - /* Draw the shadow around the graphical displays. */ - x = mts->display_top->allocation.x - 2; - y = mts->display_top->allocation.y - 2; - w = mts->display_top->allocation.width + 4; - h = mts->display_top->allocation.height + mts->display_main->allocation.height + 4; + gtk_widget_get_allocation (mts->display_top, &allocation); + x = allocation.x - 2; + y = allocation.y - 2; + w = allocation.width + 4; + h = allocation.height + allocation.height + 4; - gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL, - GTK_SHADOW_IN, NULL, NULL, NULL, x, y, w, h); + style = gtk_widget_get_style (GTK_WIDGET (mts)); + window = gtk_widget_get_window (GTK_WIDGET (mts)); + + gtk_paint_shadow ( + style, window, GTK_STATE_NORMAL, + GTK_SHADOW_IN, NULL, NULL, NULL, x, y, w, h); } /* When the main canvas scrolls, we scroll the other canvases. */ @@ -1185,26 +1232,30 @@ static void e_meeting_time_selector_hadjustment_changed (GtkAdjustment *adjustment, EMeetingTimeSelector *mts) { - GtkAdjustment *adj; + GtkAdjustment *hadjustment; + GtkLayout *layout; + gdouble value; - adj = GTK_LAYOUT (mts->display_top)->hadjustment; - if (adj->value != adjustment->value) { - adj->value = adjustment->value; - gtk_adjustment_value_changed (adj); - } + layout = GTK_LAYOUT (mts->display_top); + hadjustment = gtk_layout_get_hadjustment (layout); + + value = gtk_adjustment_get_value (adjustment); + gtk_adjustment_set_value (hadjustment, value); } static void e_meeting_time_selector_vadjustment_changed (GtkAdjustment *adjustment, EMeetingTimeSelector *mts) { - GtkAdjustment *adj; + GtkAdjustment *vadjustment; + GtkTreeView *tree_view; + gdouble value; - adj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (mts->list_view)); - if (adj->value != adjustment->value) { - adj->value = adjustment->value; - gtk_adjustment_value_changed (adj); - } + tree_view = GTK_TREE_VIEW (mts->list_view); + vadjustment = gtk_tree_view_get_vadjustment (tree_view); + + value = gtk_adjustment_get_value (adjustment); + gtk_adjustment_set_value (vadjustment, value); } void @@ -1463,12 +1514,20 @@ e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row, EMeetingTimeSelectorAutopickOption e_meeting_time_selector_get_autopick_option (EMeetingTimeSelector *mts) { - if (GTK_CHECK_MENU_ITEM (mts->autopick_all_item)->active) + GtkWidget *widget; + + widget = mts->autopick_all_item; + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES; - if (GTK_CHECK_MENU_ITEM (mts->autopick_all_people_one_resource_item)->active) + + widget = mts->autopick_all_people_one_resource_item; + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE; - if (GTK_CHECK_MENU_ITEM (mts->autopick_required_people_item)->active) + + widget = mts->autopick_required_people_item; + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE; + return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE; } @@ -1635,14 +1694,20 @@ e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu, { EMeetingTimeSelector *mts; GtkRequisition menu_requisition; + GtkAllocation allocation; + GtkWidget *widget; + GdkWindow *window; gint max_x, max_y; mts = E_MEETING_TIME_SELECTOR (user_data); /* Calculate our preferred position. */ - gdk_window_get_origin (mts->options_button->window, x, y); - *x += mts->options_button->allocation.x; - *y += mts->options_button->allocation.y + mts->options_button->allocation.height - 2; + widget = mts->options_button; + window = gtk_widget_get_window (widget); + gdk_window_get_origin (window, x, y); + gtk_widget_get_allocation (widget, &allocation); + *x += allocation.x; + *y += allocation.y + allocation.height - 2; /* Now make sure we are on the screen. */ gtk_widget_size_request (mts->options_menu, &menu_requisition); @@ -1658,11 +1723,7 @@ e_meeting_time_selector_on_update_free_busy (GtkWidget *button, { /* Make sure the menu pops down, which doesn't happen by default if keyboard accelerators are used. */ -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (mts->options_menu)) -#else - if (GTK_WIDGET_VISIBLE (mts->options_menu)) -#endif gtk_menu_popdown (GTK_MENU (mts->options_menu)); e_meeting_time_selector_refresh_free_busy (mts, 0, TRUE); @@ -1686,14 +1747,20 @@ e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu, { EMeetingTimeSelector *mts; GtkRequisition menu_requisition; + GtkAllocation allocation; + GtkWidget *widget; + GdkWindow *window; gint max_x, max_y; mts = E_MEETING_TIME_SELECTOR (user_data); /* Calculate our preferred position. */ - gdk_window_get_origin (mts->autopick_button->window, x, y); - *x += mts->autopick_button->allocation.x; - *y += mts->autopick_button->allocation.y + mts->autopick_button->allocation.height - 2; + widget = mts->autopick_button; + window = gtk_widget_get_window (widget); + gdk_window_get_origin (window, x, y); + gtk_widget_get_allocation (widget, &allocation); + *x += allocation.x; + *y += allocation.y + allocation.height - 2; /* Now make sure we are on the screen. */ gtk_widget_size_request (mts->autopick_menu, &menu_requisition); @@ -1709,11 +1776,7 @@ e_meeting_time_selector_on_autopick_option_toggled (GtkWidget *button, { /* Make sure the menu pops down, which doesn't happen by default if keyboard accelerators are used. */ -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (mts->autopick_menu)) -#else - if (GTK_WIDGET_VISIBLE (mts->autopick_menu)) -#endif gtk_menu_popdown (GTK_MENU (mts->autopick_menu)); } @@ -2108,36 +2171,34 @@ e_meeting_time_selector_find_time_clash (EMeetingTimeSelector *mts, } static void -e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *menuitem, +e_meeting_time_selector_on_zoomed_out_toggled (GtkCheckMenuItem *menuitem, EMeetingTimeSelector *mts) { + gboolean active; + /* Make sure the menu pops down, which doesn't happen by default if keyboard accelerators are used. */ -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (mts->options_menu)) -#else - if (GTK_WIDGET_VISIBLE (mts->options_menu)) -#endif gtk_menu_popdown (GTK_MENU (mts->options_menu)); - e_meeting_time_selector_set_zoomed_out (mts, GTK_CHECK_MENU_ITEM (menuitem)->active); + active = gtk_check_menu_item_get_active (menuitem); + e_meeting_time_selector_set_zoomed_out (mts, active); e_meeting_time_selector_ensure_meeting_time_shown (mts); } static void -e_meeting_time_selector_on_working_hours_toggled (GtkWidget *menuitem, +e_meeting_time_selector_on_working_hours_toggled (GtkCheckMenuItem *menuitem, EMeetingTimeSelector *mts) { + gboolean active; + /* Make sure the menu pops down, which doesn't happen by default if keyboard accelerators are used. */ -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (mts->options_menu)) -#else - if (GTK_WIDGET_VISIBLE (mts->options_menu)) -#endif gtk_menu_popdown (GTK_MENU (mts->options_menu)); - e_meeting_time_selector_set_working_hours_only (mts, GTK_CHECK_MENU_ITEM (menuitem)->active); + active = gtk_check_menu_item_get_active (menuitem); + e_meeting_time_selector_set_working_hours_only (mts, active); e_meeting_time_selector_ensure_meeting_time_shown (mts); } @@ -2356,8 +2417,10 @@ static void e_meeting_time_selector_on_canvas_realized (GtkWidget *widget, EMeetingTimeSelector *mts) { - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, - NULL, FALSE); + GdkWindow *window; + + window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + gdk_window_set_back_pixmap (window, NULL, FALSE); } /* This is called when the meeting start time GnomeDateEdit is changed, @@ -2505,12 +2568,12 @@ e_meeting_time_selector_on_canvas_scroll_event (GtkWidget *widget, GdkEventScrol static void e_meeting_time_selector_update_main_canvas_scroll_region (EMeetingTimeSelector *mts) { - gint height, canvas_height; + GtkAllocation allocation; + gint height; + gtk_widget_get_allocation (mts->display_main, &allocation); height = mts->row_height * (e_meeting_store_count_actual_attendees (mts->model) + 2); - canvas_height = GTK_WIDGET (mts->display_main)->allocation.height; - - height = MAX (height, canvas_height); + height = MAX (height, allocation.height); gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->display_main), 0, 0, @@ -2530,11 +2593,13 @@ e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts, EMeetingTime first_time, last_time, drag_time, *time_to_set; gint scroll_x, scroll_y, canvas_width; gboolean set_both_times = FALSE; + GtkAllocation allocation; /* Get the x coords of visible part of the canvas. */ gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main), &scroll_x, &scroll_y); - canvas_width = mts->display_main->allocation.width; + gtk_widget_get_allocation (mts->display_main, &allocation); + canvas_width = allocation.width; /* Save the x coordinate for the timeout handler. */ mts->last_drag_x = (x < scroll_x) ? x - scroll_x @@ -2680,6 +2745,7 @@ e_meeting_time_selector_timeout_handler (gpointer data) gint scroll_x, max_scroll_x, scroll_y, canvas_width; gint scroll_speed, scroll_offset; gboolean set_both_times = FALSE; + GtkAllocation allocation; mts = E_MEETING_TIME_SELECTOR (data); @@ -2694,7 +2760,8 @@ e_meeting_time_selector_timeout_handler (gpointer data) /* Get the x coords of visible part of the canvas. */ gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main), &scroll_x, &scroll_y); - canvas_width = mts->display_main->allocation.width; + gtk_widget_get_allocation (mts->display_main, &allocation); + canvas_width = allocation.width; /* Calculate the scroll delay, between 0 and MAX_SCROLL_SPEED. */ scroll_speed = abs (mts->last_drag_x / E_MEETING_TIME_SELECTOR_SCROLL_INCREMENT_WIDTH); @@ -2866,8 +2933,9 @@ e_meeting_time_selector_update_end_date_edit (EMeetingTimeSelector *mts) static void e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts) { - gint start_x, end_x, scroll_x, scroll_y, canvas_width; + gint start_x, end_x, scroll_x, scroll_y; gint new_scroll_x; + GtkAllocation allocation; EMeetingTime time; /* Check if we need to change the range of dates shown. */ @@ -2891,8 +2959,8 @@ e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts) gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main), &scroll_x, &scroll_y); - canvas_width = mts->display_main->allocation.width; - if (start_x > scroll_x && end_x <= scroll_x + canvas_width) + gtk_widget_get_allocation (mts->display_main, &allocation); + if (start_x > scroll_x && end_x <= scroll_x + allocation.width) return; new_scroll_x = start_x; diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 7a31efd7f0..a078fd140f 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -914,11 +914,7 @@ memo_table_paste_clipboard (ESelectable *selectable) /* Paste text into a cell being edited. */ if (gtk_clipboard_wait_is_text_available (clipboard) && -#if GTK_CHECK_VERSION(2,19,7) gtk_widget_has_focus (GTK_WIDGET (table_canvas)) && -#else - GTK_WIDGET_HAS_FOCUS (table_canvas) && -#endif E_IS_TABLE_ITEM (item) && E_TABLE_ITEM (item)->editing_col >= 0 && E_TABLE_ITEM (item)->editing_row >= 0) { diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index bb0698fa29..93f02bfdcf 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -103,13 +103,20 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, G ESelectNamesRenderer *sn_cell = E_SELECT_NAMES_RENDERER (cell); GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell); ESelectNamesEditable *editable; + gboolean is_editable; + gfloat xalign; - if (!text_cell->editable) + g_object_get ( + text_cell, + "editable", &is_editable, + "xalign", &xalign, NULL); + + if (!is_editable) return NULL; editable = E_SELECT_NAMES_EDITABLE (e_select_names_editable_new ()); gtk_entry_set_has_frame (GTK_ENTRY (editable), FALSE); - gtk_entry_set_alignment (GTK_ENTRY (editable), cell->xalign); + gtk_entry_set_alignment (GTK_ENTRY (editable), xalign); if (sn_cell->priv->email && *sn_cell->priv->email) e_select_names_editable_set_address (editable, sn_cell->priv->name, sn_cell->priv->email); gtk_widget_show (GTK_WIDGET (editable)); diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index e54a72d933..98d422aa16 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -1137,11 +1137,7 @@ task_table_paste_clipboard (ESelectable *selectable) /* Paste text into a cell being edited. */ if (gtk_clipboard_wait_is_text_available (clipboard) && -#if GTK_CHECK_VERSION(2,19,7) gtk_widget_has_focus (GTK_WIDGET (table_canvas)) && -#else - GTK_WIDGET_HAS_FOCUS (table_canvas) && -#endif E_IS_TABLE_ITEM (item) && E_TABLE_ITEM (item)->editing_col >= 0 && E_TABLE_ITEM (item)->editing_row >= 0) { diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c index 309661a2db..5adb4102d2 100644 --- a/calendar/gui/e-timezone-entry.c +++ b/calendar/gui/e-timezone-entry.c @@ -236,44 +236,20 @@ timezone_entry_focus (GtkWidget *widget, priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget); if (direction == GTK_DIR_TAB_FORWARD) { -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_has_focus (priv->entry)) -#else - if (GTK_WIDGET_HAS_FOCUS (priv->entry)) -#endif gtk_widget_grab_focus (priv->button); -#if GTK_CHECK_VERSION(2,19,7) else if (gtk_widget_has_focus (priv->button)) -#else - else if (GTK_WIDGET_HAS_FOCUS (priv->button)) -#endif return FALSE; -#if GTK_CHECK_VERSION(2,19,7) else if (gtk_widget_get_visible (priv->entry)) -#else - else if (GTK_WIDGET_VISIBLE (priv->entry)) -#endif gtk_widget_grab_focus (priv->entry); else gtk_widget_grab_focus (priv->button); } else if (direction == GTK_DIR_TAB_BACKWARD) { -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_has_focus (priv->entry)) -#else - if (GTK_WIDGET_HAS_FOCUS (priv->entry)) -#endif return FALSE; -#if GTK_CHECK_VERSION(2,19,7) else if (gtk_widget_has_focus (priv->button)) { -#else - else if (GTK_WIDGET_HAS_FOCUS (priv->button)) { -#endif -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_get_visible (priv->entry)) -#else - if (GTK_WIDGET_VISIBLE (priv->entry)) -#endif gtk_widget_grab_focus (priv->entry); else return FALSE; diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 90d8831747..5d3fefaaee 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -87,11 +87,14 @@ week_view_event_item_get_position (EWeekViewEventItem *event_item, { EWeekView *week_view; GnomeCanvasItem *item; + GtkWidget *parent; item = GNOME_CANVAS_ITEM (event_item); - week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); - g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), E_CALENDAR_VIEW_POS_NONE); + parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas)); + g_return_val_if_fail (E_IS_WEEK_VIEW (parent), E_CALENDAR_VIEW_POS_NONE); + + week_view = E_WEEK_VIEW (parent); if (x < item->x1 + E_WEEK_VIEW_EVENT_L_PAD || x >= item->x2 - E_WEEK_VIEW_EVENT_R_PAD) @@ -120,11 +123,14 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item, EWeekView *week_view; EWeekViewEvent *event; GnomeCanvasItem *item; + GtkWidget *parent; item = GNOME_CANVAS_ITEM (event_item); - week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); - g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE); + parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas)); + g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE); + + week_view = E_WEEK_VIEW (parent); event = &g_array_index ( week_view->events, EWeekViewEvent, @@ -167,11 +173,14 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item, EWeekViewEvent *event; EWeekViewEventSpan *span; GnomeCanvasItem *item; + GtkWidget *parent; item = GNOME_CANVAS_ITEM (event_item); - week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); - g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE); + parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas)); + g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE); + + week_view = E_WEEK_VIEW (parent); event = &g_array_index (week_view->events, EWeekViewEvent, event_item->priv->event_num); @@ -201,11 +210,7 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item, return TRUE; } else if (bevent->button.button == 3) { -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (week_view))) { -#else - if (!GTK_WIDGET_HAS_FOCUS (week_view)) { -#endif gtk_widget_grab_focus (GTK_WIDGET (week_view)); if (week_view->event_destroyed) { week_view->event_destroyed = FALSE; @@ -235,11 +240,14 @@ week_view_event_item_button_release (EWeekViewEventItem *event_item, { EWeekView *week_view; GnomeCanvasItem *item; + GtkWidget *parent; item = GNOME_CANVAS_ITEM (event_item); - week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); - g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE); + parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas)); + g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE); + + week_view = E_WEEK_VIEW (parent); if (week_view->pressed_event_num != -1 && week_view->pressed_event_num == event_item->priv->event_num @@ -368,6 +376,8 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item, EWeekView *week_view; EWeekViewEvent *event; ECalComponent *comp; + GnomeCanvas *canvas; + GtkWidget *parent; GdkGC *gc; gint num_icons = 0, icon_x_inc; gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE; @@ -376,7 +386,9 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item, GSList *categories_pixbufs = NULL, *pixbufs; cairo_t *cr; - week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (event_item)->canvas)->parent); + canvas = GNOME_CANVAS_ITEM (event_item)->canvas; + parent = gtk_widget_get_parent (GTK_WIDGET (canvas)); + week_view = E_WEEK_VIEW (parent); event = &g_array_index (week_view->events, EWeekViewEvent, event_item->priv->event_num); @@ -484,6 +496,8 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item, ECalModel *model; EWeekView *week_view; EWeekViewEvent *event; + GnomeCanvas *canvas; + GtkWidget *parent; GdkPoint points[3]; const gchar *color_spec; gint c1, c2; @@ -492,7 +506,9 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item, if (!can_draw_in_region (draw_region, x, y, w, h)) return; - week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (event_item)->canvas)->parent); + canvas = GNOME_CANVAS_ITEM (event_item)->canvas; + parent = gtk_widget_get_parent (GTK_WIDGET (canvas)); + week_view = E_WEEK_VIEW (parent); event = &g_array_index (week_view->events, EWeekViewEvent, event_item->priv->event_num); @@ -621,12 +637,15 @@ week_view_event_item_update (GnomeCanvasItem *item, GnomeCanvasItemClass *canvas_item_class; EWeekViewEventItem *event_item; EWeekView *week_view; + GtkWidget *parent; gint event_num, span_num; gint span_x, span_y, span_w; event_item = E_WEEK_VIEW_EVENT_ITEM (item); - week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); - g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas)); + g_return_if_fail (E_IS_WEEK_VIEW (parent)); + + week_view = E_WEEK_VIEW (parent); /* Chain up to parent's update() method. */ canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); @@ -666,6 +685,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, EWeekViewEventSpan *span; ECalModel *model; GdkGC *gc; + GtkWidget *parent; gint x1, y1, x2, y2, time_x, time_y; gint icon_x, icon_y, time_width, min_end_time_x, max_icon_x; gint rect_x, rect_w, rect_x2 = 0; @@ -686,8 +706,10 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, const gchar *color_spec; event_item = E_WEEK_VIEW_EVENT_ITEM (canvas_item); - week_view = E_WEEK_VIEW (GTK_WIDGET (canvas_item->canvas)->parent); - g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + parent = gtk_widget_get_parent (GTK_WIDGET (canvas_item->canvas)); + g_return_if_fail (E_IS_WEEK_VIEW (parent)); + + week_view = E_WEEK_VIEW (parent); if (event_item->priv->event_num == -1 || event_item->priv->span_num == -1) return; diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index eb8de3af9a..3522790401 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -169,11 +169,7 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item, || week_view->selection_end_day < day) selected = FALSE; if (selected) { -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_has_focus (GTK_WIDGET (week_view))) { -#else - if (GTK_WIDGET_HAS_FOCUS (week_view)) { -#endif gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_SELECTED]); } else { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_SELECTED]); diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c index f2d90e7150..ab7a9db652 100644 --- a/calendar/gui/e-week-view-titles-item.c +++ b/calendar/gui/e-week-view-titles-item.c @@ -126,9 +126,10 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item, EWeekView *week_view; GtkStyle *style; GdkGC *fg_gc, *light_gc, *dark_gc; - gint canvas_width, canvas_height, col_width, col, date_width, date_x; + gint col_width, col, date_width, date_x; gchar buffer[128]; GdkRectangle clip_rect; + GtkAllocation allocation; gboolean abbreviated; gint weekday; PangoLayout *layout; @@ -137,28 +138,29 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item, week_view = e_week_view_titles_item_get_week_view (titles_item); g_return_if_fail (week_view != NULL); + gtk_widget_get_allocation ( + GTK_WIDGET (canvas_item->canvas), &allocation); + style = gtk_widget_get_style (GTK_WIDGET (week_view)); fg_gc = style->fg_gc[GTK_STATE_NORMAL]; light_gc = style->light_gc[GTK_STATE_NORMAL]; dark_gc = style->dark_gc[GTK_STATE_NORMAL]; - canvas_width = GTK_WIDGET (canvas_item->canvas)->allocation.width; - canvas_height = GTK_WIDGET (canvas_item->canvas)->allocation.height; layout = gtk_widget_create_pango_layout (GTK_WIDGET (week_view), NULL); /* Draw the shadow around the dates. */ gdk_draw_line (drawable, light_gc, 1 - x, 1 - y, - canvas_width - 2 - x, 1 - y); + allocation.width - 2 - x, 1 - y); gdk_draw_line (drawable, light_gc, 1 - x, 2 - y, - 1 - x, canvas_height - 1 - y); + 1 - x, allocation.height - 1 - y); gdk_draw_rectangle (drawable, dark_gc, FALSE, 0 - x, 0 - y, - canvas_width - 1, canvas_height); + allocation.width - 1, allocation.height); /* Determine the format to use. */ - col_width = canvas_width / week_view->columns; + col_width = allocation.width / week_view->columns; abbreviated = (week_view->max_day_width + 2 >= col_width); /* Shift right one pixel to account for the shadow around the main @@ -182,7 +184,7 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item, clip_rect.x = week_view->col_offsets[col] - x; clip_rect.y = 2 - y; clip_rect.width = week_view->col_widths[col]; - clip_rect.height = canvas_height - 2; + clip_rect.height = allocation.height - 2; gdk_gc_set_clip_rectangle (fg_gc, &clip_rect); if (weekday == 5 && week_view->compress_weekend) @@ -212,22 +214,22 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item, week_view->col_offsets[col] - x, 4 - y, week_view->col_offsets[col] - x, - canvas_height - 4 - y); + allocation.height - 4 - y); gdk_draw_line (drawable, dark_gc, week_view->col_offsets[col] - 1 - x, 4 - y, week_view->col_offsets[col] - 1 - x, - canvas_height - 4 - y); + allocation.height - 4 - y); } /* Draw the lines between each column. */ if (col != 0) { gdk_draw_line (drawable, style->black_gc, week_view->col_offsets[col] - x, - canvas_height - y, + allocation.height - y, week_view->col_offsets[col] - x, - canvas_height - y); + allocation.height - y); } if (weekday == 5 && week_view->compress_weekend) diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index d41a686a79..0ab4415a6f 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -405,8 +405,14 @@ week_view_time_range_changed_cb (EWeekView *week_view, /* Reset the adjustment value to 0 if the base address has changed. Note that we do this after updating first_day_shown so that our signal handler will not try to reload the events. */ - if (update_adjustment_value) - gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0); + if (update_adjustment_value) { + GtkRange *range; + GtkAdjustment *adjustment; + + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + gtk_adjustment_set_value (adjustment, 0); + } if (!E_CALENDAR_VIEW (week_view)->in_focus) { e_week_view_free_events (week_view); @@ -895,12 +901,14 @@ e_week_view_realize (GtkWidget *widget) { EWeekView *week_view; GdkColormap *colormap; + GdkWindow *window; if (GTK_WIDGET_CLASS (e_week_view_parent_class)->realize) (*GTK_WIDGET_CLASS (e_week_view_parent_class)->realize)(widget); week_view = E_WEEK_VIEW (widget); - week_view->main_gc = gdk_gc_new (widget->window); + window = gtk_widget_get_window (widget); + week_view->main_gc = gdk_gc_new (window); colormap = gtk_widget_get_colormap (widget); @@ -941,17 +949,21 @@ color_inc (GdkColor c, gint amount) static void e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget) { - week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS] = widget->style->base[GTK_STATE_INSENSITIVE]; - week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS] = widget->style->base[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT] = widget->style->text[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_GRID] = widget->style->dark[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_SELECTED] = widget->style->base[GTK_STATE_SELECTED]; - week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED]; - week_view->colors[E_WEEK_VIEW_COLOR_DATES] = widget->style->text[GTK_STATE_NORMAL]; - week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = widget->style->text[GTK_STATE_SELECTED]; - week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = widget->style->base[GTK_STATE_SELECTED]; + GtkStyle *style; + + style = gtk_widget_get_style (widget); + + week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS] = style->base[GTK_STATE_INSENSITIVE]; + week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS] = style->base[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND] = style->base[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT] = style->text[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_GRID] = style->dark[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_SELECTED] = style->base[GTK_STATE_SELECTED]; + week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED] = style->bg[GTK_STATE_SELECTED]; + week_view->colors[E_WEEK_VIEW_COLOR_DATES] = style->text[GTK_STATE_NORMAL]; + week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = style->text[GTK_STATE_SELECTED]; + week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = style->base[GTK_STATE_SELECTED]; week_view->colors[E_WEEK_VIEW_COLOR_TODAY_BACKGROUND] = get_today_background (week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]); week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY] = color_inc (week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS], -0x0A0A); } @@ -1022,6 +1034,7 @@ get_digit_width (PangoLayout *layout) static GdkColor e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidget *widget) { + GtkStyle *style; GdkColor bg_color; guint16 red, green, blue; gdouble cc = 65535.0; @@ -1041,10 +1054,12 @@ e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidg } } + style = gtk_widget_get_style (widget); + if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 )) - return widget->style->black; + return style->black; else - return widget->style->white; + return style->white; } static void @@ -1076,9 +1091,10 @@ e_week_view_style_set (GtkWidget *widget, span = &g_array_index (week_view->spans, EWeekViewEventSpan, span_num); if (span->text_item) { - gnome_canvas_item_set (span->text_item, - "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL], - NULL); + gnome_canvas_item_set ( + span->text_item, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); } } } @@ -1170,6 +1186,7 @@ static void e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { EWeekView *week_view; + GtkAllocation canvas_allocation; gdouble old_x2, old_y2, new_x2, new_y2; week_view = E_WEEK_VIEW (widget); @@ -1179,23 +1196,31 @@ e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) e_week_view_recalc_cell_sizes (week_view); /* Set the scroll region of the top canvas to its allocated size. */ - gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->titles_canvas), - NULL, NULL, &old_x2, &old_y2); - new_x2 = week_view->titles_canvas->allocation.width - 1; - new_y2 = week_view->titles_canvas->allocation.height - 1; + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (week_view->titles_canvas), + NULL, NULL, &old_x2, &old_y2); + gtk_widget_get_allocation ( + week_view->titles_canvas, &canvas_allocation); + new_x2 = canvas_allocation.width - 1; + new_y2 = canvas_allocation.height - 1; if (old_x2 != new_x2 || old_y2 != new_y2) - gnome_canvas_set_scroll_region (GNOME_CANVAS (week_view->titles_canvas), - 0, 0, new_x2, new_y2); + gnome_canvas_set_scroll_region ( + GNOME_CANVAS (week_view->titles_canvas), + 0, 0, new_x2, new_y2); /* Set the scroll region of the main canvas to its allocated width, but with the height depending on the number of rows needed. */ - gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->main_canvas), - NULL, NULL, &old_x2, &old_y2); - new_x2 = week_view->main_canvas->allocation.width - 1; - new_y2 = week_view->main_canvas->allocation.height - 1; + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (week_view->main_canvas), + NULL, NULL, &old_x2, &old_y2); + gtk_widget_get_allocation ( + week_view->main_canvas, &canvas_allocation); + new_x2 = canvas_allocation.width - 1; + new_y2 = canvas_allocation.height - 1; if (old_x2 != new_x2 || old_y2 != new_y2) - gnome_canvas_set_scroll_region (GNOME_CANVAS (week_view->main_canvas), - 0, 0, new_x2, new_y2); + gnome_canvas_set_scroll_region ( + GNOME_CANVAS (week_view->main_canvas), + 0, 0, new_x2, new_y2); /* Flag that we need to reshape the events. */ if (old_x2 != new_x2 || old_y2 != new_y2) { @@ -1209,6 +1234,7 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) { gfloat canvas_width, canvas_height, offset; gint row, col; + GtkAllocation allocation; GtkWidget *widget; GtkStyle *style; gint width, height, time_width; @@ -1224,12 +1250,14 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) week_view->columns = 2; } + gtk_widget_get_allocation (week_view->main_canvas, &allocation); + /* Calculate the column sizes, using floating point so that pixels get divided evenly. Note that we use one more element than the number of columns, to make it easy to get the column widths. We also add one to the width so that the right border of the last column is off the edge of the displayed area. */ - canvas_width = week_view->main_canvas->allocation.width + 1; + canvas_width = allocation.width + 1; canvas_width /= week_view->columns; offset = 0; for (col = 0; col <= week_view->columns; col++) { @@ -1244,7 +1272,7 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) } /* Now do the same for the row heights. */ - canvas_height = week_view->main_canvas->allocation.height + 1; + canvas_height = allocation.height + 1; canvas_height /= week_view->rows; offset = 0; for (row = 0; row <= week_view->rows; row++) { @@ -1566,22 +1594,25 @@ e_week_view_update_query (EWeekView *week_view) static void e_week_view_draw_shadow (EWeekView *week_view) { + GtkAllocation allocation; gint x1, y1, x2, y2; GtkStyle *style; GdkGC *light_gc, *dark_gc; GdkWindow *window; + gtk_widget_get_allocation (week_view->main_canvas, &allocation); + /* Draw the shadow around the graphical displays. */ - x1 = week_view->main_canvas->allocation.x - 1; - y1 = week_view->main_canvas->allocation.y - 1; - x2 = x1 + week_view->main_canvas->allocation.width + 2; - y2 = y1 + week_view->main_canvas->allocation.height + 2; + x1 = allocation.x - 1; + y1 = allocation.y - 1; + x2 = x1 + allocation.width + 2; + y2 = y1 + allocation.height + 2; - style = GTK_WIDGET (week_view)->style; + style = gtk_widget_get_style (GTK_WIDGET (week_view)); dark_gc = style->dark_gc[GTK_STATE_NORMAL]; light_gc = style->light_gc[GTK_STATE_NORMAL]; - window = GTK_WIDGET (week_view)->window; + window = gtk_widget_get_window (GTK_WIDGET (week_view)); gdk_draw_line (window, dark_gc, x1, y1, x1, y2); gdk_draw_line (window, dark_gc, x1, y1, x2, y1); gdk_draw_line (window, light_gc, x2, y1, x2, y2); @@ -1635,8 +1666,14 @@ e_week_view_set_selected_time_range (ECalendarView *cal_view, /* Reset the adjustment value to 0 if the base address has changed. Note that we do this after updating first_day_shown so that our signal handler will not try to reload the events. */ - if (update_adjustment_value) - gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0); + if (update_adjustment_value) { + GtkRange *range; + GtkAdjustment *adjustment; + + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + gtk_adjustment_set_value (adjustment, 0); + } gtk_widget_queue_draw (week_view->main_canvas); } @@ -1814,8 +1851,14 @@ e_week_view_set_first_day_shown (EWeekView *week_view, /* Reset the adjustment value to 0 if the base address has changed. Note that we do this after updating first_day_shown so that our signal handler will not try to reload the events. */ - if (update_adjustment_value) - gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0); + if (update_adjustment_value) { + GtkRange *range; + GtkAdjustment *adjustment; + + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + gtk_adjustment_set_value (adjustment, 0); + } e_week_view_update_query (week_view); gtk_widget_queue_draw (week_view->main_canvas); @@ -1866,6 +1909,7 @@ void e_week_view_set_multi_week_view (EWeekView *week_view, gboolean multi_week_view) { + GtkRange *range; GtkAdjustment *adjustment; gint page_increment, page_size; @@ -1900,10 +1944,10 @@ e_week_view_set_multi_week_view (EWeekView *week_view, } } - adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment; - adjustment->page_increment = page_increment; - adjustment->page_size = page_size; - gtk_adjustment_changed (adjustment); + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + gtk_adjustment_set_page_increment (adjustment, page_increment); + gtk_adjustment_set_page_size (adjustment, page_size); e_week_view_recalc_cell_sizes (week_view); @@ -1940,6 +1984,7 @@ void e_week_view_set_weeks_shown (EWeekView *week_view, gint weeks_shown) { + GtkRange *range; GtkAdjustment *adjustment; gint page_increment, page_size; @@ -1961,10 +2006,10 @@ e_week_view_set_weeks_shown (EWeekView *week_view, page_size = 5; } - adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment; - adjustment->page_increment = page_increment; - adjustment->page_size = page_size; - gtk_adjustment_changed (adjustment); + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + gtk_adjustment_set_page_increment (adjustment, page_increment); + gtk_adjustment_set_page_size (adjustment, page_size); e_week_view_recalc_cell_sizes (week_view); @@ -2357,15 +2402,15 @@ e_week_view_on_button_press (GtkWidget *widget, } if (event->button == 1) { + GdkWindow *window; + /* Start the selection drag. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (week_view)) && !gtk_widget_has_focus (GTK_WIDGET (week_view->main_canvas))) -#else - if (!GTK_WIDGET_HAS_FOCUS (week_view) && !GTK_WIDGET_HAS_FOCUS (week_view->main_canvas)) -#endif gtk_widget_grab_focus (GTK_WIDGET (week_view)); - if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE, + window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + + if (gdk_pointer_grab (window, FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time) == 0) { @@ -2381,11 +2426,7 @@ e_week_view_on_button_press (GtkWidget *widget, gtk_widget_queue_draw (week_view->main_canvas); } } else if (event->button == 3) { -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (week_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (week_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (week_view)); if (day < week_view->selection_start_day || day > week_view->selection_end_day) { @@ -2427,8 +2468,14 @@ e_week_view_on_scroll (GtkWidget *widget, GdkEventScroll *scroll, EWeekView *week_view) { - GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment; - gfloat new_value; + GtkRange *range; + GtkAdjustment *adjustment; + gdouble page_increment; + gdouble new_value; + gdouble page_size; + gdouble lower; + gdouble upper; + gdouble value; GtkWidget *tool_window = g_object_get_data (G_OBJECT (week_view), "tooltip-window"); guint timeout; @@ -2443,19 +2490,28 @@ e_week_view_on_scroll (GtkWidget *widget, g_object_set_data (G_OBJECT (week_view), "tooltip-window", NULL); } + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + + page_increment = gtk_adjustment_get_page_increment (adjustment); + page_size = gtk_adjustment_get_page_size (adjustment); + lower = gtk_adjustment_get_lower (adjustment); + upper = gtk_adjustment_get_upper (adjustment); + value = gtk_adjustment_get_value (adjustment); + switch (scroll->direction) { - case GDK_SCROLL_UP: - new_value = adj->value - adj->page_increment; - break; - case GDK_SCROLL_DOWN: - new_value = adj->value + adj->page_increment; - break; - default: - return FALSE; + case GDK_SCROLL_UP: + new_value = value - page_increment; + break; + case GDK_SCROLL_DOWN: + new_value = value + page_increment; + break; + default: + return FALSE; } - new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); - gtk_adjustment_set_value (adj, new_value); + new_value = CLAMP (new_value, lower, upper - page_size); + gtk_adjustment_set_value (adjustment, new_value); return TRUE; } @@ -3392,11 +3448,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item, e = &g_array_index (week_view->events, EWeekViewEvent, event_num); -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_has_focus (GTK_WIDGET (week_view))) -#else - if (!GTK_WIDGET_HAS_FOCUS (week_view)) -#endif gtk_widget_grab_focus (GTK_WIDGET (week_view)); e_week_view_set_selected_time_range_visible (week_view, e->start, e->end); @@ -3602,27 +3654,43 @@ e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time) void e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction) { - GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment; - gfloat new_value; + GtkAdjustment *adjustment; + GtkRange *range; + gdouble step_increment; + gdouble page_size; + gdouble new_value; + gdouble lower; + gdouble upper; + gdouble value; + + range = GTK_RANGE (week_view->vscrollbar); + adjustment = gtk_range_get_adjustment (range); + + step_increment = gtk_adjustment_get_step_increment (adjustment); + page_size = gtk_adjustment_get_page_size (adjustment); + lower = gtk_adjustment_get_lower (adjustment); + upper = gtk_adjustment_get_upper (adjustment); + value = gtk_adjustment_get_value (adjustment); switch (direction) { - case E_CAL_VIEW_MOVE_UP: - new_value = adj->value - adj->step_increment; - break; - case E_CAL_VIEW_MOVE_DOWN: - new_value = adj->value + adj->step_increment; - break; - case E_CAL_VIEW_MOVE_PAGE_UP: - new_value = adj->value - adj->page_size; - break; - case E_CAL_VIEW_MOVE_PAGE_DOWN: - new_value = adj->value + adj->page_size; - break; - default: - return; + case E_CAL_VIEW_MOVE_UP: + new_value = value - step_increment; + break; + case E_CAL_VIEW_MOVE_DOWN: + new_value = value + step_increment; + break; + case E_CAL_VIEW_MOVE_PAGE_UP: + new_value = value - page_size; + break; + case E_CAL_VIEW_MOVE_PAGE_DOWN: + new_value = value + page_size; + break; + default: + return; } - new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size); - gtk_adjustment_set_value (adj, new_value); + + new_value = CLAMP (new_value, lower, upper - page_size); + gtk_adjustment_set_value (adjustment, new_value); } static void diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c index 230d7ca84f..5b4bcc7e1b 100644 --- a/calendar/gui/ea-cal-view-event.c +++ b/calendar/gui/ea-cal-view-event.c @@ -445,6 +445,7 @@ ea_cal_view_get_extents (AtkComponent *component, ECalendarView *cal_view; gint item_x, item_y, item_w, item_h; GtkWidget *canvas = NULL; + GdkWindow *window; g_return_if_fail (EA_IS_CAL_VIEW_EVENT (component)); @@ -509,8 +510,8 @@ ea_cal_view_get_extents (AtkComponent *component, if (!canvas) return; - gdk_window_get_origin (canvas->window, - &x_window, &y_window); + window = gtk_widget_get_window (canvas); + gdk_window_get_origin (window, &x_window, &y_window); gnome_canvas_get_scroll_offsets (GNOME_CANVAS (canvas), &scroll_x, &scroll_y); *x = item_x + x_window - scroll_x; @@ -519,10 +520,10 @@ ea_cal_view_get_extents (AtkComponent *component, *height = item_h; if (coord_type == ATK_XY_WINDOW) { - GdkWindow *window; gint x_toplevel, y_toplevel; - window = gdk_window_get_toplevel (GTK_WIDGET (cal_view)->window); + window = gtk_widget_get_window (GTK_WIDGET (cal_view)); + window = gdk_window_get_toplevel (window); gdk_window_get_origin (window, &x_toplevel, &y_toplevel); *x -= x_toplevel; diff --git a/calendar/gui/ea-cal-view.c b/calendar/gui/ea-cal-view.c index ceffaa0483..67969c75ec 100644 --- a/calendar/gui/ea-cal-view.c +++ b/calendar/gui/ea-cal-view.c @@ -331,11 +331,7 @@ action_interface_do_action (AtkAction *action, gint index) */ return FALSE; -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) -#else - if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget)) -#endif return FALSE; cal_view = E_CALENDAR_VIEW (widget); @@ -399,11 +395,7 @@ action_interface_get_keybinding (AtkAction *action, gint index) */ return NULL; -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) -#else - if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget)) -#endif return NULL; switch (index) { diff --git a/calendar/gui/ea-day-view.c b/calendar/gui/ea-day-view.c index c75bf89f7b..d197f49e04 100644 --- a/calendar/gui/ea-day-view.c +++ b/calendar/gui/ea-day-view.c @@ -133,11 +133,7 @@ ea_day_view_get_name (AtkObject *accessible) day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget); gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)); -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_visible (GTK_WIDGET (gcal))) -#else - if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (gcal))) -#endif return NULL; label_text = ea_gnome_calendar_get_label_description (gcal); diff --git a/calendar/gui/ea-week-view.c b/calendar/gui/ea-week-view.c index c3b4658e78..a34326cf74 100644 --- a/calendar/gui/ea-week-view.c +++ b/calendar/gui/ea-week-view.c @@ -134,11 +134,7 @@ ea_week_view_get_name (AtkObject *accessible) week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget); gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)); -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_visible (GTK_WIDGET (gcal))) -#else - if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (gcal))) -#endif return NULL; label_text = ea_gnome_calendar_get_label_description (gcal); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index b173bccff7..bc270d2d97 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -230,14 +230,17 @@ update_adjustment (GnomeCalendar *gcal, time_t lower; guint32 old_first_day_julian, new_first_day_julian; icaltimezone *timezone; + gdouble value; /* If we don't have a valid date set yet, just return. */ if (!g_date_valid (&week_view->first_day_shown)) return; + value = gtk_adjustment_get_value (adjustment); + /* Determine the first date shown. */ date = week_view->base_date; - week_offset = floor (adjustment->value + 0.5); + week_offset = floor (value + 0.5); g_date_add_days (&date, week_offset * 7); /* Convert the old & new first days shown to julian values. */ @@ -2088,11 +2091,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal) return; /* If the ECalendar isn't visible, we just return. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_visible (GTK_WIDGET (priv->date_navigator))) -#else - if (!GTK_WIDGET_VISIBLE (priv->date_navigator)) -#endif return; if (priv->current_view_type == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range) diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index a6a7e520ab..f700da5a3b 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -142,11 +142,7 @@ tag_calendar_by_client (ECalendar *ecal, g_return_if_fail (E_IS_CAL (client)); /* If the ECalendar isn't visible, we just return. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_visible (GTK_WIDGET (ecal))) -#else - if (!GTK_WIDGET_VISIBLE (ecal)) -#endif return; if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED) @@ -214,11 +210,7 @@ tag_calendar_by_comp (ECalendar *ecal, g_return_if_fail (E_IS_CAL_COMPONENT (comp)); /* If the ECalendar isn't visible, we just return. */ -#if GTK_CHECK_VERSION(2,19,7) if (!gtk_widget_get_visible (GTK_WIDGET (ecal))) -#else - if (!GTK_WIDGET_VISIBLE (ecal)) -#endif return; if (!prepare_tag (ecal, &c, display_zone, clear_first)) diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 12dd47d16a..69ba5b79f3 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -93,20 +93,22 @@ colorize_items (WeekdayPicker *wp) GdkColor *fill, *sel_fill; GdkColor *text_fill, *sel_text_fill; GtkStateType state; + GtkStyle *style; gint i; priv = wp->priv; state = gtk_widget_get_state (GTK_WIDGET (wp)); + style = gtk_widget_get_style (GTK_WIDGET (wp)); - outline = >K_WIDGET (wp)->style->fg[state]; - focus_outline = >K_WIDGET (wp)->style->bg[state]; + outline = &style->fg[state]; + focus_outline = &style->bg[state]; - fill = >K_WIDGET (wp)->style->base[state]; - text_fill = >K_WIDGET (wp)->style->fg[state]; + fill = &style->base[state]; + text_fill = &style->fg[state]; - sel_fill = >K_WIDGET (wp)->style->bg[GTK_STATE_SELECTED]; - sel_text_fill = >K_WIDGET (wp)->style->fg[GTK_STATE_SELECTED]; + sel_fill = &style->bg[GTK_STATE_SELECTED]; + sel_text_fill = &style->fg[GTK_STATE_SELECTED]; for (i = 0; i < 7; i++) { gint day; @@ -144,14 +146,17 @@ static void configure_items (WeekdayPicker *wp) { WeekdayPickerPrivate *priv; + GtkAllocation allocation; gint width, height; gint box_width; gint i; priv = wp->priv; - width = GTK_WIDGET (wp)->allocation.width; - height = GTK_WIDGET (wp)->allocation.height; + gtk_widget_get_allocation (GTK_WIDGET (wp), &allocation); + + width = allocation.width; + height = allocation.height; box_width = (width - 1) / 7; @@ -321,11 +326,7 @@ weekday_picker_focus (GtkWidget *widget, if (!gtk_widget_get_can_focus (widget)) return FALSE; -#if GTK_CHECK_VERSION(2,19,7) if (gtk_widget_has_focus (widget)) { -#else - if (GTK_WIDGET_HAS_FOCUS (widget)) { -#endif priv->focus_day = -1; colorize_items (wp); return FALSE; |