[gimp/gtk3-port: 374/386] libgimpwidgets: port GimpPreview to GtkGrid
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 374/386] libgimpwidgets: port GimpPreview to GtkGrid
- Date: Wed, 9 May 2018 09:53:45 +0000 (UTC)
commit 526ac4785f408ec860eca983f590b5886665ebff
Author: Michael Natterer <mitch gimp org>
Date: Tue May 8 12:29:01 2018 +0200
libgimpwidgets: port GimpPreview to GtkGrid
libgimpwidgets/gimppreview.c | 26 +++++++++++++-------------
libgimpwidgets/gimppreview.h | 2 +-
libgimpwidgets/gimpscrolledpreview.c | 18 +++++++-----------
3 files changed, 21 insertions(+), 25 deletions(-)
---
diff --git a/libgimpwidgets/gimppreview.c b/libgimpwidgets/gimppreview.c
index 881edcf..0acbacf 100644
--- a/libgimpwidgets/gimppreview.c
+++ b/libgimpwidgets/gimppreview.c
@@ -63,7 +63,7 @@ enum
struct _GimpPreviewPrivate
{
GtkWidget *area;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *frame;
GtkWidget *toggle;
GtkWidget *controls;
@@ -242,10 +242,9 @@ gimp_preview_init (GimpPreview *preview)
gtk_box_pack_start (GTK_BOX (preview), priv->frame, TRUE, TRUE, 0);
gtk_widget_show (priv->frame);
- priv->table = gtk_table_new (3, 2, FALSE);
- gtk_table_set_row_spacing (GTK_TABLE (priv->table), 1, 3);
- gtk_container_add (GTK_CONTAINER (priv->frame), priv->table);
- gtk_widget_show (priv->table);
+ priv->grid = gtk_grid_new ();
+ gtk_container_add (GTK_CONTAINER (priv->frame), priv->grid);
+ gtk_widget_show (priv->grid);
priv->timeout_id = 0;
@@ -262,8 +261,9 @@ gimp_preview_init (GimpPreview *preview)
/* preview area */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_table_attach (GTK_TABLE (priv->table), frame, 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
+ gtk_widget_set_hexpand (frame, TRUE);
+ gtk_widget_set_vexpand (frame, TRUE);
+ gtk_grid_attach (GTK_GRID (priv->grid), frame, 0, 0, 1, 1);
gtk_widget_show (frame);
priv->area = gimp_preview_area_new ();
@@ -307,8 +307,8 @@ gimp_preview_init (GimpPreview *preview)
preview, NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
priv->controls = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_table_attach (GTK_TABLE (priv->table), priv->controls, 0, 2, 2, 3,
- GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
+ gtk_widget_set_margin_top (priv->controls, 3);
+ gtk_grid_attach (GTK_GRID (priv->grid), priv->controls, 0, 2, 2, 1);
gtk_widget_show (priv->controls);
/* toggle button to (de)activate the instant preview */
@@ -831,19 +831,19 @@ gimp_preview_get_frame (GimpPreview *preview)
}
/**
- * gimp_preview_get_table:
+ * gimp_preview_get_grid:
* @preview: a #GimpPreview widget
*
- * Return value: a pointer to the #GtkTable used in the @preview.
+ * Return value: a pointer to the #GtkGrid used in the @preview.
*
* Since: 3.0
**/
GtkWidget *
-gimp_preview_get_table (GimpPreview *preview)
+gimp_preview_get_grid (GimpPreview *preview)
{
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), NULL);
- return GET_PRIVATE (preview)->table;
+ return GET_PRIVATE (preview)->grid;
}
/**
diff --git a/libgimpwidgets/gimppreview.h b/libgimpwidgets/gimppreview.h
index ccef991..0c5508b 100644
--- a/libgimpwidgets/gimppreview.h
+++ b/libgimpwidgets/gimppreview.h
@@ -137,7 +137,7 @@ void gimp_preview_untransform (GimpPreview *preview,
gint *dest_y);
GtkWidget * gimp_preview_get_frame (GimpPreview *preview);
-GtkWidget * gimp_preview_get_table (GimpPreview *preview);
+GtkWidget * gimp_preview_get_grid (GimpPreview *preview);
GtkWidget * gimp_preview_get_area (GimpPreview *preview);
void gimp_preview_draw (GimpPreview *preview);
diff --git a/libgimpwidgets/gimpscrolledpreview.c b/libgimpwidgets/gimpscrolledpreview.c
index 5d3acf1..e5c7683 100644
--- a/libgimpwidgets/gimpscrolledpreview.c
+++ b/libgimpwidgets/gimpscrolledpreview.c
@@ -152,7 +152,7 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview)
{
GimpScrolledPreviewPrivate *priv;
GtkWidget *image;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *area;
GtkAdjustment *adj;
gint width;
@@ -172,7 +172,7 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview)
priv->in_drag = FALSE;
priv->frozen = 1; /* we are frozen during init */
- table = gimp_preview_get_table (GIMP_PREVIEW (preview));
+ grid = gimp_preview_get_grid (GIMP_PREVIEW (preview));
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
@@ -185,9 +185,8 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview)
preview);
priv->hscr = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adj);
- gtk_table_attach (GTK_TABLE (table),
- priv->hscr, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_hexpand (priv->hscr, TRUE);
+ gtk_grid_attach (GTK_GRID (grid), priv->hscr, 0, 1, 1, 1);
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height - 1, 1.0,
height, height));
@@ -197,9 +196,8 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview)
preview);
priv->vscr = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adj);
- gtk_table_attach (GTK_TABLE (table),
- priv->vscr, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_set_vexpand (priv->vscr, TRUE);
+ gtk_grid_attach (GTK_GRID (grid), priv->vscr, 1, 0, 1, 1);
area = gimp_preview_get_area (GIMP_PREVIEW (preview));
@@ -223,9 +221,7 @@ gimp_scrolled_preview_init (GimpScrolledPreview *preview)
/* navigation icon */
priv->nav_icon = gtk_event_box_new ();
- gtk_table_attach (GTK_TABLE (table),
- priv->nav_icon, 1,2, 1,2,
- GTK_SHRINK, GTK_SHRINK, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), priv->nav_icon, 1, 1, 1, 1);
image = gtk_image_new_from_icon_name (GIMP_ICON_DIALOG_NAVIGATION,
GTK_ICON_SIZE_MENU);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]