diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-03-30 11:38:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-03-30 11:38:36 +0800 |
commit | 8a1f639a670696e71daac8305ae0823668d29a14 (patch) | |
tree | 3b7c8ec8f856095865211a40ebcaf33ca572d94f /widgets/misc/e-attachment-icon-view.c | |
parent | bc4f60ba176b64cc8fd8ffa47a01542f8eb25bdf (diff) | |
download | gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar.gz gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar.bz2 gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar.lz gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar.xz gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.tar.zst gsoc2013-evolution-8a1f639a670696e71daac8305ae0823668d29a14.zip |
Saving progress again on the attachment rewrite.
svn path=/branches/kill-bonobo/; revision=37482
Diffstat (limited to 'widgets/misc/e-attachment-icon-view.c')
-rw-r--r-- | widgets/misc/e-attachment-icon-view.c | 139 |
1 files changed, 132 insertions, 7 deletions
diff --git a/widgets/misc/e-attachment-icon-view.c b/widgets/misc/e-attachment-icon-view.c index f6e42b2fbe..9588540f05 100644 --- a/widgets/misc/e-attachment-icon-view.c +++ b/widgets/misc/e-attachment-icon-view.c @@ -101,10 +101,8 @@ attachment_icon_view_button_press_event (GtkWidget *widget, { EAttachmentView *view = E_ATTACHMENT_VIEW (widget); - if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { - e_attachment_view_show_popup_menu (view, event); + if (e_attachment_view_button_press_event (view, event)) return TRUE; - } /* Chain up to parent's button_press_event() method. */ return GTK_WIDGET_CLASS (parent_class)-> @@ -112,6 +110,20 @@ attachment_icon_view_button_press_event (GtkWidget *widget, } static gboolean +attachment_icon_view_button_release_event (GtkWidget *widget, + GdkEventButton *event) +{ + EAttachmentView *view = E_ATTACHMENT_VIEW (widget); + + if (e_attachment_view_button_release_event (view, event)) + return TRUE; + + /* Chain up to parent's button_release_event() method. */ + return GTK_WIDGET_CLASS (parent_class)-> + button_release_event (widget, event); +} + +static gboolean attachment_icon_view_key_press_event (GtkWidget *widget, GdkEventKey *event) { @@ -127,6 +139,43 @@ attachment_icon_view_key_press_event (GtkWidget *widget, key_press_event (widget, event); } +static void +attachment_icon_view_drag_begin (GtkWidget *widget, + GdkDragContext *context) +{ + EAttachmentView *view = E_ATTACHMENT_VIEW (widget); + + /* Chain up to parent's drag_begin() method. */ + GTK_WIDGET_CLASS (parent_class)->drag_begin (widget, context); + + e_attachment_view_drag_begin (view, context); +} + +static void +attachment_icon_view_drag_end (GtkWidget *widget, + GdkDragContext *context) +{ + EAttachmentView *view = E_ATTACHMENT_VIEW (widget); + + /* Chain up to parent's drag_end() method. */ + GTK_WIDGET_CLASS (parent_class)->drag_end (widget, context); + + e_attachment_view_drag_end (view, context); +} + +static void +attachment_icon_view_drag_data_get (GtkWidget *widget, + GdkDragContext *context, + GtkSelectionData *selection, + guint info, + guint time) +{ + EAttachmentView *view = E_ATTACHMENT_VIEW (widget); + + e_attachment_view_drag_data_get ( + view, context, selection, info, time); +} + static gboolean attachment_icon_view_drag_motion (GtkWidget *widget, GdkDragContext *context, @@ -139,6 +188,23 @@ attachment_icon_view_drag_motion (GtkWidget *widget, return e_attachment_view_drag_motion (view, context, x, y, time); } +static gboolean +attachment_icon_view_drag_drop (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + EAttachmentView *view = E_ATTACHMENT_VIEW (widget); + + if (!e_attachment_view_drag_drop (view, context, x, y, time)) + return FALSE; + + /* Chain up to parent's drag_drop() method. */ + return GTK_WIDGET_CLASS (parent_class)->drag_drop ( + widget, context, x, y, time); +} + static void attachment_icon_view_drag_data_received (GtkWidget *widget, GdkDragContext *context, @@ -271,6 +337,55 @@ attachment_icon_view_unselect_all (EAttachmentView *view) } static void +attachment_icon_view_drag_source_set (EAttachmentView *view, + GdkModifierType start_button_mask, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions) +{ + GtkIconView *icon_view; + + icon_view = GTK_ICON_VIEW (view); + + gtk_icon_view_enable_model_drag_source ( + icon_view, start_button_mask, targets, n_targets, actions); +} + +static void +attachment_icon_view_drag_dest_set (EAttachmentView *view, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions) +{ + GtkIconView *icon_view; + + icon_view = GTK_ICON_VIEW (view); + + gtk_icon_view_enable_model_drag_dest ( + icon_view, targets, n_targets, actions); +} + +static void +attachment_icon_view_drag_source_unset (EAttachmentView *view) +{ + GtkIconView *icon_view; + + icon_view = GTK_ICON_VIEW (view); + + gtk_icon_view_unset_model_drag_source (icon_view); +} + +static void +attachment_icon_view_drag_dest_unset (EAttachmentView *view) +{ + GtkIconView *icon_view; + + icon_view = GTK_ICON_VIEW (view); + + gtk_icon_view_unset_model_drag_dest (icon_view); +} + +static void attachment_icon_view_class_init (EAttachmentIconViewClass *class) { GObjectClass *object_class; @@ -288,8 +403,13 @@ attachment_icon_view_class_init (EAttachmentIconViewClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->button_press_event = attachment_icon_view_button_press_event; + widget_class->button_release_event = attachment_icon_view_button_release_event; widget_class->key_press_event = attachment_icon_view_key_press_event; + widget_class->drag_begin = attachment_icon_view_drag_begin; + widget_class->drag_end = attachment_icon_view_drag_end; + widget_class->drag_data_get = attachment_icon_view_drag_data_get; widget_class->drag_motion = attachment_icon_view_drag_motion; + widget_class->drag_drop = attachment_icon_view_drag_drop; widget_class->drag_data_received = attachment_icon_view_drag_data_received; widget_class->popup_menu = attachment_icon_view_popup_menu; @@ -313,6 +433,11 @@ attachment_icon_view_iface_init (EAttachmentViewIface *iface) iface->unselect_path = attachment_icon_view_unselect_path; iface->select_all = attachment_icon_view_select_all; iface->unselect_all = attachment_icon_view_unselect_all; + + iface->drag_source_set = attachment_icon_view_drag_source_set; + iface->drag_dest_set = attachment_icon_view_drag_dest_set; + iface->drag_source_unset = attachment_icon_view_drag_source_unset; + iface->drag_dest_unset = attachment_icon_view_drag_dest_unset; } static void @@ -320,7 +445,6 @@ attachment_icon_view_init (EAttachmentIconView *icon_view) { GtkCellLayout *cell_layout; GtkCellRenderer *renderer; - cell_layout = GTK_CELL_LAYOUT (icon_view); icon_view->priv = E_ATTACHMENT_ICON_VIEW_GET_PRIVATE (icon_view); @@ -331,7 +455,7 @@ attachment_icon_view_init (EAttachmentIconView *icon_view) renderer = gtk_cell_renderer_pixbuf_new (); g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL); - gtk_cell_layout_pack_start (cell_layout, renderer, TRUE); + gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "gicon", @@ -340,8 +464,9 @@ attachment_icon_view_init (EAttachmentIconView *icon_view) renderer = gtk_cell_renderer_text_new (); g_object_set ( renderer, "alignment", PANGO_ALIGN_CENTER, - "xalign", 0.5, NULL); - gtk_cell_layout_pack_start (cell_layout, renderer, TRUE); + "wrap-mode", PANGO_WRAP_WORD, "wrap-width", 150, + "yalign", 0.0, NULL); + gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "text", |