GdkDragAction nautilus_drag_drop_background_ask (GtkWidget *widget, GdkDragAction actions) { GtkWidget *menu; GtkWidget *menu_item; DropActionMenuData damd; /* Create the menu and set the sensitivity of the items based on the * allowed actions. */ menu = gtk_menu_new (); gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget)); append_drop_action_menu_item (menu, _("Set as background for _all folders"), NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND, (actions & NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND) != 0, &damd); append_drop_action_menu_item (menu, _("Set as background for _this folder"), NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND, (actions & NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND) != 0, &damd); eel_gtk_menu_append_separator (GTK_MENU (menu)); menu_item = gtk_menu_item_new_with_mnemonic (_("Cancel")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); gtk_widget_show (menu_item); damd.chosen = 0; damd.loop = g_main_loop_new (NULL, FALSE); g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivate_callback), &damd); gtk_grab_add (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); g_main_loop_run (damd.loop); gtk_grab_remove (menu); g_main_loop_unref (damd.loop); gtk_object_sink (GTK_OBJECT (menu)); return damd.chosen; }
/* Pops up a menu of actions to perform on dropped files */ GdkDragAction athena_drag_drop_action_ask (GtkWidget *widget, GdkDragAction actions) { GtkWidget *menu; GtkWidget *menu_item; DropActionMenuData damd; /* Create the menu and set the sensitivity of the items based on the * allowed actions. */ menu = gtk_menu_new (); gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget)); append_drop_action_menu_item (menu, _("_Move Here"), GDK_ACTION_MOVE, (actions & GDK_ACTION_MOVE) != 0, &damd); append_drop_action_menu_item (menu, _("_Copy Here"), GDK_ACTION_COPY, (actions & GDK_ACTION_COPY) != 0, &damd); append_drop_action_menu_item (menu, _("_Link Here"), GDK_ACTION_LINK, (actions & GDK_ACTION_LINK) != 0, &damd); append_drop_action_menu_item (menu, _("Set as _Background"), ATHENA_DND_ACTION_SET_AS_BACKGROUND, (actions & ATHENA_DND_ACTION_SET_AS_BACKGROUND) != 0, &damd); eel_gtk_menu_append_separator (GTK_MENU (menu)); menu_item = gtk_menu_item_new_with_mnemonic (_("Cancel")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); gtk_widget_show (menu_item); damd.chosen = 0; damd.loop = g_main_loop_new (NULL, FALSE); g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivate_callback), &damd); gtk_grab_add (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); g_main_loop_run (damd.loop); gtk_grab_remove (menu); g_main_loop_unref (damd.loop); g_object_ref_sink (menu); g_object_unref (menu); return damd.chosen; }