[NetworkManager-vpnc/lr/gtk-4.0: 15/15] properties: port to Gtk4
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-vpnc/lr/gtk-4.0: 15/15] properties: port to Gtk4
- Date: Tue, 18 Jan 2022 19:40:05 +0000 (UTC)
commit 4dd0f061e58b9db3f002ffac89752fca557e11a7
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Nov 3 18:24:08 2021 +0100
properties: port to Gtk4
.gitignore | 1 +
Makefile.am | 44 ++++++++++++++++++++-
configure.ac | 20 +++++++++-
po/POTFILES.skip | 1 +
properties/nm-vpnc-dialog.ui | 18 +--------
properties/nm-vpnc-editor-plugin.c | 33 +++++++++++-----
properties/nm-vpnc-editor.c | 78 +++++++++++++++++++++++---------------
7 files changed, 133 insertions(+), 62 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 68495af..0734662 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,5 +51,6 @@ properties/resources.h
src/nm-vpnc-service
src/nm-vpnc-service-vpnc-helper
src/test-vpnc-output
+gtk4
/NetworkManager-vpnc*.tar*
diff --git a/Makefile.am b/Makefile.am
index 32faec6..ff01290 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -89,6 +89,9 @@ if WITH_LIBNM_GLIB
plugin_LTLIBRARIES += properties/libnm-vpnc-properties.la
endif
endif
+if WITH_GTK4
+plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-vpnc-editor.la
+endif
properties/resources.h: properties/gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/properties
--generate-header --internal
@@ -96,6 +99,14 @@ properties/resources.h: properties/gresource.xml
properties/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES)
--sourcedir=$(srcdir)/properties --generate-dependencies $(srcdir)/properties/gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/properties
--generate-source --internal
+gtk4/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies
$(srcdir)/properties/gresource.xml |sed "s,^,$(builddir)/gtk4/,")
+ @mkdir -p $(builddir)/gtk4
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(builddir)/gtk4 --generate-source
--internal
+
+gtk4/%.ui: properties/%.ui
+ @mkdir -p $(builddir)/gtk4
+ gtk4-builder-tool simplify --3to4 $< |grep -v can-default >$@
+
plugin_sources = \
properties/nm-vpnc-helper.c \
properties/nm-vpnc-helper.h \
@@ -132,6 +143,32 @@ properties_libnm_vpn_plugin_vpnc_la_LDFLAGS = \
###############################################################################
+properties_libnm_gtk4_vpn_plugin_vpnc_editor_la_SOURCES = \
+ $(shared_sources) \
+ $(editor_sources)
+
+nodist_properties_libnm_gtk4_vpn_plugin_vpnc_editor_la_SOURCES = \
+ properties/resources.h \
+ gtk4/resources.c
+
+properties_libnm_gtk4_vpn_plugin_vpnc_editor_la_CFLAGS = \
+ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
+ $(common_cppflags) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_GTK4_CFLAGS)
+
+properties_libnm_gtk4_vpn_plugin_vpnc_editor_la_LIBADD = \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ $(LIBNMA_GTK4_LIBS)
+
+properties_libnm_gtk4_vpn_plugin_vpnc_editor_la_LDFLAGS = \
+ -avoid-version \
+ -Wl,--version-script=$(srcdir)/properties/libnm-vpn-plugin-vpnc-editor.ver
+
+###############################################################################
+
properties_libnm_vpn_plugin_vpnc_editor_la_SOURCES = \
$(shared_sources) \
$(editor_sources)
@@ -310,7 +347,8 @@ nm-vpnc-service.name: $(srcdir)/nm-vpnc-service.name.in
DISTCHECK_CONFIGURE_FLAGS = \
--with-tests=yes \
- --enable-more-warnings=yes
+ --enable-more-warnings=yes \
+ --with-gtk4
EXTRA_DIST = \
properties/libnm-vpn-plugin-vpnc.ver \
@@ -350,7 +388,9 @@ CLEANFILES = *.bak *~ \
$(nmvpnservice_DATA) \
$(appdata_files) \
properties/resources.c \
- properties/resources.h
+ properties/resources.h \
+ gtk4/resources.c \
+ gtk4/nm-vpnc-dialog.ui
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
diff --git a/configure.ac b/configure.ac
index 3c71d19..784cd88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ dnl
dnl GNOME support
dnl
AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-vpnc without GNOME support, e.g.
vpn service only]), [], [with_gnome_specified=no])
+AC_ARG_WITH(gtk4, AS_HELP_STRING([--with-gtk4], [Build NetworkManager-vpnc with libnma-gtk4 support]), [],
[with_gtk4_specified=no])
AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], [Build NetworkManager-vpnc without libnm-glib
comatibility]), [], [with_libnm_glib_specified=no])
if test "$with_libnm_glib_specified" != no -a "$with_libnm_glib" != no; then
if test "$with_gnome_specified" != no -a "$with_gnome" == no; then
@@ -78,13 +79,20 @@ fi
if test "$with_gnome" != no; then
with_gnome=yes
fi
+if test "$with_gtk4_specified" == no; then
+ with_gtk4=no
+fi
+if test "$with_gtk4" != yes; then
+ with_gtk4=no
+fi
if test "$with_libnm_glib_specified" == no; then
with_libnm_glib=no
fi
-if test "$with_libnm_glib" != no; then
+if test "$with_libnm_glib" != yes; then
with_libnm_glib=no
fi
AM_CONDITIONAL(WITH_GNOME, test "$with_gnome" != no)
+AM_CONDITIONAL(WITH_GTK4, test "$with_gtk4" != no)
AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)
AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name
files. Useful for development. (default is no)]))
@@ -96,7 +104,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
IT_PROG_INTLTOOL([0.35])
AM_GLIB_GNU_GETTEXT
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.34)
+PKG_CHECK_MODULES(GLIB, gmodule-2.0 glib-2.0 >= 2.34)
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_34"
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_34"
@@ -121,6 +129,13 @@ if test x"$with_gnome" != xno; then
fi
fi
+if test x"$with_gtk4" != xno; then
+ PKG_CHECK_MODULES(GTK4, gtk4 >= 4.0)
+ GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0"
+ GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0"
+ PKG_CHECK_MODULES(LIBNMA_GTK4, libnma-gtk4 >= 1.8.33)
+fi
+
PKG_CHECK_MODULES(LIBNM, libnm >= 1.2.0)
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
@@ -157,6 +172,7 @@ AC_OUTPUT
echo ""
echo "Build configuration: "
echo " --with-gnome=$with_gnome"
+echo " --with-gtk4=$with_gtk4"
echo " --with-libnm-glib=$with_libnm_glib"
echo " --enable-absolute-paths=$enable_absolute_paths"
echo " --enable-more-warnings=$set_more_warnings"
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index e69de29..d96fe3b 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+gtk4/nm-vpnc-dialog.ui
diff --git a/properties/nm-vpnc-dialog.ui b/properties/nm-vpnc-dialog.ui
index 6c83e8a..c30ffcf 100644
--- a/properties/nm-vpnc-dialog.ui
+++ b/properties/nm-vpnc-dialog.ui
@@ -7,11 +7,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-preferences</property>
- </object>
<object class="GtkGrid" id="vpnc-vbox">
<property name="visible">True</property>
<property name="row_spacing">6</property>
@@ -168,12 +163,10 @@ config: IPSec secret <group_password></property>
<child>
<object class="GtkCheckButton" id="show_passwords_checkbutton">
<property name="label" translatable="yes">Sho_w passwords</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -184,14 +177,12 @@ config: IPSec secret <group_password></property>
<child>
<object class="GtkCheckButton" id="hybrid_checkbutton">
<property name="label" translatable="yes">Use _hybrid authentication</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Enable hybrid authentication, i.e. use certificate
in addition to password.
config: IKE Authmode hybrid</property>
<property name="use_underline">True</property>
- <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -364,14 +355,10 @@ config: IKE Authmode hybrid</property>
</object>
<object class="GtkDialog" id="vpnc-advanced-dialog">
<property name="can_focus">False</property>
- <property name="border_width">5</property>
<property name="title" translatable="yes">Advanced Options</property>
<property name="modal">True</property>
- <property name="window_position">center</property>
<property name="destroy_with_parent">True</property>
<property name="icon_name">stock-preferences</property>
- <property name="type_hint">dialog</property>
- <property name="skip_taskbar_hint">True</property>
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-10" default="true">apply_button</action-widget>
@@ -426,10 +413,9 @@ config: IKE Authmode hybrid</property>
<property name="orientation">vertical</property>
<property name="spacing">16</property>
<child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <object class="GtkBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
<child>
<placeholder/>
</child>
@@ -760,14 +746,12 @@ config: Local Port <0-65535></property>
<child>
<object class="GtkCheckButton" id="disable_dpd_checkbutton">
<property name="label" translatable="yes">Disable Dead _Peer Detection</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Disable sending DPD packets (sets timeout
to 0)
config: DPD idle timeout (our side) 0</property>
<property name="use_underline">True</property>
- <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
diff --git a/properties/nm-vpnc-editor-plugin.c b/properties/nm-vpnc-editor-plugin.c
index 5a50145..53de7c2 100644
--- a/properties/nm-vpnc-editor-plugin.c
+++ b/properties/nm-vpnc-editor-plugin.c
@@ -24,6 +24,7 @@
#include "nm-vpnc-editor-plugin.h"
+#include <gmodule.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -817,23 +818,35 @@ _call_editor_factory (gpointer factory,
static NMVpnEditor *
get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
{
+ gpointer gtk3_only_symbol;
+ GModule *self_module;
+ const char *editor;
+
g_return_val_if_fail (VPNC_IS_EDITOR_PLUGIN (iface), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
g_return_val_if_fail (!error || !*error, NULL);
- {
+ self_module = g_module_open (NULL, 0);
+ g_module_symbol (self_module, "gtk_container_add", >k3_only_symbol);
+ g_module_close (self_module);
+
+ if (gtk3_only_symbol) {
+ editor = "libnm-vpn-plugin-vpnc-editor.so";
+ } else {
+ editor = "libnm-gtk4-vpn-plugin-vpnc-editor.so";
+ }
+
#ifdef NM_VPN_OLD
- return nm_vpnc_editor_new (connection, error);
+ return nm_vpnc_editor_new (connection, error);
#else
- return nm_vpn_plugin_utils_load_editor ("libnm-vpn-plugin-vpnc-editor.so",
- "nm_vpn_editor_factory_vpnc",
- _call_editor_factory,
- iface,
- connection,
- NULL,
- error);
+ return nm_vpn_plugin_utils_load_editor (editor,
+ "nm_vpn_editor_factory_vpnc",
+ _call_editor_factory,
+ iface,
+ connection,
+ NULL,
+ error);
#endif
- }
}
static void
diff --git a/properties/nm-vpnc-editor.c b/properties/nm-vpnc-editor.c
index bfed98a..b7d3ca3 100644
--- a/properties/nm-vpnc-editor.c
+++ b/properties/nm-vpnc-editor.c
@@ -44,6 +44,23 @@
#define ENC_TYPE_WEAK 1
#define ENC_TYPE_NONE 2
+#if !GTK_CHECK_VERSION(4,0,0)
+#define gtk_editable_set_text(editable,text) gtk_entry_set_text(GTK_ENTRY(editable), (text))
+#define gtk_editable_get_text(editable) gtk_entry_get_text(GTK_ENTRY(editable))
+#define gtk_widget_get_root(widget) gtk_widget_get_toplevel(widget)
+#define gtk_check_button_get_active(button)
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))
+#define gtk_check_button_set_active(button, active)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active)
+#define gtk_window_destroy(window) gtk_widget_destroy(GTK_WIDGET (window))
+#define gtk_window_set_hide_on_close(window, hide) \
+ G_STMT_START { \
+ G_STATIC_ASSERT(hide); \
+ g_signal_connect_swapped (G_OBJECT (window), "delete-event", \
+ G_CALLBACK (gtk_widget_hide_on_delete), window); \
+ } G_STMT_END
+
+typedef void GtkRoot;
+#endif
+
static void vpnc_editor_interface_init (NMVpnEditorInterface *iface);
G_DEFINE_TYPE_EXTENDED (VpncEditor, vpnc_editor, G_TYPE_OBJECT, 0,
@@ -71,7 +88,7 @@ check_validity (VpncEditor *self, GError **error)
char *str;
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str) || strstr (str, " ") || strstr (str, "\t")) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
@@ -81,7 +98,7 @@ check_validity (VpncEditor *self, GError **error)
}
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
- str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str)) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
@@ -109,7 +126,7 @@ hybrid_toggled_cb (GtkWidget *widget, gpointer user_data)
ca_chooser = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ca_chooser"));
g_return_if_fail (ca_chooser);
- enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON (widget));
gtk_widget_set_sensitive (ca_chooser, enabled);
@@ -132,7 +149,7 @@ setup_password_widget (VpncEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_secret (s_vpn, secret_name);
- gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
+ gtk_editable_set_text (GTK_EDITABLE (widget), value ? value : "");
}
g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
@@ -145,7 +162,7 @@ show_toggled_cb (GtkCheckButton *button, VpncEditor *self)
GtkWidget *widget;
gboolean visible;
- visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ visible = gtk_check_button_get_active (GTK_CHECK_BUTTON (button));
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
g_assert (widget);
@@ -207,7 +224,7 @@ init_password_icon (VpncEditor *self,
if (!flags || !strcmp (flags, NM_VPNC_PW_TYPE_SAVE))
flags = nm_setting_vpn_get_data_item (s_vpn, type_key);
}
- value = gtk_entry_get_text (GTK_ENTRY (entry));
+ value = gtk_editable_get_text (GTK_EDITABLE (entry));
if ((!value || !*value) && !flags)
nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
(NMSetting *) s_vpn, secret_key);
@@ -240,7 +257,7 @@ populate_adv_dialog (VpncEditor *self)
value = nm_setting_vpn_get_data_item (priv->s_vpn, NM_VPNC_KEY_DOMAIN);
if (!value)
value = "";
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
/* Vendor combo */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "vendor_combo"));
@@ -264,15 +281,15 @@ populate_adv_dialog (VpncEditor *self)
value = nm_setting_vpn_get_data_item (priv->s_vpn, NM_VPNC_KEY_APP_VERSION);
if (!value)
value = "";
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
/* Interface name */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "interface_name_entry"));
g_return_if_fail (widget != NULL);
if (priv->interface_name)
- gtk_entry_set_text (GTK_ENTRY (widget), priv->interface_name);
+ gtk_editable_set_text (GTK_EDITABLE (widget), priv->interface_name);
else
- gtk_entry_set_text (GTK_ENTRY (widget), "");
+ gtk_editable_set_text (GTK_EDITABLE (widget), "");
/* Encryption combo */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encryption_combo"));
@@ -381,7 +398,7 @@ populate_adv_dialog (VpncEditor *self)
g_return_if_fail (widget != NULL);
value = nm_setting_vpn_get_data_item (priv->s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
if (value && priv->orig_dpd_timeout == 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
}
static void
@@ -396,7 +413,7 @@ update_adv_settings (VpncEditor *self, NMSettingVpn *s_vpn)
/* Domain */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
- value = gtk_entry_get_text (GTK_ENTRY (widget));
+ value = gtk_editable_get_text (GTK_EDITABLE (widget));
if (value && strlen (value))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DOMAIN, value);
else
@@ -416,7 +433,7 @@ update_adv_settings (VpncEditor *self, NMSettingVpn *s_vpn)
/* Application version */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_version_entry"));
- value = gtk_entry_get_text (GTK_ENTRY (widget));
+ value = gtk_editable_get_text (GTK_EDITABLE (widget));
if (value && strlen (value))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_APP_VERSION, value);
else
@@ -424,7 +441,7 @@ update_adv_settings (VpncEditor *self, NMSettingVpn *s_vpn)
/* Interface name */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "interface_name_entry"));
- value = gtk_entry_get_text (GTK_ENTRY (widget));
+ value = gtk_editable_get_text (GTK_EDITABLE (widget));
g_clear_pointer (&priv->interface_name, g_free);
priv->interface_name = g_strdup (value);
@@ -487,7 +504,7 @@ update_adv_settings (VpncEditor *self, NMSettingVpn *s_vpn)
/* Disable DPD */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "disable_dpd_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) {
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, "0");
} else {
/* If DPD was disabled and now the user wishes to enable it, just
@@ -523,11 +540,11 @@ static void
advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
{
VpncEditorPrivate *priv = VPNC_EDITOR_GET_PRIVATE (user_data);
- GtkWidget *toplevel;
+ GtkRoot *root;
- toplevel = gtk_widget_get_toplevel (priv->widget);
- if (gtk_widget_is_toplevel (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), GTK_WINDOW (toplevel));
+ root = gtk_widget_get_root (priv->widget);
+ if (GTK_IS_WINDOW(root))
+ gtk_window_set_transient_for (GTK_WINDOW (priv->advanced_dialog), GTK_WINDOW (root));
gtk_widget_show (priv->advanced_dialog);
}
@@ -562,7 +579,7 @@ init_plugin_ui (VpncEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_GATEWAY);
if (value && strlen (value))
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
@@ -572,7 +589,7 @@ init_plugin_ui (VpncEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_ID);
if (value && strlen (value))
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
@@ -625,7 +642,7 @@ init_plugin_ui (VpncEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER);
if (value && strlen (value))
- gtk_entry_set_text (GTK_ENTRY (widget), value);
+ gtk_editable_set_text (GTK_EDITABLE (widget), value);
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
@@ -717,7 +734,7 @@ init_plugin_ui (VpncEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_AUTHMODE);
if (value && !strcmp("hybrid", value)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
enabled = TRUE;
}
}
@@ -756,8 +773,7 @@ init_plugin_ui (VpncEditor *self,
priv->advanced_dialog = GTK_WIDGET (gtk_builder_get_object (priv->builder, "vpnc-advanced-dialog"));
g_return_val_if_fail (priv->advanced_dialog != NULL, FALSE);
- g_signal_connect (G_OBJECT (priv->advanced_dialog), "delete-event",
- G_CALLBACK (gtk_widget_hide_on_delete), self);
+ gtk_window_set_hide_on_close (GTK_WINDOW (priv->advanced_dialog), TRUE);
g_signal_connect (G_OBJECT (priv->advanced_dialog), "response",
G_CALLBACK (advanced_dialog_response_cb), self);
@@ -799,7 +815,7 @@ save_one_password (NMSettingVpn *s_vpn,
switch (flags) {
case NM_SETTING_SECRET_FLAG_NONE:
case NM_SETTING_SECRET_FLAG_AGENT_OWNED:
- password = gtk_entry_get_text (GTK_ENTRY (entry));
+ password = gtk_editable_get_text (GTK_EDITABLE (entry));
if (password && strlen (password))
nm_setting_vpn_add_secret (s_vpn, secret_key, password);
data_val = NM_VPNC_PW_TYPE_SAVE;
@@ -840,18 +856,18 @@ update_connection (NMVpnEditor *editor,
/* Gateway */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_GATEWAY, str);
/* Group name */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
- str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_ID, str);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
- str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ str = (char *) gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER, str);
@@ -871,7 +887,7 @@ update_connection (NMVpnEditor *editor,
/* hybrid auth */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hybrid_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) {
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_AUTHMODE, "hybrid");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ca_chooser"));
@@ -971,7 +987,7 @@ dispose (GObject *object)
g_object_unref (priv->widget);
if (priv->advanced_dialog)
- gtk_widget_destroy (priv->advanced_dialog);
+ gtk_window_destroy (GTK_WINDOW (priv->advanced_dialog));
if (priv->builder) {
deinit_password_icon (plugin, "user_password_entry");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]