aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c39
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c31
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c34
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c9
-rw-r--r--addressbook/gui/merging/eab-contact-merging.c30
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c2
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c10
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c18
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c26
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c18
-rw-r--r--addressbook/gui/widgets/e-minicard.c30
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c5
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.c14
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c18
-rw-r--r--calendar/gui/comp-util.c17
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c9
-rw-r--r--calendar/gui/dialogs/alarm-list-dialog.c14
-rw-r--r--calendar/gui/dialogs/delete-comp.c8
-rw-r--r--calendar/gui/dialogs/event-editor.c12
-rw-r--r--calendar/gui/dialogs/event-page.c8
-rw-r--r--calendar/gui/dialogs/memo-page.c4
-rw-r--r--calendar/gui/dialogs/recur-comp.c7
-rw-r--r--calendar/gui/dialogs/recurrence-page.c42
-rw-r--r--calendar/gui/dialogs/schedule-page.c4
-rw-r--r--calendar/gui/dialogs/send-comp.c6
-rw-r--r--calendar/gui/dialogs/task-details-page.c19
-rw-r--r--calendar/gui/dialogs/task-editor.c5
-rw-r--r--calendar/gui/dialogs/task-page.c4
-rw-r--r--calendar/gui/e-calendar-selector.c6
-rw-r--r--calendar/gui/e-calendar-view.c73
-rw-r--r--calendar/gui/e-day-view-main-item.c8
-rw-r--r--calendar/gui/e-day-view-time-item.c9
-rw-r--r--calendar/gui/e-day-view-top-item.c17
-rw-r--r--calendar/gui/e-day-view.c399
-rw-r--r--calendar/gui/e-meeting-time-sel-item.c17
-rw-r--r--calendar/gui/e-meeting-time-sel.c286
-rw-r--r--calendar/gui/e-memo-table.c4
-rw-r--r--calendar/gui/e-select-names-renderer.c11
-rw-r--r--calendar/gui/e-task-table.c4
-rw-r--r--calendar/gui/e-timezone-entry.c24
-rw-r--r--calendar/gui/e-week-view-event-item.c58
-rw-r--r--calendar/gui/e-week-view-main-item.c4
-rw-r--r--calendar/gui/e-week-view-titles-item.c26
-rw-r--r--calendar/gui/e-week-view.c256
-rw-r--r--calendar/gui/ea-cal-view-event.c9
-rw-r--r--calendar/gui/ea-cal-view.c8
-rw-r--r--calendar/gui/ea-day-view.c4
-rw-r--r--calendar/gui/ea-week-view.c4
-rw-r--r--calendar/gui/gnome-cal.c9
-rw-r--r--calendar/gui/tag-calendar.c8
-rw-r--r--calendar/gui/weekday-picker.c25
-rw-r--r--composer/e-composer-actions.c4
-rw-r--r--composer/e-msg-composer.c4
-rw-r--r--e-util/e-alert-dialog.c2
-rw-r--r--mail/e-mail-attachment-bar.c4
-rw-r--r--mail/e-mail-reader.c4
-rw-r--r--mail/em-composer-utils.c6
-rw-r--r--mail/em-filter-folder-element.c4
-rw-r--r--mail/em-filter-rule.c7
-rw-r--r--mail/em-folder-properties.c8
-rw-r--r--mail/em-folder-selector.c19
-rw-r--r--mail/em-folder-tree.c44
-rw-r--r--mail/em-format-html-display.c17
-rw-r--r--mail/em-subscribe-editor.c9
-rw-r--r--mail/em-utils.c95
-rw-r--r--mail/mail-send-recv.c19
-rw-r--r--mail/mail-vfolder.c44
-rw-r--r--mail/message-list.c59
-rw-r--r--modules/addressbook/addressbook-config.c32
-rw-r--r--modules/calendar/e-task-shell-view-actions.c5
-rw-r--r--modules/mail/em-mailer-prefs.c12
-rw-r--r--modules/mail/em-network-prefs.c16
-rw-r--r--plugins/attachment-reminder/attachment-reminder.c7
-rw-r--r--plugins/backup-restore/backup.c20
-rw-r--r--plugins/bbdb/bbdb.c6
-rw-r--r--plugins/calendar-weather/calendar-weather.c6
-rw-r--r--plugins/email-custom-header/email-custom-header.c10
-rw-r--r--plugins/groupwise-features/junk-mail-settings.c10
-rw-r--r--plugins/groupwise-features/mail-retract.c16
-rw-r--r--plugins/groupwise-features/share-folder-common.c6
-rw-r--r--plugins/groupwise-features/status-track.c4
-rw-r--r--plugins/image-inline/image-inline.c4
-rw-r--r--plugins/itip-formatter/itip-formatter.c6
-rw-r--r--plugins/itip-formatter/itip-view.c4
-rw-r--r--plugins/mail-notification/mail-notification.c5
-rw-r--r--plugins/mark-all-read/mark-all-read.c5
-rw-r--r--plugins/publish-calendar/url-editor-dialog.c8
-rw-r--r--plugins/startup-wizard/startup-wizard.c23
-rw-r--r--shell/e-shell-content.c16
-rw-r--r--shell/e-shell-sidebar.c2
-rw-r--r--shell/e-shell-switcher.c19
-rw-r--r--shell/e-shell-taskbar.c16
-rw-r--r--shell/e-shell-window-actions.c8
-rw-r--r--shell/main.c15
-rw-r--r--smime/gui/ca-trust-dialog.c12
-rw-r--r--smime/gui/certificate-manager.c4
-rw-r--r--smime/gui/certificate-viewer.c13
-rw-r--r--smime/gui/e-cert-selector.c4
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c10
-rw-r--r--widgets/menus/gal-define-views-dialog.c11
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.c11
-rw-r--r--widgets/menus/gal-view-new-dialog.c20
-rw-r--r--widgets/misc/e-activity-proxy.c2
-rw-r--r--widgets/misc/e-buffer-tagger.c4
-rw-r--r--widgets/misc/e-calendar-item.c4
-rw-r--r--widgets/misc/e-calendar.c17
-rw-r--r--widgets/misc/e-canvas-background.c4
-rw-r--r--widgets/misc/e-canvas.c4
-rw-r--r--widgets/misc/e-dateedit.c4
-rw-r--r--widgets/misc/e-hinted-entry.c4
-rw-r--r--widgets/misc/e-map.c41
-rw-r--r--widgets/misc/e-online-button.c4
-rw-r--r--widgets/misc/e-search-bar.c4
-rw-r--r--widgets/table/e-cell-combo.c102
-rw-r--r--widgets/table/e-cell-date-edit.c38
-rw-r--r--widgets/table/e-cell-popup.c8
-rw-r--r--widgets/table/e-cell-text.c53
-rw-r--r--widgets/table/e-cell-toggle.c4
-rw-r--r--widgets/table/e-cell-tree.c72
-rw-r--r--widgets/table/e-table-click-to-add.c67
-rw-r--r--widgets/table/e-table-config.c50
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c17
-rw-r--r--widgets/table/e-table-field-chooser-item.c40
-rw-r--r--widgets/table/e-table-field-chooser.c4
-rw-r--r--widgets/table/e-table-group-container.c4
-rw-r--r--widgets/table/e-table-header-item.c160
-rw-r--r--widgets/table/e-table-header-utils.c4
-rw-r--r--widgets/table/e-table-item.c53
-rw-r--r--widgets/table/e-table-utils.c5
-rw-r--r--widgets/table/e-table.c286
-rw-r--r--widgets/table/e-tree.c364
-rw-r--r--widgets/table/gal-a11y-e-cell-popup.c5
-rw-r--r--widgets/table/gal-a11y-e-cell-toggle.c9
-rw-r--r--widgets/table/gal-a11y-e-table-click-to-add.c28
-rw-r--r--widgets/table/gal-a11y-e-table.c8
-rw-r--r--widgets/text/e-reflow.c193
-rw-r--r--widgets/text/e-text.c12
-rw-r--r--widgets/text/gal-a11y-e-text.c4
138 files changed, 2509 insertions, 1600 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index 3f80ec9f4b..a872afb7d9 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -101,20 +101,28 @@ static void
e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname)
{
GtkBuilder *builder;
+ GtkDialog *dialog;
+ GtkWidget *parent;
GtkWidget *widget;
+ GtkWidget *action_area;
+ GtkWidget *content_area;
+ const gchar *title;
+
+ dialog = GTK_DIALOG (e_contact_editor_fullname);
+ action_area = gtk_dialog_get_action_area (dialog);
+ content_area = gtk_dialog_get_content_area (dialog);
gtk_widget_realize (GTK_WIDGET (e_contact_editor_fullname));
- gtk_dialog_set_has_separator (GTK_DIALOG (e_contact_editor_fullname),
- FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (e_contact_editor_fullname)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (e_contact_editor_fullname)->action_area), 12);
+ gtk_dialog_set_has_separator (dialog, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
- gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_fullname),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ gtk_dialog_add_buttons (
+ dialog,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- gtk_window_set_resizable(GTK_WINDOW(e_contact_editor_fullname), TRUE);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
e_contact_editor_fullname->name = NULL;
@@ -124,14 +132,15 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
e_contact_editor_fullname->builder = builder;
widget = e_builder_get_widget(builder, "dialog-checkfullname");
- gtk_window_set_title (GTK_WINDOW (e_contact_editor_fullname),
- GTK_WINDOW (widget)->title);
+ title = gtk_window_get_title (GTK_WINDOW (widget));
+ gtk_window_set_title (GTK_WINDOW (e_contact_editor_fullname), title);
widget = e_builder_get_widget(builder, "table-checkfullname");
- g_object_ref(widget);
- gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0);
- g_object_unref(widget);
+ parent = gtk_widget_get_parent (widget);
+ g_object_ref (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+ g_object_unref (widget);
gtk_window_set_icon_name (
GTK_WINDOW (e_contact_editor_fullname), "contact-new");
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 95e9c34481..38490aee72 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -3457,24 +3457,7 @@ expand_phone_toggle (EContactEditor *ce)
GtkWidget *phone_ext_table;
phone_ext_table = e_builder_get_widget (ce->builder, "table-phone-extended");
-#if GTK_CHECK_VERSION(2,19,7)
expand_phone (ce, !gtk_widget_get_visible (phone_ext_table));
-#else
- expand_phone (ce, !GTK_WIDGET_VISIBLE (phone_ext_table));
-#endif
-}
-
-static void
-expand_mail_toggle (EContactEditor *ce)
-{
- GtkWidget *mail;
-
- mail = e_builder_get_widget (ce->builder, "entry-email-4");
-#if GTK_CHECK_VERSION(2,19,7)
- expand_mail (ce, !gtk_widget_get_visible (mail));
-#else
- expand_mail (ce, !GTK_WIDGET_VISIBLE (mail));
-#endif
}
static void
@@ -3482,6 +3465,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
{
GtkBuilder *builder;
EShell *shell;
+ GtkWidget *container;
GtkWidget *widget, *label;
GtkEntryCompletion *completion;
@@ -3512,8 +3496,10 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_widget_ensure_style (widget);
gtk_window_set_type_hint (GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_NORMAL);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (widget)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (widget)->action_area), 12);
+ container = gtk_dialog_get_action_area (GTK_DIALOG (widget));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
init_all (e_contact_editor);
@@ -3909,9 +3895,12 @@ static void
e_contact_editor_raise (EABEditor *editor)
{
EContactEditor *ce = E_CONTACT_EDITOR (editor);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (ce->app);
- if (GTK_WIDGET (ce->app)->window)
- gdk_window_raise (GTK_WIDGET (ce->app)->window);
+ if (window != NULL)
+ gdk_window_raise (window);
}
/**
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index d10ceeac6f..0242d20c02 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -342,6 +342,7 @@ build_quick_add_dialog (QuickAdd *qa)
{
ESourceList *source_list;
GConfClient *gconf_client;
+ GtkWidget *container;
GtkWidget *dialog;
GtkWidget *label;
GtkTable *table;
@@ -350,19 +351,21 @@ build_quick_add_dialog (QuickAdd *qa)
g_return_val_if_fail (qa != NULL, NULL);
- dialog = gtk_dialog_new_with_buttons (_("Contact Quick-Add"),
- e_shell_get_active_window (NULL),
- GTK_DIALOG_NO_SEPARATOR,
- _("_Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ dialog = gtk_dialog_new_with_buttons (
+ _("Contact Quick-Add"),
+ e_shell_get_active_window (NULL),
+ GTK_DIALOG_NO_SEPARATOR,
+ _("_Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
- 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
- 12);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
g_signal_connect (dialog, "response", G_CALLBACK (clicked_cb), qa);
@@ -460,11 +463,10 @@ build_quick_add_dialog (QuickAdd *qa)
1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
- gtk_container_set_border_width (GTK_CONTAINER (table),
- 12);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- GTK_WIDGET (table),
- FALSE, FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 12);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (
+ GTK_BOX (container), GTK_WIDGET (table), FALSE, FALSE, 0);
gtk_widget_show_all (GTK_WIDGET (table));
return dialog;
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index c15a03c70c..831b51eb27 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -439,6 +439,7 @@ contact_list_editor_drag_data_received_cb (GtkWidget *widget,
EContactListModel *model;
gboolean changed = FALSE;
gboolean handled = FALSE;
+ const guchar *data;
GList *list, *iter;
GdkAtom target;
@@ -451,7 +452,8 @@ contact_list_editor_drag_data_received_cb (GtkWidget *widget,
if (!e_targets_include_directory (&target, 1))
goto exit;
- list = eab_contact_list_from_string ((gchar *) selection_data->data);
+ data = gtk_selection_data_get_data (selection_data);
+ list = eab_contact_list_from_string ((gchar *) data);
if (list != NULL)
handled = TRUE;
@@ -1088,7 +1090,10 @@ contact_list_editor_close (EABEditor *editor)
static void
contact_list_editor_raise (EABEditor *editor)
{
- gdk_window_raise (WIDGET (DIALOG)->window);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (WIDGET (DIALOG));
+ gdk_window_raise (window);
}
static void
diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c
index a4659c7402..ec37972b46 100644
--- a/addressbook/gui/merging/eab-contact-merging.c
+++ b/addressbook/gui/merging/eab-contact-merging.c
@@ -173,12 +173,15 @@ cancelit (EContactMergingLookup *lookup)
static void
dialog_map (GtkWidget *window, GdkEvent *event, GtkWidget *table)
{
+ GtkAllocation allocation;
gint h, w;
+ gtk_widget_get_allocation (table, &allocation);
+
/* Spacing around the table */
- w = table->allocation.width + 30;
+ w = allocation.width + 30;
/* buttons and outer spacing */
- h = table->allocation.height + 60;
+ h = allocation.height + 60;
if (w > 400)
w = 400;
if (h > 450)
@@ -204,6 +207,7 @@ static gint
mergeit (EContactMergingLookup *lookup)
{
GtkWidget *scrolled_window, *label, *hbox, *dropdown;
+ GtkWidget *content_area;
GtkDialog *dialog;
GtkTable *table;
EContactField field;
@@ -216,6 +220,8 @@ mergeit (EContactMergingLookup *lookup)
dialog = (GtkDialog *)(gtk_dialog_new_with_buttons (_("Merge Contact"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL));
gtk_container_set_border_width (GTK_CONTAINER(dialog), 5);
+ content_area = gtk_dialog_get_content_area (dialog);
+
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
@@ -355,7 +361,7 @@ mergeit (EContactMergingLookup *lookup)
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 300);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), GTK_WIDGET (table));
- gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
g_signal_connect (dialog, "map-event", G_CALLBACK (dialog_map), table);
gtk_widget_show_all ((GtkWidget *)table);
@@ -477,8 +483,9 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty
doit (lookup, same_uids);
} else {
GtkBuilder *builder;
-
- GtkWidget *widget, *merge_button;
+ GtkWidget *container;
+ GtkWidget *merge_button;
+ GtkWidget *widget;
/* XXX I think we're leaking the GtkBuilder. */
builder = gtk_builder_new ();
@@ -518,11 +525,16 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty
widget = e_builder_get_widget (builder, "dialog-duplicate-contact");
gtk_widget_ensure_style (widget);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (widget)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (widget)->action_area), 12);
- g_signal_connect (widget, "response",
- G_CALLBACK (response), lookup);
+ container = gtk_dialog_get_action_area (GTK_DIALOG (widget));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
+
+ g_signal_connect (
+ widget, "response",
+ G_CALLBACK (response), lookup);
gtk_widget_show_all (widget);
}
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
index 3fcf8e8f8b..690ad007ba 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -295,7 +295,7 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector);
g_return_val_if_fail (priv->current_view != NULL, FALSE);
- string = (const gchar *) selection_data->data;
+ string = (const gchar *) gtk_selection_data_get_data (selection_data);
remove_from_source = (action == GDK_ACTION_MOVE);
target_book = e_book_new (destination, NULL);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index c27bb74d8d..1e9b732861 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -241,6 +241,7 @@ table_drag_data_get (ETable *table,
EAddressbookModel *model;
EBook *book;
GList *contact_list;
+ GdkAtom target;
gchar *value;
if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
@@ -250,14 +251,15 @@ table_drag_data_get (ETable *table,
book = e_addressbook_model_get_book (model);
contact_list = e_addressbook_view_get_selected (view);
+ target = gtk_selection_data_get_target (selection_data);
switch (info) {
case DND_TARGET_TYPE_VCARD:
value = eab_contact_list_to_string (contact_list);
gtk_selection_data_set (
- selection_data, selection_data->target,
- 8, (guchar *)value, strlen (value));
+ selection_data, target, 8,
+ (guchar *)value, strlen (value));
g_free (value);
break;
@@ -267,8 +269,8 @@ table_drag_data_get (ETable *table,
book, contact_list);
gtk_selection_data_set (
- selection_data, selection_data->target,
- 8, (guchar *)value, strlen (value));
+ selection_data, target, 8,
+ (guchar *)value, strlen (value));
g_free (value);
break;
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index 3b0edc8854..0eb166bcf3 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -414,9 +414,13 @@ e_minicard_label_resize_children(EMinicardLabel *e_minicard_label)
static void
set_colors (EMinicardLabel *label)
{
- if ((GTK_OBJECT_FLAGS( label ) & GNOME_CANVAS_ITEM_REALIZED)) {
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (label)->canvas);
- GtkStyle *style = gtk_widget_get_style (canvas);
+ if ((GTK_OBJECT_FLAGS (label) & GNOME_CANVAS_ITEM_REALIZED)) {
+ GnomeCanvas *canvas;
+ GtkStyle *style;
+
+ canvas = GNOME_CANVAS_ITEM (label)->canvas;
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
+
if (label->has_focus) {
gnome_canvas_item_set (label->rect,
"outline_color_gdk", &style->mid[GTK_STATE_SELECTED],
@@ -424,11 +428,11 @@ set_colors (EMinicardLabel *label)
NULL);
gnome_canvas_item_set (label->field,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
NULL);
gnome_canvas_item_set (label->fieldname,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
NULL);
}
else {
@@ -438,11 +442,11 @@ set_colors (EMinicardLabel *label)
NULL);
gnome_canvas_item_set (label->field,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
NULL);
gnome_canvas_item_set (label->fieldname,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
NULL);
}
}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 0244d13d34..7a78d83a42 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -361,11 +361,14 @@ static void
e_minicard_view_widget_style_set (GtkWidget *widget, GtkStyle *previous_style)
{
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
if (view->background)
- gnome_canvas_item_set (view->background,
- "fill_color_gdk", &widget->style->base[GTK_STATE_NORMAL],
- NULL );
+ gnome_canvas_item_set (
+ view->background, "fill_color_gdk",
+ &style->base[GTK_STATE_NORMAL], NULL);
if (GTK_WIDGET_CLASS(parent_class)->style_set)
GTK_WIDGET_CLASS(parent_class)->style_set (widget, previous_style);
@@ -420,11 +423,7 @@ e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocatio
if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (widget)) {
-#else
- if (GTK_WIDGET_REALIZED(widget)) {
-#endif
gdouble width;
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
@@ -447,15 +446,18 @@ e_minicard_view_widget_reflow(ECanvas *canvas)
{
gdouble width;
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas);
+ GtkAllocation allocation;
if (E_CANVAS_CLASS(parent_class)->reflow)
E_CANVAS_CLASS(parent_class)->reflow (canvas);
- g_object_get(view->emv,
- "width", &width,
- NULL);
- width = MAX(width, GTK_WIDGET(canvas)->allocation.width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.height - 1);
+ g_object_get (view->emv, "width", &width, NULL);
+ gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
+
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS(canvas), 0, 0,
+ MAX (width, allocation.width) - 1,
+ allocation.height - 1);
}
ESelectionModel *
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 04121207e7..b69f842d63 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -83,19 +83,22 @@ e_minicard_view_drag_data_get(GtkWidget *widget,
guint time,
EMinicardView *view)
{
+ GdkAtom target;
+
if (!E_IS_MINICARD_VIEW(view))
return;
+ target = gtk_selection_data_get_target (selection_data);
+
switch (info) {
case DND_TARGET_TYPE_VCARD_LIST: {
gchar *value;
value = eab_contact_list_to_string (view->drag_list);
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
+ gtk_selection_data_set (
+ selection_data, target, 8,
+ (guchar *) value, strlen (value));
g_free (value);
break;
}
@@ -106,10 +109,9 @@ e_minicard_view_drag_data_get(GtkWidget *widget,
g_object_get (view->adapter, "book", &book, NULL);
value = eab_book_and_contact_list_to_string (book, view->drag_list);
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
+ gtk_selection_data_set (
+ selection_data, target, 8,
+ (guchar *) value, strlen (value));
g_free (value);
break;
}
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 8a5783f3ed..213d600746 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -267,26 +267,31 @@ e_minicard_init (EMinicard *minicard)
static void
set_selected (EMinicard *minicard, gboolean selected)
{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(minicard)->canvas);
+ GnomeCanvas *canvas;
+ GtkStyle *style;
+
+ canvas = GNOME_CANVAS_ITEM (minicard)->canvas;
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
+
if (selected) {
gnome_canvas_item_set (minicard->rect,
- "outline_color_gdk", &canvas->style->bg[GTK_STATE_ACTIVE],
+ "outline_color_gdk", &style->bg[GTK_STATE_ACTIVE],
NULL);
gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED],
+ "fill_color_gdk", &style->bg[GTK_STATE_SELECTED],
NULL);
gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED],
+ "fill_color_gdk", &style->text[GTK_STATE_SELECTED],
NULL);
} else {
gnome_canvas_item_set (minicard->rect,
"outline_color", NULL,
NULL);
gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
NULL);
gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
NULL);
}
minicard->selected = selected;
@@ -471,11 +476,14 @@ e_minicard_realize (GnomeCanvasItem *item)
{
EMinicard *e_minicard;
GnomeCanvasGroup *group;
- GtkWidget *canvas;
+ GnomeCanvas *canvas;
+ GtkStyle *style;
e_minicard = E_MINICARD (item);
- group = GNOME_CANVAS_GROUP( item );
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
+ group = GNOME_CANVAS_GROUP (item);
+
+ canvas = GNOME_CANVAS_ITEM (item)->canvas;
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
(* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
@@ -497,7 +505,7 @@ e_minicard_realize (GnomeCanvasItem *item)
"y1", (double) 2,
"x2", (double) MAX (e_minicard->width - 3, 0),
"y2", (double) MAX (e_minicard->height - 3, 0),
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
NULL );
e_minicard->header_text =
@@ -507,7 +515,7 @@ e_minicard_realize (GnomeCanvasItem *item)
"width", (double) MAX( e_minicard->width - 12, 0 ),
"clip", TRUE,
"use_ellipsis", TRUE,
- "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->fg[GTK_STATE_NORMAL],
"text", "",
"draw_background", FALSE,
NULL );
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 080d1787c7..d127d50786 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -234,6 +234,7 @@ eab_select_source (ESource *except_source, const gchar *title, const gchar *mess
{
ESource *source;
ESourceList *source_list;
+ GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *ok_button;
/* GtkWidget *label; */
@@ -272,8 +273,8 @@ eab_select_source (ESource *except_source, const gchar *title, const gchar *mess
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrolled_window), selector);
- /* gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 4); */
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scrolled_window, TRUE, TRUE, 4);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), scrolled_window, TRUE, TRUE, 4);
gtk_widget_show_all (dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
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 = &GTK_WIDGET (wp)->style->fg[state];
- focus_outline = &GTK_WIDGET (wp)->style->bg[state];
+ outline = &style->fg[state];
+ focus_outline = &style->bg[state];
- fill = &GTK_WIDGET (wp)->style->base[state];
- text_fill = &GTK_WIDGET (wp)->style->fg[state];
+ fill = &style->base[state];
+ text_fill = &style->fg[state];
- sel_fill = &GTK_WIDGET (wp)->style->bg[GTK_STATE_SELECTED];
- sel_text_fill = &GTK_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;
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 0c1a28b130..98cb9c5e17 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -58,6 +58,7 @@ action_close_cb (GtkAction *action,
{
GtkhtmlEditor *editor;
EComposerHeaderTable *table;
+ GdkWindow *window;
GtkWidget *widget;
const gchar *subject;
gint response;
@@ -70,7 +71,8 @@ action_close_cb (GtkAction *action,
return;
}
- gdk_window_raise (widget->window);
+ window = gtk_widget_get_window (widget);
+ gdk_window_raise (window);
table = e_msg_composer_get_header_table (composer);
subject = e_composer_header_table_get_subject (table);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 5066ce24a4..2edf313a5e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -165,6 +165,7 @@ emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, .
{
GtkDialog *mbox;
GtkWidget *check = NULL;
+ GtkWidget *container;
va_list ap;
gint button;
GConfClient *gconf = gconf_client_get_default ();
@@ -186,7 +187,8 @@ emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, .
if (promptkey) {
check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
gtk_container_set_border_width((GtkContainer *)check, 12);
- gtk_box_pack_start ((GtkBox *)mbox->vbox, check, TRUE, TRUE, 0);
+ container = gtk_dialog_get_content_area (mbox);
+ gtk_box_pack_start (GTK_BOX (container), check, TRUE, TRUE, 0);
gtk_widget_show (check);
}
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 09512ce17c..4dc34174a1 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -221,7 +221,7 @@ e_alert_dialog_constructed (GObject *obj)
gtk_label_set_selectable((GtkLabel *)w, TRUE);
gtk_label_set_line_wrap((GtkLabel *)w, TRUE);
gtk_label_set_markup((GtkLabel *)w, out->str);
- GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (w, FALSE);
g_string_free(out, TRUE);
if (e_alert_get_scroll (alert)) {
gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *)scroll, w);
diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c
index 88198438b7..0ffe287306 100644
--- a/mail/e-mail-attachment-bar.c
+++ b/mail/e-mail-attachment-bar.c
@@ -322,11 +322,7 @@ mail_attachment_bar_size_request (GtkWidget *widget,
* get a sizable gap between the headers and body when this
* widget is invisible. Once we finally move to WebKit,
* remove this. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (widget)) {
-#else
- if (!GTK_WIDGET_VISIBLE (widget)) {
-#endif
requisition->width = 0;
requisition->height = 0;
return;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 684b97c085..eb1c7f298d 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1926,11 +1926,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
widget = GTK_WIDGET (EM_FORMAT_HTML (html_display)->html);
-#if GTK_CHECK_VERSION(2,19,7)
html_display_visible = gtk_widget_get_mapped (widget);
-#else
- html_display_visible = GTK_WIDGET_MAPPED (widget);
-#endif
selected_uid_changed = g_strcmp0 (cursor_uid, format_uid);
if (html_display_visible && selected_uid_changed) {
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index c9a8a30c78..ffa053712f 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -809,10 +809,8 @@ em_utils_compose_new_message_with_mailto (const gchar *url, const gchar *fromuri
composer_set_no_change (composer, TRUE, url == NULL);
- if (!e_msg_composer_get_lite ()) {
- gtk_widget_show ((GtkWidget *) composer);
- gdk_window_raise (((GtkWidget *) composer)->window);
- }
+ if (!e_msg_composer_get_lite ())
+ gtk_window_present (GTK_WINDOW (composer));
return composer;
}
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index 3b80e0da77..f4584c65b1 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -230,6 +230,7 @@ xml_decode(EFilterElement *fe, xmlNodePtr node)
static void
folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff)
{
+ GtkWidget *toplevel;
const gchar *uri;
uri = em_folder_selection_button_get_selection(button);
@@ -240,7 +241,8 @@ folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff)
else
ff->uri = uri != NULL ? em_uri_from_camel (uri) : NULL;
- gdk_window_raise(GTK_WIDGET(gtk_widget_get_ancestor(GTK_WIDGET(button), GTK_TYPE_WINDOW))->window);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
+ gtk_window_present (GTK_WINDOW (toplevel));
}
static GtkWidget *
diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c
index 41a6ba6640..ce73d2024f 100644
--- a/mail/em-filter-rule.c
+++ b/mail/em-filter-rule.c
@@ -503,9 +503,12 @@ more_parts(GtkWidget *button, struct _rule_data *data)
GtkAdjustment *adjustment;
adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (w));
- if (adjustment)
- gtk_adjustment_set_value (adjustment, adjustment->upper);
+ if (adjustment) {
+ gdouble upper;
+ upper = gtk_adjustment_get_upper (adjustment);
+ gtk_adjustment_set_value (adjustment, upper);
+ }
}
}
}
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index e02f039ee2..f3f41165c5 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -288,6 +288,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
gpointer data)
{
GtkWidget *dialog, *w;
+ GtkWidget *content_area;
struct _prop_data *prop_data;
GSList *l;
gint32 count, i,deleted;
@@ -396,8 +397,11 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_default_size ((GtkWindow *) dialog, 192, 160);
+
gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->vbox, 12);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 12);
/** @HookPoint-EMConfig: Folder Properties Window
* @Id: org.gnome.evolution.mail.folderConfig
@@ -418,7 +422,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
w = e_config_create_widget((EConfig *)ec);
- gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, w, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), w, TRUE, TRUE, 0);
/* we do 'apply on ok' ... since instant apply may apply some very long running tasks */
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index 8ba323c135..089daf4d44 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -131,7 +131,7 @@ emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs)
const gchar *text = NULL;
gboolean active;
- if (emfs->name_entry->text_length > 0)
+ if (gtk_entry_get_text_length (emfs->name_entry) > 0)
text = gtk_entry_get_text (emfs->name_entry);
path = em_folder_tree_get_selected_uri(emfs->emft);
@@ -159,14 +159,16 @@ folder_activated_cb (EMFolderTree *emft, const gchar *path, const gchar *uri, EM
void
em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text, const gchar *oklabel)
{
+ GtkWidget *container;
GtkWidget *widget;
gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300);
gtk_window_set_title (GTK_WINDOW (emfs), title);
gtk_container_set_border_width (GTK_CONTAINER (emfs), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (emfs)->vbox), 6);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (emfs)->vbox), 6);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (emfs));
+ gtk_box_set_spacing (GTK_BOX (container), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (container), 6);
emfs->flags = flags;
if (flags & EM_FOLDER_SELECTOR_CAN_CREATE) {
@@ -186,8 +188,7 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_box_pack_end (
- GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, TRUE, TRUE, 6);
+ gtk_box_pack_end (GTK_BOX (container), widget, TRUE, TRUE, 6);
gtk_widget_show (widget);
emfs->emft = emft;
@@ -202,7 +203,7 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3
gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_LEFT);
gtk_widget_show (widget);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, FALSE, TRUE, 6);
+ gtk_box_pack_end (GTK_BOX (container), widget, FALSE, TRUE, 6);
}
gtk_widget_grab_focus ((GtkWidget *) emfs->emft);
@@ -229,7 +230,7 @@ em_folder_selector_new (GtkWindow *parent,
static void
emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs)
{
- if (emfs->name_entry->text_length > 0) {
+ if (gtk_entry_get_text_length (emfs->name_entry) > 0) {
gchar *path;
const gchar *text;
@@ -251,6 +252,7 @@ em_folder_selector_create_new (GtkWindow *parent,
{
EMFolderSelector *emfs;
GtkWidget *hbox, *w;
+ GtkWidget *container;
/* remove the CREATE flag if it is there since that's the
* whole purpose of this dialog */
@@ -272,7 +274,8 @@ em_folder_selector_create_new (GtkWindow *parent,
gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) emfs->name_entry, TRUE, FALSE, 6);
gtk_widget_show_all (hbox);
- gtk_box_pack_start ((GtkBox *) ((GtkDialog *) emfs)->vbox, hbox, FALSE, TRUE, 0);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (emfs));
+ gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, TRUE, 0);
gtk_widget_grab_focus ((GtkWidget *) emfs->name_entry);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index badb6f8117..7a8f7be744 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1457,10 +1457,13 @@ static void
folder_tree_drop_folder(struct _DragDataReceivedAsync *m)
{
CamelFolder *src;
+ const guchar *data;
- d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name));
+ data = gtk_selection_data_get_data (m->selection);
- if (!(src = mail_tool_uri_to_folder((gchar *)m->selection->data, 0, &m->base.ex)))
+ d(printf(" * Drop folder '%s' onto '%s'\n", data, m->full_name));
+
+ if (!(src = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.ex)))
return;
em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move);
@@ -1471,10 +1474,13 @@ static gchar *
folder_tree_drop_async__desc (struct _DragDataReceivedAsync *m)
{
CamelURL *url;
+ const guchar *data;
gchar *buf;
+ data = gtk_selection_data_get_data (m->selection);
+
if (m->info == DND_DROP_TYPE_FOLDER) {
- url = camel_url_new ((gchar *)m->selection->data, NULL);
+ url = camel_url_new ((gchar *)data, NULL);
if (m->move)
buf = g_strdup_printf (_("Moving folder %s"), url->fragment ? url->fragment : url->path + 1);
@@ -1532,9 +1538,7 @@ folder_tree_drop_async__free (struct _DragDataReceivedAsync *m)
g_object_unref(m->context);
camel_object_unref(m->store);
g_free(m->full_name);
-
- g_free(m->selection->data);
- g_free(m->selection);
+ gtk_selection_data_free (m->selection);
}
static MailMsgInfo folder_tree_drop_async_info = {
@@ -1572,7 +1576,12 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
return;
/* this means we are receiving no data */
- if (!selection->data || selection->length == -1) {
+ if (gtk_selection_data_get_data (selection) == NULL) {
+ gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME);
+ return;
+ }
+
+ if (gtk_selection_data_get_length (selection) == -1) {
gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME);
return;
}
@@ -1604,10 +1613,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
m->info = info;
/* need to copy, goes away once we exit */
- m->selection = g_malloc0(sizeof(*m->selection));
- m->selection->data = g_malloc(selection->length);
- memcpy(m->selection->data, selection->data, selection->length);
- m->selection->length = selection->length;
+ m->selection = gtk_selection_data_copy (selection);
tree_drag_data_action(m);
}
@@ -1898,12 +1904,14 @@ tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolde
static gboolean
tree_autoscroll (EMFolderTree *folder_tree)
{
- GtkAdjustment *vadjustment;
+ GtkAdjustment *adjustment;
GtkTreeView *tree_view;
GdkRectangle rect;
GdkWindow *window;
gint offset, y;
- gfloat value;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
/* get the y pointer position relative to the treeview */
tree_view = GTK_TREE_VIEW (folder_tree);
@@ -1923,10 +1931,14 @@ tree_autoscroll (EMFolderTree *folder_tree)
return TRUE;
}
- vadjustment = gtk_tree_view_get_vadjustment (tree_view);
+ adjustment = gtk_tree_view_get_vadjustment (tree_view);
+
+ page_size = gtk_adjustment_get_value (adjustment);
+ upper = gtk_adjustment_get_value (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
- value = CLAMP (vadjustment->value + offset, 0.0, vadjustment->upper - vadjustment->page_size);
- gtk_adjustment_set_value (vadjustment, value);
+ value = CLAMP (value + offset, 0.0, upper - page_size);
+ gtk_adjustment_set_value (adjustment, value);
return TRUE;
}
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index d32ee8dd9f..54a768ec59 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -874,13 +874,15 @@ efhd_bar_resize (EMFormatHTML *efh,
GtkAllocation *event)
{
EMFormatHTMLDisplayPrivate *priv;
+ GtkAllocation allocation;
GtkWidget *widget;
gint width;
priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
widget = GTK_WIDGET (efh->html);
- width = widget->allocation.width - 12;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width - 12;
if (width > 0) {
widget = priv->attachment_view;
@@ -940,11 +942,7 @@ efhd_optional_button_show (GtkWidget *widget, GtkWidget *w)
{
GtkWidget *label = g_object_get_data (G_OBJECT (widget), "text-label");
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (w)) {
-#else
- if (GTK_WIDGET_VISIBLE (w)) {
-#endif
gtk_widget_hide (w);
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("View _Unformatted"));
} else {
@@ -956,7 +954,10 @@ efhd_optional_button_show (GtkWidget *widget, GtkWidget *w)
static void
efhd_resize (GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh)
{
- gtk_widget_set_size_request (w, ((GtkWidget *)efh->html)->allocation.width-48, 250);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (efh->html), &allocation);
+ gtk_widget_set_size_request (w, allocation.width - 48, 250);
}
/* optional render attachment button callback */
@@ -967,6 +968,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
GtkWidget *hbox, *vbox, *button, *mainbox, *scroll, *label, *img;
AtkObject *a11y;
GtkWidget *view;
+ GtkAllocation allocation;
GtkTextBuffer *buffer;
/* FIXME: handle default shown case */
@@ -1035,7 +1037,8 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
gtk_box_pack_start(GTK_BOX (vbox), scroll, TRUE, TRUE, 6);
gtk_widget_show (GTK_WIDGET(view));
- gtk_widget_set_size_request (scroll, (GTK_WIDGET (efh->html))->allocation.width - 48, 250);
+ gtk_widget_get_allocation (GTK_WIDGET (efh->html), &allocation);
+ gtk_widget_set_size_request (scroll, allocation.width - 48, 250);
g_signal_connect (scroll, "size_allocate", G_CALLBACK(efhd_resize), efh);
gtk_widget_show (scroll);
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 6485af4e2f..068d74c1d6 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -808,6 +808,7 @@ em_subscribe_editor_new(void)
EIterator *iter;
GtkBuilder *builder;
GtkWidget *w;
+ GtkWidget *container;
GtkCellRenderer *cell;
GtkListStore *store;
GtkTreeIter gtiter;
@@ -823,8 +824,12 @@ em_subscribe_editor_new(void)
g_signal_connect(se->dialog, "destroy", G_CALLBACK(sub_editor_destroy), se);
gtk_widget_ensure_style ((GtkWidget *)se->dialog);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->action_area, 12);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->vbox, 0);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (se->dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (se->dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
se->vbox = e_builder_get_widget(builder, "tree_box");
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ff4487c2d4..ae6f01e7ea 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -131,6 +131,7 @@ gboolean
em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...)
{
GtkWidget *mbox, *check = NULL;
+ GtkWidget *container;
va_list ap;
gint button;
GConfClient *gconf = mail_config_get_gconf_client();
@@ -150,7 +151,8 @@ em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag
if (promptkey) {
check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
gtk_container_set_border_width((GtkContainer *)check, 12);
- gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (mbox));
+ gtk_box_pack_start (GTK_BOX (container), check, TRUE, TRUE, 0);
gtk_widget_show (check);
}
@@ -279,7 +281,7 @@ em_utils_edit_filters (GtkWidget *parent)
EMFilterContext *fc;
if (filter_editor) {
- gdk_window_raise (GTK_WIDGET (filter_editor)->window);
+ gtk_window_present (GTK_WINDOW (filter_editor));
return;
}
@@ -636,19 +638,23 @@ void
em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids)
{
CamelStream *stream;
+ GdkAtom target;
+
+ target = gtk_selection_data_get_target (data);
stream = camel_stream_mem_new();
if (em_utils_write_messages_to_stream(folder, uids, stream) == 0)
- gtk_selection_data_set(data, data->target, 8,
- ((CamelStreamMem *)stream)->buffer->data,
- ((CamelStreamMem *)stream)->buffer->len);
+ gtk_selection_data_set(
+ data, target, 8,
+ ((CamelStreamMem *)stream)->buffer->data,
+ ((CamelStreamMem *)stream)->buffer->len);
camel_object_unref(stream);
}
/**
* em_utils_selection_get_mailbox:
- * @data: selection data
+ * @selection_data: selection data
* @folder:
*
* Receive a mailbox selection/dnd
@@ -657,39 +663,53 @@ em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtr
* FIXME: Exceptions?
**/
void
-em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder)
+em_utils_selection_get_mailbox (GtkSelectionData *selection_data,
+ CamelFolder *folder)
{
CamelStream *stream;
+ const guchar *data;
+ gint length;
+
+ data = gtk_selection_data_get_data (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
- if (data->data == NULL || data->length == -1)
+ if (data == NULL || length == -1)
return;
/* TODO: a stream mem with read-only access to existing data? */
/* NB: Although copying would let us run this async ... which it should */
- stream = (CamelStream *)camel_stream_mem_new_with_buffer((gchar *)data->data, data->length);
+ stream = (CamelStream *)
+ camel_stream_mem_new_with_buffer ((gchar *) data, length);
em_utils_read_messages_from_stream(folder, stream);
camel_object_unref(stream);
}
/**
* em_utils_selection_get_message:
- * @data:
+ * @selection_data:
* @folder:
*
* get a message/rfc822 data.
**/
void
-em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder)
+em_utils_selection_get_message (GtkSelectionData *selection_data,
+ CamelFolder *folder)
{
CamelStream *stream;
CamelException *ex;
CamelMimeMessage *msg;
+ const guchar *data;
+ gint length;
+
+ data = gtk_selection_data_get_data (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
- if (data->data == NULL || data->length == -1)
+ if (data == NULL || length == -1)
return;
ex = camel_exception_new();
- stream = (CamelStream *)camel_stream_mem_new_with_buffer((gchar *)data->data, data->length);
+ stream = (CamelStream *)
+ camel_stream_mem_new_with_buffer ((gchar *)data, length);
msg = camel_mime_message_new();
if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) == 0)
camel_folder_append_message(folder, msg, NULL, NULL, ex);
@@ -700,7 +720,7 @@ em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder)
/**
* em_utils_selection_set_uidlist:
- * @data: selection data
+ * @selection_data: selection data
* @uri:
* @uids:
*
@@ -709,9 +729,12 @@ em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder)
* FIXME: be nice if this could take a folder argument rather than uri
**/
void
-em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArray *uids)
+em_utils_selection_set_uidlist (GtkSelectionData *selection_data,
+ const gchar *uri,
+ GPtrArray *uids)
{
GByteArray *array = g_byte_array_new();
+ GdkAtom target;
gint i;
/* format: "uri\0uid1\0uid2\0uid3\0...\0uidn\0" */
@@ -721,7 +744,9 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArr
for (i=0; i<uids->len; i++)
g_byte_array_append(array, uids->pdata[i], strlen(uids->pdata[i])+1);
- gtk_selection_data_set(data, data->target, 8, array->data, array->len);
+ target = gtk_selection_data_get_target (selection_data);
+ gtk_selection_data_set (
+ selection_data, target, 8, array->data, array->len);
g_byte_array_free(array, TRUE);
}
@@ -735,27 +760,37 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArr
* Warning: Could take some time to run.
**/
void
-em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, CamelException *ex)
+em_utils_selection_get_uidlist (GtkSelectionData *selection_data,
+ CamelFolder *dest,
+ gint move,
+ CamelException *ex)
{
/* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */
gchar *inptr, *inend;
GPtrArray *uids;
CamelFolder *folder;
+ const guchar *data;
+ gint length;
+
+ g_return_if_fail (selection_data != NULL);
- if (data == NULL || data->data == NULL || data->length == -1)
+ data = gtk_selection_data_get_data (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
+
+ if (data == NULL || length == -1)
return;
uids = g_ptr_array_new();
- inptr = (gchar *)data->data;
- inend = (gchar *)(data->data + data->length);
+ inptr = (gchar *) data;
+ inend = (gchar *) (data + length);
while (inptr < inend) {
gchar *start = inptr;
while (inptr < inend && *inptr)
inptr++;
- if (start > (gchar *)data->data)
+ if (start > (gchar *) data)
g_ptr_array_add(uids, g_strndup(start, inptr-start));
inptr++;
@@ -766,7 +801,7 @@ em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint m
return;
}
- folder = mail_tool_uri_to_folder((gchar *)data->data, 0, ex);
+ folder = mail_tool_uri_to_folder((gchar *) data, 0, ex);
if (folder) {
camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, ex);
camel_object_unref(folder);
@@ -832,8 +867,10 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0) {
/* terminate with \r\n to be compliant with the spec */
gchar *uri_crlf = g_strconcat(uri, "\r\n", NULL);
+ GdkAtom target;
- gtk_selection_data_set(data, data->target, 8, (guchar *)uri_crlf, strlen(uri_crlf));
+ target = gtk_selection_data_get_target (data);
+ gtk_selection_data_set(data, target, 8, (guchar *)uri_crlf, strlen(uri_crlf));
g_free(uri_crlf);
}
@@ -855,17 +892,23 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
* automatically cleaned up when the application quits.
**/
void
-em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder)
+em_utils_selection_get_urilist (GtkSelectionData *selection_data,
+ CamelFolder *folder)
{
CamelStream *stream;
CamelURL *url;
gint fd, i, res = 0;
gchar *tmp, **uris;
+ const guchar *data;
+ gint length;
d(printf(" * drop uri list\n"));
- tmp = g_strndup((gchar *)data->data, data->length);
- uris = g_strsplit(tmp, "\n", 0);
+ data = gtk_selection_data_get_data (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
+
+ tmp = g_strndup ((gchar *) data, length);
+ uris = g_strsplit (tmp, "\n", 0);
g_free(tmp);
for (i=0;res == 0 && uris[i];i++) {
g_strstrip(uris[i]);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 4ffe4fd7a5..ffce0912d5 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -409,6 +409,7 @@ build_dialog (GtkWindow *parent,
gint row, num_sources;
GList *list = NULL;
struct _send_data *data;
+ GtkWidget *container;
GtkWidget *send_icon;
GtkWidget *recv_icon;
GtkWidget *scrolled_window;
@@ -433,8 +434,12 @@ build_dialog (GtkWindow *parent,
GTK_WINDOW (send_recv_dialog));
gtk_widget_ensure_style ((GtkWidget *)gd);
- gtk_container_set_border_width ((GtkContainer *)gd->vbox, 0);
- gtk_container_set_border_width ((GtkContainer *)gd->action_area, 6);
+
+ container = gtk_dialog_get_action_area (gd);
+ gtk_container_set_border_width (GTK_CONTAINER (container), 6);
+
+ container = gtk_dialog_get_content_area (gd);
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
cancel_button = gtk_button_new_with_mnemonic (_("Cancel _All"));
gtk_button_set_image (
@@ -477,10 +482,11 @@ build_dialog (GtkWindow *parent,
GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ container = gtk_dialog_get_content_area (gd);
gtk_scrolled_window_add_with_viewport (
GTK_SCROLLED_WINDOW (scrolled_window), table);
gtk_box_pack_start (
- GTK_BOX (gd->vbox), scrolled_window, TRUE, TRUE, 0);
+ GTK_BOX (container), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
/* must bet setup after send_recv_dialog as it may re-trigger send-recv button */
@@ -972,13 +978,8 @@ mail_send_receive (GtkWindow *parent)
GList *scan;
if (send_recv_dialog != NULL) {
-#if GTK_CHECK_VERSION(2,19,7)
if (parent != NULL && gtk_widget_get_realized (send_recv_dialog)) {
-#else
- if (parent != NULL && GTK_WIDGET_REALIZED (send_recv_dialog)) {
-#endif
- gdk_window_show (send_recv_dialog->window);
- gdk_window_raise (send_recv_dialog->window);
+ gtk_window_present (GTK_WINDOW (send_recv_dialog));
}
return send_recv_dialog;
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 700baedbe0..5f0f0c8a72 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1175,6 +1175,7 @@ vfolder_edit_rule(const gchar *uri)
{
GtkWidget *w;
GtkDialog *gd;
+ GtkWidget *container;
EFilterRule *rule, *newrule;
CamelURL *url;
@@ -1186,19 +1187,21 @@ vfolder_edit_rule(const gchar *uri)
w = e_filter_rule_get_widget((EFilterRule *)newrule, (ERuleContext *)context);
- gd = (GtkDialog *)gtk_dialog_new_with_buttons(_("Edit Search Folder"), NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK,
- NULL);
+ gd = (GtkDialog *)gtk_dialog_new_with_buttons(
+ _("Edit Search Folder"), NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+
gtk_container_set_border_width (GTK_CONTAINER (gd), 6);
- gtk_box_set_spacing ((GtkBox *) gd->vbox, 6);
+
+ container = gtk_dialog_get_content_area (gd);
+ gtk_box_set_spacing (GTK_BOX (container), 6);
+
gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK);
g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL);
gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500);
- gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (container), w, TRUE, TRUE, 0);
gtk_widget_show((GtkWidget *)gd);
g_object_set_data_full(G_OBJECT(gd), "rule", newrule, (GDestroyNotify)g_object_unref);
g_object_set_data_full(G_OBJECT(gd), "orig", rule, (GDestroyNotify)g_object_unref);
@@ -1282,26 +1285,29 @@ vfolder_gui_add_rule(EMVFolderRule *rule)
{
GtkWidget *w;
GtkDialog *gd;
+ GtkWidget *container;
/* this should be done before we call this function */
vfolder_load_storage ();
w = e_filter_rule_get_widget((EFilterRule *)rule, (ERuleContext *)context);
- gd = (GtkDialog *)gtk_dialog_new_with_buttons(_("New Search Folder"),
- NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK,
- NULL);
+ gd = (GtkDialog *)gtk_dialog_new_with_buttons (
+ _("New Search Folder"),
+ NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+
gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK);
gtk_container_set_border_width (GTK_CONTAINER (gd), 6);
- gtk_box_set_spacing ((GtkBox *) gd->vbox, 6);
+
+ container = gtk_dialog_get_content_area (gd);
+ gtk_box_set_spacing (GTK_BOX (container), 6);
+
g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL);
gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500);
- gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (container), w, TRUE, TRUE, 0);
gtk_widget_show((GtkWidget *)gd);
g_object_set_data_full(G_OBJECT(gd), "rule", rule, (GDestroyNotify)g_object_unref);
g_signal_connect(rule, "changed", G_CALLBACK (new_rule_changed_cb), gd);
diff --git a/mail/message-list.c b/mail/message-list.c
index 2ea7836120..8662999704 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2027,14 +2027,22 @@ ml_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, MessageLis
}
static void
-ml_selection_received(GtkWidget *widget, GtkSelectionData *data, guint time, MessageList *ml)
+ml_selection_received (GtkWidget *widget,
+ GtkSelectionData *selection_data,
+ guint time,
+ MessageList *ml)
{
- if (data->target != gdk_atom_intern ("x-uid-list", FALSE)) {
+ GdkAtom target;
+
+ target = gtk_selection_data_get_target (selection_data);
+
+ if (target != gdk_atom_intern ("x-uid-list", FALSE)) {
d(printf("Unknown selection received by message-list\n"));
return;
}
- em_utils_selection_get_uidlist(data, ml->folder, FALSE, NULL);
+ em_utils_selection_get_uidlist (
+ selection_data, ml->folder, FALSE, NULL);
}
static void
@@ -2125,11 +2133,9 @@ ml_drop_async_done (struct _drop_msg *m)
static void
ml_drop_async_free (struct _drop_msg *m)
{
- g_object_unref(m->context);
- camel_object_unref(m->folder);
-
- g_free(m->selection->data);
- g_free(m->selection);
+ g_object_unref (m->context);
+ camel_object_unref (m->folder);
+ gtk_selection_data_free (m->selection);
}
static MailMsgInfo ml_drop_async_info = {
@@ -2148,15 +2154,27 @@ ml_drop_action(struct _drop_msg *m)
}
static void
-ml_tree_drag_data_received (ETree *tree, gint row, ETreePath path, gint col,
- GdkDragContext *context, gint x, gint y,
- GtkSelectionData *data, guint info,
- guint time, MessageList *ml)
+ml_tree_drag_data_received (ETree *tree,
+ gint row,
+ ETreePath path,
+ gint col,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ MessageList *ml)
{
struct _drop_msg *m;
- /* this means we are receiving no data */
- if (!ml->folder || data->data == NULL || data->length == -1)
+ if (ml->folder == NULL)
+ return;
+
+ if (gtk_selection_data_get_data (selection_data) == NULL)
+ return;
+
+ if (gtk_selection_data_get_length (selection_data) == -1)
return;
m = mail_msg_new(&ml_drop_async_info);
@@ -2168,10 +2186,7 @@ ml_tree_drag_data_received (ETree *tree, gint row, ETreePath path, gint col,
m->info = info;
/* need to copy, goes away once we exit */
- m->selection = g_malloc0(sizeof(*m->selection));
- m->selection->data = g_malloc(data->length);
- memcpy(m->selection->data, data->data, data->length);
- m->selection->length = data->length;
+ m->selection = gtk_selection_data_copy (selection_data);
ml_drop_action(m);
}
@@ -4407,11 +4422,7 @@ regen_list_done (struct _regen_list_msg *m)
}
}
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (GTK_WIDGET (m->ml))) {
-#else
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (m->ml))) {
-#endif
if (e_tree_row_count (E_TREE (m->ml)) <= 0) {
/* space is used to indicate no search too */
if (m->ml->search && *m->ml->search && strcmp (m->ml->search, " ") != 0)
@@ -4576,11 +4587,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
}
if (e_tree_row_count (E_TREE (ml)) <= 0) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (GTK_WIDGET (ml))) {
-#else
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (ml))) {
-#endif
/* there is some info why the message list is empty, let it be something useful */
gchar *txt = g_strconcat (_("Generating message list"), "..." , NULL);
diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c
index 7718709c9d..7d398f855d 100644
--- a/modules/addressbook/addressbook-config.c
+++ b/modules/addressbook/addressbook-config.c
@@ -299,10 +299,15 @@ static gint
addressbook_root_dse_query (AddressbookSourceDialog *dialog, LDAP *ldap,
const gchar **attrs, LDAPMessage **resp)
{
+ GtkAdjustment *adjustment;
+ GtkRange *range;
gint ldap_error;
struct timeval timeout;
- timeout.tv_sec = (gint) gtk_adjustment_get_value (GTK_RANGE(dialog->timeout_scale)->adjustment);
+ range = GTK_RANGE (dialog->timeout_scale);
+ adjustment = gtk_range_get_adjustment (range);
+
+ timeout.tv_sec = (gint) gtk_adjustment_get_value (adjustment);
timeout.tv_usec = 0;
ldap_error = ldap_search_ext_s (ldap,
@@ -376,6 +381,7 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkWidget *dialog;
+ GtkWidget *container;
GtkWidget *supported_bases_table;
GtkBuilder *builder;
GtkTreeIter iter;
@@ -389,8 +395,12 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
supported_bases_table = e_builder_get_widget (builder, "supported-bases-table");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (supported_bases_table));
@@ -918,9 +928,13 @@ eabc_details_search(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
static void
timeout_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
{
+ GtkAdjustment *adjustment;
+ GtkRange *range;
gchar *timeout;
- timeout = g_strdup_printf("%f", gtk_adjustment_get_value(((GtkRange *)sdialog->timeout_scale)->adjustment));
+ range = GTK_RANGE (sdialog->timeout_scale);
+ adjustment = gtk_range_get_adjustment (range);
+ timeout = g_strdup_printf("%f", gtk_adjustment_get_value (adjustment));
e_source_set_property(sdialog->source, "timeout", timeout);
g_free(timeout);
}
@@ -947,6 +961,8 @@ static GtkWidget *
eabc_details_limit(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
AddressbookSourceDialog *sdialog = data;
+ GtkAdjustment *adjustment;
+ GtkRange *range;
GtkWidget *w;
const gchar *tmp;
GtkBuilder *builder;
@@ -961,9 +977,13 @@ eabc_details_limit(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
sdialog->timeout_scale = e_builder_get_widget (builder, "timeout-scale");
+ range = GTK_RANGE (sdialog->timeout_scale);
+ adjustment = gtk_range_get_adjustment (range);
tmp = e_source_get_property(sdialog->source, "timeout");
- gtk_adjustment_set_value(((GtkRange *)sdialog->timeout_scale)->adjustment, tmp?g_strtod(tmp, NULL):3.0);
- g_signal_connect (GTK_RANGE(sdialog->timeout_scale)->adjustment, "value_changed", G_CALLBACK (timeout_changed_cb), sdialog);
+ gtk_adjustment_set_value (adjustment, tmp?g_strtod(tmp, NULL):3.0);
+ g_signal_connect (
+ adjustment, "value_changed",
+ G_CALLBACK (timeout_changed_cb), sdialog);
sdialog->limit_spinbutton = e_builder_get_widget (builder, "download-limit-spinbutton");
tmp = e_source_get_property(sdialog->source, "limit");
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 0fd218c9e9..72d9aa27ce 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -532,6 +532,7 @@ action_task_purge_cb (GtkAction *action,
{
EShellView *shell_view;
EShellWindow *shell_window;
+ GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *widget;
gboolean active;
@@ -556,9 +557,9 @@ action_task_purge_cb (GtkAction *action,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
widget = gtk_check_button_new_with_label (_("Do not ask me again"));
- gtk_box_pack_start (
- GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 6);
gtk_widget_show (widget);
response = gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index fb34805409..838144695d 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -216,8 +216,15 @@ jh_add_cb (GtkWidget *widget, gpointer user_data)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
GtkWidget *dialog, *l1, *l2, *entry1, *entry2, *vbox, *hbox;
+ GtkWidget *content_area;
gint response;
- dialog = gtk_dialog_new_with_buttons (_("Add Custom Junk Header"), (GtkWindow *)gtk_widget_get_toplevel (widget), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
+
+ dialog = gtk_dialog_new_with_buttons (
+ _("Add Custom Junk Header"),
+ (GtkWindow *) gtk_widget_get_toplevel (widget),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
vbox = gtk_vbox_new (FALSE, 6);
hbox = gtk_hbox_new (FALSE, 0);
@@ -235,7 +242,8 @@ jh_add_cb (GtkWidget *widget, gpointer user_data)
gtk_box_pack_start ((GtkBox *)vbox, hbox, FALSE, FALSE, 6);
gtk_widget_show_all (vbox);
- gtk_container_add ((GtkContainer *)((GtkDialog *)dialog)->vbox, vbox);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_add (GTK_CONTAINER (content_area), vbox);
response = gtk_dialog_run ((GtkDialog *)dialog);
if (response == GTK_RESPONSE_ACCEPT) {
const gchar *name = gtk_entry_get_text ((GtkEntry *)entry1);
diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c
index 6b419d0c2e..85a0a82ca3 100644
--- a/modules/mail/em-network-prefs.c
+++ b/modules/mail/em-network-prefs.c
@@ -283,12 +283,16 @@ emnp_free(EConfig *ec, GSList *items, gpointer data)
static void
emnp_set_markups (EMNetworkPrefs *prefs)
{
- gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->sys_proxy)->child), TRUE);
- gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->no_proxy)->child), TRUE);
- gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->manual_proxy)->child), TRUE);
-#if 0
- gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->auto_proxy)->child), TRUE);
-#endif
+ GtkWidget *child;
+
+ child = gtk_bin_get_child (GTK_BIN (prefs->sys_proxy));
+ gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
+
+ child = gtk_bin_get_child (GTK_BIN (prefs->no_proxy));
+ gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
+
+ child = gtk_bin_get_child (GTK_BIN (prefs->manual_proxy));
+ gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
}
static void
diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c
index b74406bb47..983327df73 100644
--- a/plugins/attachment-reminder/attachment-reminder.c
+++ b/plugins/attachment-reminder/attachment-reminder.c
@@ -112,14 +112,17 @@ ask_for_missing_attachment (EPlugin *ep, GtkWindow *window)
{
GtkWidget *check = NULL;
GtkDialog *dialog = NULL;
+ GtkWidget *content_area;
gint response;
- dialog = (GtkDialog*)e_alert_dialog_new_for_args(window, "org.gnome.evolution.plugins.attachment_reminder:attachment-reminder", NULL);
+ dialog = (GtkDialog*) e_alert_dialog_new_for_args (
+ window, "org.gnome.evolution.plugins.attachment_reminder:attachment-reminder", NULL);
/*Check buttons*/
check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
gtk_container_set_border_width((GtkContainer *)check, 12);
- gtk_box_pack_start ((GtkBox *)dialog->vbox, check, TRUE, TRUE, 0);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), check, TRUE, TRUE, 0);
gtk_widget_show (check);
response = gtk_dialog_run ((GtkDialog *) dialog);
diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c
index 9f7e70c5b2..9304a135c1 100644
--- a/plugins/backup-restore/backup.c
+++ b/plugins/backup-restore/backup.c
@@ -443,6 +443,8 @@ main (gint argc, gchar **argv)
if (gui_arg && !check_op) {
GtkWidget *widget, *container;
+ GtkWidget *action_area;
+ GtkWidget *content_area;
const gchar *txt, *txt2;
gchar *str = NULL;
gchar *markup;
@@ -460,13 +462,16 @@ main (gint argc, gchar **argv)
gtk_dialog_set_has_separator (GTK_DIALOG (progress_dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (progress_dialog), 12);
+ action_area = gtk_dialog_get_action_area (
+ GTK_DIALOG (progress_dialog));
+ content_area = gtk_dialog_get_content_area (
+ GTK_DIALOG (progress_dialog));
+
/* Override GtkDialog defaults */
- widget = GTK_DIALOG (progress_dialog)->vbox;
- gtk_box_set_spacing (GTK_BOX (widget), 12);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
- widget = GTK_DIALOG (progress_dialog)->action_area;
- gtk_box_set_spacing (GTK_BOX (widget), 12);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+ gtk_box_set_spacing (GTK_BOX (content_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
+ gtk_box_set_spacing (GTK_BOX (action_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 0);
if (oper && file)
str = g_strdup_printf(oper, file);
@@ -476,7 +481,8 @@ main (gint argc, gchar **argv)
gtk_table_set_row_spacings (GTK_TABLE (container), 12);
gtk_widget_show (container);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (progress_dialog)->vbox), container, FALSE, TRUE, 0);
+ gtk_box_pack_start (
+ GTK_BOX (content_area), container, FALSE, TRUE, 0);
widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0);
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index aa11e71f3d..545fd6842d 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -681,7 +681,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
/* Create a new notebook page */
page = gtk_vbox_new (FALSE, 0);
- GTK_CONTAINER (page)->border_width = 12;
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
tab_label = gtk_label_new (_("Automatic Contacts"));
gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label);
@@ -694,7 +694,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("Automatic Contacts"));
gtk_label_set_markup (GTK_LABEL (frame_label), str);
g_free (str);
- GTK_MISC (frame_label)->xalign = 0.0;
+ gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
/* Indent/padding */
@@ -730,7 +730,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("Instant Messaging Contacts"));
gtk_label_set_markup (GTK_LABEL (frame_label), str);
g_free (str);
- GTK_MISC (frame_label)->xalign = 0.0;
+ gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
/* Indent/padding */
diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c
index 50c698da28..b33141a980 100644
--- a/plugins/calendar-weather/calendar-weather.c
+++ b/plugins/calendar-weather/calendar-weather.c
@@ -208,6 +208,7 @@ static GtkDialog *
create_source_selector (ESource *source)
{
GtkWidget *dialog, *treeview, *scrolledwindow;
+ GtkWidget *content_area;
GtkCellRenderer *text;
GtkTreeSelection *selection;
gchar *uri_text;
@@ -256,9 +257,10 @@ create_source_selector (ESource *source)
text = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "location", text, "text", 0, NULL);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scrolledwindow);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_add (GTK_CONTAINER (content_area), scrolledwindow);
gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 6);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 340);
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c
index 84452b28a9..771b23874f 100644
--- a/plugins/email-custom-header/email-custom-header.c
+++ b/plugins/email-custom-header/email-custom-header.c
@@ -534,8 +534,9 @@ destroy_compo_data (gpointer data)
static void action_email_custom_header_cb (GtkAction *action, EMsgComposer *composer)
{
- GtkUIManager *ui_manager;
- GtkWidget *menuitem;
+ GtkUIManager *ui_manager;
+ GtkWidget *menuitem;
+ GdkWindow *window;
CustomHeaderOptionsDialog *dialog = NULL;
EmailCustomHeaderWindow *new_email_custom_header_window = NULL;
@@ -544,14 +545,15 @@ static void action_email_custom_header_cb (GtkAction *action, EMsgComposer *comp
new_email_custom_header_window = g_object_get_data ((GObject *) composer, "compowindow");
- if (epech_check_existing_composer_window(new_email_custom_header_window,menuitem->window) == 0) {
+ window = gtk_widget_get_window (menuitem);
+ if (epech_check_existing_composer_window(new_email_custom_header_window,window) == 0) {
dialog = new_email_custom_header_window->epech_dialog;
} else {
dialog = epech_dialog_new ();
if (dialog) {
EmailCustomHeaderWindow *new_email_custom_header_window;
new_email_custom_header_window = g_new0(EmailCustomHeaderWindow, 1);
- new_email_custom_header_window->epech_window = menuitem->window;
+ new_email_custom_header_window->epech_window = window;
new_email_custom_header_window->epech_dialog = dialog;
g_object_set_data_full ((GObject *) composer, "compowindow", new_email_custom_header_window, destroy_compo_data);
}
diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c
index b868e28c5a..192b4f2b0d 100644
--- a/plugins/groupwise-features/junk-mail-settings.c
+++ b/plugins/groupwise-features/junk-mail-settings.c
@@ -62,6 +62,7 @@ void
gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view)
{
GtkWidget *dialog ,*w, *notebook, *box;
+ GtkWidget *content_area;
JunkSettings *junk_tab;
gint page_count =0;
EGwConnection *cnc;
@@ -86,9 +87,10 @@ gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view)
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_window_set_default_size ((GtkWindow *) dialog, 292, 260);
gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->vbox, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 12);
box = gtk_vbox_new (FALSE, 6);
w = gtk_label_new ("");
msg = g_strdup_printf("<b>%s</b>", _("Junk Mail Settings"));
@@ -105,12 +107,12 @@ gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view)
notebook = gtk_notebook_new ();
gtk_notebook_append_page ((GtkNotebook *)notebook, box, NULL);
gtk_box_pack_start (
- (GtkBox *) ((GtkDialog *) dialog)->vbox,
- notebook, TRUE, TRUE, 0);
+ GTK_BOX (content_area), notebook, TRUE, TRUE, 0);
}
if (page_count == 0)
- gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, box, TRUE, TRUE, 0);
+ gtk_box_pack_start (
+ GTK_BOX (content_area), box, TRUE, TRUE, 0);
g_signal_connect (dialog, "response", G_CALLBACK (junk_dialog_response), junk_tab);
gtk_widget_show_all (dialog);
diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c
index 17d5c7a554..69b9acd5f0 100644
--- a/plugins/groupwise-features/mail-retract.c
+++ b/plugins/groupwise-features/mail-retract.c
@@ -66,6 +66,7 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view)
CamelStore *store;
gchar *id = NULL;
GtkWidget *confirm_dialog, *confirm_warning;
+ GtkWidget *content_area;
gint n;
g_return_if_fail (get_selected_info (shell_view, &folder, &id));
@@ -76,16 +77,21 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view)
cnc = get_cnc (store);
if (cnc && E_IS_GW_CONNECTION(cnc)) {
- confirm_dialog = gtk_dialog_new_with_buttons (_("Message Retract"), GTK_WINDOW (e_shell_view_get_shell_window (shell_view)),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_YES, GTK_RESPONSE_YES,
- GTK_STOCK_NO, GTK_RESPONSE_NO, NULL);
+ confirm_dialog = gtk_dialog_new_with_buttons (
+ _("Message Retract"),
+ GTK_WINDOW (e_shell_view_get_shell_window (shell_view)),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_YES, GTK_RESPONSE_YES,
+ GTK_STOCK_NO, GTK_RESPONSE_NO, NULL);
+
+ content_area = gtk_dialog_get_content_area (
+ GTK_DIALOG (confirm_dialog));
confirm_warning = gtk_label_new (_("Retracting a message may remove it from the recipient's mailbox. Are you sure you want to do this?"));
gtk_label_set_line_wrap (GTK_LABEL (confirm_warning), TRUE);
gtk_label_set_selectable (GTK_LABEL (confirm_warning), TRUE);
- gtk_container_add (GTK_CONTAINER ((GTK_DIALOG(confirm_dialog))->vbox), confirm_warning);
+ gtk_container_add (GTK_CONTAINER (content_area), confirm_warning);
gtk_widget_set_size_request (confirm_dialog, 400, 100);
gtk_widget_show_all (confirm_dialog);
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 41dde5a9f9..e7775b216a 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -286,6 +286,7 @@ static void
new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *model)
{
GtkWidget *users_dialog;
+ GtkWidget *content_area;
GtkWidget *w;
struct ShareInfo *ssi;
const gchar *uri;
@@ -312,12 +313,13 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
_("Users"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
w = gtk_label_new_with_mnemonic (_("Enter the users and set permissions"));
gtk_widget_show(w);
- gtk_box_pack_start(GTK_BOX (GTK_DIALOG (users_dialog)->vbox), (GtkWidget *) w, TRUE, TRUE, 6);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (users_dialog));
+ gtk_box_pack_start(GTK_BOX (content_area), (GtkWidget *) w, TRUE, TRUE, 6);
ssi->sf = share_folder_new (cnc, NULL);
gtk_widget_set_sensitive (GTK_WIDGET ((ssi->sf)->table), TRUE);
ssi->model = model;
ssi->emfs = emfs;
- gtk_widget_reparent (GTK_WIDGET ((ssi->sf)->table), GTK_DIALOG (users_dialog)->vbox);
+ gtk_widget_reparent (GTK_WIDGET ((ssi->sf)->table), content_area);
gtk_widget_hide((GtkWidget*) emfs);
gtk_window_resize (GTK_WINDOW (users_dialog), 350, 300);
gtk_widget_show(users_dialog);
diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c
index 40fbd0b562..0243e1e453 100644
--- a/plugins/groupwise-features/status-track.c
+++ b/plugins/groupwise-features/status-track.c
@@ -94,6 +94,7 @@ gw_track_message_status_cb (GtkAction *action,
GtkDialog *d;
GtkTable *table;
GtkWidget *widget;
+ GtkWidget *content_area;
GtkScrolledWindow *win;
GtkVBox *vbox;
@@ -117,12 +118,13 @@ gw_track_message_status_cb (GtkAction *action,
/* Create the dialog */
d = (GtkDialog *) gtk_dialog_new ();
+ content_area = gtk_dialog_get_content_area (d);
gtk_dialog_add_button (d, GTK_STOCK_OK, GTK_RESPONSE_OK);
gtk_window_set_title (GTK_WINDOW (d), _("Message Status"));
table = (GtkTable *) gtk_table_new (1, 2, FALSE);
win = (GtkScrolledWindow *) gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(d)->vbox), GTK_WIDGET (win));
+ gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (win));
vbox = (GtkVBox *) gtk_vbox_new (FALSE, 12);
gtk_scrolled_window_add_with_viewport (win, GTK_WIDGET(vbox));
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0);
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index 648abc02dd..861aaacfef 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -232,6 +232,7 @@ size_allocate_cb (GtkHTMLEmbedded *embedded,
GtkAllocation *allocation,
ImageInlinePObject *image_object)
{
+ GtkAllocation image_allocation;
GtkWidget *widget;
gint pixbuf_width;
gint pixbuf_height;
@@ -240,7 +241,8 @@ size_allocate_cb (GtkHTMLEmbedded *embedded,
gdouble zoom = 1.0;
widget = GTK_WIDGET (image_object->object.format->html);
- widget_width = widget->allocation.width - 12;
+ gtk_widget_get_allocation (widget, &image_allocation);
+ widget_width = image_allocation.width - 12;
pixbuf_width = gdk_pixbuf_get_width (image_object->pixbuf);
pixbuf_height = gdk_pixbuf_get_height (image_object->pixbuf);
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 9f9b3a507b..ddec723c99 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2642,7 +2642,7 @@ itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
/* Create a new notebook page */
page = gtk_vbox_new (FALSE, 0);
- GTK_CONTAINER (page)->border_width = 12;
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
tab_label = gtk_label_new (_("Calendar and Tasks"));
gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label);
@@ -2655,7 +2655,7 @@ itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("General"));
gtk_label_set_markup (GTK_LABEL (frame_label), str);
g_free (str);
- GTK_MISC (frame_label)->xalign = 0.0;
+ gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
/* Indent/padding */
@@ -2681,7 +2681,7 @@ itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("Conflict Search"));
gtk_label_set_markup (GTK_LABEL (frame_label), str);
g_free (str);
- GTK_MISC (frame_label)->xalign = 0.0;
+ gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
/* Indent/padding */
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 83d314685e..bf40055d1e 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -966,11 +966,7 @@ alarm_check_toggled_cb (GtkWidget *check1, GtkWidget *check2)
g_return_if_fail (check1 != NULL);
g_return_if_fail (check2 != NULL);
-#if GTK_CHECK_VERSION(2,19,7)
gtk_widget_set_sensitive (check2, !(gtk_widget_get_visible (check1) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check1))));
-#else
- gtk_widget_set_sensitive (check2, !(GTK_WIDGET_VISIBLE (check1) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check1))));
-#endif
}
static void
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index 2b0d768098..9503aaf27a 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -333,6 +333,7 @@ static void
do_properties (GtkMenuItem *item, gpointer user_data)
{
GtkWidget *cfg, *dialog, *vbox, *label, *hbox;
+ GtkWidget *content_area;
gchar *text;
cfg = get_cfg_widget ();
@@ -367,8 +368,10 @@ do_properties (GtkMenuItem *item, gpointer user_data)
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
+ gtk_container_add (GTK_CONTAINER (content_area), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_widget_set_size_request (dialog, 400, -1);
g_signal_connect_swapped (
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 756ced9766..44ec323cf1 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -83,14 +83,15 @@ prompt_user (void)
gint response;
dialog = gtk_dialog_new ();
- gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
+ widget = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+ gtk_widget_hide (widget);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_title (GTK_WINDOW (dialog), "");
g_signal_connect (
dialog, "map",
G_CALLBACK (gtk_widget_queue_resize), NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
- vbox = GTK_DIALOG (dialog)->vbox;
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
/* Table */
widget = gtk_table_new (3, 2, FALSE);
diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c
index 37910d8f47..1211726b4b 100644
--- a/plugins/publish-calendar/url-editor-dialog.c
+++ b/plugins/publish-calendar/url-editor-dialog.c
@@ -116,11 +116,7 @@ check_input (UrlEditorDialog *dialog)
gtk_widget_hide (dialog->fb_duration_combo);
}
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_sensitive (dialog->events_selector)) {
-#else
- if (GTK_WIDGET_IS_SENSITIVE (dialog->events_selector)) {
-#endif
sources = e_source_selector_get_selection (E_SOURCE_SELECTOR (dialog->events_selector));
n += g_slist_length (sources);
}
@@ -332,6 +328,7 @@ static gboolean
url_editor_dialog_construct (UrlEditorDialog *dialog)
{
GtkWidget *toplevel;
+ GtkWidget *content_area;
GConfClient *gconf;
GtkSizeGroup *group;
EPublishUri *uri;
@@ -376,8 +373,9 @@ url_editor_dialog_construct (UrlEditorDialog *dialog)
uri = dialog->uri;
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
toplevel = e_builder_get_widget (dialog->builder, "publishing toplevel");
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), toplevel);
+ gtk_container_add (GTK_CONTAINER (content_area), toplevel);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c
index a38b2d9e9a..fc012eaf7b 100644
--- a/plugins/startup-wizard/startup-wizard.c
+++ b/plugins/startup-wizard/startup-wizard.c
@@ -228,6 +228,7 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
{
EShell *shell;
EShellSettings *shell_settings;
+ GtkWidget *content_area;
gchar *location;
shell = e_shell_get_default ();
@@ -245,15 +246,27 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
import_iterator = import_importers;
import_importer = import_iterator->data;
- import_dialog = e_alert_dialog_new_for_args (e_shell_get_active_window (shell), "shell:importing", _("Importing data."), NULL);
- g_signal_connect(import_dialog, "response", G_CALLBACK(import_dialog_response), NULL);
+ import_dialog = e_alert_dialog_new_for_args (
+ e_shell_get_active_window (shell),
+ "shell:importing", _("Importing data."), NULL);
+ content_area = gtk_dialog_get_content_area (
+ GTK_DIALOG (import_dialog));
+ g_signal_connect (
+ import_dialog, "response",
+ G_CALLBACK (import_dialog_response), NULL);
import_label = gtk_label_new(_("Please wait"));
import_progress = gtk_progress_bar_new();
- gtk_box_pack_start(GTK_BOX(((GtkDialog *)import_dialog)->vbox), import_label, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(((GtkDialog *)import_dialog)->vbox), import_progress, FALSE, FALSE, 0);
+ gtk_box_pack_start (
+ GTK_BOX (content_area),
+ import_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (
+ GTK_BOX (content_area),
+ import_progress, FALSE, FALSE, 0);
gtk_widget_show_all(import_dialog);
- e_import_import(import, (EImportTarget *)import_target, import_importer, import_status, import_done, NULL);
+ e_import_import (
+ import, (EImportTarget *) import_target,
+ import_importer, import_status, import_done, NULL);
} else {
gtk_main_quit();
}
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 5d5857cfc2..658bb2a6fc 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -201,7 +201,7 @@ shell_content_size_allocate (GtkWidget *widget,
priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
child = priv->searchbar;
@@ -254,11 +254,13 @@ shell_content_forall (GtkContainer *container,
gpointer callback_data)
{
EShellContentPrivate *priv;
+ GtkWidget *parent;
priv = E_SHELL_CONTENT_GET_PRIVATE (container);
+ parent = gtk_widget_get_parent (priv->searchbar);
if (include_internals && priv->searchbar != NULL &&
- container == GTK_CONTAINER (priv->searchbar->parent))
+ container == GTK_CONTAINER (parent))
callback (priv->searchbar, callback_data);
/* Chain up to parent's forall() method. */
@@ -409,6 +411,7 @@ e_shell_content_run_advanced_search_dialog (EShellContent *shell_content)
{
EShellView *shell_view;
EShellWindow *shell_window;
+ GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *widget;
EFilterRule *rule;
@@ -445,8 +448,8 @@ e_shell_content_run_advanced_search_dialog (EShellContent *shell_content)
gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 300);
- gtk_box_pack_start (
- GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
g_signal_connect_swapped (
rule, "changed", G_CALLBACK (
@@ -510,6 +513,7 @@ e_shell_content_run_save_search_dialog (EShellContent *shell_content)
{
EShellView *shell_view;
EShellWindow *shell_window;
+ GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *widget;
EFilterRule *rule;
@@ -547,8 +551,8 @@ e_shell_content_run_save_search_dialog (EShellContent *shell_content)
gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
- gtk_box_pack_start (
- GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
g_signal_connect_swapped (
rule, "changed", G_CALLBACK (
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index edb8ba5299..0c2aa48440 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -258,7 +258,7 @@ shell_sidebar_size_allocate (GtkWidget *widget,
priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
child = priv->event_box;
gtk_widget_size_request (child, &child_requisition);
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index 43a2a4c3e9..aace0a0073 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -71,7 +71,7 @@ G_DEFINE_TYPE_WITH_CODE (
static gint
shell_switcher_layout_actions (EShellSwitcher *switcher)
{
- GtkAllocation *allocation;
+ GtkAllocation allocation;
gint num_btns = g_list_length (switcher->priv->proxies), btns_per_row;
GList **rows, *p;
gboolean icons_only;
@@ -82,11 +82,12 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
gint x, y;
gint i;
- allocation = &GTK_WIDGET (switcher)->allocation;
- y = allocation->y + allocation->height;
+ gtk_widget_get_allocation (GTK_WIDGET (switcher), &allocation);
+
+ y = allocation.y + allocation.height;
if (num_btns == 0)
- return allocation->height;
+ return allocation.height;
icons_only = (switcher->priv->style == GTK_TOOLBAR_ICONS);
@@ -101,7 +102,7 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
}
/* Figure out how many rows and columns we'll use. */
- btns_per_row = MAX (1, allocation->width / (max_width + H_PADDING));
+ btns_per_row = MAX (1, allocation.width / (max_width + H_PADDING));
if (!icons_only) {
/* If using text buttons, we want to try to have a
* completely filled-in grid, but if we can't, we want
@@ -138,12 +139,12 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
for (i = row_last; i >= 0; i--) {
gint len, extra_width;
- x = H_PADDING + allocation->x;
+ x = H_PADDING + allocation.x;
y -= max_height;
len = g_list_length (rows[i]);
if (!icons_only)
extra_width =
- (allocation->width - (len * max_width) -
+ (allocation.width - (len * max_width) -
(len * H_PADDING)) / len;
else
extra_width = 0;
@@ -167,7 +168,7 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
g_list_free (rows [i]);
g_free (rows);
- return y - allocation->y;
+ return y - allocation.y;
}
static void
@@ -287,7 +288,7 @@ shell_switcher_size_allocate (GtkWidget *widget,
switcher = E_SHELL_SWITCHER (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
if (switcher->priv->toolbar_visible)
height = shell_switcher_layout_actions (switcher);
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
index bf8dfa7e2a..43865470de 100644
--- a/shell/e-shell-taskbar.c
+++ b/shell/e-shell-taskbar.c
@@ -64,20 +64,26 @@ static void
shell_taskbar_activity_remove (EShellTaskbar *shell_taskbar,
EActivity *activity)
{
- GtkBox *box;
GtkWidget *proxy;
+ GtkContainer *container;
GHashTable *proxy_table;
+ GList *children;
- box = GTK_BOX (shell_taskbar->priv->hbox);
proxy_table = shell_taskbar->priv->proxy_table;
proxy = g_hash_table_lookup (proxy_table, activity);
g_return_if_fail (proxy != NULL);
g_hash_table_remove (proxy_table, activity);
- gtk_container_remove (GTK_CONTAINER (box), proxy);
- if (box->children == NULL)
- gtk_widget_hide (GTK_WIDGET (box));
+ container = GTK_CONTAINER (shell_taskbar->priv->hbox);
+ gtk_container_remove (container, proxy);
+
+ children = gtk_container_get_children (container);
+
+ if (children == NULL)
+ gtk_widget_hide (GTK_WIDGET (container));
+
+ g_list_free (children);
}
static void
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 9b14730c7b..d33be7de1d 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -674,12 +674,16 @@ static void
action_close_cb (GtkAction *action,
EShellWindow *shell_window)
{
- GtkWidget *widget = GTK_WIDGET (shell_window);
+ GtkWidget *widget;
+ GdkWindow *window;
GdkEvent *event;
+ widget = GTK_WIDGET (shell_window);
+ window = gtk_widget_get_window (widget);
+
/* Synthesize a delete_event on this window. */
event = gdk_event_new (GDK_DELETE);
- event->any.window = g_object_ref (widget->window);
+ event->any.window = g_object_ref (window);
event->any.send_event = TRUE;
gtk_main_do_event (event);
gdk_event_free (event);
diff --git a/shell/main.c b/shell/main.c
index 188fdfcc1a..c36afc6d1a 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -127,6 +127,8 @@ categories_icon_theme_hack (void)
static gboolean
show_development_warning(void)
{
+ GtkWidget *action_area;
+ GtkWidget *content_area;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *warning_dialog;
@@ -146,16 +148,15 @@ show_development_warning(void)
gtk_dialog_set_has_separator (
GTK_DIALOG (warning_dialog), FALSE);
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (warning_dialog)->vbox), 0);
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (warning_dialog)->action_area), 12);
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (warning_dialog));
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (warning_dialog));
+
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- gtk_box_pack_start (
- GTK_BOX (GTK_DIALOG (warning_dialog)->vbox),
- vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
text = g_strdup_printf(
/* xgettext:no-c-format */
diff --git a/smime/gui/ca-trust-dialog.c b/smime/gui/ca-trust-dialog.c
index f21288dac0..47f4d5db81 100644
--- a/smime/gui/ca-trust-dialog.c
+++ b/smime/gui/ca-trust-dialog.c
@@ -72,6 +72,9 @@ GtkWidget*
ca_trust_dialog_show (ECert *cert, gboolean importing)
{
CATrustDialogData *ctd_data;
+ GtkDialog *dialog;
+ GtkWidget *action_area;
+ GtkWidget *content_area;
GtkWidget *w;
gchar *txt;
@@ -83,8 +86,13 @@ ca_trust_dialog_show (ECert *cert, gboolean importing)
ctd_data->dialog = e_builder_get_widget (ctd_data->builder, "ca-trust-dialog");
gtk_widget_ensure_style (ctd_data->dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (ctd_data->dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (ctd_data->dialog)->action_area), 12);
+
+ dialog = GTK_DIALOG (ctd_data->dialog);
+ action_area = gtk_dialog_get_action_area (dialog);
+ content_area = gtk_dialog_get_content_area (dialog);
+
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
ctd_data->cert = g_object_ref (cert);
diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c
index 505ffaf30f..cc6d702d46 100644
--- a/smime/gui/certificate-manager.c
+++ b/smime/gui/certificate-manager.c
@@ -995,6 +995,7 @@ certificate_manager_config_init (EShell *shell)
{
CertificateManagerData *cfm_data;
GtkWidget *preferences_window;
+ GtkWidget *parent;
GtkWidget *widget;
g_return_if_fail (E_IS_SHELL (shell));
@@ -1036,7 +1037,8 @@ certificate_manager_config_init (EShell *shell)
widget = e_builder_get_widget (cfm_data->builder, "cert-manager-notebook");
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
/* FIXME: remove when implemented */
gtk_widget_set_sensitive(cfm_data->backup_your_button, FALSE);
diff --git a/smime/gui/certificate-viewer.c b/smime/gui/certificate-viewer.c
index f71993dc05..c78bd77a75 100644
--- a/smime/gui/certificate-viewer.c
+++ b/smime/gui/certificate-viewer.c
@@ -317,6 +317,8 @@ GtkWidget*
certificate_viewer_show (ECert *cert)
{
CertificateViewerData *cvm_data;
+ GtkDialog *dialog;
+ GtkWidget *action_area;
gchar *title;
cvm_data = g_new0 (CertificateViewerData, 1);
@@ -327,13 +329,14 @@ certificate_viewer_show (ECert *cert)
cvm_data->dialog = e_builder_get_widget (cvm_data->builder, "certificate-viewer-dialog");
gtk_widget_realize (cvm_data->dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (cvm_data->dialog)->action_area), 12);
- title = g_strdup_printf (_("Certificate Viewer: %s"), e_cert_get_window_title (cert));
-
- gtk_window_set_title (GTK_WINDOW (cvm_data->dialog),
- title);
+ dialog = GTK_DIALOG (cvm_data->dialog);
+ action_area = gtk_dialog_get_action_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 12);
+ title = g_strdup_printf (
+ _("Certificate Viewer: %s"), e_cert_get_window_title (cert));
+ gtk_window_set_title (GTK_WINDOW (cvm_data->dialog), title);
g_free (title);
fill_in_general (cvm_data, cert);
diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c
index 5d500f5abf..71f2c00504 100644
--- a/smime/gui/e-cert-selector.c
+++ b/smime/gui/e-cert-selector.c
@@ -148,6 +148,7 @@ e_cert_selector_new(gint type, const gchar *currentid)
CERTCertList *certlist;
CERTCertListNode *node;
GtkBuilder *builder;
+ GtkWidget *content_area;
GtkWidget *w;
gint n=0, active=0;
@@ -161,7 +162,8 @@ e_cert_selector_new(gint type, const gchar *currentid)
p->description = e_builder_get_widget(builder, "cert_description");
w = e_builder_get_widget(builder, "cert_selector_vbox");
- gtk_box_pack_start((GtkBox *)((GtkDialog *)ecs)->vbox, w, TRUE, TRUE, 3);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (ecs));
+ gtk_box_pack_start (GTK_BOX (content_area), w, TRUE, TRUE, 3);
gtk_window_set_title(GTK_WINDOW(ecs), _("Select certificate"));
switch (type) {
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 3dc5f35709..250cc1d32d 100644
--- a/widgets/e-timezone-dialog/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -261,6 +261,7 @@ ETimezoneDialog *
e_timezone_dialog_construct (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
+ GtkWidget *widget;
GtkWidget *map;
g_return_val_if_fail (etd != NULL, NULL);
@@ -280,10 +281,11 @@ e_timezone_dialog_construct (ETimezoneDialog *etd)
goto error;
}
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (priv->app)->vbox), 0);
- gtk_container_set_border_width (
- GTK_CONTAINER (GTK_DIALOG (priv->app)->action_area), 12);
+ widget = gtk_dialog_get_content_area (GTK_DIALOG (priv->app));
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (GTK_DIALOG (priv->app));
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
priv->map = e_map_new ();
map = GTK_WIDGET (priv->map);
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
index ba50623b44..54d0677cdc 100644
--- a/widgets/menus/gal-define-views-dialog.c
+++ b/widgets/menus/gal-define-views-dialog.c
@@ -223,6 +223,8 @@ dialog_response (GalDefineViewsDialog *dialog, gint response_id, gpointer data)
static void
gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->collection = NULL;
@@ -236,11 +238,16 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 270);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c
index 14e8d79d3c..b713f68000 100644
--- a/widgets/menus/gal-view-instance-save-as-dialog.c
+++ b/widgets/menus/gal-view-instance-save-as-dialog.c
@@ -229,6 +229,8 @@ gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *k
static void
gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->instance = NULL;
@@ -245,11 +247,16 @@ gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
/* TODO: add position/size saving/restoring */
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 360);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
index 356813c6fa..f364bf0779 100644
--- a/widgets/menus/gal-view-new-dialog.c
+++ b/widgets/menus/gal-view-new-dialog.c
@@ -73,6 +73,8 @@ gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
static void
gal_view_new_dialog_init (GalViewNewDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->builder = gtk_builder_new ();
@@ -83,15 +85,21 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog)
if (!widget) {
return;
}
+
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_resizable (GTK_WINDOW(dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
diff --git a/widgets/misc/e-activity-proxy.c b/widgets/misc/e-activity-proxy.c
index 825aae04d6..c503e5e26d 100644
--- a/widgets/misc/e-activity-proxy.c
+++ b/widgets/misc/e-activity-proxy.c
@@ -278,7 +278,7 @@ activity_proxy_init (EActivityProxy *proxy)
widget = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (widget));
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 3);
proxy->priv->spinner = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c
index 9501f29d6a..b3d5a4e61e 100644
--- a/widgets/misc/e-buffer-tagger.c
+++ b/widgets/misc/e-buffer-tagger.c
@@ -308,11 +308,7 @@ update_mouse_cursor (GtkTextView *text_view, gint x, gint y)
if (hovering != hovering_over_link) {
update_state (buffer, E_BUFFER_TAGGER_STATE_IS_HOVERING, hovering);
-#if GTK_CHECK_VERSION(2,19,7)
if (hovering && gtk_widget_has_focus (GTK_WIDGET (text_view)))
-#else
- if (hovering && GTK_WIDGET_HAS_FOCUS (text_view))
-#endif
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
else
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 4d7506e05d..27519528c2 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1557,11 +1557,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
day_style = calitem->styles[(month_offset + 1) * 32 + day_num];
/* Get the colors & style to use for the day.*/
-#if GTK_CHECK_VERSION(2,19,7)
if ((gtk_widget_has_focus (GTK_WIDGET (item->canvas))) &&
-#else
- if ((GTK_WIDGET_HAS_FOCUS(item->canvas)) &&
-#endif
item->canvas->focused_item == item)
has_focus = TRUE;
else
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index 27ac031b8d..3164b7b976 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -266,11 +266,7 @@ e_calendar_style_set (GtkWidget *widget,
/* Set the background of the canvas window to the normal color,
or the arrow buttons are not displayed properly. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (widget)) {
-#else
- if (GTK_WIDGET_REALIZED (widget)) {
-#endif
GtkStyle *style;
GdkWindow *window;
@@ -562,13 +558,8 @@ e_calendar_button_has_focus (ECalendar *cal)
prev_widget = GNOME_CANVAS_WIDGET(cal->prev_item)->widget;
next_widget = GNOME_CANVAS_WIDGET(cal->next_item)->widget;
-#if GTK_CHECK_VERSION(2,19,7)
ret_val = gtk_widget_has_focus (prev_widget) ||
gtk_widget_has_focus (next_widget);
-#else
- ret_val = GTK_WIDGET_HAS_FOCUS (prev_widget) ||
- GTK_WIDGET_HAS_FOCUS (next_widget);
-#endif
return ret_val;
}
@@ -595,11 +586,7 @@ e_calendar_focus (GtkWidget *widget, GtkDirectionType direction)
children[2] = cal->next_item;
/* get current focused item, if e-calendar has had focus */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget) || e_calendar_button_has_focus (cal))
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget) || e_calendar_button_has_focus (cal))
-#endif
for (index = 0; index < E_CALENDAR_FOCUS_CHILDREN_NUM; ++index) {
if (canvas->focused_item == NULL)
break;
@@ -649,11 +636,7 @@ e_calendar_set_focusable (ECalendar *cal, gboolean focusable)
GTK_WIDGET_SET_FLAGS (next_widget, GTK_CAN_FOCUS);
}
else {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (cal)) || e_calendar_button_has_focus (cal)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (cal) || e_calendar_button_has_focus (cal)) {
-#endif
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (cal));
if (toplevel)
gtk_widget_grab_focus (toplevel);
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
index 68c2488508..28875725b3 100644
--- a/widgets/misc/e-canvas-background.c
+++ b/widgets/misc/e-canvas-background.c
@@ -437,11 +437,7 @@ ecb_style_set (ECanvasBackground *ecb,
style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (GTK_WIDGET (item->canvas))) {
-#else
- if (GTK_WIDGET_REALIZED (item->canvas)) {
-#endif
gdk_gc_set_foreground (
ecb->priv->gc, &style->base[GTK_STATE_NORMAL]);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb));
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index db187b6e13..593c9c4530 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -568,11 +568,7 @@ e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too)
item->canvas->focused_item = item;
-#if GTK_CHECK_VERSION(2,19,7)
if (widget_too && !gtk_widget_has_focus (GTK_WIDGET(item->canvas))) {
-#else
- if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
-#endif
gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
}
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 03c8f2fd47..73b649defd 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -1699,11 +1699,7 @@ on_date_edit_time_selected (GtkComboBox *combo,
if (gtk_combo_box_get_active (combo) == -1)
return;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_mapped (child))
-#else
- if (!GTK_WIDGET_MAPPED (child))
-#endif
return;
e_date_edit_check_time_changed (dedit);
diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c
index 24bac0087c..51131cedcd 100644
--- a/widgets/misc/e-hinted-entry.c
+++ b/widgets/misc/e-hinted-entry.c
@@ -290,11 +290,7 @@ e_hinted_entry_set_text (EHintedEntry *entry,
if (text == NULL)
text = "";
-#if GTK_CHECK_VERSION(2,19,7)
if (*text == '\0' && !gtk_widget_has_focus (GTK_WIDGET (entry)))
-#else
- if (*text == '\0' && !GTK_WIDGET_HAS_FOCUS (entry))
-#endif
hinted_entry_show_hint (entry);
else {
hinted_entry_hide_hint (entry);
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index ff13e41be8..4ce8d75084 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -382,11 +382,7 @@ e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gtk_widget_set_allocation (widget, allocation);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_realized (widget)) {
-#else
- if (GTK_WIDGET_REALIZED (widget)) {
-#endif
GdkWindow *window;
window = gtk_widget_get_window (widget);
@@ -410,11 +406,7 @@ e_map_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
static gint
e_map_button_press (GtkWidget *widget, GdkEventButton *event)
{
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (widget)) gtk_widget_grab_focus (widget);
-#else
- if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget);
-#endif
return TRUE;
}
@@ -649,11 +641,7 @@ e_map_window_to_world (EMap *map, gdouble win_x, gdouble win_y, gdouble *world_l
g_return_if_fail (map);
priv = map->priv;
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
@@ -706,11 +694,7 @@ e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude)
EMapPrivate *priv;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
priv = map->priv;
@@ -730,11 +714,7 @@ e_map_zoom_out (EMap *map)
EMapPrivate *priv;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
priv = map->priv;
@@ -970,11 +950,7 @@ update_render_pixbuf (EMap *map,
gdouble zoom;
gint i;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (GTK_WIDGET (map)))
-#else
- if (!GTK_WIDGET_REALIZED (map))
-#endif
return;
gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
@@ -1039,13 +1015,8 @@ request_paint_area (EMap *view, GdkRectangle *area)
EMapPrivate *priv;
gint width, height;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_is_drawable (GTK_WIDGET (view)) ||
!gtk_widget_get_realized (GTK_WIDGET (view))) return;
-#else
- if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (view)) ||
- !GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
-#endif
priv = view->priv;
if (!priv->map_render_pixbuf) return;
@@ -1255,11 +1226,7 @@ scroll_to (EMap *view, gint x, gint y)
priv->xofs = x;
priv->yofs = y;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_is_drawable (GTK_WIDGET (view)))
-#else
- if (!GTK_WIDGET_DRAWABLE (view))
-#endif
return;
gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
@@ -1573,11 +1540,7 @@ zoom_in_smooth (EMap *map)
gdouble x, y;
g_return_if_fail (map);
-#if GTK_CHECK_VERSION(2,19,7)
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (map)));
-#else
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (map)));
-#endif
gtk_widget_get_allocation (GTK_WIDGET (map), &allocation);
@@ -1744,11 +1707,7 @@ set_scroll_area (EMap *view)
priv = view->priv;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (GTK_WIDGET (view))) return;
-#else
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (view))) return;
-#endif
if (!priv->hadj || !priv->vadj) return;
g_object_freeze_notify (G_OBJECT (priv->hadj));
diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c
index 7c5c23b760..cb7dab1453 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -51,11 +51,7 @@ online_button_update_tooltip (EOnlineButton *button)
if (e_online_button_get_online (button))
tooltip = ONLINE_TOOLTIP;
-#if GTK_CHECK_VERSION(2,19,7)
else if (gtk_widget_get_sensitive (GTK_WIDGET (button)))
-#else
- else if (GTK_WIDGET_SENSITIVE (button))
-#endif
tooltip = OFFLINE_TOOLTIP;
else
tooltip = NETWORK_UNAVAILABLE_TOOLTIP;
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 06b9ef6e78..aaf18b3912 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -92,11 +92,7 @@ search_bar_update_tokenizer (ESearchBar *search_bar)
tokenizer = e_search_bar_get_tokenizer (search_bar);
case_sensitive = e_search_bar_get_case_sensitive (search_bar);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (GTK_WIDGET (search_bar)))
-#else
- if (GTK_WIDGET_VISIBLE (search_bar))
-#endif
active_search = search_bar->priv->active_search;
else
active_search = NULL;
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 31e6c29b99..47e1a87eac 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -126,6 +126,7 @@ e_cell_combo_init (ECellCombo *ecc)
AtkObject *a11y;
GtkListStore *store;
GtkTreeSelection *selection;
+ GtkScrolledWindow *scrolled_window;
/* We create one popup window for the ECell, since there will only
ever be one popup in use at a time. */
@@ -140,11 +141,17 @@ e_cell_combo_init (ECellCombo *ecc)
gtk_widget_show (frame);
ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window),
+ scrolled_window = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
+
+ gtk_scrolled_window_set_policy (scrolled_window,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (
+ gtk_scrolled_window_get_hscrollbar (scrolled_window),
+ GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (
+ gtk_scrolled_window_get_vscrollbar (scrolled_window),
+ GTK_CAN_FOCUS);
gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window);
gtk_widget_show (ecc->popup_scrolled_window);
@@ -330,24 +337,33 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
static void
e_cell_combo_show_popup (ECellCombo *ecc, gint row, gint view_col)
{
+ GdkWindow *window;
+ GtkAllocation allocation;
gint x, y, width, height, old_width, old_height;
+ gtk_widget_get_allocation (ecc->popup_window, &allocation);
+
/* This code is practically copied from GtkCombo. */
- old_width = ecc->popup_window->allocation.width;
- old_height = ecc->popup_window->allocation.height;
+ old_width = allocation.width;
+ old_height = allocation.height;
e_cell_combo_get_popup_pos (ecc, row, view_col, &x, &y, &height, &width);
/* workaround for gtk_scrolled_window_size_allocate bug */
if (old_width != width || old_height != height) {
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar);
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar);
+ gtk_widget_hide (
+ gtk_scrolled_window_get_hscrollbar (
+ GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
+ gtk_widget_hide (
+ gtk_scrolled_window_get_vscrollbar (
+ GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
}
gtk_window_move (GTK_WINDOW (ecc->popup_window), x, y);
gtk_widget_set_size_request (ecc->popup_window, width, height);
gtk_widget_realize (ecc->popup_window);
- gdk_window_resize (ecc->popup_window->window, width, height);
+ window = gtk_widget_get_window (ecc->popup_window);
+ gdk_window_resize (window, width, height);
gtk_widget_show (ecc->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecc), TRUE);
@@ -367,8 +383,15 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
ECellPopup *ecp = E_CELL_POPUP (ecc);
ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ GtkWidget *widget;
+ GtkWidget *popwin_child;
+ GtkWidget *popup_child;
+ GtkStyle *popwin_style;
+ GtkStyle *popup_style;
+ GdkWindow *window;
GtkBin *popwin;
GtkScrolledWindow *popup;
+ GtkRequisition requisition;
GtkRequisition list_requisition;
gboolean show_vscroll = FALSE, show_hscroll = FALSE;
gint avail_height, avail_width, min_height, work_height, screen_width;
@@ -380,7 +403,8 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
popwin = GTK_BIN (ecc->popup_window);
- gdk_window_get_origin (canvas->window, x, y);
+ window = gtk_widget_get_window (canvas);
+ gdk_window_get_origin (window, x, y);
x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
y1 = e_table_item_row_diff (eti, 0, row + 1);
@@ -402,10 +426,16 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
*x += x1;
/* The ETable positions don't include the grid lines, I think, so we add 1. */
*y += y1 + 1
- - (gint)((GnomeCanvas *)canvas)->layout.vadjustment->value
+ - (gint)gtk_adjustment_get_value (
+ gtk_layout_get_vadjustment (
+ &((GnomeCanvas *)canvas)->layout))
+ ((GnomeCanvas *)canvas)->zoom_yofs;
- scrollbar_width = popup->vscrollbar->requisition.width
+ widget = gtk_scrolled_window_get_vscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
+
+ scrollbar_width =
+ requisition.width
+ GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing;
avail_height = gdk_screen_height () - *y;
@@ -415,19 +445,27 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
screen_width = gdk_screen_width ();
avail_width = screen_width - scrollbar_width;
+ widget = gtk_scrolled_window_get_vscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
+
gtk_widget_size_request (ecc->popup_tree_view, &list_requisition);
- min_height = MIN (list_requisition.height,
- popup->vscrollbar->requisition.height);
+ min_height = MIN (list_requisition.height, requisition.height);
if (!gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)), NULL))
list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT;
+ popwin_child = gtk_bin_get_child (popwin);
+ popwin_style = gtk_widget_get_style (popwin_child);
+
+ popup_child = gtk_bin_get_child (GTK_BIN (popup));
+ popup_style = gtk_widget_get_style (popup_child);
+
/* Calculate the desired width. */
*width = list_requisition.width
- + 2 * popwin->child->style->xthickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->xthickness;
+ + 2 * popwin_style->xthickness
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popwin_child))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup_child))
+ + 2 * popup_style->xthickness;
/* Use at least the same width as the column. */
if (*width < column_width)
@@ -441,15 +479,19 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
}
/* Calculate all the borders etc. that we need to add to the height. */
- work_height = (2 * popwin->child->style->ythickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->xthickness);
+ work_height = (2 * popwin_style->ythickness
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popwin_child))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup))
+ + 2 * gtk_container_get_border_width (GTK_CONTAINER (popup_child))
+ + 2 * popup_style->xthickness);
+
+ widget = gtk_scrolled_window_get_hscrollbar (popup);
+ gtk_widget_get_child_requisition (widget, &requisition);
/* Add on the height of the horizontal scrollbar if we need it. */
if (show_hscroll)
- work_height += popup->hscrollbar->requisition.height +
+ work_height +=
+ requisition.height +
GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing;
/* Check if it fits in the available height. */
@@ -494,11 +536,7 @@ e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc)
GtkTreeIter iter;
GtkTreeModel *model;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter))
-#else
- if (!GTK_WIDGET_REALIZED (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter))
-#endif
return;
e_cell_combo_update_cell (ecc);
@@ -526,7 +564,7 @@ e_cell_combo_button_press (GtkWidget *popup_window,
presses outside the application will be reported to this window,
which is why we hide the popup in this case. */
while (event_widget) {
- event_widget = event_widget->parent;
+ event_widget = gtk_widget_get_parent (event_widget);
if (event_widget == ecc->popup_tree_view)
return FALSE;
}
@@ -564,7 +602,7 @@ e_cell_combo_button_release (GtkWidget *popup_window,
/* See if the button was released in the list (or its children). */
while (event_widget && event_widget != ecc->popup_tree_view)
- event_widget = event_widget->parent;
+ event_widget = gtk_widget_get_parent (event_widget);
/* If it wasn't, then we just ignore the event. */
if (event_widget != ecc->popup_tree_view)
@@ -601,11 +639,7 @@ e_cell_combo_key_press (GtkWidget *popup_window,
&& event->keyval != GDK_3270_Enter)
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
if (event->keyval == GDK_Escape && (!ecc->popup_window||!gtk_widget_get_visible (ecc->popup_window)))
-#else
- if (event->keyval == GDK_Escape && (!ecc->popup_window||!GTK_WIDGET_VISIBLE (ecc->popup_window)))
-#endif
return FALSE;
gtk_grab_remove (ecc->popup_window);
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index 692614ff14..cab6c816ee 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -383,32 +383,16 @@ e_cell_date_edit_get_property (GObject *object,
switch (property_id) {
case PROP_SHOW_TIME:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->time_entry));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->time_entry));
-#endif
return;
case PROP_SHOW_NOW_BUTTON:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->now_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->now_button));
-#endif
return;
case PROP_SHOW_TODAY_BUTTON:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->today_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->today_button));
-#endif
return;
case PROP_ALLOW_NO_DATE_SET:
-#if GTK_CHECK_VERSION(2,19,7)
g_value_set_boolean (value, gtk_widget_get_visible (ecde->none_button));
-#else
- g_value_set_boolean (value, GTK_WIDGET_VISIBLE (ecde->none_button));
-#endif
return;
case PROP_USE_24_HOUR_FORMAT:
g_value_set_boolean (value, ecde->use_24_hour_format);
@@ -503,6 +487,7 @@ e_cell_date_edit_do_popup (ECellPopup *ecp,
gint view_col)
{
ECellDateEdit *ecde = E_CELL_DATE_EDIT (ecp);
+ GdkWindow *window;
e_cell_date_edit_show_popup (ecde, row, view_col);
e_cell_date_edit_set_popup_values (ecde);
@@ -511,7 +496,8 @@ e_cell_date_edit_do_popup (ECellPopup *ecp,
/* Set the focus to the first widget. */
gtk_widget_grab_focus (ecde->time_entry);
- gdk_window_focus (ecde->popup_window->window, GDK_CURRENT_TIME);
+ window = gtk_widget_get_window (ecde->popup_window);
+ gdk_window_focus (window, GDK_CURRENT_TIME);
return TRUE;
}
@@ -627,6 +613,7 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
gint row,
gint view_col)
{
+ GdkWindow *window;
gint x, y, width, height;
if (ecde->need_time_list_rebuild)
@@ -636,10 +623,11 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
e_cell_date_edit_get_popup_pos (ecde, row, view_col, &x, &y, &height, &width);
+ window = gtk_widget_get_window (ecde->popup_window);
gtk_window_move (GTK_WINDOW (ecde->popup_window), x, y);
gtk_widget_set_size_request (ecde->popup_window, width, height);
gtk_widget_realize (ecde->popup_window);
- gdk_window_resize (ecde->popup_window->window, width, height);
+ gdk_window_resize (window, width, height);
gtk_widget_show (ecde->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecde), TRUE);
@@ -659,10 +647,15 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
GtkRequisition popup_requisition;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ GdkWindow *window;
gint avail_height, screen_width, column_width, row_height;
gdouble x1, y1, wx, wy;
+ gint value;
- gdk_window_get_origin (canvas->window, x, y);
+ window = gtk_widget_get_window (canvas);
+ gdk_window_get_origin (window, x, y);
x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
y1 = e_table_item_row_diff (eti, 0, row + 1);
@@ -684,9 +677,10 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
*x += x1;
/* The ETable positions don't include the grid lines, I think, so we
add 1. */
- *y += y1 + 1
- - (gint)((GnomeCanvas *)canvas)->layout.vadjustment->value
- + ((GnomeCanvas *)canvas)->zoom_yofs;
+ layout = &GNOME_CANVAS (canvas)->layout;
+ adjustment = gtk_layout_get_vadjustment (layout);
+ value = (gint) gtk_adjustment_get_value (adjustment);
+ *y += y1 + 1 - value + ((GnomeCanvas *)canvas)->zoom_yofs;
avail_height = gdk_screen_height () - *y;
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c
index 6deb4c46a9..32de41ecb4 100644
--- a/widgets/table/e-cell-popup.c
+++ b/widgets/table/e-cell-popup.c
@@ -277,6 +277,8 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable,
ecp->popup_arrow_shown = show_popup_arrow;
if (show_popup_arrow) {
+ GtkStyle *style;
+
e_cell_draw (ecp_view->child_view, drawable, model_col,
view_col, row, flags,
x1, y1, x2 - E_CELL_POPUP_ARROW_WIDTH, y2);
@@ -291,11 +293,13 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable,
else
shadow = GTK_SHADOW_OUT;
- gtk_paint_box (canvas->style, drawable,
+ style = gtk_widget_get_style (canvas);
+
+ gtk_paint_box (style, drawable,
GTK_STATE_NORMAL, shadow,
&rect, canvas, "ecellpopup",
rect.x, rect.y, rect.width, rect.height);
- gtk_paint_arrow (canvas->style, drawable,
+ gtk_paint_arrow (style, drawable,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&rect, canvas, NULL,
GTK_ARROW_DOWN, TRUE,
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index b501c47c10..ba246316bb 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -274,6 +274,7 @@ ect_queue_redraw (ECellTextView *text_view, gint view_col, gint view_row)
static void
ect_stop_editing (ECellTextView *text_view, gboolean commit)
{
+ GdkWindow *window;
CellEdit *edit = text_view->edit;
gint row, view_col, model_col;
gchar *old_text, *text;
@@ -281,6 +282,8 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit)
if (!edit)
return;
+ window = gtk_widget_get_window (GTK_WIDGET (text_view->canvas));
+
row = edit->row;
view_col = edit->view_col;
model_col = edit->model_col;
@@ -290,7 +293,7 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit)
if (edit->tep)
g_object_unref (edit->tep);
if (!edit->default_cursor_shown) {
- gdk_window_set_cursor (GTK_WIDGET(text_view->canvas)->window, NULL);
+ gdk_window_set_cursor (window, NULL);
edit->default_cursor_shown = TRUE;
}
if (edit->timeout_id) {
@@ -389,8 +392,10 @@ static void
ect_realize (ECellView *ecell_view)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
+ GdkWindow *window;
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (text_view->canvas));
+ text_view->gc = gdk_gc_new (window);
text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
@@ -730,21 +735,20 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkColor *foreground;
GtkWidget *canvas = GTK_WIDGET (text_view->canvas);
GdkRectangle clip_rect;
+ GtkStyle *style;
gint x_origin, y_origin, vspacing;
+ style = gtk_widget_get_style (canvas);
+
selected = flags & E_CELL_SELECTED;
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS (canvas))
-#endif
- foreground = &canvas->style->fg [GTK_STATE_SELECTED];
+ foreground = &style->fg[GTK_STATE_SELECTED];
else
- foreground = &canvas->style->fg [GTK_STATE_ACTIVE];
+ foreground = &style->fg[GTK_STATE_ACTIVE];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text[GTK_STATE_NORMAL];
if (ect->color_column != -1) {
gchar *color_spec;
@@ -805,11 +809,11 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
end_index = edit->selection_start ^ edit->selection_end ^ start_index;
if (edit->has_selection) {
- selection_gc = canvas->style->base_gc [GTK_STATE_SELECTED];
- text_gc = canvas->style->text_gc[GTK_STATE_SELECTED];
+ selection_gc = style->base_gc[GTK_STATE_SELECTED];
+ text_gc = style->text_gc[GTK_STATE_SELECTED];
} else {
- selection_gc = canvas->style->base_gc [GTK_STATE_ACTIVE];
- text_gc = canvas->style->text_gc[GTK_STATE_ACTIVE];
+ selection_gc = style->base_gc [GTK_STATE_ACTIVE];
+ text_gc = style->text_gc[GTK_STATE_ACTIVE];
}
gdk_gc_set_clip_rectangle (selection_gc, &clip_rect);
@@ -1126,7 +1130,10 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
#endif
if (edit_display) {
if (edit->default_cursor_shown) {
- gdk_window_set_cursor (canvas->window, text_view->i_cursor);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (canvas);
+ gdk_window_set_cursor (window, text_view->i_cursor);
edit->default_cursor_shown = FALSE;
}
}
@@ -1137,7 +1144,10 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
#endif
if (edit_display) {
if (!edit->default_cursor_shown) {
- gdk_window_set_cursor (canvas->window, NULL);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (canvas);
+ gdk_window_set_cursor (window, NULL);
edit->default_cursor_shown = TRUE;
}
}
@@ -1334,6 +1344,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
ECellTextView *ectView = (ECellTextView *)ecell_view;
GtkWidget *canvas = GTK_WIDGET(ectView->canvas);
+ GtkStyle *style;
PangoDirection dir;
gboolean strikeout, underline;
cairo_t *cr;
@@ -1355,12 +1366,14 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
cairo_rectangle (cr, 2, 2, width + 2, height + 2);
cairo_clip(cr);
+ style = gtk_widget_get_style (canvas);
pango_context = gtk_widget_get_pango_context (canvas);
- font_metrics = pango_context_get_metrics (pango_context,
- canvas->style->font_desc, pango_context_get_language(pango_context));
- ty = (gdouble)(text_height
- - pango_font_metrics_get_ascent (font_metrics)
- - pango_font_metrics_get_descent (font_metrics)) / 2.0 /(gdouble)PANGO_SCALE;
+ font_metrics = pango_context_get_metrics (
+ pango_context, style->font_desc,
+ pango_context_get_language(pango_context));
+ ty = (gdouble)(text_height -
+ pango_font_metrics_get_ascent (font_metrics) -
+ pango_font_metrics_get_descent (font_metrics)) / 2.0 /(gdouble)PANGO_SCALE;
strikeout = ect->strikeout_column >= 0 && row >= 0 &&
e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 5f7cc66321..08a9d8dcc3 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -173,8 +173,10 @@ static void
cell_toggle_realize (ECellView *ecell_view)
{
ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
+ GdkWindow *window;
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (toggle_view->canvas));
+ toggle_view->gc = gdk_gc_new (window);
}
static void
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 8a8017e2e7..b5506af13b 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -169,11 +169,13 @@ static void
ect_realize (ECellView *ecell_view)
{
ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
+ GdkWindow *window;
/* realize our subcell view */
e_cell_realize (tree_view->subcell_view);
- tree_view->gc = gdk_gc_new (GTK_WIDGET (tree_view->canvas)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (tree_view->canvas));
+ tree_view->gc = gdk_gc_new (window);
gdk_gc_set_line_attributes (tree_view->gc, 1,
GDK_LINE_ON_OFF_DASH,
@@ -229,11 +231,19 @@ draw_retro_expander (ECellTreeView *ectv, GdkDrawable *drawable, gboolean expand
static void
draw_expander (ECellTreeView *ectv, GdkDrawable *drawable, GtkExpanderStyle expander_style, GtkStateType state, GdkRectangle *rect)
{
- GtkWidget *tree = GTK_WIDGET (ectv->canvas)->parent;
+ GtkStyle *style;
+ GtkWidget *tree;
gint exp_size;
+
+ tree = gtk_widget_get_parent (GTK_WIDGET (ectv->canvas));
+ style = gtk_widget_get_style (tree);
+
gtk_widget_style_get (tree, "expander_size", &exp_size, NULL);
- gtk_paint_expander (tree->style, drawable, state, rect, tree, "treeview", rect->x + rect->width - exp_size / 2, rect->y + rect->height / 2, expander_style);
+ gtk_paint_expander (
+ style, drawable, state, rect, tree, "treeview",
+ rect->x + rect->width - exp_size / 2,
+ rect->y + rect->height / 2, expander_style);
}
/*
@@ -250,12 +260,16 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
ETreePath node;
GdkRectangle rect, *clip_rect = NULL;
GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
- GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
+ GtkStyle *style;
+ GdkGC *fg_gc;
GdkColor *foreground;
gboolean selected;
gint offset, subcell_offset;
+ style = gtk_widget_get_style (canvas);
+ fg_gc = style->fg_gc[GTK_STATE_ACTIVE];
+
selected = flags & E_CELL_SELECTED;
/* only draw the tree effects if we're the active sort */
@@ -263,7 +277,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkPixbuf *node_image;
gint node_image_width = 0, node_image_height = 0;
ETreePath parent_node;
- ETree *tree = E_TREE (canvas->parent);
+ ETree *tree;
+
+ tree = E_TREE (gtk_widget_get_parent (canvas));
gtk_widget_style_get (GTK_WIDGET (tree),
"retro_look", &tree_view->retro_look,
@@ -295,9 +311,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
clip_rect = &rect;
if (selected) {
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
+ foreground = &style->text [GTK_STATE_SELECTED];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text [GTK_STATE_NORMAL];
}
gdk_gc_set_foreground (tree_view->gc, foreground);
@@ -445,6 +461,8 @@ typedef struct {
static gboolean
animate_expander (gpointer data)
{
+ GtkLayout *layout;
+ GdkWindow *window;
animate_closure_t *closure = (animate_closure_t *) data;
if (closure->finish) {
@@ -454,9 +472,14 @@ animate_expander (gpointer data)
return FALSE;
}
- draw_expander (closure->ectv, GTK_LAYOUT (closure->ectv->canvas)->bin_window,
- closure->expanded ? GTK_EXPANDER_SEMI_COLLAPSED : GTK_EXPANDER_SEMI_EXPANDED,
- GTK_STATE_NORMAL, &closure->area);
+ layout = GTK_LAYOUT (closure->ectv->canvas);
+ window = gtk_layout_get_bin_window (layout);
+
+ draw_expander (
+ closure->ectv, window, closure->expanded ?
+ GTK_EXPANDER_SEMI_COLLAPSED :
+ GTK_EXPANDER_SEMI_EXPANDED,
+ GTK_STATE_NORMAL, &closure->area);
closure->finish = TRUE;
return TRUE;
@@ -468,6 +491,8 @@ animate_expander (gpointer data)
static gint
ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col, gint row, ECellFlags flags, ECellActions *actions)
{
+ GtkLayout *layout;
+ GdkWindow *window;
ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
ETreeTableAdapter *etta = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
@@ -475,6 +500,9 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
gint offset = offset_of_node (ecell_view->e_table_model, row);
gint result;
+ layout = GTK_LAYOUT (tree_view->canvas);
+ window = gtk_layout_get_bin_window (layout);
+
switch (event->type) {
case GDK_BUTTON_PRESS:
@@ -497,9 +525,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
if (hgt != area.height) /* Composite cells */
area.height += hgt;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- expanded ? GTK_EXPANDER_SEMI_EXPANDED : GTK_EXPANDER_SEMI_COLLAPSED,
- GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window, expanded ?
+ GTK_EXPANDER_SEMI_EXPANDED :
+ GTK_EXPANDER_SEMI_COLLAPSED,
+ GTK_STATE_NORMAL, &area);
closure->ectv = tree_view;
closure->etta = etta;
closure->node = node;
@@ -526,9 +556,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
&tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- in_expander ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window,
+ e_tree_table_adapter_node_is_expanded (etta, node) ?
+ GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
+ in_expander ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, &area);
tree_view->prelit = in_expander;
return TRUE;
}
@@ -544,9 +576,11 @@ ect_event (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col
e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
&tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- GTK_STATE_NORMAL, &area);
+ draw_expander (
+ tree_view, window,
+ e_tree_table_adapter_node_is_expanded (etta, node) ?
+ GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
+ GTK_STATE_NORMAL, &area);
tree_view->prelit = FALSE;
}
return TRUE;
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index deebd7939c..e50d0f4274 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -73,21 +73,24 @@ etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *et
static void
etcta_style_set (ETableClickToAdd *etcta, GtkStyle *previous_style)
{
- GtkWidget *widget = GTK_WIDGET(GNOME_CANVAS_ITEM(etcta)->canvas);
+ GtkWidget *widget;
+ GtkStyle *style;
- if (etcta->rect) {
- gnome_canvas_item_set (etcta->rect,
- "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
- "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
- NULL );
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etcta)->canvas);
+ style = gtk_widget_get_style (widget);
- }
+ if (etcta->rect)
+ gnome_canvas_item_set (
+ etcta->rect,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
+ NULL);
if (etcta->text)
- gnome_canvas_item_set (etcta->text,
- "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
- NULL);
-
+ gnome_canvas_item_set (
+ etcta->text,
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
+ NULL);
}
static void
@@ -237,28 +240,34 @@ etcta_set_property (GObject *object,
static void
create_rect_and_text (ETableClickToAdd *etcta)
{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM(etcta)->canvas);
+ GtkWidget *widget;
+ GtkStyle *style;
+
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etcta)->canvas);
+ style = gtk_widget_get_style (widget);
if (!etcta->rect)
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- gnome_canvas_rect_get_type(),
- "x1", (gdouble) 0,
- "y1", (gdouble) 0,
- "x2", (gdouble) etcta->width - 1,
- "y2", (gdouble) etcta->height - 1,
- "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
- "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
- NULL);
+ etcta->rect = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (etcta),
+ gnome_canvas_rect_get_type (),
+ "x1", (gdouble) 0,
+ "y1", (gdouble) 0,
+ "x2", (gdouble) etcta->width - 1,
+ "y2", (gdouble) etcta->height - 1,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
+ NULL);
if (!etcta->text)
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
- NULL);
+ etcta->text = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (etcta),
+ e_text_get_type (),
+ "text", etcta->message ? etcta->message : "",
+ "anchor", GTK_ANCHOR_NW,
+ "width", etcta->width - 4,
+ "draw_background", FALSE,
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
+ NULL);
}
static void
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 23046c717a..736473a81c 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -549,18 +549,27 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
static void
do_fields_config_dialog (ETableConfig *config)
{
+ GtkDialog *dialog;
+ GtkWidget *widget;
gint response, running = 1;
+ dialog = GTK_DIALOG (config->dialog_show_fields);
+
gtk_widget_ensure_style (config->dialog_show_fields);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_show_fields)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_show_fields)->action_area), 12);
+
+ widget = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
config->temp_state = e_table_state_duplicate (config->state);
setup_fields (config);
- gtk_window_set_transient_for (GTK_WINDOW (config->dialog_show_fields),
- GTK_WINDOW (config->dialog_toplevel));
+ gtk_window_set_transient_for (
+ GTK_WINDOW (config->dialog_show_fields),
+ GTK_WINDOW (config->dialog_toplevel));
do {
response = gtk_dialog_run (GTK_DIALOG(config->dialog_show_fields));
@@ -759,6 +768,7 @@ sort_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *sort)
ETableConfig *config = sort->e_table_config;
ETableSortInfo *sort_info = config->temp_state->sort_info;
ETableConfigSortWidgets *base = &config->sort[0];
+ GtkToggleButton *toggle_button;
gint idx = sort - base;
gchar *s;
@@ -775,8 +785,9 @@ sort_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *sort)
return;
}
- c.ascending = GTK_TOGGLE_BUTTON (
- config->sort [idx].radio_ascending)->active;
+ toggle_button = GTK_TOGGLE_BUTTON (
+ config->sort[idx].radio_ascending);
+ c.ascending = gtk_toggle_button_get_active (toggle_button);
c.column = col;
e_table_sort_info_sorting_set_nth (sort_info, idx, c);
@@ -799,7 +810,7 @@ sort_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *sort)
ETableSortColumn c;
c = e_table_sort_info_sorting_get_nth (si, idx);
- c.ascending = t->active;
+ c.ascending = gtk_toggle_button_get_active (t);
e_table_sort_info_sorting_set_nth (si, idx, c);
}
@@ -877,6 +888,7 @@ group_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *group)
s = configure_combo_box_get_active (combo_box);
if (s != NULL) {
+ GtkToggleButton *toggle_button;
ETableSortColumn c;
gint col;
@@ -887,8 +899,9 @@ group_combo_changed (GtkComboBox *combo_box, ETableConfigSortWidgets *group)
return;
}
- c.ascending = GTK_TOGGLE_BUTTON (
- config->group [idx].radio_ascending)->active;
+ toggle_button = GTK_TOGGLE_BUTTON (
+ config->group[idx].radio_ascending);
+ c.ascending = gtk_toggle_button_get_active (toggle_button);
c.column = col;
e_table_sort_info_grouping_set_nth (sort_info, idx, c);
@@ -911,7 +924,7 @@ group_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *group)
ETableSortColumn c;
c = e_table_sort_info_grouping_get_nth (si, idx);
- c.ascending = t->active;
+ c.ascending = gtk_toggle_button_get_active (t);
e_table_sort_info_grouping_set_nth (si, idx, c);
}
@@ -1324,15 +1337,23 @@ e_table_config_new (const gchar *header,
GtkWindow *parent_window)
{
ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);
+ GtkDialog *dialog;
+ GtkWidget *widget;
if (e_table_config_construct (config, header, spec, state, parent_window) == NULL) {
g_object_unref (config);
return NULL;
}
+ dialog = GTK_DIALOG (config->dialog_toplevel);
+
gtk_widget_ensure_style (config->dialog_toplevel);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->action_area), 12);
+
+ widget = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 0);
+
+ widget = gtk_dialog_get_action_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
GTK_RESPONSE_APPLY, FALSE);
@@ -1350,6 +1371,9 @@ e_table_config_new (const gchar *header,
void
e_table_config_raise (ETableConfig *config)
{
- gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (GTK_WIDGET (config->dialog_toplevel));
+ gdk_window_raise (window);
}
diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c
index 9641f6c58e..c05506d953 100644
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ b/widgets/table/e-table-field-chooser-dialog.c
@@ -85,17 +85,20 @@ e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass)
static void
e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog)
{
+ GtkDialog *dialog;
+ GtkWidget *content_area;
GtkWidget *widget;
+ dialog = GTK_DIALOG (e_table_field_chooser_dialog);
+
e_table_field_chooser_dialog->etfc = NULL;
e_table_field_chooser_dialog->dnd_code = g_strdup("");
e_table_field_chooser_dialog->full_header = NULL;
e_table_field_chooser_dialog->header = NULL;
- gtk_dialog_add_button(GTK_DIALOG(e_table_field_chooser_dialog),
- GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
+ gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
- gtk_window_set_resizable(GTK_WINDOW(e_table_field_chooser_dialog), TRUE);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
widget = e_table_field_chooser_new();
e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER(widget);
@@ -106,12 +109,12 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos
"header", e_table_field_chooser_dialog->header,
NULL);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_table_field_chooser_dialog)->vbox),
- widget, TRUE, TRUE, 0);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
- gtk_widget_show(GTK_WIDGET(widget));
+ gtk_widget_show (GTK_WIDGET(widget));
- gtk_window_set_title (GTK_WINDOW (e_table_field_chooser_dialog), _("Add a Column"));
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column"));
}
GtkWidget*
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
index 69c0b58249..a04e4f3742 100644
--- a/widgets/table/e-table-field-chooser-item.c
+++ b/widgets/table/e-table-field-chooser-item.c
@@ -214,12 +214,14 @@ etfci_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint fl
static void
etfci_font_load (ETableFieldChooserItem *etfci)
{
+ GtkWidget *widget;
GtkStyle *style;
if (etfci->font_desc)
pango_font_description_free (etfci->font_desc);
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style;
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas);
+ style = gtk_widget_get_style (widget);
etfci->font_desc = pango_font_description_copy (style->font_desc);
}
@@ -462,7 +464,7 @@ etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint w
rows = e_table_header_count (etfci->combined_header);
- style = GTK_WIDGET (canvas)->style;
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
state = gtk_widget_get_state (GTK_WIDGET (canvas));
y1 = y2 = 0;
@@ -519,6 +521,8 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo
GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas);
GtkTargetList *list;
GdkDragContext *context;
+ GdkWindow *window;
+ GtkStyle *style;
GtkStateType state;
ETableCol *ecol;
GdkPixmap *pixmap;
@@ -551,24 +555,26 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, gdouble x, gdo
g_free(etfci_drag_types[0].target);
button_height = e_table_header_compute_height (ecol, widget);
- pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1);
+ window = gtk_widget_get_window (widget);
+ pixmap = gdk_pixmap_new (window, etfci->width, button_height, -1);
+ style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
- e_table_header_draw_button (pixmap, ecol,
- widget->style, state,
- widget,
- 0, 0,
- etfci->width, button_height,
- etfci->width, button_height,
- E_TABLE_COL_ARROW_NONE);
-
- gtk_drag_set_icon_pixmap (context,
- gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)),
- pixmap,
- NULL,
- etfci->width / 2,
- button_height / 2);
+ e_table_header_draw_button (
+ pixmap, ecol, style,
+ state, widget, 0, 0,
+ etfci->width, button_height,
+ etfci->width, button_height,
+ E_TABLE_COL_ARROW_NONE);
+
+ gtk_drag_set_icon_pixmap (
+ context,
+ gdk_drawable_get_colormap (GDK_DRAWABLE (window)),
+ pixmap, NULL,
+ etfci->width / 2,
+ button_height / 2);
+
g_object_unref (pixmap);
etfci->maybe_drag = FALSE;
}
diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c
index 2e73bafcfc..e56293b111 100644
--- a/widgets/table/e-table-field-chooser.c
+++ b/widgets/table/e-table-field-chooser.c
@@ -94,9 +94,9 @@ ensure_nonzero_step_increments (ETableFieldChooser *etfc)
so use 16 pixels which should be OK
*/
if (va)
- va->step_increment = 16.0;
+ gtk_adjustment_set_step_increment (va, 16.0);
if (ha)
- ha->step_increment = 16.0;
+ gtk_adjustment_set_step_increment (ha, 16.0);
}
static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, ETableFieldChooser *etfc)
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index e99270bd4b..72f2323acd 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -146,6 +146,7 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
{
ETableCol *col;
ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, n);
+ GtkWidget *widget;
GtkStyle *style;
col = e_table_header_get_column_by_col_idx(full_header, column.column);
@@ -160,7 +161,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->n = n;
etgc->ascending = column.ascending;
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style;
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas);
+ style = gtk_widget_get_style (widget);
etgc->font_desc = pango_font_description_copy (style->font_desc);
etgc->open = TRUE;
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 57e0e42a82..133a368754 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -498,6 +498,9 @@ make_shaped_window_from_xpm (const gchar **xpm)
static void
ethi_add_drop_marker (ETableHeaderItem *ethi, gint col, gboolean recreate)
{
+ GnomeCanvas *canvas;
+ GtkAdjustment *adjustment;
+ GdkWindow *window;
gint rx, ry;
gint x;
@@ -515,14 +518,15 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, gint col, gboolean recreate)
arrow_down = make_shaped_window_from_xpm (arrow_down_xpm);
}
- gdk_window_get_origin (
- GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->window,
- &rx, &ry);
+ canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_get_origin (window, &rx, &ry);
- rx -= gtk_layout_get_hadjustment (
- GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
- ry -= gtk_layout_get_vadjustment (
- GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (canvas));
+ rx -= gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (canvas));
+ ry -= gtk_adjustment_get_value (adjustment);
gtk_window_move (
GTK_WINDOW (arrow_down),
@@ -645,7 +649,13 @@ scroll_timeout (gpointer data)
{
ETableHeaderItem *ethi = data;
gint dx = 0;
- GtkAdjustment *h, *v;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble hadjustment_value;
+ gdouble vadjustment_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
gdouble value;
if (ethi->scroll_direction & ET_SCROLL_RIGHT)
@@ -653,20 +663,35 @@ scroll_timeout (gpointer data)
if (ethi->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->hadjustment;
- v = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->vadjustment;
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ vadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ value = hadjustment_value;
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
- value = h->value;
+ gtk_adjustment_set_value (
+ adjustment, CLAMP (
+ hadjustment_value + dx, lower, upper - page_size));
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
- if (h->value != value)
- do_drag_motion(ethi,
- ethi->last_drop_context,
- ethi->last_drop_x + h->value,
- ethi->last_drop_y + v->value,
- ethi->last_drop_time,
- TRUE);
+ if (hadjustment_value != value)
+ do_drag_motion(
+ ethi,
+ ethi->last_drop_context,
+ ethi->last_drop_x + hadjustment_value,
+ ethi->last_drop_y + vadjustment_value,
+ ethi->last_drop_time,
+ TRUE);
return TRUE;
}
@@ -723,6 +748,10 @@ ethi_drag_motion (GtkWidget *widget,
guint time,
ETableHeaderItem *ethi)
{
+ GtkAllocation allocation;
+ GtkAdjustment *adjustment;
+ gdouble hadjustment_value;
+ gdouble vadjustment_value;
gchar *droptype, *headertype;
guint direction = 0;
@@ -739,9 +768,11 @@ ethi_drag_motion (GtkWidget *widget,
g_free (headertype);
+ gtk_widget_get_allocation (widget, &allocation);
+
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
ethi->last_drop_x = x;
@@ -750,12 +781,17 @@ ethi_drag_motion (GtkWidget *widget,
ethi->last_drop_context = context;
context_connect (ethi, context);
- do_drag_motion (ethi,
- context,
- x + GTK_LAYOUT(widget)->hadjustment->value,
- y + GTK_LAYOUT(widget)->vadjustment->value,
- time,
- FALSE);
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (widget));
+ hadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
+ vadjustment_value = gtk_adjustment_get_value (adjustment);
+
+ do_drag_motion (
+ ethi, context,
+ x + hadjustment_value,
+ y + vadjustment_value,
+ time, FALSE);
if (direction != 0)
scroll_on (ethi, direction);
@@ -781,20 +817,23 @@ ethi_drag_data_received (GtkWidget *canvas,
GdkDragContext *drag_context,
gint x,
gint y,
- GtkSelectionData *data,
+ GtkSelectionData *selection_data,
guint info,
guint time,
ETableHeaderItem *ethi)
{
+ const guchar *data;
gint found = FALSE;
gint count;
gint column;
gint drop_col;
gint i;
- if (data->data) {
+ data = gtk_selection_data_get_data (selection_data);
+
+ if (data != NULL) {
count = e_table_header_count(ethi->eth);
- column = atoi((gchar *)data->data);
+ column = atoi((gchar *)data);
drop_col = ethi->drop_col;
ethi->drop_col = -1;
@@ -891,6 +930,7 @@ static void
ethi_realize (GnomeCanvasItem *item)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
+ GtkStyle *style;
GtkTargetEntry ethi_drop_types [] = {
{ (gchar *) TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
};
@@ -898,8 +938,10 @@ ethi_realize (GnomeCanvasItem *item)
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize)
(*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item);
+ style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
+
if (!ethi->font_desc)
- ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font_desc);
+ ethi_font_set (ethi, style->font_desc);
/*
* Now, configure DnD
@@ -972,6 +1014,11 @@ ethi_draw (GnomeCanvasItem *item,
gint x1, x2;
gint col;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
+ GtkStateType state;
+ GtkStyle *style;
+
+ state = gtk_widget_get_state (GTK_WIDGET (canvas));
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
if (ethi->sort_info) {
gint length = e_table_sort_info_grouping_get_count(ethi->sort_info);
@@ -1018,15 +1065,13 @@ ethi_draw (GnomeCanvasItem *item,
state = gtk_widget_get_state (GTK_WIDGET (canvas));
- e_table_header_draw_button (drawable, ecol,
- GTK_WIDGET (canvas)->style,
- state,
- GTK_WIDGET (canvas),
- x1 - x, -y,
- width, height,
- x2 - x1, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, GINT_TO_POINTER (ecol->col_idx)));
+ e_table_header_draw_button (
+ drawable, ecol,
+ style, state, GTK_WIDGET (canvas),
+ x1 - x, -y, width, height,
+ x2 - x1, ethi->height,
+ (ETableColArrow) g_hash_table_lookup (
+ arrows, GINT_TO_POINTER (ecol->col_idx)));
}
g_hash_table_destroy (arrows);
@@ -1088,12 +1133,16 @@ is_pointer_on_division (ETableHeaderItem *ethi,
static void
set_cursor (ETableHeaderItem *ethi, gint pos)
{
- gint col;
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
+ GnomeCanvas *canvas;
+ GdkWindow *window;
gboolean resizable = FALSE;
+ gint col;
+
+ canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
/* We might be invoked before we are realized */
- if (!canvas->window)
+ if (window == NULL)
return;
if (is_pointer_on_division (ethi, pos, NULL, &col)) {
@@ -1119,9 +1168,9 @@ set_cursor (ETableHeaderItem *ethi, gint pos)
}
if (resizable)
- gdk_window_set_cursor (canvas->window, ethi->resize_cursor);
+ gdk_window_set_cursor (window, ethi->resize_cursor);
else
- gdk_window_set_cursor (canvas->window, NULL);
+ gdk_window_set_cursor (window, NULL);
}
static void
@@ -1157,17 +1206,24 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
GtkTargetList *list;
GdkDragContext *context;
- GtkStateType state;
ETableCol *ecol;
gint col_width;
GdkPixmap *pixmap;
gint group_indent = 0;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
+ GtkStateType state;
+ GtkStyle *style;
+ GdkWindow *window;
GtkTargetEntry ethi_drag_types [] = {
{ (gchar *) TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
};
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
+ window = gtk_widget_get_window (widget);
+ state = gtk_widget_get_state (widget);
+ style = gtk_widget_get_style (widget);
+
ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
if (ethi->drag_col == -1)
@@ -1212,23 +1268,21 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
col_width = ecol->width;
- pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
+ pixmap = gdk_pixmap_new (window, col_width, ethi->height, -1);
state = gtk_widget_get_state (widget);
e_table_header_draw_button (
pixmap, ecol,
- widget->style,
- state,
- widget,
- 0, 0,
+ style, state,
+ widget, 0, 0,
col_width, ethi->height,
col_width, ethi->height,
(ETableColArrow) g_hash_table_lookup (
arrows, GINT_TO_POINTER (ecol->col_idx)));
gtk_drag_set_icon_pixmap (
context,
- gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)),
+ gdk_drawable_get_colormap (GDK_DRAWABLE (window)),
pixmap,
NULL,
col_width / 2,
@@ -1754,6 +1808,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
GnomeCanvas *canvas = item->canvas;
+ GdkWindow *window;
const gboolean resizing = ETHI_RESIZING (ethi);
gint x, y, start, col;
gint was_maybe_drag = 0;
@@ -1765,7 +1820,8 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
break;
case GDK_LEAVE_NOTIFY:
- gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL);
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_set_cursor (window, NULL);
break;
case GDK_MOTION_NOTIFY:
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index f2a3c1a826..ecb906d093 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -349,12 +349,12 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_ensure_style (window);
gtk_widget_ensure_style (button);
- g_label = GTK_BIN(button)->child;
+ g_label = gtk_bin_get_child (GTK_BIN (button));
g_object_add_weak_pointer (G_OBJECT (g_label), &g_label);
gtk_widget_ensure_style (g_label);
}
- gc = GTK_WIDGET (g_label)->style->fg_gc[state];
+ gc = gtk_widget_get_style (GTK_WIDGET (g_label))->fg_gc[state];
gdk_gc_set_clip_rectangle (gc, NULL);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 3c0fa33bb0..b2c27590c7 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -245,22 +245,22 @@ inline static GdkColor *
eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean selected, gboolean *allocatedp)
{
ECellView *ecell_view = eti->cell_views [col];
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
+ GtkWidget *canvas;
GdkColor *background, bg;
+ GtkStyle *style;
gchar *color_spec = NULL;
gboolean allocated = FALSE;
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ style = gtk_widget_get_style (canvas);
+
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS(canvas))
-#endif
- background = &canvas->style->bg [GTK_STATE_SELECTED];
+ background = &style->bg [GTK_STATE_SELECTED];
else
- background = &canvas->style->bg [GTK_STATE_ACTIVE];
+ background = &style->bg [GTK_STATE_ACTIVE];
} else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
+ background = &style->base [GTK_STATE_NORMAL];
}
color_spec = e_cell_get_bg_color (ecell_view, row);
@@ -268,7 +268,7 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
if (color_spec != NULL) {
if (gdk_color_parse (color_spec, &bg)) {
background = gdk_color_copy (&bg);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background,
+ gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
FALSE, TRUE);
allocated = TRUE;
}
@@ -283,7 +283,7 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
allocated = TRUE;
}
e_hsv_tweak (background, 0.0f, 0.0f, -0.07f);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background,
+ gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
FALSE, TRUE);
}
}
@@ -296,23 +296,23 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
inline static GdkColor *
eti_get_cell_foreground_color (ETableItem *eti, gint row, gint col, gboolean selected, gboolean *allocated)
{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
+ GtkWidget *canvas;
GdkColor *foreground;
+ GtkStyle *style;
+
+ canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
+ style = gtk_widget_get_style (canvas);
if (allocated)
*allocated = FALSE;
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (canvas))
-#else
- if (GTK_WIDGET_HAS_FOCUS (canvas))
-#endif
- foreground = &canvas->style->fg [GTK_STATE_SELECTED];
+ foreground = &style->fg [GTK_STATE_SELECTED];
else
- foreground = &canvas->style->fg [GTK_STATE_ACTIVE];
+ foreground = &style->fg [GTK_STATE_ACTIVE];
} else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
+ foreground = &style->text [GTK_STATE_NORMAL];
}
return foreground;
@@ -1631,8 +1631,9 @@ static void
eti_realize (GnomeCanvasItem *item)
{
ETableItem *eti = E_TABLE_ITEM (item);
- GtkWidget *canvas_widget = GTK_WIDGET (item->canvas);
GdkWindow *window;
+ GtkWidget *widget;
+ GtkStyle *style;
if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)
(*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item);
@@ -1642,15 +1643,17 @@ eti_realize (GnomeCanvasItem *item)
/*
* Gdk Resource allocation
*/
- window = canvas_widget->window;
+ widget = GTK_WIDGET (item->canvas);
+ style = gtk_widget_get_style (widget);
+ window = gtk_widget_get_window (widget);
eti->fill_gc = gdk_gc_new (window);
eti->grid_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->dark [GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground (eti->grid_gc, &style->dark [GTK_STATE_NORMAL]);
eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground (eti->focus_gc, &style->bg [GTK_STATE_NORMAL]);
+ gdk_gc_set_background (eti->focus_gc, &style->fg [GTK_STATE_NORMAL]);
eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
@@ -1933,11 +1936,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
gdk_color_free (background);
flags = col_selected ? E_CELL_SELECTED : 0;
-#if GTK_CHECK_VERSION(2,19,7)
flags |= gtk_widget_has_focus (canvas) ? E_CELL_FOCUSED : 0;
-#else
- flags |= GTK_WIDGET_HAS_FOCUS(canvas) ? E_CELL_FOCUSED : 0;
-#endif
flags |= cursor ? E_CELL_CURSOR : 0;
switch (ecol->justification) {
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index 89affd357d..f3bce34487 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -36,6 +36,7 @@ ETableHeader *
e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableState *state)
{
ETableHeader *nh;
+ GtkStyle *style;
const gint max_cols = e_table_header_count (full_header);
gint column;
GValue *val = g_new0 (GValue, 1);
@@ -44,9 +45,11 @@ e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableSta
g_return_val_if_fail (full_header, NULL);
g_return_val_if_fail (state, NULL);
+ style = gtk_widget_get_style (widget);
+
nh = e_table_header_new ();
g_value_init (val, G_TYPE_DOUBLE);
- g_value_set_double (val, e_table_header_width_extras (widget->style));
+ g_value_set_double (val, e_table_header_width_extras (style));
g_object_set_property (G_OBJECT(nh), "width_extras", val);
g_free (val);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 5c35eb26e6..ce2253bc66 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -509,11 +509,9 @@ et_finalize (GObject *object)
static void
e_table_init (ETable *e_table)
{
- GtkTable *gtk_table = GTK_TABLE (e_table);
-
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_table), GTK_CAN_FOCUS);
- gtk_table->homogeneous = FALSE;
+ gtk_table_set_homogeneous (GTK_TABLE (e_table), FALSE);
e_table->sort_info = NULL;
e_table->group_info_change_id = 0;
@@ -582,7 +580,7 @@ et_focus (GtkWidget *container, GtkDirectionType direction)
e_table = E_TABLE (container);
- if (GTK_CONTAINER (container)->focus_child) {
+ if (gtk_container_get_focus_child (GTK_CONTAINER (container))) {
gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
return FALSE;
}
@@ -615,14 +613,18 @@ set_header_canvas_width (ETable *e_table)
static void
header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
{
+ GtkAllocation allocation;
+
set_header_canvas_width (e_table);
+ gtk_widget_get_allocation (
+ GTK_WIDGET (e_table->header_canvas), &allocation);
+
/* When the header item is created ->height == 0,
as the font is only created when everything is realized.
So we set the usize here as well, so that the size of the
header is correct */
- if (GTK_WIDGET (e_table->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_table->header_item)->height)
+ if (allocation.height != E_TABLE_HEADER_ITEM (e_table->header_item)->height)
g_object_set (
e_table->header_canvas, "height-request",
E_TABLE_HEADER_ITEM (e_table->header_item)->height,
@@ -688,14 +690,16 @@ table_canvas_reflow_idle (ETable *e_table)
{
gdouble height, width;
gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation);
+ GtkAllocation allocation;
- g_object_get (e_table->canvas_vbox,
- "height", &height,
- "width", &width,
- NULL);
- height = MAX ((gint)height, alloc->height);
- width = MAX((gint)width, alloc->width);
+ gtk_widget_get_allocation (
+ GTK_WIDGET (e_table->table_canvas), &allocation);
+
+ g_object_get (
+ e_table->canvas_vbox,
+ "height", &height, "width", &width, NULL);
+ height = MAX ((gint)height, allocation.height);
+ width = MAX((gint)width, allocation.width);
/* I have no idea why this needs to be -1, but it works. */
gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
NULL, NULL, &oldwidth, &oldheight);
@@ -805,14 +809,24 @@ group_key_press (ETableGroup *etg, gint row, gint col, GdkEvent *event, ETable *
gboolean return_val = FALSE;
GdkEventKey *key = (GdkEventKey *) event;
gint y, row_local, col_local;
- GtkAdjustment *vadj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
+
+ layout = GTK_LAYOUT (et->table_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
switch (key->keyval) {
case GDK_Page_Down:
case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_value (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ y = CLAMP (value + (2 * page_size - 50), 0, upper);
+ y -= value;
e_table_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -825,9 +839,12 @@ group_key_press (ETableGroup *etg, gint row, gint col, GdkEvent *event, ETable *
break;
case GDK_Page_Up:
case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ y = CLAMP (value - (page_size - 50), 0, upper);
+ y -= value;
e_table_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -1029,9 +1046,15 @@ changed_idle (gpointer data)
static void
et_canvas_realize (GtkWidget *canvas, ETable *e_table)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
+ widget = GTK_WIDGET (e_table->table_canvas);
+ style = gtk_widget_get_style (widget);
+
gnome_canvas_item_set(
e_table->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
CHECK_HORIZONTAL(e_table);
@@ -1052,11 +1075,7 @@ et_eti_leave_edit (ETable *et)
{
GnomeCanvas *canvas = et->table_canvas;
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (canvas))) {
-#else
- if (GTK_WIDGET_HAS_FOCUS(canvas)) {
-#endif
GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item;
if (E_IS_TABLE_ITEM(item)) {
@@ -1208,6 +1227,9 @@ static void
e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header,
ETableModel *model)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
e_table->table_canvas = GNOME_CANVAS (e_canvas_new ());
g_signal_connect (
G_OBJECT (e_table->table_canvas), "size_allocate",
@@ -1247,12 +1269,15 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
g_signal_connect (G_OBJECT(e_table->table_canvas), "reflow",
G_CALLBACK (table_canvas_reflow), e_table);
- gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
+ widget = GTK_WIDGET (e_table->table_canvas);
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_show (widget);
e_table->white_item = gnome_canvas_item_new(
gnome_canvas_root(e_table->table_canvas),
e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
g_signal_connect (G_OBJECT (e_table->white_item), "event",
@@ -1321,12 +1346,19 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
void
e_table_set_state_object(ETable *e_table, ETableState *state)
{
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkWidget *widget;
+ GtkAllocation allocation;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_DOUBLE);
connect_header (e_table, state);
- g_value_set_double (val, (gdouble) (GTK_WIDGET(e_table->table_canvas)->allocation.width));
+ widget = GTK_WIDGET (e_table->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_value_set_double (val, (gdouble) allocation.width);
g_object_set_property (G_OBJECT (e_table->header), "width", val);
g_free (val);
@@ -1528,7 +1560,11 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
{
gint row = 0;
gint col_count, i;
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_OBJECT);
if (ete)
@@ -1607,15 +1643,16 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
e_table_setup_table (e_table, e_table->full_header, e_table->header, etm);
e_table_fill_table (e_table, etm);
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas)));
+ layout = GTK_LAYOUT (e_table->table_canvas);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
if (!specification->no_headers) {
- /*
- * The header
- */
+ /* The header */
gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
@@ -2237,25 +2274,22 @@ set_scroll_adjustments (ETable *table,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
+ if (vadjustment != NULL)
+ gtk_adjustment_set_step_increment (vadjustment, 20);
+
+ if (hadjustment != NULL)
+ gtk_adjustment_set_step_increment (hadjustment, 20);
if (table->table_canvas != NULL) {
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(table->table_canvas),
- vadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(table->table_canvas), hadjustment);
+ gtk_layout_set_vadjustment (
+ GTK_LAYOUT(table->table_canvas), vadjustment);
}
if (table->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->header_canvas),
- hadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(table->header_canvas), hadjustment);
}
/**
@@ -2384,7 +2418,9 @@ e_table_get_cell_at (ETable *table,
gint x, gint y,
gint *row_return, gint *col_return)
{
- g_return_if_fail (table != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TABLE (table));
g_return_if_fail (row_return != NULL);
g_return_if_fail (col_return != NULL);
@@ -2392,9 +2428,16 @@ e_table_get_cell_at (ETable *table,
/* FIXME it would be nice if it could handle a NULL row_return or
* col_return gracefully. */
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- e_table_group_compute_location(table->group, &x, &y, row_return, col_return);
+ layout = GTK_LAYOUT (table->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
+
+ e_table_group_compute_location (
+ table->group, &x, &y, row_return, col_return);
}
/**
@@ -2416,18 +2459,35 @@ e_table_get_cell_geometry (ETable *table,
gint *x_return, gint *y_return,
gint *width_return, gint *height_return)
{
- g_return_if_fail (table != NULL);
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TABLE (table));
- e_table_group_get_cell_geometry(table->group, &row, &col, x_return, y_return, width_return, height_return);
+ layout = GTK_LAYOUT (table->table_canvas);
+
+ e_table_group_get_cell_geometry (
+ table->group, &row, &col, x_return, y_return,
+ width_return, height_return);
+
+ if (x_return && table->table_canvas) {
+ adjustment = gtk_layout_get_hadjustment (layout);
+ (*x_return) -= gtk_adjustment_get_value (adjustment);
+ }
- if (x_return && table->table_canvas)
- (*x_return) -= GTK_LAYOUT(table->table_canvas)->hadjustment->value;
if (y_return) {
- if (table->table_canvas)
- (*y_return) -= GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- if (table->header_canvas)
- (*y_return) += GTK_WIDGET(table->header_canvas)->allocation.height;
+ if (table->table_canvas) {
+ adjustment = gtk_layout_get_vadjustment (layout);
+ (*y_return) -= gtk_adjustment_get_value (adjustment);
+ }
+
+ if (table->header_canvas) {
+ gtk_widget_get_allocation (
+ GTK_WIDGET (table->header_canvas),
+ &allocation);
+ (*y_return) += allocation.height;
+ }
}
}
@@ -2578,30 +2638,39 @@ e_table_drag_highlight (ETable *table,
gint row,
gint col)
{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+ GtkStyle *style;
+
+ g_return_if_fail (E_IS_TABLE (table));
+
+ layout = GTK_LAYOUT (table->table_canvas);
+ style = gtk_widget_get_style (GTK_WIDGET (table));
+ gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
if (row != -1) {
gint x, y, width, height;
if (col == -1) {
e_table_get_cell_geometry (table, row, 0, &x, &y, &width, &height);
x = 0;
- width = GTK_WIDGET (table->table_canvas)->allocation.width;
+ width = allocation.width;
} else {
e_table_get_cell_geometry (table, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
}
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
if (table->drop_highlight == NULL) {
- table->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (table->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (table)->style->fg[GTK_STATE_NORMAL]),
- NULL);
+ table->drop_highlight = gnome_canvas_item_new (
+ gnome_canvas_root (table->table_canvas),
+ gnome_canvas_rect_get_type (),
+ "fill_color", NULL,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ NULL);
}
gnome_canvas_item_set (table->drop_highlight,
"x1", (gdouble) x,
@@ -2901,8 +2970,15 @@ scroll_timeout (gpointer data)
{
ETable *et = data;
gint dx = 0, dy = 0;
- GtkAdjustment *h, *v;
- gdouble hvalue, vvalue;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble old_h_value;
+ gdouble new_h_value;
+ gdouble old_v_value;
+ gdouble new_v_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
if (et->scroll_direction & ET_SCROLL_DOWN)
dy += 20;
@@ -2914,22 +2990,37 @@ scroll_timeout (gpointer data)
if (et->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(et->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->table_canvas)->vadjustment;
+ layout = GTK_LAYOUT (et->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
- hvalue = h->value;
- vvalue = v->value;
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
+ old_h_value = gtk_adjustment_get_value (adjustment);
+ new_h_value = CLAMP (old_h_value + dx, lower, upper - page_size);
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->last_drop_context,
- et->last_drop_x,
- et->last_drop_y,
- et->last_drop_time);
+ gtk_adjustment_set_value (adjustment, new_h_value);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+
+ old_v_value = gtk_adjustment_get_value (adjustment);
+ new_v_value = CLAMP (old_v_value + dy, lower, upper - page_size);
+
+ gtk_adjustment_set_value (adjustment, new_v_value);
+
+ if (new_h_value != old_h_value || new_v_value != old_v_value)
+ do_drag_motion (
+ et,
+ et->last_drop_context,
+ et->last_drop_x,
+ et->last_drop_y,
+ et->last_drop_time);
return TRUE;
}
@@ -3001,28 +3092,27 @@ et_drag_motion(GtkWidget *widget,
guint time,
ETable *et)
{
+ GtkAllocation allocation;
gboolean ret_val;
guint direction = 0;
+ gtk_widget_get_allocation (widget, &allocation);
+
et->last_drop_x = x;
et->last_drop_y = y;
et->last_drop_time = time;
et->last_drop_context = context;
context_connect (et, context);
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
+ ret_val = do_drag_motion (et, context, x, y, time);
if (y < 20)
direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
+ if (y > allocation.height - 20)
direction |= ET_SCROLL_DOWN;
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
if (direction != 0)
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index c093255518..3f7ab111fa 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -538,11 +538,9 @@ et_search_accept (ETableSearch *search, ETree *et)
static void
e_tree_init (ETree *e_tree)
{
- GtkTable *gtk_table = GTK_TABLE (e_tree);
-
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_tree), GTK_CAN_FOCUS);
- gtk_table->homogeneous = FALSE;
+ gtk_table_set_homogeneous (GTK_TABLE (e_tree), FALSE);
e_tree->priv = g_new(ETreePriv, 1);
@@ -656,7 +654,7 @@ et_focus (GtkWidget *container, GtkDirectionType direction)
e_tree = E_TREE (container);
- if (GTK_CONTAINER (container)->focus_child) {
+ if (gtk_container_get_focus_child (GTK_CONTAINER (container))) {
gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
return FALSE;
}
@@ -689,16 +687,21 @@ set_header_canvas_width (ETree *e_tree)
static void
header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *e_tree)
{
+ GtkAllocation allocation;
+
set_header_canvas_width (e_tree);
+ widget = GTK_WIDGET (e_tree->priv->header_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
/* When the header item is created ->height == 0,
as the font is only created when everything is realized.
So we set the usize here as well, so that the size of the
header is correct */
- if (GTK_WIDGET (e_tree->priv->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
- gtk_widget_set_size_request (GTK_WIDGET (e_tree->priv->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
+ if (allocation.height != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
+ gtk_widget_set_size_request (
+ widget, -1,
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
}
static void
@@ -737,23 +740,39 @@ static void
scroll_to_cursor (ETree *e_tree)
{
ETreePath path;
- GtkAdjustment *adj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
gint x, y, w, h;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
path = e_tree_get_cursor (e_tree);
- adj = GTK_LAYOUT (e_tree->priv->table_canvas)->vadjustment;
x = y = w = h = 0;
+
if (path) {
gint row = e_tree_row_of_node(e_tree, path);
gint col = 0;
if (row >= 0)
- e_table_item_get_cell_geometry (E_TABLE_ITEM (e_tree->priv->item),
- &row, &col, &x, &y, &w, &h);
+ e_table_item_get_cell_geometry (
+ E_TABLE_ITEM (e_tree->priv->item),
+ &row, &col, &x, &y, &w, &h);
}
- if (y < adj->value || y + h > adj->value + adj->page_size)
- gtk_adjustment_set_value(adj, CLAMP(y - adj->page_size / 2, adj->lower, adj->upper - adj->page_size));
+ layout = GTK_LAYOUT (e_tree->priv->table_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);
+
+ if (y < value || y + h > value + page_size) {
+ value = CLAMP (y - page_size / 2, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, value);
+ }
}
static gboolean
@@ -761,24 +780,32 @@ tree_canvas_reflow_idle (ETree *e_tree)
{
gdouble height, width;
gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_tree->priv->table_canvas)->allocation);
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_object_get (
+ e_tree->priv->item,
+ "height", &height, "width", &width, NULL);
+
+ height = MAX ((gint)height, allocation.height);
+ width = MAX((gint)width, allocation.width);
- g_object_get (e_tree->priv->item,
- "height", &height,
- "width", &width,
- NULL);
- height = MAX ((gint)height, alloc->height);
- width = MAX((gint)width, alloc->width);
/* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- NULL, NULL, &oldwidth, &oldheight);
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (e_tree->priv->table_canvas),
+ NULL, NULL, &oldwidth, &oldheight);
if (oldwidth != width - 1 ||
oldheight != height - 1) {
- gnome_canvas_set_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- 0, 0, width - 1, height - 1);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_tree->priv->table_canvas),
+ 0, 0, width - 1, height - 1);
set_header_canvas_width (e_tree);
}
+
e_tree->priv->reflow_idle_id = 0;
if (e_tree->priv->show_cursor_after_reflow) {
@@ -881,14 +908,24 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et)
GdkEventKey *key = (GdkEventKey *) event;
ETreePath path;
gint y, row_local, col_local;
- GtkAdjustment *vadj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble page_size;
+ gdouble upper;
+ gdouble value;
+
+ layout = GTK_LAYOUT (et->priv->table_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
switch (key->keyval) {
case GDK_Page_Down:
case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ y = CLAMP (value + (2 * page_size - 50), 0, upper);
+ y -= value;
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -902,9 +939,8 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et)
break;
case GDK_Page_Up:
case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
+ y = CLAMP (value - (page_size - 50), 0, upper);
+ y -= value;
e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
if (row_local == -1)
@@ -1029,9 +1065,13 @@ et_build_item (ETree *et)
static void
et_canvas_style_set (GtkWidget *widget, GtkStyle *prev_style)
{
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
gnome_canvas_item_set(
E_TREE(widget)->priv->white_item,
- "fill_color_gdk", &widget->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
}
@@ -1053,11 +1093,7 @@ et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETree *e_tree)
case GDK_2BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.button != 4 && event->button.button != 5) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (root->canvas))) {
-#else
- if (GTK_WIDGET_HAS_FOCUS(root->canvas)) {
-#endif
GnomeCanvasItem *item = GNOME_CANVAS(root->canvas)->focused_item;
if (E_IS_TABLE_ITEM(item)) {
@@ -1102,6 +1138,9 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d
static void
e_tree_setup_table (ETree *e_tree)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
e_tree->priv->table_canvas = GNOME_CANVAS (e_canvas_new ());
g_signal_connect (
e_tree->priv->table_canvas, "size_allocate",
@@ -1141,16 +1180,20 @@ e_tree_setup_table (ETree *e_tree)
g_signal_connect (e_tree->priv->table_canvas, "reflow",
G_CALLBACK (tree_canvas_reflow), e_tree);
- gtk_widget_show (GTK_WIDGET (e_tree->priv->table_canvas));
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ style = gtk_widget_get_style (widget);
+
+ gtk_widget_show (widget);
- e_tree->priv->white_item = gnome_canvas_item_new(
- gnome_canvas_root(e_tree->priv->table_canvas),
+ e_tree->priv->white_item = gnome_canvas_item_new (
+ gnome_canvas_root (e_tree->priv->table_canvas),
e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
NULL);
- g_signal_connect (e_tree->priv->white_item, "event",
- G_CALLBACK (white_item_event), e_tree);
+ g_signal_connect (
+ e_tree->priv->white_item, "event",
+ G_CALLBACK (white_item_event), e_tree);
g_signal_connect (
gnome_canvas_root (e_tree->priv->table_canvas), "event",
G_CALLBACK(et_canvas_root_event), e_tree);
@@ -1182,12 +1225,19 @@ e_tree_set_search_column (ETree *e_tree, gint col)
void
e_tree_set_state_object(ETree *e_tree, ETableState *state)
{
- GValue *val = g_new0 (GValue, 1);
+ GValue *val;
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
+ val = g_new0 (GValue, 1);
g_value_init (val, G_TYPE_DOUBLE);
connect_header (e_tree, state);
- g_value_set_double (val, (gdouble) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width));
+ widget = GTK_WIDGET (e_tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ g_value_set_double (val, (gdouble) allocation.width);
g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val);
g_free (val);
@@ -1424,6 +1474,8 @@ static gboolean
et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
ETableSpecification *specification, ETableState *state)
{
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
gint row = 0;
if (ete)
@@ -1475,10 +1527,13 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
}
e_tree_setup_table (e_tree);
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
+ layout = GTK_LAYOUT (e_tree->priv->table_canvas);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ gtk_adjustment_set_step_increment (adjustment, 20);
if (!specification->no_headers) {
/*
@@ -1930,24 +1985,24 @@ set_scroll_adjustments (ETree *tree,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
+ GtkLayout *layout;
+
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ if (vadjustment != NULL)
+ gtk_adjustment_set_step_increment (vadjustment, 20);
+
+ if (hadjustment != NULL)
+ gtk_adjustment_set_step_increment (hadjustment, 20);
if (tree->priv) {
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- vadjustment);
+ gtk_layout_set_hadjustment (layout, hadjustment);
+ gtk_layout_set_vadjustment (layout, vadjustment);
if (tree->priv->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->header_canvas),
- hadjustment);
+ gtk_layout_set_hadjustment (
+ GTK_LAYOUT(tree->priv->header_canvas),
+ hadjustment);
}
}
@@ -2383,37 +2438,48 @@ e_tree_drag_highlight (ETree *tree,
gint row,
gint col)
{
- g_return_if_fail(tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkAllocation allocation;
+ GtkLayout *layout;
+ GtkStyle *style;
+
g_return_if_fail(E_IS_TREE(tree));
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+ style = gtk_widget_get_style (GTK_WIDGET (tree));
+ gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
+
if (row != -1) {
gint x, y, width, height;
if (col == -1) {
e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
x = 0;
- width = GTK_WIDGET (tree->priv->table_canvas)->allocation.width;
+ width = allocation.width;
} else {
e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
}
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
if (tree->priv->drop_highlight == NULL) {
- tree->priv->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (tree->priv->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (tree)->style->fg[GTK_STATE_NORMAL]),
- NULL);
+ tree->priv->drop_highlight = gnome_canvas_item_new (
+ gnome_canvas_root (tree->priv->table_canvas),
+ gnome_canvas_rect_get_type (),
+ "fill_color", NULL,
+ "outline_color_gdk", &style->fg[GTK_STATE_NORMAL],
+ NULL);
}
- gnome_canvas_item_set (tree->priv->drop_highlight,
- "x1", (gdouble) x,
- "x2", (gdouble) x + width - 1,
- "y1", (gdouble) y,
- "y2", (gdouble) y + height - 1,
- NULL);
+
+ gnome_canvas_item_set (
+ tree->priv->drop_highlight,
+ "x1", (gdouble) x,
+ "x2", (gdouble) x + width - 1,
+ "y1", (gdouble) y,
+ "y2", (gdouble) y + height - 1,
+ NULL);
} else {
gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
tree->priv->drop_highlight = NULL;
@@ -2617,7 +2683,9 @@ e_tree_get_cell_at (ETree *tree,
gint x, gint y,
gint *row_return, gint *col_return)
{
- g_return_if_fail (tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TREE (tree));
g_return_if_fail (row_return != NULL);
g_return_if_fail (col_return != NULL);
@@ -2630,9 +2698,17 @@ e_tree_get_cell_at (ETree *tree,
if (col_return)
*col_return = -1;
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- e_table_item_compute_location(E_TABLE_ITEM(tree->priv->item), &x, &y, row_return, col_return);
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ x += gtk_adjustment_get_value (adjustment);
+
+ adjustment = gtk_layout_get_vadjustment (layout);
+ y += gtk_adjustment_get_value (adjustment);
+
+ e_table_item_compute_location (
+ E_TABLE_ITEM (tree->priv->item),
+ &x, &y, row_return, col_return);
}
/**
@@ -2653,7 +2729,9 @@ e_tree_get_cell_geometry (ETree *tree,
gint *x_return, gint *y_return,
gint *width_return, gint *height_return)
{
- g_return_if_fail (tree != NULL);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+
g_return_if_fail (E_IS_TREE (tree));
g_return_if_fail (row >= 0);
g_return_if_fail (col >= 0);
@@ -2661,12 +2739,22 @@ e_tree_get_cell_geometry (ETree *tree,
/* FIXME it would be nice if it could handle a NULL row_return or
* col_return gracefully. */
- e_table_item_get_cell_geometry(E_TABLE_ITEM(tree->priv->item), &row, &col, x_return, y_return, width_return, height_return);
+ e_table_item_get_cell_geometry (
+ E_TABLE_ITEM (tree->priv->item),
+ &row, &col, x_return, y_return,
+ width_return, height_return);
+
+ layout = GTK_LAYOUT (tree->priv->table_canvas);
+
+ if (x_return) {
+ adjustment = gtk_layout_get_hadjustment (layout);
+ (*x_return) -= gtk_adjustment_get_value (adjustment);
+ }
- if (x_return)
- (*x_return) -= GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- if (y_return)
- (*y_return) -= GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
+ if (y_return) {
+ adjustment = gtk_layout_get_vadjustment (layout);
+ (*y_return) -= gtk_adjustment_get_value (adjustment);
+ }
}
static void
@@ -2777,8 +2865,15 @@ scroll_timeout (gpointer data)
{
ETree *et = data;
gint dx = 0, dy = 0;
- GtkAdjustment *v, *h;
- gdouble vvalue, hvalue;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble old_h_value;
+ gdouble new_h_value;
+ gdouble old_v_value;
+ gdouble new_v_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
if (et->priv->scroll_direction & ET_SCROLL_DOWN)
dy += 20;
@@ -2790,22 +2885,37 @@ scroll_timeout (gpointer data)
if (et->priv->scroll_direction & ET_SCROLL_LEFT)
dx -= 20;
- h = GTK_LAYOUT(et->priv->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->priv->table_canvas)->vadjustment;
+ layout = GTK_LAYOUT (et->priv->table_canvas);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
- hvalue = h->value;
- vvalue = v->value;
+ old_h_value = gtk_adjustment_get_value (adjustment);
+ new_h_value = CLAMP (old_h_value + dx, lower, upper - page_size);
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
+ gtk_adjustment_set_value (adjustment, new_h_value);
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->priv->last_drop_context,
- et->priv->last_drop_x,
- et->priv->last_drop_y,
- et->priv->last_drop_time);
+ 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);
+
+ old_v_value = gtk_adjustment_get_value (adjustment);
+ new_v_value = CLAMP (old_v_value + dy, lower, upper - page_size);
+
+ gtk_adjustment_set_value (adjustment, new_v_value);
+
+ if (new_h_value != old_h_value || new_v_value != old_v_value)
+ do_drag_motion (
+ et,
+ et->priv->last_drop_context,
+ et->priv->last_drop_x,
+ et->priv->last_drop_y,
+ et->priv->last_drop_time);
return TRUE;
}
@@ -2969,6 +3079,7 @@ et_drag_motion(GtkWidget *widget,
guint time,
ETree *et)
{
+ GtkAllocation allocation;
gint ret_val;
guint direction = 0;
@@ -2987,19 +3098,17 @@ et_drag_motion(GtkWidget *widget,
hover_on (et, x, y);
}
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
+ ret_val = do_drag_motion (et, context, x, y, time);
+
+ gtk_widget_get_allocation (widget, &allocation);
if (y < 20)
direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
+ if (y > allocation.height - 20)
direction |= ET_SCROLL_DOWN;
if (x < 20)
direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
+ if (x > allocation.width - 20)
direction |= ET_SCROLL_RIGHT;
if (direction != 0)
@@ -3453,6 +3562,9 @@ tree_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *tree)
void
e_tree_set_info_message (ETree *tree, const gchar *info_message)
{
+ GtkAllocation allocation;
+ GtkWidget *widget;
+
g_return_if_fail (tree != NULL);
g_return_if_fail (tree->priv != NULL);
@@ -3466,18 +3578,22 @@ e_tree_set_info_message (ETree *tree, const gchar *info_message)
return;
}
+ widget = GTK_WIDGET (tree->priv->table_canvas);
+ gtk_widget_get_allocation (widget, &allocation);
+
if (!tree->priv->info_text) {
- tree->priv->info_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (gnome_canvas_root (tree->priv->table_canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "line_wrap", TRUE,
- "clip", TRUE,
- "justification", GTK_JUSTIFY_LEFT,
- "text", info_message,
- "draw_background", FALSE,
- "width", (gdouble) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
- "clip_width", (gdouble) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
- NULL);
+ tree->priv->info_text = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (gnome_canvas_root (tree->priv->table_canvas)),
+ e_text_get_type (),
+ "anchor", GTK_ANCHOR_NW,
+ "line_wrap", TRUE,
+ "clip", TRUE,
+ "justification", GTK_JUSTIFY_LEFT,
+ "text", info_message,
+ "draw_background", FALSE,
+ "width", (gdouble) allocation.width - 60.0,
+ "clip_width", (gdouble) allocation.width - 60.0,
+ NULL);
e_canvas_item_move_absolute (tree->priv->info_text, 30, 30);
diff --git a/widgets/table/gal-a11y-e-cell-popup.c b/widgets/table/gal-a11y-e-cell-popup.c
index 33dcf733a5..921ae8e4d5 100644
--- a/widgets/table/gal-a11y-e-cell-popup.c
+++ b/widgets/table/gal-a11y-e-cell-popup.c
@@ -133,9 +133,12 @@ popup_cell_action (GalA11yECell *cell)
{
gint finished;
GdkEvent event;
+ GtkLayout *layout;
+
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (cell->item)->canvas);
event.key.type = GDK_KEY_PRESS;
- event.key.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;;
+ event.key.window = gtk_layout_get_bin_window (layout);
event.key.send_event = TRUE;
event.key.time = GDK_CURRENT_TIME;
event.key.state = GDK_MOD1_MASK;
diff --git a/widgets/table/gal-a11y-e-cell-toggle.c b/widgets/table/gal-a11y-e-cell-toggle.c
index 25d59496a7..54b1b3586c 100644
--- a/widgets/table/gal-a11y-e-cell-toggle.c
+++ b/widgets/table/gal-a11y-e-cell-toggle.c
@@ -90,6 +90,7 @@ static void
toggle_cell_action (GalA11yECell *cell)
{
gint finished;
+ GtkLayout *layout;
GdkEventButton event;
gint x, y, width, height;
gint row, col;
@@ -97,14 +98,16 @@ toggle_cell_action (GalA11yECell *cell)
row = cell->row;
col = cell->view_col;
- e_table_item_get_cell_geometry (cell->item, &row, &col,
- &x, &y, &width, &height);
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (cell->item)->canvas);
+
+ e_table_item_get_cell_geometry (
+ cell->item, &row, &col, &x, &y, &width, &height);
event.x = x + width / 2 + (gint)(GNOME_CANVAS_ITEM (cell->item)->x1);
event.y = y + height / 2 + (gint)(GNOME_CANVAS_ITEM (cell->item)->y1);
event.type = GDK_BUTTON_PRESS;
- event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;
+ event.window = gtk_layout_get_bin_window (layout);
event.button = 1;
event.send_event = TRUE;
event.time = GDK_CURRENT_TIME;
diff --git a/widgets/table/gal-a11y-e-table-click-to-add.c b/widgets/table/gal-a11y-e-table-click-to-add.c
index 8d788a458b..ebec8681ae 100644
--- a/widgets/table/gal-a11y-e-table-click-to-add.c
+++ b/widgets/table/gal-a11y-e-table-click-to-add.c
@@ -72,26 +72,30 @@ etcta_action_get_name (AtkAction *action, gint i)
static gboolean
idle_do_action (gpointer data)
{
- GdkEventButton event;
+ GtkLayout *layout;
+ GdkEventButton event;
ETableClickToAdd * etcta;
- gint finished;
+ gint finished;
g_return_val_if_fail ( data!= NULL, FALSE);
- etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (data)));
+ etcta = E_TABLE_CLICK_TO_ADD (
+ atk_gobject_accessible_get_object (
+ ATK_GOBJECT_ACCESSIBLE (data)));
g_return_val_if_fail (etcta, FALSE);
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (etcta)->canvas);
+
event.x = 0;
event.y = 0;
-
- event.type = GDK_BUTTON_PRESS;
- event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(etcta)->canvas)->bin_window;
- event.button = 1;
- event.send_event = TRUE;
- event.time = GDK_CURRENT_TIME;
- event.axes = NULL;
-
- g_signal_emit_by_name (etcta, "event", &event, &finished);
+ event.type = GDK_BUTTON_PRESS;
+ event.window = gtk_layout_get_bin_window (layout);
+ event.button = 1;
+ event.send_event = TRUE;
+ event.time = GDK_CURRENT_TIME;
+ event.axes = NULL;
+
+ g_signal_emit_by_name (etcta, "event", &event, &finished);
return FALSE;
}
diff --git a/widgets/table/gal-a11y-e-table.c b/widgets/table/gal-a11y-e-table.c
index 37e5b892d2..6134b2d297 100644
--- a/widgets/table/gal-a11y-e-table.c
+++ b/widgets/table/gal-a11y-e-table.c
@@ -90,11 +90,7 @@ init_child_item (GalA11yETable *a11y)
return FALSE;
table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
-#if GTK_CHECK_VERSION(2,19,7)
if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
-#else
- if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
-#endif
ETableGroupContainer *etgc = (ETableGroupContainer *)table->group;
GList *list;
@@ -288,11 +284,7 @@ gal_a11y_e_table_new (GObject *widget)
GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
/* we need to init all the children for multiple table items */
-#if GTK_CHECK_VERSION(2,19,7)
if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) {
-#else
- if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) {
-#endif
/* Ref it here so that it is still valid in the idle function */
/* It will be unrefed in the idle function */
g_object_ref (a11y);
diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c
index 0e11047408..4e3f36fd19 100644
--- a/widgets/text/e-reflow.c
+++ b/widgets/text/e-reflow.c
@@ -162,20 +162,25 @@ static gboolean
do_adjustment (gpointer user_data)
{
gint row;
- GtkAdjustment *adj;
- gfloat value, min_value, max_value;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble page_size;
+ gdouble value, min_value, max_value;
EReflow *reflow = user_data;
row = reflow->cursor_row;
if (row == -1)
return FALSE;
- adj = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
- value = adj->value;
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ value = gtk_adjustment_get_value (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
if ((!reflow->items) || (!reflow->items[row]))
return TRUE;
- min_value = reflow->items[row]->x2 - adj->page_size;
+ min_value = reflow->items[row]->x2 - page_size;
max_value = reflow->items[row]->x1;
if (value < min_value)
@@ -184,10 +189,8 @@ do_adjustment (gpointer user_data)
if (value > max_value)
value = max_value;
- if (value != adj->value) {
- adj->value = value;
- gtk_adjustment_value_changed (adj);
- }
+ if (value != gtk_adjustment_get_value (adjustment))
+ gtk_adjustment_set_value (adjustment, value);
reflow->do_adjustment_idle_id = 0;
@@ -238,14 +241,23 @@ incarnate (EReflow *reflow)
gint first_cell;
gint last_cell;
gint i;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble value;
+ gdouble page_size;
+
+ layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+
+ value = gtk_adjustment_get_value (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
column_width = reflow->column_width;
- first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH;
+ first_column = value - 1 + E_REFLOW_BORDER_WIDTH;
first_column /= column_width + E_REFLOW_FULL_GUTTER;
- last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
+ last_column = value + page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
last_column /= column_width + E_REFLOW_FULL_GUTTER;
last_column ++;
@@ -733,13 +745,23 @@ e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GPar
break;
case PROP_COLUMN_WIDTH:
if (reflow->column_width != g_value_get_double (value)) {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
gdouble old_width = reflow->column_width;
+ gdouble step_increment;
+ gdouble page_size;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ page_size = gtk_adjustment_get_page_size (adjustment);
reflow->column_width = g_value_get_double (value);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
+ step_increment = (reflow->column_width +
+ E_REFLOW_FULL_GUTTER) / 2;
+ gtk_adjustment_set_step_increment (
+ adjustment, step_increment);
+ gtk_adjustment_set_page_increment (
+ adjustment, page_size - step_increment);
e_reflow_resize_children(item);
e_canvas_item_request_reflow(item);
@@ -827,6 +849,9 @@ e_reflow_realize (GnomeCanvasItem *item)
{
EReflow *reflow;
GtkAdjustment *adjustment;
+ gdouble page_increment;
+ gdouble step_increment;
+ gdouble page_size;
gint count;
gint i;
@@ -851,19 +876,18 @@ e_reflow_realize (GnomeCanvasItem *item)
reflow->need_reflow_columns = TRUE;
e_canvas_item_request_reflow(item);
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (item->canvas));
#if 0
connect_set_adjustment (reflow);
#endif
connect_adjustment (reflow, adjustment);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
-
- if (!item->canvas->aa) {
- }
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
+ page_increment = page_size - step_increment;
+ gtk_adjustment_set_step_increment (adjustment, step_increment);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
}
static void
@@ -873,9 +897,6 @@ e_reflow_unrealize (GnomeCanvasItem *item)
reflow = E_REFLOW (item);
- if (!item->canvas->aa) {
- }
-
gdk_cursor_unref (reflow->arrow_cursor);
gdk_cursor_unref (reflow->default_cursor);
reflow->arrow_cursor = NULL;
@@ -979,20 +1000,34 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
break;
case 4:
{
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value -= adjustment->step_increment;
- gtk_adjustment_set_value(adjustment, new_value);
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ new_value = gtk_adjustment_get_value (adjustment);
+ new_value -= gtk_adjustment_get_step_increment (adjustment);
+ gtk_adjustment_set_value (adjustment, new_value);
}
break;
case 5:
{
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value += adjustment->step_increment;
- if (new_value > adjustment->upper - adjustment->page_size)
- new_value = adjustment->upper - adjustment->page_size;
- gtk_adjustment_set_value(adjustment, new_value);
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+ gdouble page_size;
+ gdouble upper;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ new_value = gtk_adjustment_get_value (adjustment);
+ new_value += gtk_adjustment_get_step_increment (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ if (new_value > upper - page_size)
+ new_value = upper - page_size;
+ gtk_adjustment_set_value (adjustment, new_value);
}
break;
}
@@ -1001,18 +1036,31 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
if (reflow->column_drag) {
gdouble old_width = reflow->column_width;
GdkEventButton *button = (GdkEventButton *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
reflow->temp_column_width = reflow->column_width +
- (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
+ (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, value));
if (reflow->temp_column_width < 50)
reflow->temp_column_width = 50;
reflow->column_drag = FALSE;
if (old_width != reflow->temp_column_width) {
- gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width));
+ gdouble page_increment;
+ gdouble step_increment;
+ gdouble page_size;
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ gtk_adjustment_set_value(adjustment, value + e_reflow_pick_line(reflow, value) * (reflow->temp_column_width - reflow->column_width));
reflow->column_width = reflow->temp_column_width;
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
+ step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
+ page_increment = page_size - step_increment;
+ gtk_adjustment_set_step_increment (adjustment, step_increment);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
e_reflow_resize_children(item);
e_canvas_item_request_reflow(item);
gnome_canvas_request_redraw(item->canvas, 0, 0, reflow->width, reflow->height);
@@ -1028,9 +1076,16 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
if (reflow->column_drag) {
gdouble old_width = reflow->temp_column_width;
GdkEventMotion *motion = (GdkEventMotion *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
reflow->temp_column_width = reflow->column_width +
- (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
+ (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, value));
if (reflow->temp_column_width < 50)
reflow->temp_column_width = 50;
if (old_width != reflow->temp_column_width) {
@@ -1040,20 +1095,23 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
return TRUE;
} else {
GdkEventMotion *motion = (GdkEventMotion *) event;
+ GdkWindow *window;
gdouble n_x;
n_x = motion->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER) {
if (reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
+ gdk_window_set_cursor(window, reflow->arrow_cursor);
reflow->default_cursor_shown = FALSE;
}
} else
if (!reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
+ gdk_window_set_cursor(window, reflow->default_cursor);
reflow->default_cursor_shown = TRUE;
}
@@ -1062,14 +1120,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_ENTER_NOTIFY:
if (!reflow->column_drag) {
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
+ GdkWindow *window;
gdouble n_x;
+
n_x = crossing->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER) {
if (reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
+ gdk_window_set_cursor(window, reflow->arrow_cursor);
reflow->default_cursor_shown = FALSE;
}
}
@@ -1078,13 +1140,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_LEAVE_NOTIFY:
if (!reflow->column_drag) {
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
+ GdkWindow *window;
gdouble n_x;
+
n_x = crossing->x;
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
+
+ window = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+
if (!( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER )) {
if (!reflow->default_cursor_shown) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
+ gdk_window_set_cursor(window, reflow->default_cursor);
reflow->default_cursor_shown = TRUE;
}
}
@@ -1104,6 +1171,7 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gint x, gint y, gint width, gint height)
{
+ GtkStyle *style;
gint x_rect, y_rect, width_rect, height_rect;
gdouble running_width;
EReflow *reflow = E_REFLOW(item);
@@ -1123,11 +1191,13 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
i /= column_width + E_REFLOW_FULL_GUTTER;
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
+ style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
+
for (; i < reflow->column_count; i++) {
if (running_width > x + width)
break;
x_rect = running_width;
- gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style,
+ gtk_paint_flat_box(style,
drawable,
GTK_STATE_ACTIVE,
GTK_SHADOW_NONE,
@@ -1141,8 +1211,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
}
if (reflow->column_drag) {
- gint start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble value;
+ gint start_line;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+
+ start_line = e_reflow_pick_line(reflow, value);
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
column_width = reflow->temp_column_width;
@@ -1162,7 +1240,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
break;
x_rect = running_width;
gdk_draw_rectangle(drawable,
- GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL],
+ style->fg_gc[GTK_STATE_NORMAL],
TRUE,
x_rect - x,
y_rect - y,
@@ -1212,12 +1290,19 @@ e_reflow_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gi
gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1);
reflow->need_height_update = FALSE;
} else if (reflow->need_column_resize) {
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
gint x_rect, y_rect, width_rect, height_rect;
- gint start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
+ gint start_line;
gdouble running_width;
gint i;
gdouble column_width;
+ gdouble value;
+
+ layout = GTK_LAYOUT (item->canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ value = gtk_adjustment_get_value (adjustment);
+ start_line = e_reflow_pick_line (reflow, value);
if (reflow->previous_temp_column_width != -1) {
running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 2a455409ba..92fc67cbfa 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1439,11 +1439,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
widget = gtk_widget_get_parent (widget);
while (widget && !GTK_IS_BUTTON(widget)) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_has_window (widget)) {
-#else
- if (!GTK_WIDGET_NO_WINDOW (widget)) {
-#endif
widget = NULL;
break;
}
@@ -1498,11 +1494,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
thisy += (1 + default_spacing) / 2;
}
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
-#endif
thisx += 1;
thisy += 1;
thiswidth -= 2;
@@ -1522,11 +1514,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
thisx + xoff, thisy + yoff,
thiswidth, thisheight);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
-#endif
thisx -= 1;
thisy -= 1;
thiswidth += 2;
diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c
index 6c6724ea6d..e368e7d68b 100644
--- a/widgets/text/gal-a11y-e-text.c
+++ b/widgets/text/gal-a11y-e-text.c
@@ -533,7 +533,7 @@ et_get_character_extents (AtkText *text,
etext = E_TEXT(obj);
canvas = GNOME_CANVAS_ITEM(etext)->canvas;
widget = GTK_WIDGET(canvas);
- window = widget->window;
+ window = gtk_widget_get_window (widget);
gdk_window_get_origin (window, &x_widget, &y_widget);
pango_layout_index_to_pos (etext->layout, offset, &pango_pos);
@@ -611,7 +611,7 @@ et_get_offset_at_point (AtkText *text,
etext = E_TEXT(obj);
canvas = GNOME_CANVAS_ITEM(etext)->canvas;
widget = GTK_WIDGET(canvas);
- window = widget->window;
+ window = gtk_widget_get_window (widget);
gdk_window_get_origin (window, &x_widget, &y_widget);
if (coords == ATK_XY_SCREEN) {