Skip to content

Commit

Permalink
DND
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Aug 6, 2024
1 parent 0c9ef6f commit d23d012
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/Widgets/SaveDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,29 @@ public class Screenshot.SaveDialog : Granite.Dialog {

Application.create_dir_if_missing (folder_dir);

var drag_source = new Gtk.DragSource () {
actions = COPY,
content = new Gdk.ContentProvider.for_value (pixbuf)
};
drag_source.set_icon (
Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).lookup_icon (
"image-x-generic",
null,
32,
scale_factor,
NONE,
PRELOAD
), 0, 0
);

var preview = new Gtk.Picture.for_paintable (Gdk.Texture.for_pixbuf (pixbuf)) {
height_request = 128,
margin_top = 18,
margin_bottom = 18
};
preview.add_css_class (Granite.STYLE_CLASS_CARD);
preview.add_css_class (Granite.STYLE_CLASS_CHECKERBOARD);

// Gtk.drag_source_set (preview_event_box, Gdk.ModifierType.BUTTON1_MASK, null, Gdk.DragAction.COPY);
// Gtk.drag_source_add_image_targets (preview_event_box);
// Gtk.drag_source_set_icon_gicon (preview_event_box, new ThemedIcon ("image-x-generic"));
// preview_event_box.drag_data_get.connect ((widget, context, selection_data, info, time_) => {
// selection_data.set_pixbuf (pixbuf);
// });
preview.add_controller (drag_source);

var dialog_label = new Granite.HeaderLabel (_("Save Image as…"));

Expand Down

0 comments on commit d23d012

Please sign in to comment.