[poppler] 5 commits - glib/demo

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Jul 26 00:56:46 PDT 2015


 glib/demo/annots.c      |   31 +++++++++--------------
 glib/demo/attachments.c |    1 
 glib/demo/find.c        |    1 
 glib/demo/fonts.c       |    1 
 glib/demo/forms.c       |   23 +++++++++--------
 glib/demo/info.cc       |   18 ++++++++-----
 glib/demo/main.c        |   26 +++++--------------
 glib/demo/page.c        |   34 +++++++++++++++----------
 glib/demo/selections.c  |   16 ------------
 glib/demo/text.c        |   18 ++++++++-----
 glib/demo/transitions.c |    1 
 glib/demo/utils.c       |   64 +++++++++++++++++++++++++++---------------------
 12 files changed, 113 insertions(+), 121 deletions(-)

New commits:
commit fb264bfa8bf7142cabc8d94a86594cf0e7c9f134
Author: Hib Eris <hib at hiberis.nl>
Date:   Fri Jul 24 22:18:26 2015 +0200

    glib-demo: Remove code for no longer supported gtk versions
    
    https://bugs.freedesktop.org/show_bug.cgi?id=88788

diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index 13f1bc8..7f2e861 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -458,11 +458,7 @@ pgd_annot_color_changed (GtkButton     *button,
                          GParamSpec    *pspec,
                          PgdAnnotsDemo *demo)
 {
-#if GTK_CHECK_VERSION(3,4,0)
     gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &demo->annot_color);
-#else
-    gtk_color_button_get_rgba (GTK_COLOR_BUTTON (button), &demo->annot_color);
-#endif
 }
 
 static void
@@ -1336,11 +1332,7 @@ pgd_annots_create_widget (PopplerDocument *document)
     button = gtk_color_button_new ();
     demo->annot_color.red = 65535;
     demo->annot_color.alpha = 1.0;
-#if GTK_CHECK_VERSION(3,4,0)
     gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), &demo->annot_color);
-#else
-    gtk_color_button_set_rgba (GTK_COLOR_BUTTON (button), &demo->annot_color);
-#endif
     g_signal_connect (button, "notify::color",
                       G_CALLBACK (pgd_annot_color_changed),
                       (gpointer)demo);
diff --git a/glib/demo/selections.c b/glib/demo/selections.c
index 567a880..dc6c672 100644
--- a/glib/demo/selections.c
+++ b/glib/demo/selections.c
@@ -336,17 +336,9 @@ pgd_selections_drawing_area_realize (GtkWidget         *area,
 	g_object_set (area, "has-tooltip", TRUE, NULL);
 
         gtk_style_context_get_color (style_context, GTK_STATE_FLAG_SELECTED, &rgba);
-#if GTK_CHECK_VERSION(3,4,0)
 	gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->fg_color_button), &rgba);
-#else
-        gtk_color_button_set_rgba (GTK_COLOR_BUTTON (demo->fg_color_button), &rgba);
-#endif
         gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_SELECTED, &rgba);
-#if GTK_CHECK_VERSION(3,4,0)
 	gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->bg_color_button), &rgba);
-#else
-        gtk_color_button_set_rgba (GTK_COLOR_BUTTON (demo->bg_color_button), &rgba);
-#endif
 }
 
 static gboolean
