summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-07-29 15:22:42 -0700
committerJohn Stebbins <[email protected]>2019-07-29 15:22:42 -0700
commiteac6a03790d684b076d40759363e9c3b6bddb5d4 (patch)
treeaa2f322f8c46439c10c72e9aa0ab0982749341fd /gtk
parenta75241042529818b5e4483fced9d645f02285585 (diff)
LinGui: gtk4 port, fix summary tab preview image scaling
GTK4 added a new widgit GtkPicture that is almost identical to GtkImage. The main difference appears to be that GtkImage now scales down the size of the given pixbuf using some undocumented algorithm. It's filling some of the space available, but not all of it. But it isn't a hard size limit because making the window bigger continues to make the image bigger. GtkPicture shows the pixbuf unscaled as expected. So use GtkPicture for the preview image :*(
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c9
-rw-r--r--gtk/src/ghb3.ui45
-rw-r--r--gtk/src/ghb4.ui38
-rw-r--r--gtk/src/preview.c7
4 files changed, 57 insertions, 42 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 13c3373e9..1c5ebae68 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2314,11 +2314,18 @@ ghb_update_summary_info(signal_user_data_t *ud)
gtk_label_set_text(GTK_LABEL(widget), "");
widget = GHB_WIDGET(ud->builder, "dimensions_summary");
gtk_label_set_text(GTK_LABEL(widget), "--");
+ widget = GHB_WIDGET(ud->builder, "summary_image");
+ gtk_widget_show(widget);
widget = GHB_WIDGET(ud->builder, "preview_button_image");
- ghb_image_set_from_icon_name(GTK_IMAGE(widget), "hb-icon", 128);
+ gtk_widget_hide(widget);
return;
}
+ widget = GHB_WIDGET(ud->builder, "summary_image");
+ gtk_widget_hide(widget);
+ widget = GHB_WIDGET(ud->builder, "preview_button_image");
+ gtk_widget_show(widget);
+
// Video Track
const hb_encoder_t * video_encoder;
const hb_rate_t * fps;
diff --git a/gtk/src/ghb3.ui b/gtk/src/ghb3.ui
index 1c175be0a..e7d1b8d95 100644
--- a/gtk/src/ghb3.ui
+++ b/gtk/src/ghb3.ui
@@ -3106,35 +3106,38 @@ sync for broken players that do not honor MP4 edit lists.</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="vbox9">
- <property name="orientation">vertical</property>
+ <object class="GtkImage" id="summary_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
<property name="expand">True</property>
- <property name="margin-top">12</property>
- <property name="margin-end">0</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <object class="GtkImage" id="preview_button_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-bottom">4</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
- <property name="expand">True</property>
- <property name="pixel_size">128</property>
- <property name="icon_name">hb-icon</property>
- <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkImage" id="preview_button_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="expand">True</property>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
+ <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
diff --git a/gtk/src/ghb4.ui b/gtk/src/ghb4.ui
index 5bc690b31..d90ac98df 100644
--- a/gtk/src/ghb4.ui
+++ b/gtk/src/ghb4.ui
@@ -2674,26 +2674,30 @@ sync for broken players that do not honor MP4 edit lists.</property>
</object>
</child>
<child>
- <object class="GtkBox" id="vbox9">
- <property name="orientation">vertical</property>
+ <object class="GtkImage" id="summary_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
<property name="expand">True</property>
- <property name="margin-top">12</property>
- <property name="margin-end">0</property>
- <child>
- <object class="GtkImage" id="preview_button_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-bottom">4</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
- <property name="expand">True</property>
- <property name="pixel_size">128</property>
- <property name="icon_name">hb-icon</property>
- <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
- </object>
- </child>
+ <property name="pixel_size">128</property>
+ <property name="icon_name">hb-icon</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkPicture" id="preview_button_image">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="vexpand">True</property>
+ <property name="valign">fill</property>
+ <property name="expand">True</property>
+ <signal name="size-allocate" handler="preview_button_size_allocate_cb" swapped="no"/>
</object>
</child>
</object>
diff --git a/gtk/src/preview.c b/gtk/src/preview.c
index 6721b3284..3272d4787 100644
--- a/gtk/src/preview.c
+++ b/gtk/src/preview.c
@@ -861,7 +861,11 @@ static void set_mini_preview_image(signal_user_data_t *ud, GdkPixbuf * pix)
GtkWidget * widget;
widget = GHB_WIDGET (ud->builder, "preview_button_image");
+#if GTK_CHECK_VERSION(3, 90, 0)
+ gtk_picture_set_pixbuf(GTK_PICTURE(widget), scaled_preview);
+#else
gtk_image_set_from_pixbuf(GTK_IMAGE(widget), scaled_preview);
+#endif
g_object_unref(scaled_preview);
}
}
@@ -932,7 +936,6 @@ init_preview_image(signal_user_data_t *ud)
GtkWidget *widget;
gint width, height;
- g_debug("set_preview_button_image ()");
gint title_id, titleindex;
const hb_title_t *title;
@@ -1094,8 +1097,6 @@ preview_button_size_allocate_cb(
g_debug("nothing to do");
return;
}
- g_debug("prev allocate %d x %d", ud->preview->button_width,
- ud->preview->button_height);
ud->preview->button_width = width;
ud->preview->button_height = height;
set_mini_preview_image(ud, ud->preview->pix);