[network-manager-openswan] build: require Gtk+ 3.4



commit 6b5b95ad0ae68889d188c5f1a887efd1bf49c96d
Author: Dan Winship <danw gnome org>
Date:   Tue Feb 26 11:01:20 2013 +0100

    build: require Gtk+ 3.4

 auth-dialog/vpn-password-dialog.c |   71 ++++++++++++++----------------------
 configure.ac                      |   20 +---------
 2 files changed, 30 insertions(+), 61 deletions(-)
---
diff --git a/auth-dialog/vpn-password-dialog.c b/auth-dialog/vpn-password-dialog.c
index 9fa2509..ce30540 100644
--- a/auth-dialog/vpn-password-dialog.c
+++ b/auth-dialog/vpn-password-dialog.c
@@ -45,8 +45,8 @@ typedef struct {
        GtkWidget *password_entry_secondary;
        GtkWidget *show_passwords_checkbox;
 
-       GtkWidget *table_alignment;
-       GtkWidget *table;
+       GtkWidget *grid_alignment;
+       GtkWidget *grid;
        GtkSizeGroup *group;
 
        char *secondary_password_label;
@@ -114,46 +114,46 @@ dialog_close_callback (GtkWidget *widget, gpointer callback_data)
 }
 
 static void
-add_row (GtkWidget *table, int row, const char *label_text, GtkWidget *entry)
+add_row (GtkWidget *grid, int row, const char *label_text, GtkWidget *entry)
 {
        GtkWidget *label;
 
        label = gtk_label_new_with_mnemonic (label_text);
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 
-       gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row + 1);
-       gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, row, row + 1);
+       gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
+       gtk_grid_attach (GTK_GRID (grid), entry, 1, row, 1, 1);
 
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
 }
 
 static void
-remove_child (GtkWidget *child, GtkWidget *table)
+remove_child (GtkWidget *child, GtkWidget *grid)
 {
-       gtk_container_remove (GTK_CONTAINER (table), child);
+       gtk_container_remove (GTK_CONTAINER (grid), child);
 }
 
 static void
-add_table_rows (VpnPasswordDialog *dialog)
+add_grid_rows (VpnPasswordDialog *dialog)
 {
        VpnPasswordDialogPrivate *priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
        int row;
        int offset = 0;
 
-       gtk_alignment_set_padding (GTK_ALIGNMENT (priv->table_alignment), 0, 0, offset, 0);
+       gtk_alignment_set_padding (GTK_ALIGNMENT (priv->grid_alignment), 0, 0, offset, 0);
 
        /* This will not kill the entries, since they are ref:ed */
-       gtk_container_foreach (GTK_CONTAINER (priv->table), (GtkCallback) remove_child, priv->table);
+       gtk_container_foreach (GTK_CONTAINER (priv->grid), (GtkCallback) remove_child, priv->grid);
        
        row = 0;
        if (priv->show_password)
-               add_row (priv->table, row++, _("_Password:"), priv->password_entry);
+               add_row (priv->grid, row++, _("_Password:"), priv->password_entry);
        if (priv->show_password_secondary)
-               add_row (priv->table, row++, priv->secondary_password_label,  priv->password_entry_secondary);
+               add_row (priv->grid, row++, priv->secondary_password_label,  priv->password_entry_secondary);
 
-       gtk_table_attach_defaults (GTK_TABLE (priv->table), priv->show_passwords_checkbox, 1, 2, row, row + 
1);
+       gtk_grid_attach (GTK_GRID (priv->grid), priv->show_passwords_checkbox, 1, row, 1, 1);
 
-       gtk_widget_show_all (priv->table);
+       gtk_widget_show_all (priv->grid);
 }
 
 static void
@@ -201,10 +201,7 @@ vpn_password_dialog_new (const char *title,
        content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
        action_area = GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog)));
 
-       /* Setup the dialog */
-#if !GTK_CHECK_VERSION (2,22,0)
-       gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-#endif
+       /* Set up the dialog */
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
        gtk_box_set_spacing (content, 2); /* 2 * 5 + 2 = 12 */
        gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
@@ -220,22 +217,22 @@ vpn_password_dialog_new (const char *title,
                          G_CALLBACK (dialog_close_callback),
                          dialog);
 
-       /* The table that holds the captions */
-       priv->table_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
+       /* The grid that holds the captions */
+       priv->grid_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
 
        priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-       priv->table = gtk_table_new (4, 2, FALSE);
