[network-manager-pptp] ui: migrate to GtkBuilder (bgo #641273)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-pptp] ui: migrate to GtkBuilder (bgo #641273)
- Date: Mon, 7 Feb 2011 13:56:11 +0000 (UTC)
commit 80d75e1a91311fa3b9ec035dc1af6431ab350876
Author: Mathieu Trudel-Lapierre <mathieu tl gmail com>
Date: Mon Feb 7 14:49:43 2011 +0100
ui: migrate to GtkBuilder (bgo #641273)
[jklimes: changing ui file and some other corrections as well]
auth-dialog/Makefile.am | 2 +-
configure.ac | 4 -
properties/Makefile.am | 16 +-
properties/advanced-dialog.c | 106 ++++----
.../{nm-pptp-dialog.glade => nm-pptp-dialog.ui} | 287 ++++++++++----------
properties/nm-pptp.c | 64 +++--
6 files changed, 246 insertions(+), 233 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index 446955b..9df6a51 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -9,7 +9,7 @@ nm_pptp_auth_dialog_CPPFLAGS = \
$(GCONF_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
- -DGLADEDIR=\""$(gladedir)"\" \
+ -DUIDIR=\""$(uidir)"\" \
-DBINDIR=\""$(bindir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
diff --git a/configure.ac b/configure.ac
index 1ab4056..33d9ab3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,10 +86,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/properties/Makefile.am b/properties/Makefile.am
index 50b49fc..a83cd27 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -9,26 +9,24 @@ libnm_pptp_properties_la_SOURCES = \
import-export.c \
import-export.h
-gladedir = $(datadir)/gnome-vpn-properties/pptp
-glade_DATA = nm-pptp-dialog.glade
+uidir = $(datadir)/gnome-vpn-properties/pptp
+ui_DATA = nm-pptp-dialog.ui
-libnm_pptp_properties_la_CFLAGS = \
- $(GLADE_CFLAGS) \
+libnm_pptp_properties_la_CFLAGS = \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
$(NETWORKMANAGER_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
- -DGLADEDIR=\""$(gladedir)"\" \
+ -DUIDIR=\""$(uidir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\"
-libnm_pptp_properties_la_LIBADD = \
- $(GLADE_LIBS) \
+libnm_pptp_properties_la_LIBADD = \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS) \
@@ -38,7 +36,7 @@ libnm_pptp_properties_la_LIBADD = \
libnm_pptp_properties_la_LDFLAGS = \
-avoid-version
-CLEANFILES = *.bak *.gladep *~
+CLEANFILES = *.bak *~
EXTRA_DIST = \
- $(glade_DATA)
+ $(ui_DATA)
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index 2bf4f2d..f271d0e 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -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
@@ -33,7 +34,6 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-#include <glade/glade.h>
#include <nm-connection.h>
#include <nm-setting-vpn.h>
@@ -99,7 +99,7 @@ advanced_dialog_new_hash_from_connection (NMConnection *connection,
}
static void
-handle_mppe_changed (GtkWidget *check, gboolean is_init, GladeXML *xml)
+handle_mppe_changed (GtkWidget *check, gboolean is_init, GtkBuilder *builder)
{
GtkWidget *widget;
gboolean use_mppe;
@@ -120,7 +120,7 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GladeXML *xml)
/* If MPPE is active, PAP, CHAP, and EAP aren't allowed by the MPPE specs;
* likewise, if MPPE is inactive, sensitize the PAP, CHAP, and EAP checkboxes.
*/
- widget = glade_xml_get_widget (xml, "ppp_auth_methods");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_auth_methods"));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid) {
@@ -141,15 +141,15 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GladeXML *xml)
valid = gtk_tree_model_iter_next (model, &iter);
}
- widget = glade_xml_get_widget (xml, "ppp_mppe_security_label");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_label"));
gtk_widget_set_sensitive (widget, use_mppe);
- widget = glade_xml_get_widget (xml, "ppp_mppe_security_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
if (!use_mppe)
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); /* default */
gtk_widget_set_sensitive (widget, use_mppe);
- widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
if (!use_mppe)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_set_sensitive (widget, use_mppe);
@@ -158,7 +158,7 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GladeXML *xml)
static void
mppe_toggled_cb (GtkWidget *check, gpointer user_data)
{
- handle_mppe_changed (check, FALSE, (GladeXML *) user_data);
+ handle_mppe_changed (check, FALSE, (GtkBuilder *) user_data);
}
#define SEC_INDEX_DEFAULT 0
@@ -166,7 +166,7 @@ mppe_toggled_cb (GtkWidget *check, gpointer user_data)
#define SEC_INDEX_MPPE_40 2
static void
-setup_security_combo (GladeXML *xml, GHashTable *hash)
+setup_security_combo (GtkBuilder *builder, GHashTable *hash)
{
GtkWidget *widget;
GtkListStore *store;
@@ -174,10 +174,10 @@ setup_security_combo (GladeXML *xml, GHashTable *hash)
int active = -1;
const char *value;
- g_return_if_fail (xml != NULL);
+ g_return_if_fail (builder != NULL);
g_return_if_fail (hash != NULL);
- widget = glade_xml_get_widget (xml, "ppp_mppe_security_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
store = gtk_list_store_new (1, G_TYPE_STRING);
@@ -211,7 +211,7 @@ setup_security_combo (GladeXML *xml, GHashTable *hash)
static void
check_toggled_cb (GtkCellRendererToggle *cell, gchar *path_str, gpointer user_data)
{
- GladeXML *xml = GLADE_XML (user_data);
+ GtkBuilder *builder = (GtkBuilder *) user_data;
GtkWidget *widget;
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
GtkTreeModel *model;
@@ -221,7 +221,7 @@ check_toggled_cb (GtkCellRendererToggle *cell, gchar *path_str, gpointer user_da
gboolean mschap_state = TRUE;
gboolean mschap2_state = TRUE;
- widget = glade_xml_get_widget (xml, "ppp_auth_methods");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_auth_methods"));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
gtk_tree_model_get_iter (model, &iter, path);
@@ -254,7 +254,7 @@ check_toggled_cb (GtkCellRendererToggle *cell, gchar *path_str, gpointer user_da
valid = gtk_tree_model_iter_next (model, &iter);
}
- widget = glade_xml_get_widget (xml, "ppp_use_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
if (!mschap_state && !mschap2_state) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_set_sensitive (widget, FALSE);
@@ -263,7 +263,7 @@ check_toggled_cb (GtkCellRendererToggle *cell, gchar *path_str, gpointer user_da
}
static void
-auth_methods_setup (GladeXML *xml, GHashTable *hash)
+auth_methods_setup (GtkBuilder *builder, GHashTable *hash)
{
GtkWidget *widget;
GtkListStore *store;
@@ -359,11 +359,11 @@ auth_methods_setup (GladeXML *xml, GHashTable *hash)
-1);
/* Set up the tree view */
- widget = glade_xml_get_widget (xml, "ppp_auth_methods");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_auth_methods"));
gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (store));
check_renderer = GTK_CELL_RENDERER_TOGGLE (gtk_cell_renderer_toggle_new ());
- g_signal_connect (check_renderer, "toggled", G_CALLBACK (check_toggled_cb), xml);
+ g_signal_connect (check_renderer, "toggled", G_CALLBACK (check_toggled_cb), builder);
offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
-1, "", GTK_CELL_RENDERER (check_renderer),
@@ -386,7 +386,7 @@ auth_methods_setup (GladeXML *xml, GHashTable *hash)
gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
/* Make sure MPPE is non-sensitive if MSCHAP and MSCHAPv2 are disabled */
- widget = glade_xml_get_widget (xml, "ppp_use_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
if (!mschap_state && !mschap2_state) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_set_sensitive (widget, FALSE);
@@ -397,31 +397,39 @@ auth_methods_setup (GladeXML *xml, GHashTable *hash)
GtkWidget *
advanced_dialog_new (GHashTable *hash)
{
- GladeXML *xml;
+ GtkBuilder *builder;
GtkWidget *dialog = NULL;
- char *glade_file = NULL;
+ char *ui_file = NULL;
GtkWidget *widget;
const char *value;
gboolean mppe = FALSE;
+ GError *error = NULL;
g_return_val_if_fail (hash != NULL, NULL);
- glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-pptp-dialog.glade");
- xml = glade_xml_new (glade_file, "pptp-advanced-dialog", GETTEXT_PACKAGE);
- if (xml == NULL)
+ ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-pptp-dialog.ui");
+ builder = gtk_builder_new ();
+
+ if (!gtk_builder_add_from_file (builder, ui_file, &error)) {
+ g_warning ("Couldn't load builder file: %s",
+ error ? error->message : "(unknown)");
+ g_clear_error (&error);
+ g_object_unref (G_OBJECT (builder));
goto out;
+ }
+ gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
- dialog = glade_xml_get_widget (xml, "pptp-advanced-dialog");
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder, "pptp-advanced-dialog"));
if (!dialog) {
- g_object_unref (G_OBJECT (xml));
+ g_object_unref (G_OBJECT (builder));
goto out;
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- g_object_set_data_full (G_OBJECT (dialog), "glade-xml",
- xml, (GDestroyNotify) g_object_unref);
+ g_object_set_data_full (G_OBJECT (dialog), "gtkbuilder-xml",
+ builder, (GDestroyNotify) g_object_unref);
- setup_security_combo (xml, hash);
+ setup_security_combo (builder, hash);
value = g_hash_table_lookup (hash, NM_PPTP_KEY_REQUIRE_MPPE);
if (value && !strcmp (value, "yes"))
@@ -435,34 +443,34 @@ advanced_dialog_new (GHashTable *hash)
if (value && !strcmp (value, "yes"))
mppe = TRUE;
- widget = glade_xml_get_widget (xml, "ppp_use_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
if (mppe)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
value = g_hash_table_lookup (hash, NM_PPTP_KEY_MPPE_STATEFUL);
if (value && !strcmp (value, "yes"))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- widget = glade_xml_get_widget (xml, "ppp_allow_bsdcomp");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_bsdcomp"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
value = g_hash_table_lookup (hash, NM_PPTP_KEY_NOBSDCOMP);
if (value && !strcmp (value, "yes"))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- widget = glade_xml_get_widget (xml, "ppp_allow_deflate");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_deflate"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
value = g_hash_table_lookup (hash, NM_PPTP_KEY_NODEFLATE);
if (value && !strcmp (value, "yes"))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- widget = glade_xml_get_widget (xml, "ppp_usevj");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_usevj"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
value = g_hash_table_lookup (hash, NM_PPTP_KEY_NO_VJ_COMP);
if (value && !strcmp (value, "yes"))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- widget = glade_xml_get_widget (xml, "ppp_send_echo_packets");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_send_echo_packets"));
value = g_hash_table_lookup (hash, NM_PPTP_KEY_LCP_ECHO_INTERVAL);
if (value && strlen (value)) {
long int tmp_int;
@@ -473,14 +481,14 @@ advanced_dialog_new (GHashTable *hash)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
}
- auth_methods_setup (xml, hash);
+ auth_methods_setup (builder, hash);
- widget = glade_xml_get_widget (xml, "ppp_use_mppe");
- handle_mppe_changed (widget, TRUE, xml);
- g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (mppe_toggled_cb), xml);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
+ handle_mppe_changed (widget, TRUE, builder);
+ g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (mppe_toggled_cb), builder);
out:
- g_free (glade_file);
+ g_free (ui_file);
return dialog;
}
@@ -489,7 +497,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
{
GHashTable *hash;
GtkWidget *widget;
- GladeXML *xml;
+ GtkBuilder *builder;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid;
@@ -498,15 +506,15 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
if (error)
g_return_val_if_fail (*error == NULL, NULL);
- xml = g_object_get_data (G_OBJECT (dialog), "glade-xml");
- g_return_val_if_fail (xml != NULL, NULL);
+ builder = g_object_get_data (G_OBJECT (dialog), "gtkbuilder-xml");
+ g_return_val_if_fail (builder != NULL, NULL);
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- widget = glade_xml_get_widget (xml, "ppp_use_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
- widget = glade_xml_get_widget (xml, "ppp_mppe_security_combo");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) {
case SEC_INDEX_MPPE_128:
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_REQUIRE_MPPE_128), g_strdup ("yes"));
@@ -519,30 +527,30 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
break;
}
- widget = glade_xml_get_widget (xml, "ppp_allow_stateful_mppe");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_MPPE_STATEFUL), g_strdup ("yes"));
}
- widget = glade_xml_get_widget (xml, "ppp_allow_bsdcomp");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_bsdcomp"));
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NOBSDCOMP), g_strdup ("yes"));
- widget = glade_xml_get_widget (xml, "ppp_allow_deflate");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_deflate"));
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NODEFLATE), g_strdup ("yes"));
- widget = glade_xml_get_widget (xml, "ppp_usevj");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_usevj"));
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NO_VJ_COMP), g_strdup ("yes"));
- widget = glade_xml_get_widget (xml, "ppp_send_echo_packets");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_send_echo_packets"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_FAILURE), g_strdup_printf ("%d", 5));
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_LCP_ECHO_INTERVAL), g_strdup_printf ("%d", 30));
}
- widget = glade_xml_get_widget (xml, "ppp_auth_methods");
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_auth_methods"));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid) {
diff --git a/properties/nm-pptp-dialog.glade b/properties/nm-pptp-dialog.ui
similarity index 77%
rename from properties/nm-pptp-dialog.glade
rename to properties/nm-pptp-dialog.ui
index f003935..13c62c8 100644
--- a/properties/nm-pptp-dialog.glade
+++ b/properties/nm-pptp-dialog.ui
@@ -1,98 +1,105 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Sun Oct 12 10:59:11 2008 -->
-<glade-interface>
- <widget class="GtkWindow" id="pptp-widget">
- <property name="title" translatable="yes">window1</property>
- <child>
- <widget class="GtkVBox" id="pptp-vbox">
+<?xml version="1.0"?>
+<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">Default</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkVBox" id="pptp-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_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<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="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_SHRINK | GTK_FILL</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">4</property>
<property name="n_columns">2</property>
@@ -102,104 +109,103 @@
<placeholder/>
</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">3</property>
<property name="bottom_attach">4</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">NT Domain:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</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 password</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>
<property name="top_attach">2</property>
<property name="bottom_attach">3</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">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">Password:</property>
- </widget>
+ </object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | 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="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_SHRINK | GTK_FILL</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>
<property name="fill">False</property>
@@ -207,47 +213,46 @@
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="xscale">0</property>
<child>
- <widget class="GtkButton" id="advanced_button">
+ <object class="GtkButton" id="advanced_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="response_id">0</property>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkImage" id="image1">
+ <object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Ad_vanced...</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -255,10 +260,8 @@
<property name="position">2</property>
</packing>
</child>
- </widget>
- </child>
- </widget>
- <widget class="GtkDialog" id="pptp-advanced-dialog">
+ </object>
+ <object class="GtkDialog" id="pptp-advanced-dialog">
<property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="title" translatable="yes">PPTP Advanced Options</property>
@@ -268,193 +271,196 @@
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox3">
+ <object class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GtkVBox" id="PppPage">
+ <object class="GtkVBox" id="PppPage">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="spacing">18</property>
<child>
- <widget class="GtkVBox" id="vbox2">
+ <object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label28">
+ <object class="GtkLabel" id="label28">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>Authentication</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="alignment2">
+ <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkVBox" id="vbox4">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="auth_methods_label">
+ <object class="GtkLabel" id="auth_methods_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Allow the following authentication methods:</property>
- </widget>
+ </object>
</child>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
- <widget class="GtkTreeView" id="ppp_auth_methods">
+ <object class="GtkTreeView" id="ppp_auth_methods">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox5">
+ <object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label29">
+ <object class="GtkLabel" id="label29">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>Security and Compression</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="alignment3">
+ <object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkVBox" id="vbox6">
+ <object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox7">
+ <object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton" id="ppp_use_mppe">
+ <object class="GtkCheckButton" id="ppp_use_mppe">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use _Point-to-Point encryption (MPPE)</property>
- <property name="tooltip" translatable="yes">Note: MPPE encryption is only available with MSCHAP authentication methods. To enable this checkbox, select one or more of the MSCHAP authentication methods: MSCHAP or MSCHAPv2.</property>
+ <property name="tooltip-text" translatable="yes">Note: MPPE encryption is only available with MSCHAP authentication methods. To enable this checkbox, select one or more of the MSCHAP authentication methods: MSCHAP or MSCHAPv2.</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment4">
+ <object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox1">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="ppp_mppe_security_label">
+ <object class="GtkLabel" id="ppp_mppe_security_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Security:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ppp_mppe_security_combo</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="ppp_mppe_security_combo">
+ <object class="GtkComboBox" id="ppp_mppe_security_combo">
<property name="visible">True</property>
- <property name="items" translatable="yes">Default</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="expand">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
<child>
- <widget class="GtkCheckButton" id="ppp_allow_stateful_mppe">
+ <object class="GtkCheckButton" id="ppp_allow_stateful_mppe">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Allow st_ateful encryption</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</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>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="ppp_allow_bsdcomp">
+ <object class="GtkCheckButton" id="ppp_allow_bsdcomp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Allow _BSD data compression</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -462,14 +468,13 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="ppp_allow_deflate">
+ <object class="GtkCheckButton" id="ppp_allow_deflate">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Allow _Deflate data compression</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -477,112 +482,112 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="ppp_usevj">
+ <object class="GtkCheckButton" id="ppp_usevj">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use TCP _header compression</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox9">
+ <object class="GtkVBox" id="vbox9">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label31">
+ <object class="GtkLabel" id="label31">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>Echo</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="alignment5">
+ <object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkCheckButton" id="ppp_send_echo_packets">
+ <object class="GtkCheckButton" id="ppp_send_echo_packets">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Send PPP _echo packets</property>
<property name="use_underline">True</property>
- <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area3">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
- <widget class="GtkButton" id="cancel_button">
+ <object class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
- <property name="response_id">-6</property>
- </widget>
+ </object>
</child>
<child>
- <widget class="GtkButton" id="ok_button">
+ <object class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
- <property name="response_id">-5</property>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
-</glade-interface>
+ <action-widgets>
+ <action-widget response="-6">cancel_button</action-widget>
+ <action-widget response="-5">ok_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index 0d6f472..69483d1 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -3,6 +3,7 @@
* nm-pptp.c : GNOME UI dialogs for configuring PPTP VPN connections
*
* Copyright (C) 2008 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2008 - 2011 Red Hat, Inc.
* Based on work by David Zeuthen, <davidz redhat com>
*
* This program is free software; you can redistribute it and/or modify
@@ -32,7 +33,6 @@
#include <glib/gi18n-lib.h>
#include <string.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#define NM_VPN_API_SUBJECT_TO_CHANGE
@@ -73,7 +73,7 @@ G_DEFINE_TYPE_EXTENDED (PptpPluginUiWidget, pptp_plugin_ui_widget, G_TYPE_OBJECT
#define PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PPTP_TYPE_PLUGIN_UI_WIDGET, PptpPluginUiWidgetPrivate))
typedef struct {
- GladeXML *xml;
+ GtkBuilder *builder;
GtkWidget *widget;
GtkSizeGroup *group;
GtkWindowGroup *window_group;
@@ -129,7 +129,7 @@ check_validity (PptpPluginUiWidget *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,
@@ -218,13 +218,13 @@ show_toggled_cb (GtkCheckButton *button, PptpPluginUiWidget *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);
}
static GtkWidget *
-fill_password (GladeXML *xml,
+fill_password (GtkBuilder *builder,
const char *widget_name,
NMConnection *connection,
const char *password_type)
@@ -232,7 +232,7 @@ fill_password (GladeXML *xml,
GtkWidget *widget = NULL;
gchar *password = NULL;
- widget = glade_xml_get_widget (xml, widget_name);
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
g_assert (widget);
if (!connection)
@@ -272,7 +272,7 @@ fill_password (GladeXML *xml,
}
static void
-fill_vpn_passwords (GladeXML *xml,
+fill_vpn_passwords (GtkBuilder *builder,
GtkSizeGroup *group,
NMConnection *connection,
ChangedCallback changed_cb,
@@ -280,12 +280,12 @@ fill_vpn_passwords (GladeXML *xml,
{
GtkWidget *w = NULL;
- w = fill_password (xml, "user_password_entry", connection, NM_PPTP_KEY_PASSWORD);
+ w = fill_password (builder, "user_password_entry", connection, NM_PPTP_KEY_PASSWORD);
if (w) {
gtk_size_group_add_widget (group, w);
g_signal_connect (w, "changed", G_CALLBACK (changed_cb), user_data);
} else {
- g_error ("No user_password_entry in glade file!");
+ g_error ("No userbuilder in GtkBuilder file!");
}
}
@@ -301,7 +301,7 @@ init_plugin_ui (PptpPluginUiWidget *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"));
if (!widget)
return FALSE;
gtk_size_group_add_widget (priv->group, widget);
@@ -312,7 +312,7 @@ init_plugin_ui (PptpPluginUiWidget *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, "user_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
if (!widget)
return FALSE;
gtk_size_group_add_widget (priv->group, widget);
@@ -323,7 +323,7 @@ init_plugin_ui (PptpPluginUiWidget *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"));
if (!widget)
return FALSE;
gtk_size_group_add_widget (priv->group, widget);
@@ -334,16 +334,16 @@ init_plugin_ui (PptpPluginUiWidget *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, "advanced_button");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "advanced_button"));
g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (advanced_button_clicked_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,
self);
- fill_vpn_passwords (priv->xml, priv->group, connection, stuff_changed_cb, self);
+ fill_vpn_passwords (priv->builder, priv->group, connection, stuff_changed_cb, self);
return TRUE;
}
@@ -384,19 +384,19 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_PPTP, NULL);
/* Gateway */
- 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))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_GATEWAY, str);
/* Username */
- widget = glade_xml_get_widget (priv->xml, "user_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
str = gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_USER, str);
/* Domain */
- widget = glade_xml_get_widget (priv->xml, "domain_entry");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
str = gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_DOMAIN, str);
@@ -434,7 +434,7 @@ save_secrets (NMVpnPluginUiWidgetInterface *iface,
id = nm_setting_connection_get_id (s_con);
uuid = nm_setting_connection_get_uuid (s_con);
- 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);
str = gtk_entry_get_text (GTK_ENTRY (widget));
if (str && strlen (str)) {
@@ -452,7 +452,7 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
{
NMVpnPluginUiWidgetInterface *object;
PptpPluginUiWidgetPrivate *priv;
- char *glade_file;
+ char *ui_file;
if (error)
g_return_val_if_fail (*error == NULL, NULL);
@@ -465,18 +465,24 @@ nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (object);
- glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-pptp-dialog.glade");
- priv->xml = glade_xml_new (glade_file, "pptp-vbox", GETTEXT_PACKAGE);
- if (priv->xml == NULL) {
+ ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-pptp-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, PPTP_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, "pptp-vbox");
+ priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "pptp-vbox"));
if (!priv->widget) {
g_set_error (error, PPTP_PLUGIN_UI_ERROR, 0, "could not load UI widget");
g_object_unref (object);
@@ -515,8 +521,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);
if (priv->advanced)
g_hash_table_destroy (priv->advanced);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]