diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-06-04 19:05:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-06-04 20:34:15 +0800 |
commit | 970662db34ff0a718cd5e39c1fa268beb51e1f64 (patch) | |
tree | 73c987b95c107ae7e3014abdca4c95de12dc853d /widgets | |
parent | 3ee48d9bf66fbc76b7b06e77aafa015c341cd419 (diff) | |
download | gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar.gz gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar.bz2 gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar.lz gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar.xz gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.tar.zst gsoc2013-evolution-970662db34ff0a718cd5e39c1fa268beb51e1f64.zip |
More GTK3 preparation.
This uses the new gtk_assistant_commit() I had added to GTK+ for our
EImportAssistant progress page.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/e-attachment-view.c | 7 | ||||
-rw-r--r-- | widgets/misc/e-image-chooser.c | 13 | ||||
-rw-r--r-- | widgets/misc/e-import-assistant.c | 51 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 11 | ||||
-rw-r--r-- | widgets/table/gal-a11y-e-table.c | 11 | ||||
-rw-r--r-- | widgets/table/gal-a11y-e-tree.c | 9 |
6 files changed, 66 insertions, 36 deletions
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c index 832565c929..b810e402c4 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 5defe2090d..e4474135f8 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 48c2d221ee..ec36c8b32d 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 133a368754..a80315a596 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 6134b2d297..8aef407941 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 879b517aab..c65ed543c8 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); } |