[network-manager-openvpn/NM_0_8] ui: fix for compilation with -DGSEAL_ENABLE
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/NM_0_8] ui: fix for compilation with -DGSEAL_ENABLE
- Date: Mon, 2 Aug 2010 21:07:07 +0000 (UTC)
commit c072e5d025bbf8fc9f597457378b9d32b6cf936f
Author: Dan Williams <dcbw redhat com>
Date: Mon Aug 2 16:08:38 2010 -0700
ui: fix for compilation with -DGSEAL_ENABLE
auth-dialog/gnome-two-password-dialog.c | 70 ++++++++++++++++++++-----------
configure.ac | 2 +-
properties/nm-openvpn.c | 4 ++
3 files changed, 50 insertions(+), 26 deletions(-)
---
diff --git a/auth-dialog/gnome-two-password-dialog.c b/auth-dialog/gnome-two-password-dialog.c
index c9fae82..3762d73 100644
--- a/auth-dialog/gnome-two-password-dialog.c
+++ b/auth-dialog/gnome-two-password-dialog.c
@@ -155,6 +155,26 @@ gnome_two_password_dialog_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
+static gboolean
+is_visible (GtkWidget *w)
+{
+#if GTK_CHECK_VERSION(2,20,0)
+ return gtk_widget_get_visible (w);
+#else
+ return GTK_WIDGET_VISIBLE (w);
+#endif
+}
+
+static gboolean
+is_sensitive (GtkWidget *w)
+{
+#if GTK_CHECK_VERSION(2,18,0)
+ return gtk_widget_get_sensitive (w);
+#else
+ return GTK_WIDGET_SENSITIVE (w);
+#endif
+}
+
/* GtkDialog callbacks */
static void
dialog_show_callback (GtkWidget *widget, gpointer callback_data)
@@ -163,15 +183,15 @@ dialog_show_callback (GtkWidget *widget, gpointer callback_data)
password_dialog = GNOME_TWO_PASSWORD_DIALOG (callback_data);
- if (GTK_WIDGET_VISIBLE (password_dialog->details->username_entry) &&
- !password_dialog->details->readonly_username) {
+ if ( is_visible (password_dialog->details->username_entry)
+ && !password_dialog->details->readonly_username) {
gtk_widget_grab_focus (password_dialog->details->username_entry);
- } else if (GTK_WIDGET_VISIBLE (password_dialog->details->domain_entry) &&
- !password_dialog->details->readonly_domain) {
+ } else if ( is_visible (password_dialog->details->domain_entry)
+ && !password_dialog->details->readonly_domain) {
gtk_widget_grab_focus (password_dialog->details->domain_entry);
- } else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry)) {
+ } else if (is_visible (password_dialog->details->password_entry)) {
gtk_widget_grab_focus (password_dialog->details->password_entry);
- } else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary)) {
+ } else if (is_visible (password_dialog->details->password_entry_secondary)) {
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
}
}
@@ -265,14 +285,14 @@ username_entry_activate (GtkWidget *widget, GtkWidget *dialog)
password_dialog = GNOME_TWO_PASSWORD_DIALOG (dialog);
- if (GTK_WIDGET_VISIBLE (password_dialog->details->domain_entry) &&
- GTK_WIDGET_SENSITIVE (password_dialog->details->domain_entry))
+ if (is_visible (password_dialog->details->domain_entry) &&
+ is_sensitive (password_dialog->details->domain_entry))
gtk_widget_grab_focus (password_dialog->details->domain_entry);
- else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry) &&
- GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry))
+ else if (is_visible (password_dialog->details->password_entry) &&
+ is_sensitive (password_dialog->details->password_entry))
gtk_widget_grab_focus (password_dialog->details->password_entry);
- else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary) &&
- GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry_secondary))
+ else if (is_visible (password_dialog->details->password_entry_secondary) &&
+ is_sensitive (password_dialog->details->password_entry_secondary))
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
}
@@ -283,11 +303,11 @@ domain_entry_activate (GtkWidget *widget, GtkWidget *dialog)
password_dialog = GNOME_TWO_PASSWORD_DIALOG (dialog);
- if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry) &&
- GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry))
+ if (is_visible (password_dialog->details->password_entry) &&
+ is_sensitive (password_dialog->details->password_entry))
gtk_widget_grab_focus (password_dialog->details->password_entry);
- else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary) &&
- GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry_secondary))
+ else if (is_visible (password_dialog->details->password_entry_secondary) &&
+ is_sensitive (password_dialog->details->password_entry_secondary))
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
}
@@ -309,6 +329,7 @@ gnome_two_password_dialog_new (const char *dialog_title,
GtkWidget *main_vbox;
GtkWidget *dialog_icon;
GSList *group;
+ GtkBox *content, *action_area;
password_dialog = GNOME_TWO_PASSWORD_DIALOG (gtk_widget_new (gnome_two_password_dialog_get_type (), NULL));
dialog = GTK_DIALOG (password_dialog);
@@ -322,12 +343,15 @@ gnome_two_password_dialog_new (const char *dialog_title,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (password_dialog), GTK_RESPONSE_OK);
+ 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 */
gtk_dialog_set_has_separator (dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
+ gtk_box_set_spacing (content, 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (action_area, 6);
gtk_window_set_position (GTK_WINDOW (password_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (password_dialog), TRUE);
@@ -444,13 +468,9 @@ gnome_two_password_dialog_new (const char *dialog_title,
gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialog)->vbox),
- hbox,
- TRUE, /* expand */
- TRUE, /* fill */
- 0); /* padding */
+ gtk_box_pack_start (content, hbox, TRUE, TRUE, 0);
- gtk_widget_show_all (GTK_DIALOG (password_dialog)->vbox);
+ gtk_widget_show_all (GTK_WIDGET (content));
password_dialog->details->remember_session_button =
gtk_check_button_new_with_mnemonic (_("_Remember password for this session"));
diff --git a/configure.ac b/configure.ac
index b218663..71b171a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ AC_SUBST(NETWORK_MANAGER_CFLAGS)
AC_SUBST(NETWORK_MANAGER_LIBS)
if test x"$with_gnome" != xno; then
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6)
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index a33a315..b90453b 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -238,7 +238,11 @@ advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
const char *contype = NULL;
toplevel = gtk_widget_get_toplevel (priv->widget);
+#if GTK_CHECK_VERSION(2,20,0)
+ g_return_if_fail (gtk_widget_is_toplevel (toplevel));
+#else
g_return_if_fail (GTK_WIDGET_TOPLEVEL (toplevel));
+#endif
widget = glade_xml_get_widget (priv->xml, "auth_combo");
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]