@@ -160,35 +160,6 @@ mainwindow_dispose(GObject *object)
160160 G_OBJECT_CLASS (mainwindow_parent_class )-> dispose (object );
161161}
162162
163- static void
164- mainwindow_copy_action (GSimpleAction * action ,
165- GVariant * parameter , gpointer user_data )
166- {
167- printf ("mainwindow_copy_action: FIXME\n" );
168-
169- /*
170- Mainwindow *main = MAINWINDOW(user_data);
171-
172- GdkClipboard *clipboard = gtk_widget_get_clipboard(GTK_WIDGET(win));
173- g_autoptr(GFile) file = tilesource_get_file(tilesource);
174-
175- VipsImage *image;
176-
177- if (file)
178- gdk_clipboard_set(clipboard, G_TYPE_FILE, file);
179- else if ((image = tilesource_get_base_image(tilesource))) {
180- g_autoptr(GdkTexture) texture = texture_new_from_image(image);
181-
182- if (texture)
183- gdk_clipboard_set(clipboard, GDK_TYPE_TEXTURE, texture);
184- else
185- imagewindow_error(win);
186- }
187- }
188-
189- */
190- }
191-
192163static gboolean
193164mainwindow_open_workspace (Mainwindow * main , const char * filename )
194165{
@@ -236,82 +207,13 @@ mainwindow_load_path(Mainwindow *main, const char *path)
236207 return TRUE;
237208}
238209
210+ // used byworkspacegroupview.c for filename drop
239211gboolean
240212mainwindow_paste_filename (const char * filename , void * user_data )
241213{
242- return mainwindow_load_path (MAINWINDOW (user_data ), filename );
243- }
244-
245- static void
246- mainwindow_paste_action_ready (GObject * source_object ,
247- GAsyncResult * res , gpointer user_data )
248- {
249- GdkClipboard * clipboard = GDK_CLIPBOARD (source_object );
250214 Mainwindow * main = MAINWINDOW (user_data );
251215
252- const GValue * value ;
253- GError * error = NULL ;
254- value = gdk_clipboard_read_value_finish (clipboard , res , & error );
255- if (error ) {
256- error_top (_ ("Unable to paste" ));
257- error_sub ("%s" , error -> message );
258- g_error_free (error );
259- mainwindow_error (main );
260- }
261- else if (value ) {
262- if (!value_to_filename (value , mainwindow_paste_filename , main ))
263- mainwindow_error (main );
264- else
265- symbol_recalculate_all ();
266- }
267- }
268-
269- /* GTypes we handle in copy/paste and drag/drop paste ... these are in the
270- * order we try, so a GFile is preferred to a simple string.
271- *
272- * gnome file manager pastes as GdkFileList, GFile, gchararray
273- * print-screen button pastes as GdkTexture, GdkPixbuf
274- *
275- * Created in _class_init(), since some of these types are only defined at
276- * runtime.
277- */
278- static GType * mainwindow_supported_types ;
279- static int mainwindow_n_supported_types ;
280-
281- static void
282- mainwindow_paste_action (GSimpleAction * action ,
283- GVariant * parameter , gpointer user_data )
284- {
285- Mainwindow * main = MAINWINDOW (user_data );
286- GdkClipboard * clipboard = gtk_widget_get_clipboard (GTK_WIDGET (main ));
287-
288- GdkContentFormats * formats = gdk_clipboard_get_formats (clipboard );
289- gsize n_types ;
290- const GType * types = gdk_content_formats_get_gtypes (formats , & n_types );
291-
292- #ifdef DEBUG
293- printf ("clipboard in %lu formats\n" , n_types );
294- for (gsize i = 0 ; i < n_types ; i ++ )
295- printf ("%lu - %s\n" , i , g_type_name (types [i ]));
296- #endif /*DEBUG*/
297-
298- gboolean handled = FALSE;
299- for (gsize i = 0 ; i < n_types ; i ++ ) {
300- for (int j = 0 ; j < mainwindow_n_supported_types ; j ++ )
301- if (types [i ] == mainwindow_supported_types [j ]) {
302- gdk_clipboard_read_value_async (clipboard ,
303- mainwindow_supported_types [j ],
304- G_PRIORITY_DEFAULT ,
305- NULL ,
306- mainwindow_paste_action_ready ,
307- main );
308- handled = TRUE;
309- break ;
310- }
311-
312- if (handled )
313- break ;
314- }
216+ return mainwindow_load_path (main , filename );
315217}
316218
317219static gboolean
@@ -665,8 +567,6 @@ mainwindow_keyboard_duplicate_action(GSimpleAction *action,
665567
666568static GActionEntry mainwindow_entries [] = {
667569 // main window actions
668- { "copy" , mainwindow_copy_action },
669- { "paste" , mainwindow_paste_action },
670570
671571 { "open" , mainwindow_open_action },
672572 { "merge" , mainwindow_merge_action },
@@ -840,19 +740,6 @@ mainwindow_class_init(MainwindowClass *class)
840740
841741 BIND_CALLBACK (mainwindow_progress_cancel_clicked );
842742 BIND_CALLBACK (mainwindow_close_request );
843-
844- GType supported_types [] = {
845- GDK_TYPE_FILE_LIST ,
846- G_TYPE_FILE ,
847- GDK_TYPE_TEXTURE ,
848- G_TYPE_STRING ,
849- };
850-
851- mainwindow_n_supported_types = VIPS_NUMBER (supported_types );
852- mainwindow_supported_types =
853- VIPS_ARRAY (NULL , mainwindow_n_supported_types + 1 , GType );
854- for (int i = 0 ; i < mainwindow_n_supported_types ; i ++ )
855- mainwindow_supported_types [i ] = supported_types [i ];
856743}
857744
858745static void
0 commit comments