[libgdata] demos: Port scrapbook demo to GtkGrid from GtkTable
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] demos: Port scrapbook demo to GtkGrid from GtkTable
- Date: Sun, 9 Oct 2011 21:23:48 +0000 (UTC)
commit c8ddd2eb7860aca9dc9764f99854bec79de8da1c
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Oct 9 22:01:03 2011 +0100
demos: Port scrapbook demo to GtkGrid from GtkTable
This fixes compilation against GTK+ with deprecations disabled. This also
requires enforcing a minimum version of GTK+ of 2.91.2, which should be fine.
configure.ac | 3 ++-
demos/scrapbook/scrapbook.c | 28 ++++++++++++++++------------
demos/scrapbook/scrapbook.h | 2 +-
3 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 152f616..bc05b07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,7 @@ GLIB_REQS=2.19.0
GIO_REQS=2.17.3
SOUP_REQS=2.26.1
OAUTH_REQS=0.9.4
+GTK_REQS=2.91.2
# Before making a release, the GDATA_LT_VERSION string should be modified. The string is of the form c:r:a. Follow these instructions sequentially:
#
@@ -74,7 +75,7 @@ fi
AC_SUBST(GDK_PIXBUF_CFLAGS)
AC_SUBST(GDK_PIXBUF_LIBS)
-PKG_CHECK_MODULES([GTK], [gtk+-3.0], [have_gtk=yes], [have_gtk=no])
+PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQS], [have_gtk=yes], [have_gtk=no])
AM_CONDITIONAL([HAVE_GTK], [test "x$have_gtk" = "xyes"])
# GNOME support, which pulls in libsoup-gnome-2.4 to provide transparent proxy support
diff --git a/demos/scrapbook/scrapbook.c b/demos/scrapbook/scrapbook.c
index 4d685f2..46c4284 100644
--- a/demos/scrapbook/scrapbook.c
+++ b/demos/scrapbook/scrapbook.c
@@ -19,7 +19,7 @@
/*
* This is an extremely simple example program to query youtube videos
- * and picasa pictures and add them to a table.
+ * and picasa pictures and add them to a grid.
* It was coded as part of the 2010 Google Code-In.
* Click on Properties to change the window's title, or authenticate
* yourself (it's assumed that your google and picasa ids are the same)
@@ -69,10 +69,12 @@ picture_selected (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *colum
gtk_container_add (GTK_CONTAINER (button), image);
/*g_signal_connect (button, "clicked", G_CALLBACK (open_in_web_browser), gdata_entry_get_id (pic));
* commented out, I can't seem to find anything that will give me a picture's URI */
- gtk_table_attach_defaults (GTK_TABLE(self->main_data->table), button,
- self->main_data->currentRow[self->main_data->currentCol],
- self->main_data->currentRow[self->main_data->currentCol]+1,
- self->main_data->currentCol, self->main_data->currentCol+1);
+
+ gtk_grid_attach (GTK_GRID (self->main_data->grid), button,
+ self->main_data->currentCol,
+ self->main_data->currentRow[self->main_data->currentCol],
+ 1, 1);
+
gtk_widget_show (button);
self->main_data->currentRow[self->main_data->currentCol]++;
}
@@ -108,10 +110,12 @@ video_selected (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column,
gtk_container_add (GTK_CONTAINER (button), image);
g_signal_connect (button, "clicked", G_CALLBACK (open_in_web_browser),
(gpointer) gdata_youtube_video_get_player_uri (GDATA_YOUTUBE_VIDEO (video)));
- gtk_table_attach_defaults (GTK_TABLE(self->main_data->table), button,
- self->main_data->currentRow[self->main_data->currentCol],
- self->main_data->currentRow[self->main_data->currentCol]+1,
- self->main_data->currentCol, self->main_data->currentCol+1);
+
+ gtk_grid_attach (GTK_GRID (self->main_data->grid), button,
+ self->main_data->currentCol,
+ self->main_data->currentRow[self->main_data->currentCol],
+ 1, 1);
+
gtk_widget_show (button);
self->main_data->currentRow[self->main_data->currentCol]++;
}
@@ -680,7 +684,7 @@ main(int argc, char **argv)
fUpload->main_data = scrapbook;
scrapbook->box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- scrapbook->table = gtk_table_new (5,5,FALSE);
+ scrapbook->grid = gtk_grid_new ();
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
@@ -708,8 +712,8 @@ main(int argc, char **argv)
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (scrapbook->box1), vbox, FALSE, FALSE, 5);
- gtk_box_pack_start (GTK_BOX (scrapbook->box1), scrapbook->table, TRUE, TRUE, 0);
- gtk_widget_show (scrapbook->table);
+ gtk_box_pack_start (GTK_BOX (scrapbook->box1), scrapbook->grid, TRUE, TRUE, 0);
+ gtk_widget_show (scrapbook->grid);
gtk_widget_show (scrapbook->box1);
gtk_container_add (GTK_CONTAINER (scrapbook->window), scrapbook->box1);
gtk_widget_show (scrapbook->window);
diff --git a/demos/scrapbook/scrapbook.h b/demos/scrapbook/scrapbook.h
index bdafb57..802e736 100644
--- a/demos/scrapbook/scrapbook.h
+++ b/demos/scrapbook/scrapbook.h
@@ -66,7 +66,7 @@ typedef struct _ScrapData {
gint currentCol;
gint currentRow[5];
GtkWidget *box1;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *scrollWindow;
ScrapYTSearch *yt_search;
ScrapPSearch *p_search;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]