Skip to content

Preview pane - #3650

Merged
mtwebster merged 1 commit into
linuxmint:masterfrom
mtwebster:preview-pane
Oct 30, 2026
Merged

mtwebster merged 1 commit into
linuxmint:masterfrom
mtwebster:preview-pane

Conversation

@mtwebster

@mtwebster mtwebster commented Dec 10, 2025 •

Copy link
Copy Markdown
Member

Add a preview pane

  • Uses folder metadata for visibility - it defaults to visible in the
    Pictures, Music and Videos folders.
  • Audio and Video can be played
  • Audio art is extracted if available, otherwise the thumbnail is used
  • Supported images are rendered at size.
  • Other file types show a thumbnail or icon
    related discussion:
  • https://github.com/orgs/linuxmint/discussions/949

ref: #2122, #3085, #2431

@mtwebster
mtwebster marked this pull request as draft December 10, 2025 23:29
@CyrilCommando

Copy link
Copy Markdown

Looking good

@mtwebster
mtwebster requested a review from Copilot December 15, 2025 23:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a new preview pane feature to Nemo, allowing users to view image previews and file details directly within the file manager. The implementation includes a split-pane interface with image preview at the top and metadata at the bottom, activated via F7 or the View menu.

Key Changes:

  • New preview pane infrastructure with split-pane layout (horizontal for main view, vertical for preview sections)
  • Image preview widget with optimized loading and responsive resize handling
  • File details widget displaying metadata (name, size, type, modified date, permissions, location)

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/nemo-window.h Added public API declarations for preview pane on/off/showing functions
src/nemo-window.c Implemented preview pane lifecycle management, selection tracking, and split view integration
src/nemo-window-private.h Added preview pane widget and state flag to window details struct
src/nemo-window-menus.c Added preview pane toggle action with F7 keyboard shortcut
src/nemo-preview-pane.h Header for main preview pane container widget
src/nemo-preview-pane.c Container managing vertical split between image and details widgets
src/nemo-actions.h Added action constant for preview pane toggle
src/meson.build Registered preview pane source file in build
libnemo-private/org.nemo.gschema.xml Added settings schema for pane width and details height persistence
libnemo-private/nemo-preview-image.h Header for image preview widget
libnemo-private/nemo-preview-image.c Image display with debounced resize and Cairo rendering
libnemo-private/nemo-preview-details.h Header for file metadata widget
libnemo-private/nemo-preview-details.c Grid-based display of file properties
libnemo-private/nemo-global-preferences.h Declared preview pane GSettings object
libnemo-private/nemo-global-preferences.c Initialized and finalized preview pane settings
libnemo-private/meson.build Registered preview image and details source files
gresources/nemo-shell-ui.xml Added preview pane menu item to View menu

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/nemo-window.c Outdated
Comment on lines +1549 to +1551
/* Forward declaration for preview pane callback */
static void preview_pane_selection_changed_callback (NemoView *view, NemoWindow *window);

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forward declaration placed far from its usage. Consider moving this declaration closer to the first function that uses it (nemo_window_connect_content_view at line 1587) or reorganizing the function order to eliminate the forward declaration.

Suggested change
/* Forward declaration for preview pane callback */
static void preview_pane_selection_changed_callback (NemoView *view, NemoWindow *window);

Copilot uses AI. Check for mistakes.
Comment thread src/nemo-window.c Outdated
Comment on lines +2350 to +2352
/* Fallback to 60/40 split if no saved value */
gtk_paned_set_position (GTK_PANED (window->details->split_view_hpane),
total_width * 0.6);

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number 0.6 should be defined as a named constant (e.g., DEFAULT_PREVIEW_PANE_RATIO) to clarify intent and enable easy adjustment.

Copilot uses AI. Check for mistakes.
Comment thread libnemo-private/nemo-preview-image.c Outdated
widget_height = gtk_widget_get_allocated_height (widget);

/* Get surface dimensions - works for image surfaces created from pixbufs */
scale_factor = gtk_widget_get_scale_factor (widget);

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential division by zero if scale_factor is 0. The gtk_widget_get_scale_factor documentation indicates it returns a positive integer, but defensive coding would add a check or assertion before division to handle unexpected values.

Suggested change
scale_factor = gtk_widget_get_scale_factor (widget);
scale_factor = gtk_widget_get_scale_factor (widget);
if (scale_factor <= 0) {
g_warning ("gtk_widget_get_scale_factor returned %d; avoiding division by zero.", scale_factor);
return FALSE;
}

Copilot uses AI. Check for mistakes.
ui_scale = gtk_widget_get_scale_factor (GTK_WIDGET (widget));
orig_width = gdk_pixbuf_get_width (priv->current_pixbuf);
orig_height = gdk_pixbuf_get_height (priv->current_pixbuf);

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential division by zero if orig_width or orig_height is 0. While gdk_pixbuf_get_width/height typically return positive values, a zero-dimension pixbuf could cause a crash. Add validation before performing division.

Suggested change
/* Prevent division by zero if pixbuf has zero width or height */
if (orig_width == 0 || orig_height == 0) {
return;
}

Copilot uses AI. Check for mistakes.
mtwebster added a commit to linuxmint/nemo-extensions that referenced this pull request Aug 10, 2026
This plugin really needs a rewrite or retirement (such as
linuxmint/nemo#3650), but for now keep it working as an x11 client.
@mtwebster
mtwebster force-pushed the preview-pane branch 2 times, most recently from 7c3fb9a to 8515afe Compare October 28, 2026 01:04
@mtwebster
mtwebster marked this pull request as ready for review October 28, 2026 13:04
@mtwebster mtwebster changed the title [WIP] Preview pane Preview pane Oct 28, 2026
@mtwebster
mtwebster force-pushed the preview-pane branch 3 times, most recently from ade0853 to 93dd62b Compare October 30, 2026 02:02
- Uses folder metadata for visibility - it defaults to visible in the
  Pictures, Music and Videos folders.
- Audio and Video can be played.
- Audio art is extracted if available, otherwise the thumbnail is used.
- Supported images are rendered at size..
- Other file types show a thumbnail or icon.
- Toggles via F7 or button in the status bar.
@mtwebster
mtwebster merged commit d081606 into linuxmint:master Oct 30, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants