[NetworkManager-pptp/lr/gtk-4.0: 9/9] properties: port to Gtk4
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-pptp/lr/gtk-4.0: 9/9] properties: port to Gtk4
- Date: Fri, 14 Jan 2022 16:21:03 +0000 (UTC)
commit ba63f02fd20e41955405bc24194cc3524cb67bca
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Nov 3 18:24:08 2021 +0100
properties: port to Gtk4
.gitignore | 1 +
Makefile.am | 41 ++++++++++++++++++++++++++++++++++--
configure.ac | 15 +++++++++++++
po/POTFILES.skip | 1 +
properties/advanced-dialog.c | 43 +++++++++++++++++++-------------------
properties/nm-pptp-editor-plugin.c | 33 ++++++++++++++++++++---------
properties/nm-pptp-editor.c | 41 ++++++++++++++++++------------------
properties/nm-pptp-editor.h | 11 ++++++++++
8 files changed, 133 insertions(+), 53 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 135d914..c79ca37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@ m4/lt*.m4
appdata/network-manager-pptp.metainfo.xml
/cscope.*
/properties/resources.[ch]
+/gtk4
auth-dialog/nm-pptp-auth-dialog
nm-pptp-service.name
diff --git a/Makefile.am b/Makefile.am
index 5153d4b..2e1dbe0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,8 @@
AUTOMAKE_OPTIONS = subdir-objects
DISTCHECK_CONFIGURE_FLAGS = \
- --enable-more-warnings=yes
+ --enable-more-warnings=yes \
+ --with-gtk4
libexec_PROGRAMS =
@@ -122,6 +123,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 = \
shared/nm-utils/nm-vpn-plugin-macros.h \
properties/nm-pptp-editor-plugin.c \
@@ -141,7 +150,9 @@ properties_cppflags = \
CLEANFILES += \
properties/resources.c \
- properties/resources.h
+ properties/resources.h \
+ gtk4/resources.c \
+ gtk4/nm-pptp-dialog.ui
EXTRA_DIST += \
properties/nm-pptp-dialog.ui \
@@ -200,6 +211,32 @@ properties_libnm_vpn_plugin_pptp_editor_la_LDFLAGS = \
###############################################################################
+if WITH_GTK4
+plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-pptp-editor.la
+endif
+
+properties_libnm_gtk4_vpn_plugin_pptp_editor_la_SOURCES = \
+ $(editor_sources)
+nodist_properties_libnm_gtk4_vpn_plugin_pptp_editor_la_SOURCES = \
+ gtk4/resources.c \
+ properties/resources.h
+properties_libnm_gtk4_vpn_plugin_pptp_editor_la_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_GTK4_CFLAGS)
+properties_libnm_gtk4_vpn_plugin_pptp_editor_la_CPPFLAGS = \
+ $(properties_libnm_vpn_plugin_pptp_editor_la_CPPFLAGS)
+properties_libnm_gtk4_vpn_plugin_pptp_editor_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ $(LIBNMA_GTK4_LIBS)
+properties_libnm_gtk4_vpn_plugin_pptp_editor_la_LDFLAGS = \
+ $(properties_libnm_vpn_plugin_pptp_editor_la_LDFLAGS)
+
+###############################################################################
+
if WITH_LIBNM_GLIB
plugin_LTLIBRARIES += properties/libnm-pptp-properties.la
endif
diff --git a/configure.ac b/configure.ac
index 6133fa7..b33f251 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,7 @@ dnl
dnl GNOME support
dnl
AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-pptp without GNOME support, e.g.
vpn service only]), [], [with_gnome_specified=no])
+AC_ARG_WITH(gtk4, AS_HELP_STRING([--with-gtk4], [Build NetworkManager-pptp with libnma-gtk4 support]), [],
[with_gtk4_specified=no])
AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--with-libnm-glib], [Build NetworkManager-pptp with libnm-glib
comatibility (depreacted)]), [], [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
@@ -83,6 +84,12 @@ 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
@@ -90,6 +97,7 @@ 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)]))
@@ -125,6 +133,12 @@ if test x"$with_gnome" != xno; then
LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
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.32)
+fi
PKG_CHECK_MODULES(LIBNM, libnm >= 1.2.0)
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
@@ -163,6 +177,7 @@ echo ""
echo "Build configuration: "
echo " --with-dist-version=$ac_distver"
echo " --with-gnome=$with_gnome"
+echo " --with-gtk4=$with_gtk4"
echo " --with-libnm-glib=$with_libnm_glib"
echo " --with-pppd-plugin-dir=$PPPD_PLUGIN_DIR"
echo " --enable-absolute-paths=$enable_absolute_paths"
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..26afb04
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+gtk4/nm-pptp-dialog.ui
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index 0e62061..838fa64 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -22,6 +22,7 @@
#include "nm-default.h"
+#include "nm-pptp-editor.h"
#include "advanced-dialog.h"
#include <errno.h>
@@ -94,7 +95,7 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GtkBuilder *builder)
gboolean valid;
mppe_sensitive = gtk_widget_get_sensitive (check);
- use_mppe = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
+ use_mppe = gtk_check_button_get_active (GTK_CHECK_BUTTON (check));
/* (De)-sensitize MPPE related stuff */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_label"));
@@ -369,7 +370,7 @@ auth_methods_setup (GtkBuilder *builder, GHashTable *hash)
/* Make sure MPPE is non-sensitive if MSCHAP and MSCHAPv2 are disabled */
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_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
gtk_widget_set_sensitive (widget, FALSE);
} else
gtk_widget_set_sensitive (widget, TRUE);
@@ -380,7 +381,7 @@ checkbox_toggled_update_widget_cb (GtkWidget *check, gpointer user_data)
{
GtkWidget *widget = (GtkWidget*) user_data;
- gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+ gtk_widget_set_sensitive (widget, gtk_check_button_get_active (GTK_CHECK_BUTTON (check)));
}
GtkWidget *
@@ -431,30 +432,30 @@ advanced_dialog_new (GHashTable *hash)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
if (mppe)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
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);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_bsdcomp"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_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);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_deflate"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_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);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_usevj"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_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);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_send_echo_packets"));
value = g_hash_table_lookup (hash, NM_PPTP_KEY_LCP_ECHO_INTERVAL);
@@ -464,7 +465,7 @@ advanced_dialog_new (GHashTable *hash)
errno = 0;
tmp_int = strtol (value, NULL, 10);
if (errno == 0 && tmp_int > 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
}
auth_methods_setup (builder, hash);
@@ -484,14 +485,14 @@ advanced_dialog_new (GHashTable *hash)
errno = 0;
tmp = strtol (value, NULL, 10);
if (errno == 0 && tmp >= 0 && tmp < 65536) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_unit_spinbutton"));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) tmp);
gtk_widget_set_sensitive (widget, TRUE);
}
} else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_unit_spinbutton"));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 0.0);
@@ -521,7 +522,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) {
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) {
@@ -537,24 +538,24 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_MPPE_STATEFUL), g_strdup ("yes"));
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_bsdcomp"));
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NOBSDCOMP), g_strdup ("yes"));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_deflate"));
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NODEFLATE), g_strdup ("yes"));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_usevj"));
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_PPTP_KEY_NO_VJ_COMP), g_strdup ("yes"));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_send_echo_packets"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if (gtk_check_button_get_active (GTK_CHECK_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));
}
@@ -596,7 +597,7 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_unit_checkbutton"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) {
int unit_num;
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_unit_spinbutton"));
diff --git a/properties/nm-pptp-editor-plugin.c b/properties/nm-pptp-editor-plugin.c
index 664f9da..9389a40 100644
--- a/properties/nm-pptp-editor-plugin.c
+++ b/properties/nm-pptp-editor-plugin.c
@@ -149,23 +149,36 @@ _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 (PPTP_IS_PLUGIN_UI (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-pptp-editor.so";
+ } else {
+ editor = "libnm-gtk4-vpn-plugin-pptp-editor.so";
+ }
+
#ifdef NM_VPN_OLD
- return nm_vpn_plugin_ui_widget_interface_new (connection, error);
+ return nm_vpn_plugin_ui_widget_interface_new (connection, error);
#else
- return nm_vpn_plugin_utils_load_editor ("libnm-vpn-plugin-pptp-editor.so",
- "nm_vpn_editor_factory_pptp",
- _call_editor_factory,
- iface,
- connection,
- NULL,
- error);
+ return nm_vpn_plugin_utils_load_editor (editor,
+ "nm_vpn_editor_factory_pptp",
+ _call_editor_factory,
+ iface,
+ connection,
+ NULL,
+ error);
#endif
- }
}
static void
diff --git a/properties/nm-pptp-editor.c b/properties/nm-pptp-editor.c
index 337c73e..5eb519f 100644
--- a/properties/nm-pptp-editor.c
+++ b/properties/nm-pptp-editor.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/***************************************************************************
* Copyright (C) 2008 Dan Williams, <dcbw redhat com>
- * Copyright (C) 2008 - 2011 Red Hat, Inc.
+ * Copyright (C) 2008 - 2022 Red Hat, Inc.
* Based on work by David Zeuthen, <davidz redhat com>
*
* This program is free software; you can redistribute it and/or modify
@@ -58,7 +58,7 @@ check_validity (PptpPluginUiWidget *self, GError **error)
const char *str;
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (!str || !strlen (str)) {
g_set_error (error,
NMV_EDITOR_PLUGIN_ERROR,
@@ -80,8 +80,8 @@ static void
advanced_dialog_close_cb (GtkWidget *dialog, gpointer user_data)
{
gtk_widget_hide (dialog);
- /* gtk_widget_destroy() will remove the window from the window group */
- gtk_widget_destroy (dialog);
+ /* gtk_window_destroy() will remove the window from the window group */
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
@@ -113,10 +113,11 @@ advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
{
PptpPluginUiWidget *self = PPTP_PLUGIN_UI_WIDGET (user_data);
PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- GtkWidget *dialog, *toplevel;
+ GtkWidget *dialog;
+ GtkRoot *root;
- toplevel = gtk_widget_get_toplevel (priv->widget);
- g_return_if_fail (gtk_widget_is_toplevel (toplevel));
+ root = gtk_widget_get_root (priv->widget);
+ g_return_if_fail (GTK_IS_WINDOW(root));
dialog = advanced_dialog_new (priv->advanced);
if (!dialog) {
@@ -126,15 +127,15 @@ advanced_button_clicked_cb (GtkWidget *button, gpointer user_data)
gtk_window_group_add_window (priv->window_group, GTK_WINDOW (dialog));
if (!priv->window_added) {
- gtk_window_group_add_window (priv->window_group, GTK_WINDOW (toplevel));
+ gtk_window_group_add_window (priv->window_group, GTK_WINDOW (root));
priv->window_added = TRUE;
}
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (root));
g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (advanced_dialog_response_cb), self);
g_signal_connect (G_OBJECT (dialog), "close", G_CALLBACK (advanced_dialog_close_cb), self);
- gtk_widget_show_all (dialog);
+ gtk_widget_show (dialog);
}
static void
@@ -154,7 +155,7 @@ setup_password_widget (PptpPluginUiWidget *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);
@@ -167,7 +168,7 @@ show_toggled_cb (GtkCheckButton *button, PptpPluginUiWidget *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);
@@ -209,7 +210,7 @@ init_password_icon (PptpPluginUiWidget *self,
*/
if (s_vpn)
nm_setting_get_secret_flags (NM_SETTING (s_vpn), secret_key, &pw_flags, NULL);
- value = gtk_entry_get_text (GTK_ENTRY (entry));
+ value = gtk_editable_get_text (GTK_EDITABLE (entry));
if ((!value || !*value) && (pw_flags == NM_SETTING_SECRET_FLAG_NONE))
nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
(NMSetting *) s_vpn, secret_key);
@@ -237,7 +238,7 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_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);
@@ -248,7 +249,7 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_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);
@@ -259,7 +260,7 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err
if (s_vpn) {
value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_DOMAIN);
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);
@@ -324,7 +325,7 @@ save_password_and_flags (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);
break;
@@ -356,13 +357,13 @@ update_connection (NMVpnEditor *iface,
/* Gateway */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_GATEWAY, str);
/* Username */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_USER, str);
@@ -374,7 +375,7 @@ update_connection (NMVpnEditor *iface,
/* Domain */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "domain_entry"));
- str = gtk_entry_get_text (GTK_ENTRY (widget));
+ str = gtk_editable_get_text (GTK_EDITABLE (widget));
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_DOMAIN, str);
diff --git a/properties/nm-pptp-editor.h b/properties/nm-pptp-editor.h
index 3a8ee81..d3ce3d4 100644
--- a/properties/nm-pptp-editor.h
+++ b/properties/nm-pptp-editor.h
@@ -21,6 +21,17 @@
#ifndef _NM_PPTP_H_
#define _NM_PPTP_H_
+#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_window_destroy(window) gtk_widget_destroy(GTK_WIDGET (window))
+#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)
+
+typedef void GtkRoot;
+#endif
+
#define PPTP_TYPE_PLUGIN_UI_WIDGET (pptp_plugin_ui_widget_get_type ())
#define PPTP_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
PPTP_TYPE_PLUGIN_UI_WIDGET, PptpPluginUiWidget))
#define PPTP_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PPTP_TYPE_PLUGIN_UI_WIDGET,
PptpPluginUiWidgetClass))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]