[evolution] More GTK3 preparation.



commit 970662db34ff0a718cd5e39c1fa268beb51e1f64
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 4 07:05:46 2010 -0400

    More GTK3 preparation.
    
    This uses the new gtk_assistant_commit() I had added to GTK+ for our
    EImportAssistant progress page.

 .../contact-list-editor/e-contact-list-editor.c    |   11 ++-
 calendar/gui/dialogs/event-editor.c                |    2 +-
 calendar/gui/ea-cal-view.c                         |   12 ++-
 calendar/gui/ea-day-view.c                         |   28 +++--
 calendar/gui/ea-gnome-calendar.c                   |   12 ++-
 calendar/gui/ea-week-view.c                        |   29 ++++--
 doc/reference/shell/tmpl/e-poolv.sgml              |   69 +++++++++++
 e-util/Makefile.am                                 |    1 +
 e-util/gtk-compat.h                                |   21 ++++
 mail/em-folder-tree.c                              |  125 ++++++++++++--------
 mail/message-list.c                                |   12 ++-
 plugins/groupwise-features/proxy-login.c           |    5 +-
 shell/e-shell.c                                    |   16 ++-
 widgets/misc/e-attachment-view.c                   |    7 +-
 widgets/misc/e-image-chooser.c                     |   13 ++-
 widgets/misc/e-import-assistant.c                  |   51 +++++---
 widgets/table/e-table-header-item.c                |   11 ++-
 widgets/table/gal-a11y-e-table.c                   |   11 +-
 widgets/table/gal-a11y-e-tree.c                    |    9 +-
 19 files changed, 319 insertions(+), 126 deletions(-)
---
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 dc2edd2..865cdbb 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -26,6 +26,7 @@
 #include <e-util/e-util-private.h>
 #include <e-util/e-alert-dialog.h>
 #include <e-util/e-selection.h>
+#include <e-util/gtk-compat.h>
 #include "shell/e-shell.h"
 
 #include <string.h>