@@ -465,11 +457,7 @@ pgd_selections_fg_color_changed (GtkColorButton    *button,
 {
 	GdkRGBA color;
 
-#if GTK_CHECK_VERSION(3,4,0)
 	gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
-#else
-	gtk_color_button_get_rgba (GTK_COLOR_BUTTON (button), &color);
-#endif
 	demo->glyph_color.red = CLAMP ((guint) (color.red * 65535), 0, 65535);
 	demo->glyph_color.green = CLAMP ((guint) (color.green * 65535), 0, 65535);
 	demo->glyph_color.blue = CLAMP ((guint) (color.blue * 65535), 0, 65535);
@@ -482,11 +470,7 @@ pgd_selections_bg_color_changed (GtkColorButton    *button,
 {
 	GdkRGBA color;
 
-#if GTK_CHECK_VERSION(3,4,0)
 	gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
-#else
-	gtk_color_button_get_rgba (GTK_COLOR_BUTTON (button), &color);
-#endif
 	demo->background_color.red = CLAMP ((guint) (color.red * 65535), 0, 65535);
 	demo->background_color.green = CLAMP ((guint) (color.green * 65535), 0, 65535);
 	demo->background_color.blue = CLAMP ((guint) (color.blue * 65535), 0, 65535);
commit dd0883649ac296c6033474fe5991c534ac2ce594
Author: Hib Eris <hib at hiberis.nl>
Date:   Fri Jul 24 22:09:57 2015 +0200

    glib-demo: Remove use of deprecated gtk_dialog_set_alternative_button_order()
    
    https://bugs.freedesktop.org/show_bug.cgi?id=88788

diff --git a/glib/demo/main.c b/glib/demo/main.c
index 750f5e8..24c7b51 100644
--- a/glib/demo/main.c
+++ b/glib/demo/main.c
@@ -195,10 +195,6 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 	gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
 					   GTK_RESPONSE_OK, FALSE);
-	gtk_dialog_set_alternative_button_order (dialog,
-						 GTK_RESPONSE_OK,
-						 GTK_RESPONSE_CANCEL,
-						 -1);
 
 	/* Build contents */
 	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
commit ffc798a7fcf95d2aaf123772072ef956ceb2dff7
Author: Hib Eris <hib at hiberis.nl>
Date:   Sun Jan 25 18:16:04 2015 +0100

    glib-demo: Remove deprecated use of gtk_misc_set_alignment()
    
    https://bugs.freedesktop.org/show_bug.cgi?id=88788

diff --git a/glib/demo/main.c b/glib/demo/main.c
index d1a1215..750f5e8 100644
--- a/glib/demo/main.c
+++ b/glib/demo/main.c
@@ -208,8 +208,8 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 
 	icon = gtk_image_new_from_icon_name ("dialog-password",
 					 GTK_ICON_SIZE_DIALOG);
-
-	gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0);
+	gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
+	gtk_widget_set_valign (icon, GTK_ALIGN_START);
 	gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
 	gtk_widget_show (icon);
 
@@ -218,7 +218,8 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 	gtk_widget_show (main_vbox);
 
 	label = gtk_label_new (NULL);
-	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+        gtk_widget_set_halign (label, GTK_ALIGN_START);
+        gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
 	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
 	file_name = g_file_get_basename (uri_file);
 	format = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s",
@@ -245,7 +246,8 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 	gtk_widget_show (table);
 
 	label = gtk_label_new_with_mnemonic ("_Password:");
-	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+        gtk_widget_set_halign (label, GTK_ALIGN_START);
+        gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
 
 	password_entry = gtk_entry_new ();
 	gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE);
commit 56915b2989fc244b58a454fe40412eb731e706bd
Author: Hib Eris <hib at hiberis.nl>
Date:   Sun Jan 25 13:10:31 2015 +0100

    glib-demo: Remove use of deprecated GtkAlignment
    
    https://bugs.freedesktop.org/show_bug.cgi?id=88788

diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index 168575e..13f1bc8 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -619,27 +619,30 @@ static void
 pgd_annot_view_set_annot (PgdAnnotsDemo *demo,
                           PopplerAnnot  *annot)
 {
-    GtkWidget  *alignment;
     GtkWidget  *table;
     gint        row = 0;
     gchar      *text;
     time_t      timet;
     PopplerRectangle rect;
 
-    alignment = gtk_bin_get_child (GTK_BIN (demo->annot_view));
-    if (alignment) {
-        gtk_container_remove (GTK_CONTAINER (demo->annot_view), alignment);
+    table = gtk_bin_get_child (GTK_BIN (demo->annot_view));
+    if (table) {
+        gtk_container_remove (GTK_CONTAINER (demo->annot_view), table);
     }
 
-    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 8, 5);
-    gtk_container_add (GTK_CONTAINER (demo->annot_view), alignment);
-    gtk_widget_show (alignment);
-
     if (!annot)
         return;
 
     table = gtk_grid_new ();
+    gtk_widget_set_margin_top (table, 5);
+    gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+    gtk_widget_set_margin_start (table, 8);
+    gtk_widget_set_margin_end (table, 5);
+#else
+    gtk_widget_set_margin_left (table, 8);
+    gtk_widget_set_margin_right (table, 5);
+#endif
     gtk_grid_set_column_spacing (GTK_GRID (table), 6);
     gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -694,7 +697,7 @@ pgd_annot_view_set_annot (PgdAnnotsDemo *demo,
           break;
     }
 
-    gtk_container_add (GTK_CONTAINER (alignment), table);
+    gtk_container_add (GTK_CONTAINER (demo->annot_view), table);
     gtk_widget_show (table);
 }
 
diff --git a/glib/demo/forms.c b/glib/demo/forms.c
index 9dfe3cd..8fa8785 100644
--- a/glib/demo/forms.c
+++ b/glib/demo/forms.c
@@ -129,27 +129,30 @@ static void
 pgd_form_field_view_set_field (GtkWidget        *field_view,
 			       PopplerFormField *field)
 {
-	GtkWidget     *alignment;
 	GtkWidget     *table;
         PopplerAction *action;
 	GEnumValue    *enum_value;
 	gchar         *text;
 	gint           row = 0;
 
-	alignment = gtk_bin_get_child (GTK_BIN (field_view));
-	if (alignment) {
-		gtk_container_remove (GTK_CONTAINER (field_view), alignment);
+	table = gtk_bin_get_child (GTK_BIN (field_view));
+	if (table) {
+		gtk_container_remove (GTK_CONTAINER (field_view), table);
 	}
-	
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (field_view), alignment);
-	gtk_widget_show (alignment);
 
 	if (!field)
 		return;
 
 	table = gtk_grid_new ();
+	gtk_widget_set_margin_top (table, 5);
+	gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (table, 12);
+	gtk_widget_set_margin_end (table, 5);
+#else
+	gtk_widget_set_margin_left (table, 12);
+	gtk_widget_set_margin_right (table, 5);
+#endif
 	gtk_grid_set_column_spacing (GTK_GRID (table), 6);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -251,7 +254,7 @@ pgd_form_field_view_set_field (GtkWidget        *field_view,
 		g_assert_not_reached ();
 	}
 
-	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_container_add (GTK_CONTAINER (field_view), table);
 	gtk_widget_show (table);
 }
 
diff --git a/glib/demo/info.cc b/glib/demo/info.cc
index 590ddc7..a396ba1 100644
--- a/glib/demo/info.cc
+++ b/glib/demo/info.cc
@@ -143,7 +143,7 @@ pgd_info_create_widget (PopplerDocument *document)
 {
 	GtkWidget *vbox;
 	GtkWidget *label;
-	GtkWidget *frame, *alignment, *table;
+	GtkWidget *frame, *table;
 	gchar     *str;
 	gchar     *title, *format, *author, *subject;
 	gchar     *keywords, *creator, *producer;
@@ -196,13 +196,17 @@ pgd_info_create_widget (PopplerDocument *document)
 	gtk_label_set_markup (GTK_LABEL (label), "<b>Document properties</b>");
 	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
 	gtk_widget_show (label);
-	
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (frame), alignment);
-	gtk_widget_show (alignment);
 
 	table = gtk_grid_new ();
+	gtk_widget_set_margin_top (table, 5);
+	gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (table, 12);
+	gtk_widget_set_margin_end (table, 5);
+#else
+	gtk_widget_set_margin_left (table, 12);
+	gtk_widget_set_margin_right (table, 5);
+#endif
 	gtk_grid_set_column_spacing (GTK_GRID (table), 6);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -261,7 +265,7 @@ pgd_info_create_widget (PopplerDocument *document)
 
 	/* TODO: view_prefs */
 
-	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_container_add (GTK_CONTAINER (frame), table);
 	gtk_widget_show (table);
 
 	gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
diff --git a/glib/demo/main.c b/glib/demo/main.c
index 1816825..d1a1215 100644
--- a/glib/demo/main.c
+++ b/glib/demo/main.c
@@ -170,7 +170,6 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 {
 	GtkDialog *dialog;
 	GtkWidget *content_area;
-	GtkWidget *entry_container;
 	GtkWidget *password_entry;
 	GtkWidget *hbox, *main_vbox, *vbox, *icon;
 	GtkWidget *table;
@@ -239,19 +238,10 @@ pgd_demo_get_auth_dialog (GFile *uri_file)
 	gtk_widget_show (vbox);
 
 	/* The table that holds the entries */
-	entry_container = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
-
-	gtk_alignment_set_padding (GTK_ALIGNMENT (entry_container),
-				   0, 0, 0, 0);
-
-	gtk_box_pack_start (GTK_BOX (vbox), entry_container,
-			    FALSE, FALSE, 0);
-	gtk_widget_show (entry_container);
-
 	table = gtk_grid_new ();
 	gtk_grid_set_column_spacing (GTK_GRID (table), 12);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
-	gtk_container_add (GTK_CONTAINER (entry_container), table);
+	gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
 	gtk_widget_show (table);
 
 	label = gtk_label_new_with_mnemonic ("_Password:");
diff --git a/glib/demo/page.c b/glib/demo/page.c
index f9413a8..ba7e52f 100644
--- a/glib/demo/page.c
+++ b/glib/demo/page.c
@@ -215,7 +215,7 @@ pgd_page_create_widget (PopplerDocument *document)
 	GtkWidget   *vbox;
 	GtkWidget   *hbox, *page_selector;
 	GtkWidget   *button;
-	GtkWidget   *frame, *alignment;
+	GtkWidget   *frame;
 	GtkWidget   *table;
 	GtkWidget   *label;
 	GtkWidget   *thumnail_box;
@@ -269,12 +269,16 @@ pgd_page_create_widget (PopplerDocument *document)
 	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
 	gtk_widget_show (label);
 
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (frame), alignment);
-	gtk_widget_show (alignment);
-
 	table = gtk_grid_new ();
+	gtk_widget_set_margin_top (table, 5);
+	gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (table, 12);
+	gtk_widget_set_margin_end (table, 5);
+#else
+	gtk_widget_set_margin_left (table, 12);
+	gtk_widget_set_margin_right (table, 5);
+#endif
 	gtk_grid_set_column_spacing (GTK_GRID (table), 6);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -287,7 +291,7 @@ pgd_page_create_widget (PopplerDocument *document)
 	pgd_table_add_property_with_value_widget (GTK_GRID (table), "<b>Page Duration:</b>",
 						  &(demo->duration), NULL, &row);
 
-	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_container_add (GTK_CONTAINER (frame), table);
 	gtk_widget_show (table);
 
 	gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
@@ -301,12 +305,16 @@ pgd_page_create_widget (PopplerDocument *document)
 	gtk_frame_set_label_widget (GTK_FRAME (frame), label);
 	gtk_widget_show (label);
 
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (frame), alignment);
-	gtk_widget_show (alignment);
-	
 	thumnail_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+	gtk_widget_set_margin_top (thumnail_box, 5);
