[seahorse] Migrate to GTK3
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Migrate to GTK3
- Date: Wed, 6 Oct 2010 21:56:09 +0000 (UTC)
commit 106786f532fbd5d914707a494c7a9824bec29cfc
Author: Stef Walter <stef memberwebs com>
Date: Wed Oct 6 21:55:24 2010 +0000
Migrate to GTK3
Use the --with-gtk=3.0 option to build with GTK3
.gitignore | 1 +
configure.in | 49 +++++++++++++++-----
daemon/Makefile.am | 3 +-
libcryptui/Makefile.am | 5 +-
libcryptui/cryptui-keyset.h | 10 ++--
libegg/egg-datetime.c | 41 ++++++++++++-----
libseahorse/seahorse-context.c | 27 ++++++++----
libseahorse/seahorse-context.h | 20 +++++----
libseahorse/seahorse-object-widget.c | 10 +----
libseahorse/seahorse-passphrase.c | 6 ++-
libseahorse/seahorse-set.h | 12 +++---
libseahorse/seahorse-util.c | 1 +
libseahorse/seahorse-widget.c | 81 ++++++++++++++++++++-------------
libseahorse/seahorse-widget.h | 20 +++++---
src/seahorse-key-manager.c | 2 +-
src/seahorse-viewer.c | 26 -----------
16 files changed, 179 insertions(+), 135 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 51b37e4..b8f3a08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
*.tmp
.tm*
~*
+tmp-*
/configure.lineno
/Makefile
diff --git a/configure.in b/configure.in
index c42bb5a..54577b0 100644
--- a/configure.in
+++ b/configure.in
@@ -45,13 +45,37 @@ AC_CHECK_FUNCS(strsep)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18)
-AC_SUBST([GTK_LIBS])
-AC_SUBST([GTK_CFLAGS])
-
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-PKG_CHECK_MODULES(SEAHORSE, gmodule-2.0 gconf-2.0 gthread-2.0 gtk+-2.0 >= 2.10.0)
+AC_MSG_CHECKING([which GTK+ version to compile against])
+AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk=2.0|3.0],[which GTK+ version to compile against (default: 2.0)])],
+ [case "$with_gtk" in
+ 2.0|3.0) ;;
+ *) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
+ esac],
+ [with_gtk=2.0])
+AC_MSG_RESULT([$with_gtk])
+
+case "$with_gtk" in
+ 2.0)
+ GCR_LIBRARY=gcr-0
+ GTK_API_VERSION=2.0
+ GTK_REQUIRED=2.20.0
+ ;;
+ 3.0)
+ GCR_LIBRARY=gcr-3
+ GTK_API_VERSION=3.0
+ GTK_REQUIRED=2.90.0
+ ;;
+esac
+
+AC_SUBST(GTK_API_VERSION)
+AM_CONDITIONAL([WITH_GTK3],[test "$with_gtk" = "3.0"])
+
+PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
+PKG_CHECK_MODULES(SEAHORSE, gmodule-2.0 gio-2.0 gconf-2.0 gthread-2.0 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
@@ -441,7 +465,7 @@ if test "$enable_pkcs11" = "no"; then
echo "disabling pkcs11 support"
enable_pkcs11="no"
else
- PKG_CHECK_MODULES(GCR, gcr-0 >= 2.25.5, gcr_is_present="yes", gcr_is_present="no")
+ PKG_CHECK_MODULES(GCR, $GCR_LIBRARY >= 2.25.5, gcr_is_present="yes", gcr_is_present="no")
if test "$gcr_is_present" = "no"; then
echo "disabling pkcs11 support"
fi
@@ -528,11 +552,9 @@ dnl ****************************************************************************
LIBCRYPTUI_LT_RELEASE=$LIBCRYPTUI_CURRENT:$LIBCRYPTUI_REVISION:$LIBCRYPTUI_AGE
AC_SUBST(LIBCRYPTUI_LT_RELEASE)
-
-LIBCRYPTUI_MAJOR=$LIBCRYPTUI_CURRENT.$LIBCRYPTUI_REVISION
AC_SUBST(LIBCRYPTUI_MAJOR)
-
-PKG_CHECK_MODULES(LIBCRYPTUI, gtk+-2.0 >= 2.10.0 gconf-2.0)
+
+PKG_CHECK_MODULES(LIBCRYPTUI, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gconf-2.0)
cryptuitargetlib=libcryptui.la
AC_SUBST(cryptuitargetlib)
@@ -582,11 +604,11 @@ AM_GLIB_GNU_GETTEXT
dnl ****************************************************************************
## here we get the flags we'll actually use
-PKG_CHECK_MODULES(EGG, gtk+-2.0 >= 2.5.0)
+PKG_CHECK_MODULES(EGG, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
AC_SUBST(EGG_LIBS)
AC_SUBST(EGG_CFLAGS)
-PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-2.0)
+PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-$GTK_API_VERSION)
AC_SUBST(EGG_SMCLIENT_LIBS)
AC_SUBST(EGG_SMCLIENT_CFLAGS)
@@ -628,6 +650,7 @@ dnl SUMMARY
dnl ****************************************************************************
echo "
+GTK+ Version: $GTK_API_VERSION
PKCS11 Support: $enable_pkcs11
PGP Support: $enable_pgp
GnuPG Version: $have_gpg
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 664859e..3cb175f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -64,8 +64,7 @@ EXTRA_DIST = \
org.gnome.seahorse.service.in
CLEANFILES = *.bak \
- seahorse-daemon.desktop.in \
- org.gnome.seahorse.service
+ org.gnome.seahorse.service
# DBUS binding files
seahorse-service-bindings.h: seahorse-service.xml
diff --git a/libcryptui/Makefile.am b/libcryptui/Makefile.am
index db646fb..ffbcd56 100644
--- a/libcryptui/Makefile.am
+++ b/libcryptui/Makefile.am
@@ -100,12 +100,11 @@ if HAVE_INTROSPECTION
CryptUI- LIBCRYPTUI_MAJOR@.gir: $(INTROSPECTION_SCANNER) libcryptui.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace CryptUI --nsversion= LIBCRYPTUI_MAJOR@ \
- --strip-prefix=CryptUI \
$(INCLUDES) \
--include=Gtk-2.0 \
--library=libcryptui.la \
- --pkg gtk+-2.0 \
- --output $@ \
+ --pkg gtk+-2.0 \
+ --output $@ \
$(inc_HEADERS) \
$(libcryptui_src)
diff --git a/libcryptui/cryptui-keyset.h b/libcryptui/cryptui-keyset.h
index ed91b2a..bf5d19a 100644
--- a/libcryptui/cryptui-keyset.h
+++ b/libcryptui/cryptui-keyset.h
@@ -29,15 +29,15 @@ typedef struct _CryptUIKeysetClass CryptUIKeysetClass;
typedef struct _CryptUIKeysetPrivate CryptUIKeysetPrivate;
struct _CryptUIKeyset {
- GtkObject parent;
+ GObject parent;
- /*<private>*/
- CryptUIKeysetPrivate *priv;
+ /*<private>*/
+ CryptUIKeysetPrivate *priv;
};
struct _CryptUIKeysetClass {
- GtkObjectClass parent_class;
-
+ GObjectClass parent_class;
+
/* signals --------------------------------------------------------- */
/* A key was added to this view */
diff --git a/libegg/egg-datetime.c b/libegg/egg-datetime.c
index 59b255f..fe1e329 100644
--- a/libegg/egg-datetime.c
+++ b/libegg/egg-datetime.c
@@ -26,8 +26,11 @@
#include <string.h>
#include <time.h>
-#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (2,90,0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include "egg-datetime.h"
@@ -230,7 +233,12 @@ static void egg_datetime_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void egg_datetime_destroy (GtkObject *object);
+#if GTK_CHECK_VERSION (2, 90, 0)
+static void egg_datetime_destroy (GtkWidget *widget);
+#else
+static void egg_datetime_destroy (GtkObject *widget);
+#endif
+
static void egg_datetime_finalize (GObject *object);
static gchar *get_time_string (guint8 hour, guint8 minute, guint8 second);
@@ -294,18 +302,22 @@ static void
egg_datetime_class_init (EggDateTimeClass *klass)
{
GObjectClass *o_class;
- GtkObjectClass *go_class;
GParamSpec *pspec;
parent_class = g_type_class_peek_parent (klass);
o_class = (GObjectClass *) klass;
- go_class = (GtkObjectClass *) klass;
o_class->finalize = egg_datetime_finalize;
o_class->set_property = egg_datetime_set_property;
o_class->get_property = egg_datetime_get_property;
- go_class->destroy = egg_datetime_destroy;
+
+#if GTK_CHECK_VERSION (2,90,0)
+ ((GtkWidgetClass*)klass)->destroy = egg_datetime_destroy;
+#else
+ ((GtkObjectClass*)klass)->destroy = egg_datetime_destroy;
+#endif
+
/* Properties */
@@ -547,8 +559,6 @@ egg_datetime_init (EggDateTime *edt)
priv->calendar = gtk_calendar_new ();
cal_options = GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING;
- if (priv->week_start_monday)
- cal_options |= GTK_CALENDAR_WEEK_START_MONDAY;
gtk_calendar_set_display_options (GTK_CALENDAR (priv->calendar), cal_options);
gtk_container_add (GTK_CONTAINER (priv->cal_popup), priv->calendar);
g_signal_connect_swapped (G_OBJECT (priv->calendar), "day-selected",
@@ -734,9 +744,13 @@ egg_datetime_get_property (GObject *object,
}
static void
-egg_datetime_destroy (GtkObject *object)
+#if GTK_CHECK_VERSION (2, 90, 0)
+egg_datetime_destroy (GtkWidget *widget)
+#else
+egg_datetime_destroy (GtkObject *widget)
+#endif
{
- EggDateTime *edt = EGG_DATETIME (object);
+ EggDateTime *edt = EGG_DATETIME (widget);
EggDateTimePrivate *priv = edt->priv;
if (priv->cal_popup) {
@@ -749,8 +763,13 @@ egg_datetime_destroy (GtkObject *object)
priv->time_popup = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+#if GTK_CHECK_VERSION (2, 90, 0)
+ if (GTK_WIDGET_CLASS (parent_class)->destroy)
+ (* GTK_WIDGET_CLASS (parent_class)->destroy) (widget);
+#else
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (widget);
+#endif
}
static void
diff --git a/libseahorse/seahorse-context.c b/libseahorse/seahorse-context.c
index f887c8f..12c558b 100644
--- a/libseahorse/seahorse-context.c
+++ b/libseahorse/seahorse-context.c
@@ -59,12 +59,13 @@ enum {
REMOVED,
CHANGED,
REFRESHING,
+ DESTROY,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (SeahorseContext, seahorse_context, GTK_TYPE_OBJECT);
+G_DEFINE_TYPE (SeahorseContext, seahorse_context, G_TYPE_OBJECT);
/*
* Two hashtables are used to keep track of the objects:
@@ -85,6 +86,7 @@ struct _SeahorseContextPrivate {
guint notify_id; /* Notify for GConf watch */
SeahorseMultiOperation *refresh_ops; /* Operations for refreshes going on */
SeahorseServiceDiscovery *discovery; /* Adds sources from DNS-SD */
+ gboolean in_destruction; /* In destroy signal */
};
static void seahorse_context_dispose (GObject *gobject);
@@ -123,6 +125,9 @@ seahorse_context_class_init (SeahorseContextClass *klass)
signals[REFRESHING] = g_signal_new ("refreshing", SEAHORSE_TYPE_CONTEXT,
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, refreshing),
NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OPERATION);
+ signals[DESTROY] = g_signal_new ("destroy", SEAHORSE_TYPE_CONTEXT,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, destroy),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
/* init context, private vars, set prefs, connect signals */
@@ -214,8 +219,14 @@ seahorse_context_dispose (GObject *gobject)
if (sctx->pv->refresh_ops)
g_object_unref (sctx->pv->refresh_ops);
sctx->pv->refresh_ops = NULL;
-
- G_OBJECT_CLASS (seahorse_context_parent_class)->dispose (gobject);
+
+ if (!sctx->pv->in_destruction) {
+ sctx->pv->in_destruction = TRUE;
+ g_signal_emit (sctx, signals[DESTROY], 0);
+ sctx->pv->in_destruction = FALSE;
+ }
+
+ G_OBJECT_CLASS (seahorse_context_parent_class)->dispose (gobject);
}
@@ -313,12 +324,10 @@ seahorse_context_new (guint flags)
void
seahorse_context_destroy (SeahorseContext *sctx)
{
- g_return_if_fail (GTK_IS_OBJECT (sctx));
-
- gtk_object_destroy (GTK_OBJECT (sctx));
-
- if (sctx == app_context)
- app_context = NULL;
+ g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+ g_object_run_dispose (G_OBJECT (sctx));
+ if (sctx == app_context)
+ app_context = NULL;
}
/**
diff --git a/libseahorse/seahorse-context.h b/libseahorse/seahorse-context.h
index 16f2b72..832eff4 100644
--- a/libseahorse/seahorse-context.h
+++ b/libseahorse/seahorse-context.h
@@ -66,18 +66,18 @@ typedef struct _SeahorseContextPrivate SeahorseContextPrivate;
*/
struct _SeahorseContext {
- GtkObject parent;
-
- /*< public >*/
- gboolean is_daemon;
-
- /*< private >*/
- SeahorseContextPrivate *pv;
+ GObject parent;
+
+ /*< public >*/
+ gboolean is_daemon;
+
+ /*< private >*/
+ SeahorseContextPrivate *pv;
};
struct _SeahorseContextClass {
- GtkObjectClass parent_class;
-
+ GObjectClass parent_class;
+
/* signals --------------------------------------------------------- */
/* A object was added to this source */
@@ -91,6 +91,8 @@ struct _SeahorseContextClass {
/* The source is being refreshed */
void (*refreshing) (SeahorseContext *sctx, SeahorseOperation *op);
+
+ void (*destroy) (SeahorseContext *sctx);
};
enum SeahorseContextType {
diff --git a/libseahorse/seahorse-object-widget.c b/libseahorse/seahorse-object-widget.c
index 48906d9..551b494 100644
--- a/libseahorse/seahorse-object-widget.c
+++ b/libseahorse/seahorse-object-widget.c
@@ -259,13 +259,5 @@ seahorse_object_widget_create (gchar *name, GtkWindow *parent, SeahorseObject *o
SeahorseWidget*
seahorse_object_widget_new (gchar *name, GtkWindow *parent, SeahorseObject *object)
{
- SeahorseWidget *swidget;
-
- swidget = seahorse_object_widget_create (name, parent, object);
-
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (swidget));
- g_object_ref_sink (GTK_OBJECT (swidget));
- g_object_unref (GTK_OBJECT (swidget));
- return swidget;
+ return seahorse_object_widget_create (name, parent, object);
}
diff --git a/libseahorse/seahorse-passphrase.c b/libseahorse/seahorse-passphrase.c
index 79d919e..0b621ba 100644
--- a/libseahorse/seahorse-passphrase.c
+++ b/libseahorse/seahorse-passphrase.c
@@ -41,7 +41,11 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (2,90,0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include "seahorse-libdialogs.h"
#include "seahorse-widget.h"
@@ -198,7 +202,7 @@ seahorse_passphrase_prompt_show (const gchar *title, const gchar *description,
if (!prompt)
prompt = _("Password:");
- w = gtk_dialog_new_with_buttons (title, NULL, GTK_DIALOG_NO_SEPARATOR, NULL);
+ w = gtk_dialog_new_with_buttons (title, NULL, 0, NULL);
gtk_window_set_icon_name (GTK_WINDOW (w), GTK_STOCK_DIALOG_AUTHENTICATION);
dialog = GTK_DIALOG (w);
diff --git a/libseahorse/seahorse-set.h b/libseahorse/seahorse-set.h
index 8e15f38..3ab2b99 100644
--- a/libseahorse/seahorse-set.h
+++ b/libseahorse/seahorse-set.h
@@ -65,15 +65,15 @@ typedef struct _SeahorseSetPrivate SeahorseSetPrivate;
*/
struct _SeahorseSet {
- GtkObject parent;
-
- /*<private>*/
- SeahorseSetPrivate *pv;
+ GObject parent;
+
+ /*<private>*/
+ SeahorseSetPrivate *pv;
};
struct _SeahorseSetClass {
- GtkObjectClass parent_class;
-
+ GObjectClass parent_class;
+
/* signals --------------------------------------------------------- */
/* A key was added to this view */
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index 3db56b3..cd1d04d 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -43,6 +43,7 @@
#include <unistd.h>
#include <time.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
diff --git a/libseahorse/seahorse-widget.c b/libseahorse/seahorse-widget.c
index 9eacf46..a2a0862 100644
--- a/libseahorse/seahorse-widget.c
+++ b/libseahorse/seahorse-widget.c
@@ -44,9 +44,17 @@ enum {
PROP_NAME
};
+enum {
+ DESTROY,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
static void class_init (SeahorseWidgetClass *klass);
static void object_init (SeahorseWidget *swidget);
+static void object_dispose (GObject *gobject);
static void object_finalize (GObject *gobject);
static void object_set_property (GObject *object,
@@ -74,10 +82,10 @@ G_MODULE_EXPORT gboolean on_widget_delete_event (GtkWidget *widget,
GdkEvent *event,
SeahorseWidget *swidget);
-static void context_destroyed (GtkObject *object,
+static void context_destroyed (SeahorseContext *sctx,
SeahorseWidget *swidget);
-static GtkObjectClass *parent_class = NULL;
+static GObjectClass *parent_class = NULL;
/* Hash of widgets with name as key */
static GHashTable *widgets = NULL;
@@ -100,9 +108,9 @@ seahorse_widget_get_type (void)
(GClassInitFunc) class_init,
NULL, NULL, sizeof (SeahorseWidget), 0, (GInstanceInitFunc) object_init
};
-
- widget_type = g_type_register_static (GTK_TYPE_OBJECT, "SeahorseWidget",
- &widget_info, 0);
+
+ widget_type = g_type_register_static (G_TYPE_OBJECT, "SeahorseWidget",
+ &widget_info, 0);
}
return widget_type;
@@ -123,24 +131,29 @@ class_init (SeahorseWidgetClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructor = seahorse_widget_constructor;
+ gobject_class->dispose = object_dispose;
gobject_class->finalize = object_finalize;
gobject_class->set_property = object_set_property;
gobject_class->get_property = object_get_property;
-
- g_object_class_install_property (gobject_class, PROP_NAME,
- g_param_spec_string ("name", "Widget name", "Name of gtkbuilder file and main widget",
- NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (gobject_class, PROP_NAME,
+ g_param_spec_string ("name", "Widget name", "Name of gtkbuilder file and main widget",
+ NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ signals[DESTROY] = g_signal_new ("destroy", SEAHORSE_TYPE_WIDGET,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseWidgetClass, destroy),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
/**
-* object: ignored
+* sctx: ignored
* swidget: The swidget being destroyed
*
* Destroy widget when context is destroyed
*
**/
static void
-context_destroyed (GtkObject *object, SeahorseWidget *swidget)
+context_destroyed (SeahorseContext *sctx, SeahorseWidget *swidget)
{
seahorse_widget_destroy (swidget);
}
@@ -154,8 +167,8 @@ context_destroyed (GtkObject *object, SeahorseWidget *swidget)
static void
object_init (SeahorseWidget *swidget)
{
- g_signal_connect_after (SCTX_APP(), "destroy",
- G_CALLBACK (context_destroyed), swidget);
+ g_signal_connect_after (SCTX_APP(), "destroy",
+ G_CALLBACK (context_destroyed), swidget);
}
/**
@@ -199,6 +212,19 @@ seahorse_widget_constructor (GType type, guint n_props, GObjectConstructParam* p
return obj;
}
+static void
+object_dispose (GObject *object)
+{
+ SeahorseWidget *swidget = SEAHORSE_WIDGET (object);
+
+ if (!swidget->in_destruction) {
+ swidget->in_destruction = TRUE;
+ g_signal_emit (swidget, signals[DESTROY], 0);
+ swidget->in_destruction = FALSE;
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
/**
* gobject: The #SeahorseWidget to finalize
@@ -383,11 +409,6 @@ seahorse_widget_new (const gchar *name, GtkWindow *parent)
gtk_window_set_transient_for (window, parent);
}
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (swidget));
- g_object_ref_sink (GTK_OBJECT (swidget));
- g_object_unref (GTK_OBJECT (swidget));
-
return swidget;
}
@@ -403,22 +424,18 @@ seahorse_widget_new (const gchar *name, GtkWindow *parent)
SeahorseWidget*
seahorse_widget_new_allow_multiple (const gchar *name, GtkWindow *parent)
{
- GtkWindow *window;
- SeahorseWidget *swidget = g_object_new (SEAHORSE_TYPE_WIDGET, "name", name, NULL);
-
- if (parent != NULL) {
- window = GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name));
- gtk_window_set_transient_for (window, parent);
- }
+ GtkWindow *window;
+ SeahorseWidget *swidget;
- gtk_builder_connect_signals (swidget->gtkbuilder, NULL);
-
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (swidget));
- g_object_ref_sink (GTK_OBJECT (swidget));
- g_object_unref (GTK_OBJECT (swidget));
+ swidget = g_object_new (SEAHORSE_TYPE_WIDGET, "name", name, NULL);
- return swidget;
+ if (parent != NULL) {
+ window = GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name));
+ gtk_window_set_transient_for (window, parent);
+ }
+
+ gtk_builder_connect_signals (swidget->gtkbuilder, NULL);
+ return swidget;
}
/**
diff --git a/libseahorse/seahorse-widget.h b/libseahorse/seahorse-widget.h
index 4774c43..76dd225 100644
--- a/libseahorse/seahorse-widget.h
+++ b/libseahorse/seahorse-widget.h
@@ -58,18 +58,22 @@ typedef struct _SeahorseWidgetClass SeahorseWidgetClass;
*/
struct _SeahorseWidget {
- GtkObject parent;
-
- /*< public >*/
- GtkBuilder *gtkbuilder;
- gchar *name;
-
- /*< private >*/
- gboolean destroying;
+ GObject parent;
+
+ /*< public >*/
+ GtkBuilder *gtkbuilder;
+ gchar *name;
+
+ /*< private >*/
+ gboolean destroying;
+ gboolean in_destruction;
};
struct _SeahorseWidgetClass {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
+
+ /*< signals >*/
+ void (*destroy) (SeahorseWidget *swidget);
};
GType seahorse_widget_get_type ();
diff --git a/src/seahorse-key-manager.c b/src/seahorse-key-manager.c
index 8396d0b..49420a4 100644
--- a/src/seahorse-key-manager.c
+++ b/src/seahorse-key-manager.c
@@ -882,7 +882,7 @@ seahorse_key_manager_constructor (GType type, guint n_props, GObjectConstructPar
seahorse_viewer_include_actions (SEAHORSE_VIEWER (self), self->pv->view_actions);
/* Notify us when gconf stuff changes under this key */
- seahorse_gconf_notify_lazy (LISTING_SCHEMAS, (GConfClientNotifyFunc)on_gconf_notify, self, GTK_OBJECT (self));
+ seahorse_gconf_notify_lazy (LISTING_SCHEMAS, (GConfClientNotifyFunc)on_gconf_notify, self, self);
/* close event */
g_signal_connect_object (seahorse_widget_get_toplevel (SEAHORSE_WIDGET (self)),
diff --git a/src/seahorse-viewer.c b/src/seahorse-viewer.c
index 929c3d9..4f770e5 100644
--- a/src/seahorse-viewer.c
+++ b/src/seahorse-viewer.c
@@ -65,8 +65,6 @@ G_DEFINE_TYPE_EXTENDED (SeahorseViewer, seahorse_viewer, SEAHORSE_TYPE_WIDGET, 0
#define SEAHORSE_VIEWER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_VIEWER, SeahorseViewerPrivate))
-static gboolean about_initialized = FALSE;
-
/* Predicates which control export and delete commands, inited in class_init */
static SeahorseObjectPredicate exportable_predicate = { 0, };
static SeahorseObjectPredicate deletable_predicate = { 0, };
@@ -108,25 +106,6 @@ on_app_preferences (GtkAction* action, SeahorseViewer* self)
}
static void
-on_about_link_clicked (GtkAboutDialog* about, const char* url, gpointer unused)
-{
- GError *error = NULL;
- GAppLaunchContext* ctx;
-
- g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
- g_return_if_fail (url != NULL);
-
-
- ctx = g_app_launch_context_new ();
- if (!g_app_info_launch_default_for_uri (url, ctx, &error)) {
- g_warning ("couldn't launch url: %s: %s", url, error->message);
- g_clear_error (&error);
- }
-
- g_object_unref (ctx);
-}
-
-static void
on_app_about (GtkAction* action, SeahorseViewer* self)
{
GtkAboutDialog *about;
@@ -157,11 +136,6 @@ on_app_about (GtkAction* action, SeahorseViewer* self)
NULL
};
- if (!about_initialized) {
- about_initialized = TRUE;
- gtk_about_dialog_set_url_hook (on_about_link_clicked, NULL, NULL);
- }
-
about = GTK_ABOUT_DIALOG (gtk_about_dialog_new ());
gtk_about_dialog_set_artists (about, artists);
gtk_about_dialog_set_authors (about, authors);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]