GtkWidget * gimp_document_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpDocumentView *document_view; GimpContainerEditor *editor; document_view = g_object_new (GIMP_TYPE_DOCUMENT_VIEW, NULL); if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (document_view), view_type, container, context, view_size, view_border_width, menu_factory, "<Documents>", "/documents-popup")) { g_object_unref (document_view); return NULL; } editor = GIMP_CONTAINER_EDITOR (document_view); document_view->open_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-open", "documents-raise-or-open", GDK_SHIFT_MASK, "documents-file-open-dialog", GDK_CONTROL_MASK, NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->open_button), GIMP_TYPE_IMAGEFILE); document_view->remove_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-remove", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->remove_button), GIMP_TYPE_IMAGEFILE); gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-clear", NULL); document_view->refresh_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-recreate-preview", "documents-reload-previews", GDK_SHIFT_MASK, "documents-remove-dangling", GDK_CONTROL_MASK, NULL); if (view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *dnd_widget; dnd_widget = gimp_container_view_get_dnd_widget (editor->view); gimp_dnd_uri_list_source_add (dnd_widget, gimp_document_view_drag_uri_list, editor); } gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor); return GTK_WIDGET (document_view); }
GtkWidget * gimp_document_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpDocumentView *document_view; GimpContainerEditor *editor; g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (view_size > 0 && view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE); g_return_val_if_fail (view_border_width >= 0 && view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH, FALSE); g_return_val_if_fail (menu_factory == NULL || GIMP_IS_MENU_FACTORY (menu_factory), NULL); document_view = g_object_new (GIMP_TYPE_DOCUMENT_VIEW, "view-type", view_type, "container", container, "context", context, "view-size", view_size, "view-border-width", view_border_width, "menu-factory", menu_factory, "menu-identifier", "<Documents>", "ui-path", "/documents-popup", NULL); editor = GIMP_CONTAINER_EDITOR (document_view); document_view->open_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-open", "documents-raise-or-open", GDK_SHIFT_MASK, "documents-file-open-dialog", gimp_get_toggle_behavior_mask (), NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->open_button), GIMP_TYPE_IMAGEFILE); document_view->remove_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-remove", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (document_view->remove_button), GIMP_TYPE_IMAGEFILE); gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-clear", NULL); document_view->refresh_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "documents", "documents-recreate-preview", "documents-reload-previews", GDK_SHIFT_MASK, "documents-remove-dangling", gimp_get_toggle_behavior_mask (), NULL); if (view_type == GIMP_VIEW_TYPE_LIST) { GtkWidget *dnd_widget; dnd_widget = gimp_container_view_get_dnd_widget (editor->view); gimp_dnd_uri_list_source_add (dnd_widget, gimp_document_view_drag_uri_list, editor); } gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (document_view); }