+	gtk_widget_set_margin_bottom (thumnail_box, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (thumnail_box, 12);
+	gtk_widget_set_margin_end (thumnail_box, 5);
+#else
+	gtk_widget_set_margin_left (thumnail_box, 12);
+	gtk_widget_set_margin_right (thumnail_box, 5);
+#endif
 	
 	demo->thumbnail = gtk_image_new ();
 	gtk_box_pack_start (GTK_BOX (thumnail_box), demo->thumbnail, TRUE, TRUE, 0);
@@ -317,7 +325,7 @@ pgd_page_create_widget (PopplerDocument *document)
 	gtk_box_pack_start (GTK_BOX (thumnail_box), demo->thumbnail_size, TRUE, TRUE, 0);
 	gtk_widget_show (demo->thumbnail_size);
 
-	gtk_container_add (GTK_CONTAINER (alignment), thumnail_box);
+	gtk_container_add (GTK_CONTAINER (frame), thumnail_box);
 	gtk_widget_show (thumnail_box);
 
 	gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
diff --git a/glib/demo/text.c b/glib/demo/text.c
index 8af3ce3..af74cd6 100644
--- a/glib/demo/text.c
+++ b/glib/demo/text.c
@@ -330,7 +330,7 @@ pgd_text_create_widget (PopplerDocument *document)
 	GtkWidget        *button;
 	GtkWidget        *swindow, *textview, *treeview;
 	GtkTreeSelection *selection;
-        GtkWidget        *frame, *alignment, *table;
+        GtkWidget        *frame, *table;
 	GtkWidget        *hpaned;
 	GtkCellRenderer  *renderer;
 	gchar            *str;
@@ -515,12 +515,16 @@ pgd_text_create_widget (PopplerDocument *document)
         gtk_frame_set_label_widget (GTK_FRAME (frame), label);
         gtk_widget_show (label);
 
-        alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-        gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-        gtk_container_add (GTK_CONTAINER (frame), alignment);
-        gtk_widget_show (alignment);
-
         table = gtk_grid_new ();
+        gtk_widget_set_margin_top (table, 5);
+        gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+        gtk_widget_set_margin_start (table, 12);
+        gtk_widget_set_margin_end (table, 5);
+#else
+        gtk_widget_set_margin_left (table, 12);
+        gtk_widget_set_margin_right (table, 5);
+#endif
         gtk_grid_set_column_spacing (GTK_GRID (table), 6);
         gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -533,7 +537,7 @@ pgd_text_create_widget (PopplerDocument *document)
         demo->text_color = gtk_image_new ();
         pgd_table_add_property_with_custom_widget (GTK_GRID (table), "<b>Color:</b>", demo->text_color, &row);
 
-        gtk_container_add (GTK_CONTAINER (alignment), table);
+        gtk_container_add (GTK_CONTAINER (frame), table);
         gtk_widget_show (table);
 
 	gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 12);
