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/misc | |
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/misc')
-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 |
3 files changed, 44 insertions, 27 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, |