@@ -508,9 +509,12 @@ contact_list_editor_drag_drop_cb (GtkWidget *widget,
                                   gint x, gint y,
                                   guint time)
 {
+	GList *targets;
 	GList *iter;
 
-	for (iter = context->targets; iter != NULL; iter = iter->next) {
+	targets = gdk_drag_context_list_targets (context);
+
+	for (iter = targets; iter != NULL; iter = iter->next) {
 		GdkAtom target = GDK_POINTER_TO_ATOM (iter->data);
 
 		if (e_targets_include_directory (&target, 1)) {
@@ -534,9 +538,12 @@ contact_list_editor_drag_motion_cb (GtkWidget *widget,
                                     gint x, gint y,
                                     guint time)
 {
+	GList *targets;
 	GList *iter;
 
-	for (iter = context->targets; iter != NULL; iter = iter->next) {
+	targets = gdk_drag_context_list_targets (context);
+
+	for (iter = targets; iter != NULL; iter = iter->next) {
 		GdkAtom target = GDK_POINTER_TO_ATOM (iter->data);
 
 		if (e_targets_include_directory (&target, 1)) {
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 0b70aef..96242c0 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -332,7 +332,7 @@ event_editor_constructor (GType type,
 	page = COMP_EDITOR_PAGE (priv->recur_page);
 	if (!e_shell_get_express_mode (shell)) {
 		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/ea-cal-view.c b/calendar/gui/ea-cal-view.c
index 67969c7..a012154 100644
--- a/calendar/gui/ea-cal-view.c
+++ b/calendar/gui/ea-cal-view.c
@@ -28,6 +28,8 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#include <e-util/gtk-compat.h>
+
 static void ea_cal_view_class_init (EaCalViewClass *klass);
 
 static AtkObject* ea_cal_view_get_parent (AtkObject *accessible);
@@ -172,13 +174,15 @@ ea_cal_view_get_parent (AtkObject *accessible)
 {
 	ECalendarView *cal_view;
 	GnomeCalendar *gnomeCalendar;
+	GtkWidget *widget;
 
 	g_return_val_if_fail (EA_IS_CAL_VIEW (accessible), NULL);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
-	cal_view = E_CALENDAR_VIEW (GTK_ACCESSIBLE (accessible)->widget);
 
+	cal_view = E_CALENDAR_VIEW (widget);
 	gnomeCalendar = e_calendar_view_get_calendar (cal_view);
 
 	return gtk_widget_get_accessible (GTK_WIDGET(gnomeCalendar));
@@ -324,7 +328,7 @@ action_interface_do_action (AtkAction *action, gint index)
 	time_t dtstart, dtend;
 	ECalendarView *cal_view;
 
-	widget = GTK_ACCESSIBLE (action)->widget;
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
 	if (widget == NULL)
 		/*
 		 * State is defunct
@@ -388,7 +392,7 @@ action_interface_get_keybinding (AtkAction *action, gint index)
 {
 	GtkWidget *widget;
 
-	widget = GTK_ACCESSIBLE (action)->widget;
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
 	if (widget == NULL)
 		/*
 		 * State is defunct
diff --git a/calendar/gui/ea-day-view.c b/calendar/gui/ea-day-view.c
index d197f49..991a78e 100644
--- a/calendar/gui/ea-day-view.c
+++ b/calendar/gui/ea-day-view.c
@@ -28,6 +28,8 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#include <e-util/gtk-compat.h>
+
 static void ea_day_view_class_init (EaDayViewClass *klass);
 
 static G_CONST_RETURN gchar * ea_day_view_get_name (AtkObject *accessible);
@@ -123,15 +125,17 @@ ea_day_view_get_name (AtkObject *accessible)
 	GnomeCalendar *gcal;
 	const gchar *label_text;
 	GnomeCalendarViewType view_type;
+	GtkWidget *widget;
 	gint n_events;
 	gchar *event_str, *name_str;
 
 	g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
 
-	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+	day_view = E_DAY_VIEW (widget);
 	gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
 	if (!gtk_widget_get_visible (GTK_WIDGET (gcal)))
 		return NULL;
@@ -177,12 +181,15 @@ static G_CONST_RETURN gchar *
 ea_day_view_get_description (AtkObject *accessible)
 {
 	EDayView *day_view;
+	GtkWidget *widget;
 
 	g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
-	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+	day_view = E_DAY_VIEW (widget);
 
 	if (accessible->description)
 		return accessible->description;
@@ -204,15 +211,17 @@ static gint
 ea_day_view_get_n_children (AtkObject *accessible)
 {
 	EDayView *day_view;
+	GtkWidget *widget;
 	gint day;
 	gint child_num = 0;
 
 	g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), -1);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return -1;
 
-	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+	day_view = E_DAY_VIEW (widget);
 
 	child_num += day_view->long_events->len;
 
@@ -232,6 +241,7 @@ ea_day_view_ref_child (AtkObject *accessible, gint index)
 	gint day;
 	AtkObject *atk_object = NULL;
 	EDayViewEvent *event = NULL;
+	GtkWidget *widget;
 
 	g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
 
@@ -239,9 +249,11 @@ ea_day_view_ref_child (AtkObject *accessible, gint index)
 	if (child_num <= 0 || index < 0 || index >= child_num)
 		return NULL;
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
-	day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+	day_view = E_DAY_VIEW (widget);
 
 	if (index == 0) {
 		/* index == 0 is the main item */
diff --git a/calendar/gui/ea-gnome-calendar.c b/calendar/gui/ea-gnome-calendar.c
index 1f599c1..e35ef14 100644
--- a/calendar/gui/ea-gnome-calendar.c
+++ b/calendar/gui/ea-gnome-calendar.c
@@ -29,6 +29,8 @@
 #include <libedataserver/e-data-server-util.h>
 #include <glib/gi18n.h>
 
+#include <e-util/gtk-compat.h>
+
 static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
 
 static gint ea_gnome_calendar_get_n_children (AtkObject* obj);
@@ -253,8 +255,9 @@ ea_gnome_calendar_get_n_children (AtkObject* obj)
 {
 	g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), 0);
 
-	if (!GTK_ACCESSIBLE (obj)->widget)
+	if (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)) == NULL)
 		return -1;
+
 	return 2;
 }
 
@@ -267,15 +270,18 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
 	ECalendarView *view;
 	ECalendar *date_navigator;
 	GtkWidget *childWidget;
+	GtkWidget *widget;
 
 	g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
 	/* valid child index range is [0-3] */
 	if (i < 0 || i >3 )
 		return NULL;
 
-	if (!GTK_ACCESSIBLE (obj)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+	if (widget == NULL)
 		return NULL;
-	calendarWidget = GNOME_CALENDAR (GTK_ACCESSIBLE (obj)->widget);
+
+	calendarWidget = GNOME_CALENDAR (widget);
 
 	switch (i) {
 	case 0:
diff --git a/calendar/gui/ea-week-view.c b/calendar/gui/ea-week-view.c
index a34326c..14bb456 100644
--- a/calendar/gui/ea-week-view.c
+++ b/calendar/gui/ea-week-view.c
@@ -27,6 +27,8 @@
 #include <text/e-text.h>
 #include <glib/gi18n.h>
 
+#include <e-util/gtk-compat.h>
+
 static void ea_week_view_class_init (EaWeekViewClass *klass);
 
 static G_CONST_RETURN gchar * ea_week_view_get_name (AtkObject *accessible);
@@ -124,15 +126,17 @@ ea_week_view_get_name (AtkObject *accessible)
 	GnomeCalendar *gcal;
 	const gchar *label_text;
 	GnomeCalendarViewType view_type;
+	GtkWidget *widget;
 	gint n_events;
 	gchar *event_str, *name_str;
 
 	g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
 
-	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+	week_view = E_WEEK_VIEW (widget);
 	gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
 	if (!gtk_widget_get_visible (GTK_WIDGET (gcal)))
 		return NULL;
@@ -168,12 +172,15 @@ static G_CONST_RETURN gchar *
 ea_week_view_get_description (AtkObject *accessible)
 {
 	EWeekView *week_view;
+	GtkWidget *widget;
 
 	g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
-	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+	week_view = E_WEEK_VIEW (widget);
 
 	if (accessible->description)
 		return accessible->description;
@@ -195,14 +202,17 @@ static gint
 ea_week_view_get_n_children (AtkObject *accessible)
 {
 	EWeekView *week_view;
+	GtkWidget *widget;
 	gint i, count = 0;
 	gint event_index;
 
 	g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), -1);
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return -1;
-	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+	week_view = E_WEEK_VIEW (widget);
 
 	for (event_index = 0; event_index < week_view->events->len;
 	     ++event_index) {
@@ -249,6 +259,7 @@ ea_week_view_ref_child (AtkObject *accessible, gint index)
 	EWeekView *week_view;
 	gint child_num, max_count;
 	AtkObject *atk_object = NULL;
+	GtkWidget *widget;
 	gint event_index;
 	gint jump_button = -1;
 	gint span_num = 0;
@@ -260,9 +271,11 @@ ea_week_view_ref_child (AtkObject *accessible, gint index)
 	if (child_num <= 0 || index < 0 || index >= child_num)
 		return NULL;
 
-	if (!GTK_ACCESSIBLE (accessible)->widget)
+	widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+	if (widget == NULL)
 		return NULL;
-	week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+	week_view = E_WEEK_VIEW (widget);
 	max_count = week_view->events->len;
 
 	if (index == 0) {
diff --git a/doc/reference/shell/tmpl/e-poolv.sgml b/doc/reference/shell/tmpl/e-poolv.sgml
new file mode 100644
index 0000000..d143d30
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-poolv.sgml
@@ -0,0 +1,69 @@
+<!-- ##### SECTION Title ##### -->
+EPoolv
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### SECTION Image ##### -->
+
+
+<!-- ##### STRUCT EPoolv ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION e_poolv_new ##### -->
+<para>
+
+</para>
+
+ size: 
+ Returns: 
+
+
+<!-- ##### FUNCTION e_poolv_set ##### -->
+<para>
+
+</para>
+
+ poolv: 
+ index: 
+ str: 
+ freeit: 
+ Returns: 
+
+
+<!-- ##### FUNCTION e_poolv_get ##### -->
+<para>
+
+</para>
+
+ poolv: 
+ index: 
+ Returns: 
+
+
+<!-- ##### FUNCTION e_poolv_destroy ##### -->
+<para>
+
+</para>
+
+ poolv: 
+
+
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index a258c64..7df0e0d 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -137,6 +137,7 @@ libeutil_la_SOURCES =				\
 	e-util-private.h			\
 	e-xml-utils.c				\
 	gconf-bridge.c				\
+	gtk-compat.h				\
 	$(PLATFORM_SOURCES)
 
 MARSHAL_GENERATED = e-marshal.c e-marshal.h
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
new file mode 100644
index 0000000..75b3297
--- /dev/null
+++ b/e-util/gtk-compat.h
@@ -0,0 +1,21 @@
+#ifndef __GTK_COMPAT_H__
+#define __GTK_COMPAT_H__
+
+#include <gtk/gtk.h>
+
+/* Provide a compatibility layer for accessor functions introduced
+ * in GTK+ 2.22 which we need to build with sealed GDK.  That way it
+ * is still possible to build with GTK+ 2.20. */
+
+#if !GTK_CHECK_VERSION(2,21,0)
+
+#define gdk_drag_context_get_actions(context)		(context)->actions
+#define gdk_drag_context_get_suggested_action(context)	(context)->suggested_action
+#define gdk_drag_context_get_selected_action(context)	(context)->action
+#define gdk_drag_context_list_targets(context)		(context)->targets
+
+#define gtk_accessible_get_widget(accessible) \
+	(GTK_ACCESSIBLE (accessible)->widget)
+#endif
+
+#endif /* __GTK_COMPAT_H__ */
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index cb1e61b..95c5dbd 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -44,6 +44,7 @@
 #include "e-util/e-icon-factory.h"
 #include "e-util/e-alert-dialog.h"
 #include "e-util/e-util.h"
+#include "e-util/gtk-compat.h"
 
 #include "misc/e-selectable.h"
 
@@ -1405,7 +1406,9 @@ em_folder_tree_new (void)
 }
 
 static void
-tree_drag_begin (GtkWidget *widget, GdkDragContext *context, EMFolderTree *folder_tree)
+tree_drag_begin (GtkWidget *widget,
+                 GdkDragContext *context,
+                 EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 	GtkTreeSelection *selection;
@@ -1425,7 +1428,9 @@ tree_drag_begin (GtkWidget *widget, GdkDragContext *context, EMFolderTree *folde
 }
 
 static void
-tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree *folder_tree)
+tree_drag_data_delete (GtkWidget *widget,
+                       GdkDragContext *context,
+                       EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 	gchar *full_name = NULL;
@@ -1463,7 +1468,12 @@ fail:
 }
 
 static void
-tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection, guint info, guint time, EMFolderTree *folder_tree)
+tree_drag_data_get (GtkWidget *widget,
+                    GdkDragContext *context,
+                    GtkSelectionData *selection,
+                    guint info,
+                    guint time,
+                    EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 	gchar *full_name = NULL, *uri = NULL;
@@ -1654,7 +1664,14 @@ tree_drag_data_action(struct _DragDataReceivedAsync *m)
 }
 
 static void
-tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection, guint info, guint time, EMFolderTree *folder_tree)
+tree_drag_data_received (GtkWidget *widget,
+                         GdkDragContext *context,
+                         gint x,
+                         gint y,
+                         GtkSelectionData *selection,
+                         guint info,
+                         guint time,
+                         EMFolderTree *folder_tree)
 {
 	GtkTreeViewDropPosition pos;
 	GtkTreeModel *model;
@@ -1706,7 +1723,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint
 	m->store = store;
 	g_object_ref (store);
 	m->full_name = full_name;
-	m->action = context->action;
+	m->action = gdk_drag_context_get_selected_action (context);
 	m->info = info;
 
 	/* need to copy, goes away once we exit */
@@ -1722,7 +1739,11 @@ is_special_local_folder (const gchar *name)
 }
 
 static GdkAtom
-folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkTreePath *path)
+folder_tree_drop_target (EMFolderTree *folder_tree,
+                         GdkDragContext *context,
+                         GtkTreePath *path,
+                         GdkDragAction *actions,
+                         GdkDragAction *suggested_action)
 {
 	EMFolderTreePrivate *p = folder_tree->priv;
 	gchar *full_name = NULL, *uri = NULL, *src_uri = NULL;
@@ -1734,13 +1755,17 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 	GList *targets;
 	guint32 flags = 0;
 
-	model = gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree));
-
 	/* This is a bit of a mess, but should handle all the cases properly */
 
+	model = gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree));
+
 	if (!gtk_tree_model_get_iter (model, &iter, path))
 		return GDK_NONE;
 
+	/* We may override these further down. */
+	*actions = gdk_drag_context_get_actions (context);
+	*suggested_action = gdk_drag_context_get_suggested_action (context);
+
 	gtk_tree_model_get (
 		model, &iter,
 		COL_BOOL_IS_STORE, &is_store,
@@ -1751,29 +1776,10 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 
 	local = e_mail_local_get_store ();
 
-	targets = context->targets;
+	targets = gdk_drag_context_list_targets (context);
 
 	/* Check for special destinations */
 	if (uri && full_name) {
-#if 0
-		/* only allow copying/moving folders (not messages) into the local Outbox */
-		if (dstore == local && !strcmp (full_name, "Outbox")) {
-			GdkAtom xfolder;
-
-			xfolder = drop_atoms[DND_DROP_TYPE_FOLDER];
-			while (targets != NULL) {
-				if (targets->data == (gpointer) xfolder) {
-					atom = xfolder;
-					goto done;
-				}
-
-				targets = targets->next;
-			}
-
-			goto done;
-		}
-#endif
-
 		/* don't allow copying/moving into the UNMATCHED vfolder */
 		if (!strncmp (uri, "vfolder:", 8) && !strcmp (full_name, CAMEL_UNMATCHED_NAME))
 			goto done;
@@ -1816,9 +1822,9 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 				/* allow only copy of the Inbox and other system folders */
 				GdkAtom xfolder;
 
-				/* TODO: not sure if this is legal, but it works, force copy for special local folders */
-				context->suggested_action = GDK_ACTION_COPY;
-				context->actions = GDK_ACTION_COPY;
+				/* force copy for special local folders */
+				*suggested_action = GDK_ACTION_COPY;
+				*actions = GDK_ACTION_COPY;
 				xfolder = drop_atoms[DND_DROP_TYPE_FOLDER];
 				while (targets != NULL) {
 					if (targets->data == (gpointer) xfolder) {
@@ -1850,9 +1856,9 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 
 				camel_url_free (url);
 
-				/* TODO: not sure if this is legal, but it works, force copy for special local folders */
-				context->suggested_action = GDK_ACTION_COPY;
-				context->actions = GDK_ACTION_COPY;
+				/* force copy for special local folders */
+				*suggested_action = GDK_ACTION_COPY;
+				*actions = GDK_ACTION_COPY;
 				xfolder = drop_atoms[DND_DROP_TYPE_FOLDER];
 				while (targets != NULL) {
 					if (targets->data == (gpointer) xfolder) {
@@ -1885,8 +1891,8 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 
 		/* Search Folders can only be dropped into other Search Folders */
 		if (strncmp(src_uri, "vfolder:", 8) == 0) {
-			/* TODO: not sure if this is legal, but it works, force move only for vfolders */
-			context->suggested_action = GDK_ACTION_MOVE;
+			/* force move only for vfolders */
+			*suggested_action = GDK_ACTION_MOVE;
 
 			if (uri && strncmp(uri, "vfolder:", 8) == 0) {
 				GdkAtom xfolder;
@@ -1948,12 +1954,19 @@ folder_tree_drop_target(EMFolderTree *folder_tree, GdkDragContext *context, GtkT
 }
 
 static gboolean
-tree_drag_drop (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, EMFolderTree *folder_tree)
+tree_drag_drop (GtkWidget *widget,
+                GdkDragContext *context,
+                gint x,
+                gint y,
+                guint time,
+                EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 	GtkTreeViewColumn *column;
 	GtkTreeView *tree_view;
 	gint cell_x, cell_y;
+	GdkDragAction actions;
+	GdkDragAction suggested_action;
 	GtkTreePath *path;
 	GdkAtom target;
 
@@ -1975,16 +1988,19 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guin
 	if (!gtk_tree_view_get_path_at_pos (tree_view, x, y, &path, &column, &cell_x, &cell_y))
 		return FALSE;
 
-	target = folder_tree_drop_target(folder_tree, context, path);
+	target = folder_tree_drop_target (
+		folder_tree, context, path,
+		&actions, &suggested_action);
+
 	gtk_tree_path_free (path);
-	if (target == GDK_NONE)
-		return FALSE;
 
-	return TRUE;
+	return (target != GDK_NONE);
 }
 
 static void
-tree_drag_end (GtkWidget *widget, GdkDragContext *context, EMFolderTree *folder_tree)
+tree_drag_end (GtkWidget *widget,
+               GdkDragContext *context,
+               EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 
@@ -1997,7 +2013,10 @@ tree_drag_end (GtkWidget *widget, GdkDragContext *context, EMFolderTree *folder_
 }
 
 static void
-tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolderTree *folder_tree)
+tree_drag_leave (GtkWidget *widget,
+                 GdkDragContext *context,
+                 guint time,
+                 EMFolderTree *folder_tree)
 {
 	EMFolderTreePrivate *priv = folder_tree->priv;
 	GtkTreeView *tree_view;
@@ -2086,7 +2105,9 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, gu
 	GtkTreeViewDropPosition pos;
 	GtkTreeView *tree_view;
 	GtkTreeModel *model;
-	GdkDragAction action = 0;
+	GdkDragAction actions;
+	GdkDragAction suggested_action;
+	GdkDragAction chosen_action = 0;
 	GtkTreePath *path;
 	GtkTreeIter iter;
 	GdkAtom target;
@@ -2129,21 +2150,23 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, gu
 		priv->autoexpand_id = 0;
 	}
 
-	target = folder_tree_drop_target(folder_tree, context, path);
+	target = folder_tree_drop_target (
+		folder_tree, context, path,
+		&actions, &suggested_action);
 	if (target != GDK_NONE) {
 		for (i=0; i<NUM_DROP_TYPES; i++) {
 			if (drop_atoms[i] == target) {
 				switch (i) {
 				case DND_DROP_TYPE_UID_LIST:
 				case DND_DROP_TYPE_FOLDER:
-					action = context->suggested_action;
-					if (action == GDK_ACTION_COPY && (context->actions & GDK_ACTION_MOVE))
-						action = GDK_ACTION_MOVE;
+					chosen_action = suggested_action;
+					if (chosen_action == GDK_ACTION_COPY && (actions & GDK_ACTION_MOVE))
+						chosen_action = GDK_ACTION_MOVE;
 					gtk_tree_view_set_drag_dest_row(tree_view, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
 					break;
 				default:
 					gtk_tree_view_set_drag_dest_row(tree_view, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
-					action = context->suggested_action;
+					chosen_action = suggested_action;
 					break;
 				}
 				break;
@@ -2153,9 +2176,9 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, gu
 
 	gtk_tree_path_free(path);
 
-	gdk_drag_status(context, action, time);
+	gdk_drag_status(context, chosen_action, time);
 
-	return action != 0;
+	return chosen_action != 0;
 }
 
 void
diff --git a/mail/message-list.c b/mail/message-list.c
index 466d4c5..ee80748 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -41,6 +41,7 @@
 #include "e-util/e-profile-event.h"
 #include "e-util/e-util-private.h"
 #include "e-util/e-util.h"
+#include "e-util/gtk-compat.h"
 
 #include "misc/e-selectable.h"
 
@@ -2193,7 +2194,7 @@ ml_tree_drag_data_received (ETree *tree,
 	g_object_ref(context);
 	m->folder = ml->folder;
 	g_object_ref (m->folder);
-	m->action = context->action;
+	m->action = gdk_drag_context_get_selected_action (context);
 	m->info = info;
 
 	/* need to copy, goes away once we exit */
@@ -2246,18 +2247,21 @@ ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint
 		return TRUE;
 	}
 
-	for (targets = context->targets; targets; targets = targets->next) {
+	targets = gdk_drag_context_list_targets (context);
+	while (targets != NULL) {
 		gint i;
 
 		d(printf("atom drop '%s'\n", gdk_atom_name(targets->data)));
 		for (i = 0; i < G_N_ELEMENTS (ml_drag_info); i++)
 			if (targets->data == (gpointer)ml_drag_info[i].atom)
 				actions |= ml_drag_info[i].actions;
+
+		targets = g_list_next (targets);
 	}
 	d(printf("\n"));
 
-	actions &= context->actions;
-	action = context->suggested_action;
+	actions &= gdk_drag_context_get_actions (context);
+	action = gdk_drag_context_get_suggested_action (context);
 	if (action == GDK_ACTION_COPY && (actions & GDK_ACTION_MOVE))
 		action = GDK_ACTION_MOVE;
 
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index 6fd97d9..41c9a91 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -406,8 +406,9 @@ proxy_login_tree_view_changed_cb(GtkDialog *dialog)
 
 	account_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree));
 	gtk_tree_selection_get_selected (account_select, &model, &iter);
-	if ((priv->store)->stamp != (&iter)->stamp)
-		return;
+	/* FIXME Find a different way to check whatever this is checking. */
+	/*if ((priv->store)->stamp != (&iter)->stamp)
+		return;*/
 	gtk_tree_model_get (model, &iter, ACCOUNT_NAME, &account_mailid, -1);
 	account_mailid = g_strrstr (account_mailid, "\n") + 1;
 	account_name_tbox = e_builder_get_widget (priv->builder, "account_name");
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 2345d70..f82931c 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1926,20 +1926,22 @@ e_shell_cancel_quit (EShell *shell)
  * a given screen.
  **/
 void
-e_shell_adapt_window_size (EShell    *shell,
-			   GtkWindow *window)
+e_shell_adapt_window_size (EShell *shell,
+                           GtkWindow *window)
 {
-	gint monitor;
-	GdkScreen *scr;
+	GdkScreen *screen;
 	GdkRectangle rect;
+	GdkWindow *gdk_window;
+	gint monitor;
 
 	if (!e_shell_get_meego_mode (shell) ||
 	    !e_shell_get_small_screen_mode (shell))
 		return;
 
-	scr = gdk_screen_get_default ();
-	monitor = gdk_screen_get_monitor_at_window (scr, GTK_WIDGET (window)->window);
-	gdk_screen_get_monitor_geometry (scr, monitor, &rect);
+	screen = gdk_screen_get_default ();
+	gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+	monitor = gdk_screen_get_monitor_at_window (screen, gdk_window);
+	gdk_screen_get_monitor_geometry (screen, monitor, &rect);
 
 	gtk_window_set_default_size (window, rect.width, rect.height);
 	gtk_window_set_decorated (window, FALSE);
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index 832565c..b810e40 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -29,6 +29,8 @@
 #include "e-util/e-selection.h"
 #include "e-util/e-ui-manager.h"
 #include "e-util/e-util.h"
+#include "e-util/gtk-compat.h"
+
 #include "e-attachment-dialog.h"
 #include "e-attachment-handler-image.h"
 #include "e-attachment-handler-sendto.h"
@@ -1561,8 +1563,9 @@ e_attachment_view_drag_motion (EAttachmentView *view,
 	if (!e_attachment_view_get_editable (view))
 		return FALSE;
 
-	actions = priv->drag_actions & context->actions;
-	chosen_action = context->suggested_action;
+	actions = gdk_drag_context_get_actions (context);
+	actions &= priv->drag_actions;
+	chosen_action = gdk_drag_context_get_suggested_action (context);
 
 	if (chosen_action == GDK_ACTION_ASK) {
 		GdkDragAction mask;
diff --git a/widgets/misc/e-image-chooser.c b/widgets/misc/e-image-chooser.c
index 5defe20..e447413 100644
--- a/widgets/misc/e-image-chooser.c
+++ b/widgets/misc/e-image-chooser.c
@@ -29,6 +29,7 @@
 #include "e-image-chooser.h"
 #include "e-util/e-util.h"
 #include "e-util/e-icon-factory.h"
+#include "e-util/gtk-compat.h"
 
 #define E_IMAGE_CHOOSER_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -166,11 +167,12 @@ image_drag_motion_cb (GtkWidget *widget,
                       EImageChooser *chooser)
 {
 	GtkFrame *frame;
-	GList *p;
+	GList *targets, *p;
 
 	frame = GTK_FRAME (chooser->priv->frame);
+	targets = gdk_drag_context_list_targets (context);
 
-	for (p = context->targets; p != NULL; p = p->next) {
+	for (p = targets; p != NULL; p = p->next) {
 		gchar *possible_type;
 
 		possible_type = gdk_atom_name (GDK_POINTER_TO_ATOM (p->data));
@@ -210,16 +212,17 @@ image_drag_drop_cb (GtkWidget *widget,
                     EImageChooser *chooser)
 {
 	GtkFrame *frame;
-	GList *p;
+	GList *targets, *p;
 
 	frame = GTK_FRAME (chooser->priv->frame);
+	targets = gdk_drag_context_list_targets (context);
 
-	if (context->targets == NULL) {
+	if (targets == NULL) {
 		gtk_frame_set_shadow_type (frame, GTK_SHADOW_NONE);
 		return FALSE;
 	}
 
-	for (p = context->targets; p != NULL; p = p->next) {
+	for (p = targets; p != NULL; p = p->next) {
 		gchar *possible_type;
 
 		possible_type = gdk_atom_name (GDK_POINTER_TO_ATOM (p->data));
diff --git a/widgets/misc/e-import-assistant.c b/widgets/misc/e-import-assistant.c
index 48c2d22..ec36c8b 100644
--- a/widgets/misc/e-import-assistant.c
+++ b/widgets/misc/e-import-assistant.c
@@ -640,6 +640,15 @@ import_intelligent_done (EImport *ei,
 }
 
 static void
+import_cancelled (EImportAssistant *assistant)
+{
+	e_import_cancel (
+		assistant->priv->import,
+		assistant->priv->import_target,
+		assistant->priv->import_importer);
+}
+
+static void
 prepare_file_page (GtkAssistant *assistant,
                    GtkWidget *vbox)
 {
@@ -734,15 +743,36 @@ prepare_progress_page (GtkAssistant *assistant,
 	EImportAssistantPrivate *priv;
 	EImportCompleteFunc done = NULL;
 	ImportSelectionPage *page;
+	GtkWidget *cancel_button;
 	gboolean intelligent_import;
 	gboolean is_simple = FALSE;
 
 	priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
 	page = &priv->selection_page;
 
-	/* Hide the Back and Forward buttons, so only Cancel is visible. */
+#if GTK_CHECK_VERSION(2,21,2)
+	/* Because we're a GTK_ASSISTANT_PAGE_PROGRESS, this will
+	 * prevent the assistant window from being closed via window
+	 * manager decorations while importing. */
+	gtk_assistant_commit (assistant);
+#else
+	/* Hide all GtkAssistant buttons. */
 	gtk_widget_hide (assistant->back);
 	gtk_widget_hide (assistant->forward);
+	gtk_widget_hide (assistant->cancel);
+#endif
+
+	/* Install a custom "Cancel Import" button. */
+	cancel_button = gtk_button_new_with_mnemonic (_("_Cancel Import"));
+	gtk_button_set_image (
+		GTK_BUTTON (cancel_button),
+		gtk_image_new_from_stock (
+		GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
+	g_signal_connect_swapped (
+		cancel_button, "clicked",
+		G_CALLBACK (import_cancelled), assistant);
+	gtk_assistant_add_action_widget (assistant, cancel_button);
+	gtk_widget_show (cancel_button);
 
 	g_object_get (G_OBJECT (assistant), "is-simple", &is_simple, NULL);
 
@@ -1179,24 +1209,6 @@ import_assistant_prepare (GtkAssistant *assistant,
 }
 
 static void
-import_assistant_cancel (GtkAssistant *assistant)
-{
-	EImportAssistantPrivate *priv;
-	gint current_page;
-
-	priv = E_IMPORT_ASSISTANT_GET_PRIVATE (assistant);
-
-	current_page = gtk_assistant_get_current_page (assistant);
-
-	/* Cancel the import if it's in progress. */
-	if (current_page == PAGE_PROGRESS)
-		e_import_cancel (
-			priv->import,
-			priv->import_target,
-			priv->import_importer);
-}
-
-static void
 import_assistant_class_init (EImportAssistantClass *class)
 {
 	GObjectClass *object_class;
@@ -1217,7 +1229,6 @@ import_assistant_class_init (EImportAssistantClass *class)
 
 	assistant_class = GTK_ASSISTANT_CLASS (class);
 	assistant_class->prepare = import_assistant_prepare;
-	assistant_class->cancel = import_assistant_cancel;
 
 	g_object_class_install_property (
 		object_class,
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 133a368..a80315a 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -37,6 +37,7 @@
 #include <glib/gi18n.h>
 #include "e-util/e-util.h"
 #include "e-util/e-xml-utils.h"
+#include "e-util/gtk-compat.h"
 #include "misc/e-canvas.h"
 #include "misc/e-popup-menu.h"
 
@@ -614,24 +615,26 @@ do_drag_motion (ETableHeaderItem *ethi,
 {
 	if ((x >= 0) && (x <= (ethi->width)) &&
 	    (y >= 0) && (y <= (ethi->height))) {
+		GdkDragAction suggested_action;
 		gint col;
 		d(g_print("In header\n"));
 
 		col = ethi_find_col_by_x_nearest (ethi, x);
+		suggested_action = gdk_drag_context_get_suggested_action (context);
 
 		if (ethi->drag_col != -1 && (col == ethi->drag_col || col == ethi->drag_col + 1)) {
 			if (ethi->drag_col != -1)
 				ethi_remove_destroy_marker (ethi);
 
 			ethi_remove_drop_marker (ethi);
-			gdk_drag_status (context, context->suggested_action, time);
+			gdk_drag_status (context, suggested_action, time);
 		}
 		else if (col != -1) {
 			if (ethi->drag_col != -1)
 				ethi_remove_destroy_marker (ethi);
 
 			ethi_add_drop_marker (ethi, col, recreate);
-			gdk_drag_status (context, context->suggested_action, time);
+			gdk_drag_status (context, suggested_action, time);
 		} else {
 			ethi_remove_drop_marker (ethi);
 			if (ethi->drag_col != -1)
@@ -750,6 +753,7 @@ ethi_drag_motion (GtkWidget *widget,
 {
 	GtkAllocation allocation;
 	GtkAdjustment *adjustment;
+	GList *targets;
 	gdouble hadjustment_value;
 	gdouble vadjustment_value;
 	gchar *droptype, *headertype;
@@ -757,7 +761,8 @@ ethi_drag_motion (GtkWidget *widget,
 
 	gdk_drag_status (context, 0, time);
 
-	droptype = gdk_atom_name (GDK_POINTER_TO_ATOM (context->targets->data));
+	targets = gdk_drag_context_list_targets (context);
+	droptype = gdk_atom_name (GDK_POINTER_TO_ATOM (targets->data));
 	headertype = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE,
 				      ethi->dnd_code);
 
diff --git a/widgets/table/gal-a11y-e-table.c b/widgets/table/gal-a11y-e-table.c
index 6134b2d..8aef407 100644
--- a/widgets/table/gal-a11y-e-table.c
+++ b/widgets/table/gal-a11y-e-table.c
@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include "e-util/gtk-compat.h"
+
 #include "a11y/gal-a11y-util.h"
 #include "table/e-table.h"
 #include "table/e-table-click-to-add.h"
@@ -89,7 +91,7 @@ init_child_item (GalA11yETable *a11y)
 	if (!a11y || !GTK_IS_ACCESSIBLE (a11y))
 		return FALSE;
 
-	table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
+	table = E_TABLE (gtk_accessible_get_widget (GTK_ACCESSIBLE (a11y)));
 	if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
 		ETableGroupContainer *etgc =  (ETableGroupContainer *)table->group;
 		GList *list;
@@ -127,7 +129,7 @@ et_get_n_children (AtkObject *accessible)
 	ETable * et;
 	gint n = 0;
 
-	et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget);
+	et = E_TABLE (gtk_accessible_get_widget (GTK_ACCESSIBLE (a11y)));
 
 	if (et->group) {
 		if (E_IS_TABLE_GROUP_LEAF (et->group))
@@ -152,7 +154,7 @@ et_ref_child (AtkObject *accessible,
 	ETable * et;
 	gint child_no;
 
-	et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget);
+	et = E_TABLE (gtk_accessible_get_widget (GTK_ACCESSIBLE (a11y)));
 
 	child_no = et_get_n_children (accessible);
 	if (i == 0 || i < child_no - 1) {
@@ -281,7 +283,8 @@ gal_a11y_e_table_new (GObject *widget)
 
 	a11y = g_object_new (gal_a11y_e_table_get_type (), NULL);
 
-	GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
+	/* FIXME No way to do this in GTK 3. */
+	/*GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);*/
 
 	/* we need to init all the children for multiple table items */
 	if (table && gtk_widget_get_mapped (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER (table->group)) {
diff --git a/widgets/table/gal-a11y-e-tree.c b/widgets/table/gal-a11y-e-tree.c
index 879b517..c65ed54 100644
--- a/widgets/table/gal-a11y-e-tree.c
+++ b/widgets/table/gal-a11y-e-tree.c
@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include "e-util/gtk-compat.h"
+
 #include "a11y/gal-a11y-util.h"
 #include "table/e-table-item.h"
 #include "table/e-tree.h"
@@ -47,10 +49,12 @@ static void
 init_child_item (GalA11yETree *a11y)
 {
 	GalA11yETreePrivate *priv = GET_PRIVATE (a11y);
-	ETree *tree = E_TREE (GTK_ACCESSIBLE (a11y)->widget);
+	ETree *tree;
 	ETableItem * eti;
 
+	tree = E_TREE (gtk_accessible_get_widget (GTK_ACCESSIBLE (a11y)));
 	g_return_if_fail (tree);
+
 	eti = e_tree_get_item (tree);
 	if (priv->child_item == NULL) {
 		priv->child_item = atk_gobject_accessible_for_object (G_OBJECT (eti));
@@ -174,7 +178,8 @@ gal_a11y_e_tree_new (GObject *widget)
 
 	a11y = g_object_new (gal_a11y_e_tree_get_type (), NULL);
 
-	GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
+	/* FIXME No way to do this in GTK 3. */
+	/*GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);*/
 
 	return ATK_OBJECT (a11y);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]