diff --git a/glib/demo/utils.c b/glib/demo/utils.c
index 5833104..440793b 100644
--- a/glib/demo/utils.c
+++ b/glib/demo/utils.c
@@ -158,23 +158,27 @@ pgd_action_view_add_destination (GtkWidget   *action_view,
 
 			new_dest = poppler_document_find_dest (document, dest->named_dest);
 			if (new_dest) {
-				GtkWidget *new_table, *alignment;
+				GtkWidget *new_table;
 				gint       new_row = 0;
 
-				alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-				gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-				
 				new_table = gtk_grid_new ();
+				gtk_widget_set_margin_top (new_table, 5);
+				gtk_widget_set_margin_bottom (new_table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+				gtk_widget_set_margin_start (new_table, 12);
+				gtk_widget_set_margin_end (new_table, 5);
+#else
+				gtk_widget_set_margin_left (new_table, 12);
+				gtk_widget_set_margin_right (new_table, 5);
+#endif
 				gtk_grid_set_column_spacing (GTK_GRID (new_table), 6);
 				gtk_grid_set_row_spacing (GTK_GRID (new_table), 6);
-				gtk_grid_attach (GTK_GRID(table), alignment, 0, *row, 1, 1);
-				gtk_widget_show (alignment);
 				
 				pgd_action_view_add_destination (action_view, GTK_GRID (new_table),
 								 new_dest, FALSE, &new_row);
 				poppler_dest_free (new_dest);
 
-				gtk_container_add (GTK_CONTAINER (alignment), new_table);
+				gtk_grid_attach (GTK_GRID(table), new_table, 0, *row, 1, 1);
 				gtk_widget_show (new_table);
 
 				*row += 1;
@@ -311,24 +315,27 @@ void
 pgd_action_view_set_action (GtkWidget     *action_view,
 			    PopplerAction *action)
 {
-	GtkWidget  *alignment;
 	GtkWidget  *table;
 	gint        row = 0;
 
-	alignment = gtk_bin_get_child (GTK_BIN (action_view));
-	if (alignment) {
-		gtk_container_remove (GTK_CONTAINER (action_view), alignment);
+	table = gtk_bin_get_child (GTK_BIN (action_view));
+	if (table) {
+		gtk_container_remove (GTK_CONTAINER (action_view), table);
 	}
-	
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (action_view), alignment);
-	gtk_widget_show (alignment);
 
 	if (!action)
 		return;
 
 	table = gtk_grid_new ();
+	gtk_widget_set_margin_top (table, 5);
+	gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (table, 12);
+	gtk_widget_set_margin_end (table, 5);
+#else
+	gtk_widget_set_margin_left (table, 12);
+	gtk_widget_set_margin_right (table, 5);
+#endif
 	gtk_grid_set_column_spacing (GTK_GRID (table), 6);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -466,7 +473,7 @@ pgd_action_view_set_action (GtkWidget     *action_view,
 		g_assert_not_reached ();
 	}
 
-	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_container_add (GTK_CONTAINER (action_view), table);
 	gtk_widget_show (table);
 }
 
@@ -546,25 +553,28 @@ void
 pgd_movie_view_set_movie (GtkWidget    *movie_view,
 			  PopplerMovie *movie)
 {
-	GtkWidget  *alignment;
 	GtkWidget  *table;
 	GtkWidget  *button;
 	gint        row = 0;
 
-	alignment = gtk_bin_get_child (GTK_BIN (movie_view));
-	if (alignment) {
-		gtk_container_remove (GTK_CONTAINER (movie_view), alignment);
+	table = gtk_bin_get_child (GTK_BIN (movie_view));
+	if (table) {
+		gtk_container_remove (GTK_CONTAINER (movie_view), table);
 	}
 
-	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5);
-	gtk_container_add (GTK_CONTAINER (movie_view), alignment);
-	gtk_widget_show (alignment);
-
 	if (!movie)
 		return;
 
 	table = gtk_grid_new ();
+	gtk_widget_set_margin_top (table, 5);
+	gtk_widget_set_margin_bottom (table, 5);
+#if GTK_CHECK_VERSION(3, 12, 0)
+	gtk_widget_set_margin_start (table, 12);
+	gtk_widget_set_margin_end (table, 5);
+#else
+	gtk_widget_set_margin_left (table, 12);
+	gtk_widget_set_margin_right (table, 5);
+#endif
 	gtk_grid_set_column_spacing (GTK_GRID (table), 6);
 	gtk_grid_set_row_spacing (GTK_GRID (table), 6);
 
@@ -579,7 +589,7 @@ pgd_movie_view_set_movie (GtkWidget    *movie_view,
 	pgd_table_add_property_with_custom_widget (GTK_GRID (table), NULL, button, &row);
 	gtk_widget_show (button);
 
-	gtk_container_add (GTK_CONTAINER (alignment), table);
+	gtk_container_add (GTK_CONTAINER (movie_view), table);
 	gtk_widget_show (table);
 }
 
commit 49e33e1213a7957d4814656960bf269abcabc7c3
Author: Hib Eris <hib at hiberis.nl>
Date:   Sun Jan 25 12:21:41 2015 +0100

    glib-demo: Remove deprecated use of gtk_tree_view_set_rules_hint()
    
    The use of rules-hint is deprecated in gtk because it is
    considered bad application API and is not really usefull.
    
    See https://git.gnome.org/browse/gtk+/commit/?id=0ed766ec866a2da7e3db05b1db2fc2519d6b1cdc
    
    https://bugs.freedesktop.org/show_bug.cgi?id=88788

diff --git a/glib/demo/attachments.c b/glib/demo/attachments.c
index 0ecd5b8..efffd72 100644
--- a/glib/demo/attachments.c
+++ b/glib/demo/attachments.c
@@ -82,7 +82,6 @@ pgd_attachments_create_list (GtkTreeModel *model)
 	
 	treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), TRUE);
-	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
 
 	renderer = gtk_cell_renderer_text_new ();
 	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
diff --git a/glib/demo/find.c b/glib/demo/find.c
index 8e91952..8b02dfc 100644
--- a/glib/demo/find.c
+++ b/glib/demo/find.c
@@ -453,7 +453,6 @@ pgd_find_create_widget (PopplerDocument *document)
 	treeview = gtk_tree_view_new_with_model (model);
         g_object_unref (model);
         demo->treeview = treeview;
-	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
 	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
         g_signal_connect (selection, "changed",
diff --git a/glib/demo/fonts.c b/glib/demo/fonts.c
index d0ffa3d..078368e 100644
--- a/glib/demo/fonts.c
+++ b/glib/demo/fonts.c
@@ -255,7 +255,6 @@ pgd_fonts_create_widget (PopplerDocument *document)
 	model = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
 	demo->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (demo->treeview), FALSE);
-	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (demo->treeview), TRUE);
 	gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (demo->treeview)),
 				     GTK_SELECTION_NONE);
 	g_object_unref (model);
diff --git a/glib/demo/transitions.c b/glib/demo/transitions.c
index e6e2ab4..b646dd6 100644
--- a/glib/demo/transitions.c
+++ b/glib/demo/transitions.c
@@ -207,7 +207,6 @@ pgd_transitions_create_list (GtkTreeModel *model)
 	
 	treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), TRUE);
-	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
 	gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
 				     GTK_SELECTION_NONE);
 


More information about the poppler mailing list