-       gtk_table_set_col_spacings (GTK_TABLE (priv->table), 12);
-       gtk_table_set_row_spacings (GTK_TABLE (priv->table), 6);
-       gtk_container_add (GTK_CONTAINER (priv->table_alignment), priv->table);
+       priv->grid = gtk_grid_new ();
+       gtk_grid_set_column_spacing (GTK_GRID (priv->grid), 12);
+       gtk_grid_set_row_spacing (GTK_GRID (priv->grid), 6);
+       gtk_container_add (GTK_CONTAINER (priv->grid_alignment), priv->grid);
 
        priv->password_entry = gtk_entry_new ();
        priv->password_entry_secondary = gtk_entry_new ();
 
        priv->show_passwords_checkbox = gtk_check_button_new_with_mnemonic (_("Sh_ow passwords"));
 
-       /* We want to hold on to these during the table rearrangement */
+       /* We want to hold on to these during the grid rearrangement */
        g_object_ref_sink (priv->password_entry);
        g_object_ref_sink (priv->password_entry_secondary);
        g_object_ref_sink (priv->show_passwords_checkbox);
@@ -254,25 +251,17 @@ vpn_password_dialog_new (const char *title,
                          G_CALLBACK (show_passwords_toggled_cb),
                          dialog);
 
-       add_table_rows (VPN_PASSWORD_DIALOG (dialog));
+       add_grid_rows (VPN_PASSWORD_DIALOG (dialog));
 
        /* Adds some eye-candy to the dialog */
-#if GTK_CHECK_VERSION (3,1,6)
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
-       hbox = gtk_hbox_new (FALSE, 12);
-#endif
        gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
        dialog_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
        gtk_misc_set_alignment (GTK_MISC (dialog_icon), 0.5, 0.0);
        gtk_box_pack_start (GTK_BOX (hbox), dialog_icon, FALSE, FALSE, 0);
 
        /* Fills the vbox */
-#if GTK_CHECK_VERSION (3,1,6)
        main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
-#else
-       main_vbox = gtk_vbox_new (FALSE, 18);
-#endif
 
        if (message) {
                message_label = GTK_LABEL (gtk_label_new (message));
@@ -280,16 +269,12 @@ vpn_password_dialog_new (const char *title,
                gtk_label_set_line_wrap (message_label, TRUE);
                gtk_size_group_add_widget (priv->group, GTK_WIDGET (message_label));
                gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (message_label), FALSE, FALSE, 0);
-               gtk_size_group_add_widget (priv->group, priv->table_alignment);
+               gtk_size_group_add_widget (priv->group, priv->grid_alignment);
        }
 
-#if GTK_CHECK_VERSION (3,1,6)
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
-       vbox = gtk_vbox_new (FALSE, 6);
-#endif
        gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (vbox), priv->table_alignment, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox), priv->grid_alignment, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
        gtk_box_pack_start (content, hbox, FALSE, FALSE, 0);
        gtk_widget_show_all (GTK_WIDGET (content));
@@ -351,7 +336,7 @@ vpn_password_dialog_set_show_password (VpnPasswordDialog *dialog, gboolean show)
        show = !!show;
        if (priv->show_password != show) {
                priv->show_password = show;
-               add_table_rows (dialog);
+               add_grid_rows (dialog);
        }
 }
 
@@ -369,7 +354,7 @@ vpn_password_dialog_set_show_password_secondary (VpnPasswordDialog *dialog,
        show = !!show;
        if (priv->show_password_secondary != show) {
                priv->show_password_secondary = show;
-               add_table_rows (dialog);
+               add_grid_rows (dialog);
        }
 }
 
@@ -435,6 +420,6 @@ void vpn_password_dialog_set_password_secondary_label (VpnPasswordDialog *dialog
        priv->secondary_password_label = g_strdup (label);
 
        if (priv->show_password_secondary)
-               add_table_rows (dialog);
+               add_grid_rows (dialog);
 }
 
diff --git a/configure.ac b/configure.ac
index d150393..6fdaac6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,26 +75,10 @@ AC_SUBST(NM_CFLAGS)
 AC_SUBST(NM_LIBS)
 
 if test x"$with_gnome" != xno; then
-       AC_ARG_WITH([gtkver], AS_HELP_STRING([--with-gtkver], [The major version of GTK+ to build with]),
-                   with_gtkver="$withval",with_gtkver=0)
-
-       gtk2_req=2.20
-       gtk3_req=3.0
-       case "${with_gtkver}" in
-              0) PKG_CHECK_MODULES(GTK, gtk+-3.0 > $gtk3_req, ,
-                                   [PKG_CHECK_MODULES(GTK, gtk+-2.0 > $gtk2_req)])
-                 ;;
-              2) PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $gtk2_req)
-                 ;;
-              3) PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $gtk3_req)
-                 ;;
-              *) AC_MSG_ERROR(unknown GTK+ version $with_gtkver!)
-                 ;;
-       esac
+       PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4)
        AC_SUBST(GTK_CFLAGS)
        AC_SUBST(GTK_LIBS)
-
-       GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_0"
+       GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
 
        PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
        AC_SUBST(GNOMEKEYRING_CFLAGS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]