[network-manager-iodine: 7/10] properties: Use iodine_editor_get_instance_private()
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-iodine: 7/10] properties: Use iodine_editor_get_instance_private()
- Date: Thu, 7 Apr 2022 09:42:49 +0000 (UTC)
commit c2fe15d375c4a1e7f0f1af2dc198ff3ea36d3900
Author: Guido Günther <agx sigxcpu org>
Date: Thu Dec 23 23:59:33 2021 +0100
properties: Use iodine_editor_get_instance_private()
properties/Makefile.am | 2 +-
properties/nm-iodine.c | 39 ++++++++++++++++-----------------------
2 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/properties/Makefile.am b/properties/Makefile.am
index bf6cf8d..975d0ff 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -31,7 +31,7 @@ libnm_vpn_plugin_iodine_la_CFLAGS = \
$(common_CFLAGS)
libnm_iodine_properties_la_CFLAGS = \
- -DNM_IODINE_OLD \
+ $(LIBNM_CFLAGS) \
$(common_CFLAGS)
libnm_vpn_plugin_iodine_la_LIBADD = \
diff --git a/properties/nm-iodine.c b/properties/nm-iodine.c
index 39aef8b..30c432c 100644
--- a/properties/nm-iodine.c
+++ b/properties/nm-iodine.c
@@ -34,7 +34,6 @@
#include <gtk/gtk.h>
#include <NetworkManager.h>
-#include <nma-ui-utils.h>
#define IODINE_EDITOR_PLUGIN_ERROR NM_CONNECTION_ERROR
#define IODINE_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
@@ -69,12 +68,6 @@ G_DEFINE_TYPE_EXTENDED (IodineEditorPlugin, iodine_editor_plugin, G_TYPE_OBJECT,
static void iodine_editor_interface_init (NMVpnEditorInterface *iface_class);
-G_DEFINE_TYPE_EXTENDED (IodineEditor, iodine_editor,G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR,
- iodine_editor_interface_init))
-
-#define IODINE_EDITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IODINE_TYPE_EDITOR,
IodineEditorPrivate))
-
typedef struct {
GtkBuilder *builder;
GtkWidget *widget;
@@ -82,6 +75,11 @@ typedef struct {
gboolean window_added;
} IodineEditorPrivate;
+G_DEFINE_TYPE_WITH_CODE (IodineEditor, iodine_editor,G_TYPE_OBJECT,
+ G_ADD_PRIVATE (IodineEditor)
+ G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR,
+
iodine_editor_interface_init))
+
typedef enum {
NM_IODINE_IMPORT_EXPORT_ERROR_UNKNOWN = 0,
NM_IODINE_IMPORT_EXPORT_ERROR_NOT_IODINE,
@@ -236,8 +234,7 @@ done:
static gboolean
check_validity (IodineEditor *self, GError **error)
{
- IodineEditorPrivate *priv = \
- IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
GtkWidget *widget;
const char *str;
@@ -266,8 +263,7 @@ setup_password_widget (IodineEditor *self,
NMSettingVpn *s_vpn,
const char *secret_name)
{
- IodineEditorPrivate *priv = \
- IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
GtkWidget *widget;
@@ -302,7 +298,7 @@ setup_password_widget (IodineEditor *self,
static void
show_toggled_cb (GtkCheckButton *button, IodineEditor *self)
{
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
GtkWidget *widget;
gboolean visible;
@@ -317,7 +313,7 @@ static void
pw_type_combo_changed_cb (GtkWidget *combo, gpointer user_data)
{
IodineEditor *self = IODINE_EDITOR (user_data);
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
GtkWidget *entry;
entry = GTK_WIDGET (gtk_builder_get_object (priv->builder, "password_entry"));
@@ -347,7 +343,7 @@ init_one_pw_combo (IodineEditor *self,
const char *secret_key,
const char *entry_name)
{
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
int active = -1;
GtkWidget *widget;
GtkListStore *store;
@@ -400,7 +396,7 @@ init_editor_plugin (IodineEditor *self,
NMConnection *connection,
GError **error)
{
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
NMSettingVpn *s_vpn;
GtkWidget *widget;
const char *value;
@@ -469,7 +465,7 @@ static GObject *
get_widget (NMVpnEditor *iface)
{
IodineEditor *self = IODINE_EDITOR (iface);
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
return G_OBJECT (priv->widget);
}
@@ -518,7 +514,7 @@ update_connection (NMVpnEditor *iface,
GError **error)
{
IodineEditor *self = IODINE_EDITOR (iface);
- IodineEditorPrivate *priv = IODINE_EDITOR_GET_PRIVATE (self);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (self);
NMSettingVpn *s_vpn;
GtkWidget *widget;
char *str;
@@ -578,7 +574,7 @@ nm_vpn_editor_interface_new (NMConnection *connection, GError **error)
return NULL;
}
- priv = IODINE_EDITOR_GET_PRIVATE (object);
+ priv = iodine_editor_get_instance_private (IODINE_EDITOR (object));
ui_file = g_strdup_printf ("%s/%s", UIDIR, "nm-iodine-dialog.ui");
priv->builder = gtk_builder_new ();
@@ -615,9 +611,8 @@ nm_vpn_editor_interface_new (NMConnection *connection, GError **error)
static void
dispose (GObject *object)
{
- IodineEditor *plugin = IODINE_EDITOR (object);
- IodineEditorPrivate *priv = \
- IODINE_EDITOR_GET_PRIVATE (plugin);
+ IodineEditor *self = IODINE_EDITOR (object);
+ IodineEditorPrivate *priv = iodine_editor_get_instance_private (IODINE_EDITOR (self));
if (priv->group)
g_object_unref (priv->group);
@@ -636,8 +631,6 @@ iodine_editor_class_init (IodineEditorClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
- g_type_class_add_private (req_class, sizeof (IodineEditorPrivate));
-
object_class->dispose = dispose;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]