[network-manager-openconnect/NM_0_8: 16/55] ui: migrate to GtkBuilder (bgo #641272)



commit e5fb404d84ccb0c14831e315129536b7198fe8ec
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Mon Feb 7 11:51:27 2011 +0100

    ui: migrate to GtkBuilder (bgo #641272)

 configure.ac                           |    4 -
 po/POTFILES.in                         |    2 +-
 properties/Makefile.am                 |   14 +-
 properties/auth-helpers.c              |   27 +-
 properties/auth-helpers.h              |   10 +-
 properties/nm-openconnect-dialog.glade |  516 --------------------------------
 properties/nm-openconnect-dialog.ui    |  472 +++++++++++++++++++++++++++++
 properties/nm-openconnect.c            |   57 ++--
 8 files changed, 529 insertions(+), 573 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0d8caa0..571d7e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,10 +66,6 @@ if test x"$with_gnome" != xno; then
 	AC_SUBST(GDK_PIXBUF_CFLAGS)
 	AC_SUBST(GDK_PIXBUF_LIBS)
 
-	PKG_CHECK_MODULES(GLADE, libglade-2.0)
-	AC_SUBST(GLADE_CFLAGS)
-	AC_SUBST(GLADE_LIBS)
-
 	PKG_CHECK_MODULES(GCONF, gconf-2.0)
 	AC_SUBST(GCONF_CFLAGS)
 	AC_SUBST(GCONF_LIBS)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9751d36..535139e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,7 @@
 # Please keep this file sorted alphabetically.
 properties/auth-helpers.c
 properties/nm-openconnect.c
-properties/nm-openconnect-dialog.glade
+properties/nm-openconnect-dialog.ui
 src/nm-openconnect-service.c
 
 
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 159f7d2..c3dea82 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -7,16 +7,15 @@ libnm_openconnect_properties_la_SOURCES = \
 	nm-openconnect.c \
 	nm-openconnect.h
 
-gladedir = $(datadir)/gnome-vpn-properties/openconnect
-glade_DATA = nm-openconnect-dialog.glade
+uidir = $(datadir)/gnome-vpn-properties/openconnect
+ui_DATA = nm-openconnect-dialog.ui
 
-libnm_openconnect_properties_la_CFLAGS =                          \
-        $(GLADE_CFLAGS)                                 \
+libnm_openconnect_properties_la_CFLAGS =                \
         $(GTK_CFLAGS)                                   \
         $(GCONF_CFLAGS)                                 \
         $(NETWORKMANAGER_CFLAGS)                        \
         -DICONDIR=\""$(datadir)/pixmaps"\"              \
-        -DGLADEDIR=\""$(gladedir)"\"                    \
+        -DUIDIR=\""$(uidir)"\"                          \
         -DG_DISABLE_DEPRECATED                          \
         -DGDK_DISABLE_DEPRECATED                        \
         -DGNOME_DISABLE_DEPRECATED                      \
@@ -24,7 +23,6 @@ libnm_openconnect_properties_la_CFLAGS =                          \
         -DVERSION=\"$(VERSION)\"
 
 libnm_openconnect_properties_la_LIBADD = \
-        $(GLADE_LIBS) \
         $(GTK_LIBS) \
         $(GCONF_LIBS) \
         $(NETWORKMANAGER_LIBS)
@@ -32,7 +30,7 @@ libnm_openconnect_properties_la_LIBADD = \
 libnm_openconnect_properties_la_LDFLAGS =      \
         -avoid-version
 
-CLEANFILES = *.bak *.gladep *~
+CLEANFILES = *.bak *~
 
 EXTRA_DIST =                            \
-        $(glade_DATA)
+        $(ui_DATA)
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index b7a8be2..905c1fe 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -2,6 +2,7 @@
 /***************************************************************************
  *
  * Copyright (C) 2008 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2008 - 2011 Red Hat, Inc.
  * Copyright (C) 2008 Tambet Ingo, <tambet gmail com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -39,7 +40,7 @@
 #include "../src/nm-openconnect-service.h"
 
 void
-tls_pw_init_auth_widget (GladeXML *xml,
+tls_pw_init_auth_widget (GtkBuilder *builder,
                          GtkSizeGroup *group,
                          NMSettingVPN *s_vpn,
                          ChangedCallback changed_cb,
@@ -49,11 +50,11 @@ tls_pw_init_auth_widget (GladeXML *xml,
 	const char *value;
 	GtkFileFilter *filter;
 
-	g_return_if_fail (xml != NULL);
+	g_return_if_fail (builder != NULL);
 	g_return_if_fail (group != NULL);
 	g_return_if_fail (changed_cb != NULL);
 
-	widget = glade_xml_get_widget (xml, "ca_cert_chooser");
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ca_cert_chooser"));
 
 	gtk_size_group_add_widget (group, widget);
 	filter = tls_file_chooser_filter_new ();
@@ -69,7 +70,7 @@ tls_pw_init_auth_widget (GladeXML *xml,
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 	}
 
-	widget = glade_xml_get_widget (xml, "cert_user_cert_chooser");
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "cert_user_cert_chooser"));
 
 	gtk_size_group_add_widget (group, widget);
 	filter = tls_file_chooser_filter_new ();
@@ -85,7 +86,7 @@ tls_pw_init_auth_widget (GladeXML *xml,
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 	}
 
-	widget = glade_xml_get_widget (xml, "cert_private_key_chooser");
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "cert_private_key_chooser"));
 
 	gtk_size_group_add_widget (group, widget);
 	filter = tls_file_chooser_filter_new ();
@@ -103,13 +104,13 @@ tls_pw_init_auth_widget (GladeXML *xml,
 }
 
 gboolean
-auth_widget_check_validity (GladeXML *xml, GError **error)
+auth_widget_check_validity (GtkBuilder *builder, GError **error)
 {
 	return TRUE;
 }
 
 static void
-update_from_filechooser (GladeXML *xml,
+update_from_filechooser (GtkBuilder *builder,
                          const char *key,
                          const char *widget_name,
                          NMSettingVPN *s_vpn)
@@ -118,12 +119,12 @@ update_from_filechooser (GladeXML *xml,
 	char *filename;
 	char *authtype;
 
-	g_return_if_fail (xml != NULL);
+	g_return_if_fail (builder != NULL);
 	g_return_if_fail (key != NULL);
 	g_return_if_fail (widget_name != NULL);
 	g_return_if_fail (s_vpn != NULL);
 
-	widget = glade_xml_get_widget (xml, widget_name);
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
 
 	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
 	if (filename && strlen(filename)) {
@@ -140,13 +141,13 @@ update_from_filechooser (GladeXML *xml,
 }
 
 gboolean
-auth_widget_update_connection (GladeXML *xml,
+auth_widget_update_connection (GtkBuilder *builder,
                                const char *contype,
                                NMSettingVPN *s_vpn)
 {
-	update_from_filechooser (xml, NM_OPENCONNECT_KEY_CACERT, "ca_cert_chooser", s_vpn);
-	update_from_filechooser (xml, NM_OPENCONNECT_KEY_USERCERT, "cert_user_cert_chooser", s_vpn);
-	update_from_filechooser (xml, NM_OPENCONNECT_KEY_PRIVKEY, "cert_private_key_chooser", s_vpn);
+	update_from_filechooser (builder, NM_OPENCONNECT_KEY_CACERT, "ca_cert_chooser", s_vpn);
+	update_from_filechooser (builder, NM_OPENCONNECT_KEY_USERCERT, "cert_user_cert_chooser", s_vpn);
+	update_from_filechooser (builder, NM_OPENCONNECT_KEY_PRIVKEY, "cert_private_key_chooser", s_vpn);
 	return TRUE;
 }
 
diff --git a/properties/auth-helpers.h b/properties/auth-helpers.h
index 79e86f9..c2efe5e 100644
--- a/properties/auth-helpers.h
+++ b/properties/auth-helpers.h
@@ -2,6 +2,7 @@
 /***************************************************************************
  *
  * Copyright (C) 2008 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2008 - 2011 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,28 +26,27 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gtk/gtkfilefilter.h>
-#include <glade/glade.h>
 
 #include <nm-connection.h>
 #include <nm-setting-vpn.h>
 
 typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data);
 
-void tls_pw_init_auth_widget (GladeXML *xml,
+void tls_pw_init_auth_widget (GtkBuilder *builder,
                               GtkSizeGroup *group,
                               NMSettingVPN *s_vpn,
                               ChangedCallback changed_cb,
                               gpointer user_data);
 
-void sk_init_auth_widget (GladeXML *xml,
+void sk_init_auth_widget (GtkBuilder *builder,
                           GtkSizeGroup *group,
                           NMSettingVPN *s_vpn,
                           ChangedCallback changed_cb,
                           gpointer user_data);
 
-gboolean auth_widget_check_validity (GladeXML *xml, GError **error);
+gboolean auth_widget_check_validity (GtkBuilder *builder, GError **error);
 
-gboolean auth_widget_update_connection (GladeXML *xml,
+gboolean auth_widget_update_connection (GtkBuilder *builder,
                                         const char *contype,
                                         NMSettingVPN *s_vpn);
 
diff --git a/properties/nm-openconnect-dialog.ui b/properties/nm-openconnect-dialog.ui
new file mode 100644
index 0000000..78c6824
--- /dev/null
+++ b/properties/nm-openconnect-dialog.ui
@@ -0,0 +1,472 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+  <!-- interface-requires gtk+ 2.6 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+      <object class="GtkVBox" id="openconnect-vbox">
+        <property name="border_width">12</property>
+        <property name="visible">True</property>
+        <property name="homogeneous">False</property>
+        <property name="spacing">16</property>
+        <child>
+          <object class="GtkVBox" id="vbox8">
+            <property name="visible">True</property>
+            <property name="homogeneous">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label22">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
+                <property name="use_underline">False</property>
+                <property name="use_markup">True</property>
+                <property name="justify">GTK_JUSTIFY_LEFT</property>
+                <property name="wrap">False</property>
+                <property name="selectable">False</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0.5</property>
+                <property name="xpad">0</property>
+                <property name="ypad">0</property>
+                <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                <property name="width_chars">-1</property>
+                <property name="single_line_mode">False</property>
+                <property name="angle">0</property>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkAlignment" id="alignment8">
+                <property name="visible">True</property>
+                <property name="xalign">0.5</property>
+                <property name="yalign">0.5</property>
+                <property name="xscale">1</property>
+                <property name="yscale">1</property>
+                <property name="top_padding">0</property>
+                <property name="bottom_padding">0</property>
+                <property name="left_padding">12</property>
+                <property name="right_padding">0</property>
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="n_rows">3</property>
+                    <property name="n_columns">2</property>
+                    <property name="homogeneous">False</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment2">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">1</property>
+                        <property name="top_padding">0</property>
+                        <property name="bottom_padding">0</property>
+                        <property name="left_padding">0</property>
+                        <property name="right_padding">0</property>
+                        <child>
+                          <object class="GtkEntry" id="gateway_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="editable">True</property>
+                            <property name="visibility">True</property>
+                            <property name="max_length">0</property>
+                            <property name="text" translatable="yes"/>
+                            <property name="has_frame">True</property>
+                            <property name="invisible_char">&#x2022;</property>
+                            <property name="activates_default">False</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">0</property>
+                        <property name="bottom_attach">1</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment11">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">1</property>
+                        <property name="top_padding">0</property>
+                        <property name="bottom_padding">0</property>
+                        <property name="left_padding">0</property>
+                        <property name="right_padding">0</property>
+                        <child>
+                          <object class="GtkEntry" id="proxy_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="editable">True</property>
+                            <property name="visibility">True</property>
+                            <property name="max_length">0</property>
+                            <property name="text" translatable="yes"/>
+                            <property name="has_frame">True</property>
+                            <property name="invisible_char">&#x2022;</property>
+                            <property name="activates_default">False</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">fill</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment12">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">1</property>
+                        <property name="top_padding">0</property>
+                        <property name="bottom_padding">0</property>
+                        <property name="left_padding">0</property>
+                        <property name="right_padding">0</property>
+                        <child>
+                          <object class="GtkFileChooserButton" id="ca_cert_chooser">
+                            <property name="visible">True</property>
+                            <property name="title" translatable="yes">Select A File</property>
+                            <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                            <property name="local_only">True</property>
+                            <property name="show_hidden">True</property>
+                            <property name="do_overwrite_confirmation">False</property>
+                            <property name="width_chars">-1</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label23">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Gateway:</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_markup">False</property>
+                        <property name="justify">GTK_JUSTIFY_LEFT</property>
+                        <property name="wrap">False</property>
+                        <property name="selectable">False</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xpad">0</property>
+                        <property name="ypad">0</property>
+                        <property name="mnemonic_widget">gateway_entry</property>
+                        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                        <property name="width_chars">-1</property>
+                        <property name="single_line_mode">False</property>
+                        <property name="angle">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="right_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="bottom_attach">1</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label28">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Proxy:</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_markup">False</property>
+                        <property name="justify">GTK_JUSTIFY_LEFT</property>
+                        <property name="wrap">False</property>
+                        <property name="selectable">False</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xpad">0</property>
+                        <property name="ypad">0</property>
+                        <property name="mnemonic_widget">proxy_entry</property>
+                        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                        <property name="width_chars">-1</property>
+                        <property name="single_line_mode">False</property>
+                        <property name="angle">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="right_attach">1</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label27">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_CA Certificate:</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_markup">False</property>
+                        <property name="justify">GTK_JUSTIFY_LEFT</property>
+                        <property name="wrap">False</property>
+                        <property name="selectable">False</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xpad">0</property>
+                        <property name="ypad">0</property>
+                        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                        <property name="width_chars">-1</property>
+                        <property name="single_line_mode">False</property>
+                        <property name="angle">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="right_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="csd_button">
+                <property name="border_width">2</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">Allow Cisco Secure Desktop _trojan</property>
+                <property name="use_underline">True</property>
+                <property name="relief">GTK_RELIEF_NORMAL</property>
+                <property name="focus_on_click">True</property>
+                <property name="active">False</property>
+                <property name="inconsistent">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox11">
+            <property name="visible">True</property>
+            <property name="homogeneous">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label25">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">&lt;b&gt;Certificate Authentication&lt;/b&gt;</property>
+                <property name="use_underline">False</property>
+                <property name="use_markup">True</property>
+                <property name="justify">GTK_JUSTIFY_LEFT</property>
+                <property name="wrap">False</property>
+                <property name="selectable">False</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0.5</property>
+                <property name="xpad">0</property>
+                <property name="ypad">0</property>
+                <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                <property name="width_chars">-1</property>
+                <property name="single_line_mode">False</property>
+                <property name="angle">0</property>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkAlignment" id="alignment13">
+                <property name="visible">True</property>
+                <property name="xalign">0.5</property>
+                <property name="yalign">0.5</property>
+                <property name="xscale">1</property>
+                <property name="yscale">1</property>
+                <property name="top_padding">0</property>
+                <property name="bottom_padding">0</property>
+                <property name="left_padding">12</property>
+                <property name="right_padding">0</property>
+                <child>
+                  <object class="GtkTable" id="table1">
+                    <property name="visible">True</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="homogeneous">False</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment5">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">1</property>
+                        <property name="top_padding">0</property>
+                        <property name="bottom_padding">0</property>
+                        <property name="left_padding">0</property>
+                        <property name="right_padding">0</property>
+                        <child>
+                          <object class="GtkFileChooserButton" id="cert_user_cert_chooser">
+                            <property name="visible">True</property>
+                            <property name="title" translatable="yes">Select A File</property>
+                            <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                            <property name="local_only">True</property>
+                            <property name="show_hidden">False</property>
+                            <property name="do_overwrite_confirmation">False</property>
+                            <property name="width_chars">-1</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">0</property>
+                        <property name="bottom_attach">1</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_User Certificate:</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_markup">False</property>
+                        <property name="justify">GTK_JUSTIFY_LEFT</property>
+                        <property name="wrap">False</property>
+                        <property name="selectable">False</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xpad">0</property>
+                        <property name="ypad">0</property>
+                        <property name="mnemonic_widget">cert_user_cert_chooser</property>
+                        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                        <property name="width_chars">-1</property>
+                        <property name="single_line_mode">False</property>
+                        <property name="angle">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="right_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="bottom_attach">1</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment6">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xscale">0.019999999553</property>
+                        <property name="yscale">1</property>
+                        <property name="top_padding">0</property>
+                        <property name="bottom_padding">0</property>
+                        <property name="left_padding">0</property>
+                        <property name="right_padding">0</property>
+                        <child>
+                          <object class="GtkFileChooserButton" id="cert_private_key_chooser">
+                            <property name="visible">True</property>
+                            <property name="title" translatable="yes">Select A File</property>
+                            <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                            <property name="local_only">True</property>
+                            <property name="show_hidden">False</property>
+                            <property name="do_overwrite_confirmation">False</property>
+                            <property name="width_chars">-1</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Private _Key:</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_markup">False</property>
+                        <property name="justify">GTK_JUSTIFY_LEFT</property>
+                        <property name="wrap">False</property>
+                        <property name="selectable">False</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0.5</property>
+                        <property name="xpad">0</property>
+                        <property name="ypad">0</property>
+                        <property name="mnemonic_widget">cert_private_key_chooser</property>
+                        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                        <property name="width_chars">-1</property>
+                        <property name="single_line_mode">False</property>
+                        <property name="angle">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="right_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="fsid_button">
+                <property name="border_width">2</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">Use _FSID for key passphrase</property>
+                <property name="use_underline">True</property>
+                <property name="relief">GTK_RELIEF_NORMAL</property>
+                <property name="focus_on_click">True</property>
+                <property name="active">False</property>
+                <property name="inconsistent">False</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+      </object>
+</interface>
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index ac5c77c..8cdbe1d 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2005 David Zeuthen, <davidz redhat com>
  * Copyright (C) 2005 - 2008 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2005 - 2011 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,7 +35,6 @@
 #include <glib/gi18n-lib.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 
 #define NM_VPN_API_SUBJECT_TO_CHANGE
 
@@ -71,7 +71,7 @@ G_DEFINE_TYPE_EXTENDED (OpenconnectPluginUiWidget, openconnect_plugin_ui_widget,
 #define OPENCONNECT_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), OPENCONNECT_TYPE_PLUGIN_UI_WIDGET, OpenconnectPluginUiWidgetPrivate))
 
 typedef struct {
-	GladeXML *xml;
+	GtkBuilder *builder;
 	GtkWidget *widget;
 	GtkSizeGroup *group;
 	GtkWindowGroup *window_group;
@@ -293,7 +293,7 @@ check_validity (OpenconnectPluginUiWidget *self, GError **error)
 	GtkWidget *widget;
 	const char *str;
 
-	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (!str || !strlen (str)) {
 		g_set_error (error,
@@ -304,7 +304,7 @@ check_validity (OpenconnectPluginUiWidget *self, GError **error)
 	}
 
 
-	widget = glade_xml_get_widget (priv->xml, "proxy_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "proxy_entry"));
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && str[0] &&
 		strncmp(str, "socks://", 8) && strncmp(str, "http://";, 7)) {
@@ -315,7 +315,7 @@ check_validity (OpenconnectPluginUiWidget *self, GError **error)
 		return FALSE;
 	}
 
-	if (!auth_widget_check_validity (priv->xml, error))
+	if (!auth_widget_check_validity (priv->builder, error))
 		return FALSE;
 
 	return TRUE;
@@ -339,7 +339,7 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 
 	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
 	if (!widget)
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
@@ -350,7 +350,7 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 	}
 	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
 
-	widget = glade_xml_get_widget (priv->xml, "proxy_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "proxy_entry"));
 	if (!widget)
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
@@ -361,7 +361,7 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 	}
 	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
 
-	widget = glade_xml_get_widget (priv->xml, "fsid_button");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "fsid_button"));
 	if (!widget)
 		return FALSE;
 	if (s_vpn) {
@@ -371,7 +371,7 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 	}
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
 
-	widget = glade_xml_get_widget (priv->xml, "csd_button");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "csd_button"));
 	if (!widget)
 		return FALSE;
 	if (s_vpn) {
@@ -381,8 +381,7 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 	}
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
 
-	tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn,
-							 stuff_changed_cb, self);
+	tls_pw_init_auth_widget (priv->builder, priv->group, s_vpn, stuff_changed_cb, self);
 
 	return TRUE;
 }
@@ -414,25 +413,25 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
 	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_OPENCONNECT, NULL);
 
-	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && strlen (str))
 		nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_GATEWAY, str);
 
-	widget = glade_xml_get_widget (priv->xml, "proxy_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "proxy_entry"));
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && strlen (str))
 		nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PROXY, str);
 
-	widget = glade_xml_get_widget (priv->xml, "fsid_button");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "fsid_button"));
 	str = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget))?"yes":"no";
 	nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID, str);
 
-	widget = glade_xml_get_widget (priv->xml, "csd_button");
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "csd_button"));
 	str = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget))?"yes":"no";
 	nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_ENABLE, str);
 	
-	auth_widget_update_connection (priv->xml, auth_type, s_vpn);
+	auth_widget_update_connection (priv->builder, auth_type, s_vpn);
 
 	nm_connection_add_setting (connection, NM_SETTING (s_vpn));
 	return TRUE;
@@ -452,7 +451,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 {
 	NMVpnPluginUiWidgetInterface *object;
 	OpenconnectPluginUiWidgetPrivate *priv;
-	char *glade_file;
+	char *ui_file;
 
 	if (error)
 		g_return_val_if_fail (*error == NULL, NULL);
@@ -465,18 +464,24 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 
 	priv = OPENCONNECT_PLUGIN_UI_WIDGET_GET_PRIVATE (object);
 
-	glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-openconnect-dialog.glade");
-	priv->xml = glade_xml_new (glade_file, "openconnect-vbox", GETTEXT_PACKAGE);
-	if (priv->xml == NULL) {
+	ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-openconnect-dialog.ui");
+	priv->builder = gtk_builder_new ();
+
+	if (!gtk_builder_add_from_file (priv->builder, ui_file, error)) {
+		g_warning ("Couldn't load builder file: %s",
+		           error && *error ? (*error)->message : "(unknown)");
+		g_clear_error (error);
 		g_set_error (error, OPENCONNECT_PLUGIN_UI_ERROR, 0,
-		             "could not load required resources at %s", glade_file);
-		g_free (glade_file);
+		             "could not load required resources at %s", ui_file);
+		g_free (ui_file);
 		g_object_unref (object);
 		return NULL;
 	}
-	g_free (glade_file);
+	g_free (ui_file);
+
+	gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
 
-	priv->widget = glade_xml_get_widget (priv->xml, "openconnect-vbox");
+	priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "openconnect-vbox"));
 	if (!priv->widget) {
 		g_set_error (error, OPENCONNECT_PLUGIN_UI_ERROR, 0, "could not load UI widget");
 		g_object_unref (object);
@@ -509,8 +514,8 @@ dispose (GObject *object)
 	if (priv->widget)
 		g_object_unref (priv->widget);
 
-	if (priv->xml)
-		g_object_unref (priv->xml);
+	if (priv->builder)
+		g_object_unref (priv->builder);
 
 	G_OBJECT_CLASS (openconnect_plugin_ui_widget_parent_class)->dispose (object);
 }



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