[network-manager-vpnc/NM_0_8] ui: migrate to GtkBuilder (bgo #641274)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/NM_0_8] ui: migrate to GtkBuilder (bgo #641274)
- Date: Mon, 7 Feb 2011 15:15:31 +0000 (UTC)
commit 5f5d753d67f5d16c0e9562dbde9b7064cf93c7a8
Author: Mathieu Trudel-Lapierre <mathieu tl gmail com>
Date: Mon Feb 7 16:10:02 2011 +0100
ui: migrate to GtkBuilder (bgo #641274)
[jklimes: changed ui file and did some other adjustments]
auth-dialog/Makefile.am | 1 -
configure.ac | 4 -
po/POTFILES.in | 2 +-
properties/Makefile.am | 12 +-
.../{nm-vpnc-dialog.glade => nm-vpnc-dialog.ui} | 254 +++++++++++++-------
properties/nm-vpnc.c | 107 +++++----
properties/tests/Makefile.am | 2 -
7 files changed, 226 insertions(+), 156 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index 61bd673..4d9b6ba 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -9,7 +9,6 @@ nm_vpnc_auth_dialog_CPPFLAGS = \
$(GCONF_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
- -DGLADEDIR=\""$(gladedir)"\" \
-DBINDIR=\""$(bindir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
diff --git a/configure.ac b/configure.ac
index 3a3a696..82967b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,10 +74,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 c1109cd..94cc01d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,7 +4,7 @@ auth-dialog/gnome-two-password-dialog.c
auth-dialog/main.c
nm-vpnc.desktop.in
properties/nm-vpnc.c
-properties/nm-vpnc-dialog.glade
+properties/nm-vpnc-dialog.ui
src/nm-vpnc-service.c
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 529b7a8..7b5539c 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -11,17 +11,16 @@ libnm_vpnc_properties_la_SOURCES = \
nm-vpnc.c \
nm-vpnc.h
-gladedir = $(datadir)/gnome-vpn-properties/vpnc
-glade_DATA = nm-vpnc-dialog.glade
+uidir = $(datadir)/gnome-vpn-properties/vpnc
+ui_DATA = nm-vpnc-dialog.ui
libnm_vpnc_properties_la_CPPFLAGS = \
- $(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
$(NETWORKMANAGER_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
- -DGLADEDIR=\""$(gladedir)"\" \
+ -DUIDIR=\""$(uidir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
@@ -29,7 +28,6 @@ libnm_vpnc_properties_la_CPPFLAGS = \
-DVERSION=\"$(VERSION)\"
libnm_vpnc_properties_la_LIBADD = \
- $(GLADE_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(NETWORKMANAGER_LIBS) \
@@ -39,6 +37,6 @@ libnm_vpnc_properties_la_LIBADD = \
libnm_vpnc_properties_la_LDFLAGS = \
-avoid-version
-CLEANFILES = *.bak *.gladep *~
+CLEANFILES = *.bak *~
-EXTRA_DIST = $(glade_DATA)
+EXTRA_DIST = $(ui_DATA)
diff --git a/properties/nm-vpnc-dialog.glade b/properties/nm-vpnc-dialog.ui
similarity index 70%
rename from properties/nm-vpnc-dialog.glade
rename to properties/nm-vpnc-dialog.ui
index adf9788..e26952d 100644
--- a/properties/nm-vpnc-dialog.glade
+++ b/properties/nm-vpnc-dialog.ui
@@ -1,36 +1,84 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<?xml version="1.0"?>
<!--*- mode: xml -*-->
-<glade-interface>
- <widget class="GtkWindow" id="vpnc-widget">
- <property name="title" translatable="yes">window1</property>
- <child>
- <widget class="GtkVBox" id="vpnc-vbox">
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkListStore" id="model1">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model2">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model3">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model4">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model5">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkVBox" id="vpnc-vbox">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">16</property>
<child>
- <widget class="GtkVBox" id="vbox8">
+ <object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label22">
+ <object class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>General</b></property>
<property name="use_markup">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment8">
+ <object class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkTable" id="table2">
+ <object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">3</property>
@@ -49,10 +97,16 @@
<placeholder/>
</child>
<child>
- <widget class="GtkComboBox" id="group_pass_type_combo">
+ <object class="GtkComboBox" id="group_pass_type_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- </widget>
+ <property name="model">model1</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@@ -61,10 +115,16 @@
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="user_pass_type_combo">
+ <object class="GtkComboBox" id="user_pass_type_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- </widget>
+ <property name="model">model2</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@@ -73,13 +133,12 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="show_passwords_checkbutton">
+ <object class="GtkCheckButton" id="show_passwords_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show passwords</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -88,149 +147,149 @@
</packing>
</child>
<child>
- <widget class="GtkEntry" id="group_password_entry">
+ <object class="GtkEntry" id="group_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label4">
+ <object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Gro_up password:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label23">
+ <object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Gateway:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">gateway_entry</property>
- </widget>
+ </object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label24">
+ <object class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">G_roup name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="gateway_entry">
+ <object class="GtkEntry" id="gateway_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="group_entry">
+ <object class="GtkEntry" id="group_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- </widget>
+ </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"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label3">
+ <object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_User password:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="user_password_entry">
+ <object class="GtkEntry" id="user_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
- </widget>
+ </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="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox11">
+ <object class="GtkVBox" id="vbox11">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label25">
+ <object class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>Optional</b></property>
<property name="use_markup">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment9">
+ <object class="GtkAlignment" id="alignment9">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkTable" id="table3">
+ <object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
@@ -240,10 +299,16 @@
<placeholder/>
</child>
<child>
- <widget class="GtkComboBox" id="encryption_combo">
+ <object class="GtkComboBox" id="encryption_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- </widget>
+ <property name="model">model3</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer3"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -252,80 +317,86 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Encryption method:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label26">
+ <object class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">User name:</property>
- </widget>
+ </object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="user_entry">
+ <object class="GtkEntry" id="user_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label27">
+ <object class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Domain:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="domain_entry">
+ <object class="GtkEntry" id="domain_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- </widget>
+ </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"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label2">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">NAT traversal:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="natt_combo">
+ <object class="GtkComboBox" id="natt_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- </widget>
+ <property name="model">model4</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer4"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -334,21 +405,27 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label5">
+ <object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">IKE DH Group:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="dhgroup_combo">
+ <object class="GtkComboBox" id="dhgroup_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- </widget>
+ <property name="model">model5</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer5"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -357,13 +434,12 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="disable_dpd_checkbutton">
+ <object class="GtkCheckButton" id="disable_dpd_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Disable Dead Peer Detection</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -371,21 +447,19 @@
<property name="bottom_attach">6</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
- </child>
- </widget>
-</glade-interface>
+ </object>
+</interface>
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index 6d23d60..9130bd9 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -35,7 +35,6 @@
#include <glib/gi18n-lib.h>
#include <string.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <gnome-keyring.h>
#include <gnome-keyring-memory.h>
@@ -84,7 +83,7 @@ G_DEFINE_TYPE_EXTENDED (VpncPluginUiWidget, vpnc_plugin_ui_widget, G_TYPE_OBJECT
#define VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VPNC_TYPE_PLUGIN_UI_WIDGET, VpncPluginUiWidgetPrivate))
typedef struct {
- GladeXML *xml;
+ GtkBuilder *builder;
GtkWidget *widget;
GtkSizeGroup *group;
gint orig_dpd_timeout;
@@ -137,7 +136,7 @@ check_validity (VpncPluginUiWidget *self, GError **error)
GtkWidget *widget;
char *str;
- 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) || strstr (str, " ") || strstr (str, "\t")) {
g_set_error (error,
@@ -147,7 +146,7 @@ check_validity (VpncPluginUiWidget *self, GError **error)
return FALSE;
}
- widget = glade_xml_get_widget (priv->xml, "group_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (!str || !strlen (str)) {
g_set_error (error,
@@ -216,7 +215,7 @@ fill_vpn_passwords (VpncPluginUiWidget *self, NMConnection *connection)
}
/* User password */
- widget = glade_xml_get_widget (priv->xml, "user_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
if (!widget)
goto out;
if (password)
@@ -225,7 +224,7 @@ fill_vpn_passwords (VpncPluginUiWidget *self, NMConnection *connection)
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
/* Group password */
- widget = glade_xml_get_widget (priv->xml, "group_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_password_entry"));
if (!widget)
goto out;
if (group_password)
@@ -251,11 +250,11 @@ show_toggled_cb (GtkCheckButton *button, VpncPluginUiWidget *self)
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
- widget = glade_xml_get_widget (priv->xml, "user_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
g_assert (widget);
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
- widget = glade_xml_get_widget (priv->xml, "group_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_password_entry"));
g_assert (widget);
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
}
@@ -271,18 +270,18 @@ pw_type_changed_helper (VpncPluginUiWidget *self, GtkWidget *combo)
/* If the user chose "Not required", desensitize and clear the correct
* password entry.
*/
- widget = glade_xml_get_widget (priv->xml, "user_pass_type_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_pass_type_combo"));
if (combo == widget)
entry = "user_password_entry";
else {
- widget = glade_xml_get_widget (priv->xml, "group_pass_type_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_pass_type_combo"));
if (combo == widget)
entry = "group_password_entry";
}
if (!entry)
return;
- widget = glade_xml_get_widget (priv->xml, entry);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry));
g_assert (widget);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
@@ -325,7 +324,7 @@ init_one_pw_combo (VpncPluginUiWidget *self,
/* If there's already a password and the password type can't be found in
* the VPN settings, default to saving it. Otherwise, always ask for it.
*/
- widget = glade_xml_get_widget (priv->xml, entry_name);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry_name));
if (widget) {
const char *tmp;
@@ -359,7 +358,7 @@ init_one_pw_combo (VpncPluginUiWidget *self,
active = 2;
}
- widget = glade_xml_get_widget (priv->xml, combo_name);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, combo_name));
g_assert (widget);
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
g_object_unref (store);
@@ -386,7 +385,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
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"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
if (s_vpn) {
@@ -396,7 +395,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "group_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
if (s_vpn) {
@@ -406,7 +405,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "encryption_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encryption_combo"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
@@ -446,7 +445,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
init_one_pw_combo (self, s_vpn, "group_pass_type_combo",
NM_VPNC_KEY_SECRET_TYPE, "group_password_entry");
- widget = glade_xml_get_widget (priv->xml, "user_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
if (s_vpn) {
@@ -456,7 +455,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "domain_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
if (s_vpn) {
@@ -499,7 +498,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
active = 3;
}
- widget = glade_xml_get_widget (priv->xml, "natt_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "natt_combo"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
@@ -533,7 +532,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
active = 2;
}
- widget = glade_xml_get_widget (priv->xml, "dhgroup_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dhgroup_combo"));
g_return_val_if_fail (widget != NULL, FALSE);
gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
@@ -542,7 +541,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "disable_dpd_checkbutton"));
g_return_val_if_fail (widget != NULL, FALSE);
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
@@ -560,7 +559,7 @@ init_plugin_ui (VpncPluginUiWidget *self, NMConnection *connection, GError **err
}
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "show_passwords_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "show_passwords_checkbutton"));
g_return_val_if_fail (widget != NULL, FALSE);
g_signal_connect (G_OBJECT (widget), "toggled",
(GCallback) show_toggled_cb,
@@ -579,13 +578,13 @@ get_widget (NMVpnPluginUiWidgetInterface *iface)
}
static guint32
-handle_one_pw_type (NMSettingVPN *s_vpn, GladeXML *xml, const char *name, const char *key)
+handle_one_pw_type (NMSettingVPN *s_vpn, GtkBuilder *builder, const char *name, const char *key)
{
GtkWidget *widget;
GtkTreeModel *model;
guint32 pw_type;
- widget = glade_xml_get_widget (xml, name);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, name));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
pw_type = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
@@ -627,28 +626,28 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_VPNC, NULL);
/* Gateway */
- 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_VPNC_KEY_GATEWAY, str);
/* Group name */
- widget = glade_xml_get_widget (priv->xml, "group_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_ID, str);
- widget = glade_xml_get_widget (priv->xml, "user_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER, str);
- widget = glade_xml_get_widget (priv->xml, "domain_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DOMAIN, str);
- widget = glade_xml_get_widget (priv->xml, "encryption_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encryption_combo"));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) {
case ENC_TYPE_WEAK:
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_SINGLE_DES, "yes");
@@ -661,7 +660,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
break;
}
- widget = glade_xml_get_widget (priv->xml, "natt_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "natt_combo"));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
const char *mode = NULL;
@@ -671,7 +670,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
} else
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE, NM_VPNC_NATT_MODE_NATT);
- widget = glade_xml_get_widget (priv->xml, "dhgroup_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dhgroup_combo"));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
const char *dhgroup = NULL;
@@ -681,7 +680,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
} else
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DHGROUP, NM_VPNC_DHGROUP_DH2);
- widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "disable_dpd_checkbutton"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, "0");
} else {
@@ -696,21 +695,21 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
}
}
- upw_type = handle_one_pw_type (s_vpn, priv->xml, "user_pass_type_combo", NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
- gpw_type = handle_one_pw_type (s_vpn, priv->xml, "group_pass_type_combo", NM_VPNC_KEY_SECRET_TYPE);
+ upw_type = handle_one_pw_type (s_vpn, priv->builder, "user_pass_type_combo", NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
+ gpw_type = handle_one_pw_type (s_vpn, priv->builder, "group_pass_type_combo", NM_VPNC_KEY_SECRET_TYPE);
/* System secrets get stored in the connection, user secrets are saved
* via the save_secrets() hook.
*/
if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM) {
/* User password */
- widget = glade_xml_get_widget (priv->xml, "user_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str) && (upw_type != PW_TYPE_UNUSED))
nm_setting_vpn_add_secret (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD, str);
/* Group password */
- widget = glade_xml_get_widget (priv->xml, "group_password_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_password_entry"));
str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str) && (gpw_type != PW_TYPE_UNUSED))
nm_setting_vpn_add_secret (s_vpn, NM_VPNC_KEY_SECRET, str);
@@ -731,7 +730,7 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
}
static void
-save_one_password (GladeXML *xml,
+save_one_password (GtkBuilder *builder,
const char *keyring_tag,
const char *uuid,
const char *id,
@@ -745,11 +744,11 @@ save_one_password (GladeXML *xml,
GtkTreeModel *model;
gboolean saved = FALSE;
- widget = glade_xml_get_widget (xml, combo);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, combo));
g_assert (widget);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == PW_TYPE_SAVE) {
- widget = glade_xml_get_widget (xml, entry);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, entry));
g_assert (widget);
password = gtk_entry_get_text (GTK_ENTRY (widget));
if (password && strlen (password)) {
@@ -787,9 +786,9 @@ save_secrets (NMVpnPluginUiWidgetInterface *iface,
id = nm_setting_connection_get_id (s_con);
uuid = nm_setting_connection_get_uuid (s_con);
- save_one_password (priv->xml, VPNC_USER_PASSWORD, uuid, id,
+ save_one_password (priv->builder, VPNC_USER_PASSWORD, uuid, id,
"user_password_entry", "user_pass_type_combo", "user password");
- save_one_password (priv->xml, VPNC_GROUP_PASSWORD, uuid, id,
+ save_one_password (priv->builder, VPNC_GROUP_PASSWORD, uuid, id,
"group_password_entry", "group_pass_type_combo", "group password");
return TRUE;
@@ -800,7 +799,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
{
NMVpnPluginUiWidgetInterface *object;
VpncPluginUiWidgetPrivate *priv;
- char *glade_file;
+ char *ui_file;
if (error)
g_return_val_if_fail (*error == NULL, NULL);
@@ -813,18 +812,24 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (object);
- glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-vpnc-dialog.glade");
- priv->xml = glade_xml_new (glade_file, "vpnc-vbox", GETTEXT_PACKAGE);
- if (priv->xml == NULL) {
+ ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-vpnc-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, VPNC_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, "vpnc-vbox");
+ priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "vpnc-vbox"));
if (!priv->widget) {
g_set_error (error, VPNC_PLUGIN_UI_ERROR, 0, "could not load UI widget");
g_object_unref (object);
@@ -852,8 +857,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 (vpnc_plugin_ui_widget_parent_class)->dispose (object);
}
diff --git a/properties/tests/Makefile.am b/properties/tests/Makefile.am
index f4b4d22..53a1a43 100644
--- a/properties/tests/Makefile.am
+++ b/properties/tests/Makefile.am
@@ -9,7 +9,6 @@ test_import_export_SOURCES = \
test_import_export_CPPFLAGS = \
$(GLIB_CFLAGS) \
- $(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
@@ -18,7 +17,6 @@ test_import_export_CPPFLAGS = \
test_import_export_LDADD = \
$(GTHREAD_LIBS) \
- $(GLADE_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(GNOMEKEYRING_LIBS) \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]