Commit 72fdd0af authored by Sébastien Wilmet's avatar Sébastien Wilmet

navigator: GInitiallyUnowned

To use the full possibilities of GObject, when it makes sense.
parent 83540c4e
......@@ -100,7 +100,7 @@ set_navigator (GspellCheckerDialog *dialog,
priv = gspell_checker_dialog_get_instance_private (dialog);
g_return_if_fail (priv->navigator == NULL);
priv->navigator = g_object_ref (navigator);
priv->navigator = g_object_ref_sink (navigator);
g_object_notify (G_OBJECT (dialog), "spell-navigator");
}
......@@ -703,10 +703,6 @@ gspell_checker_dialog_init (GspellCheckerDialog *dialog)
* @parent: transient parent of the dialog.
* @navigator: the #GspellNavigator to use.
*
* Creates a new #GspellCheckerDialog. The #GspellCheckerDialog will own a
* reference to @navigator, so you can release your reference if you no longer
* need it.
*
* Returns: a new #GspellCheckerDialog widget.
*/
GtkWidget *
......
......@@ -73,7 +73,7 @@ static void gspell_navigator_iface_init (gpointer g_iface, gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (GspellNavigatorTextView,
gspell_navigator_text_view,
G_TYPE_OBJECT,
G_TYPE_INITIALLY_UNOWNED,
G_ADD_PRIVATE (GspellNavigatorTextView)
G_IMPLEMENT_INTERFACE (GSPELL_TYPE_NAVIGATOR,
gspell_navigator_iface_init))
......
......@@ -33,11 +33,11 @@ G_BEGIN_DECLS
#define GSPELL_TYPE_NAVIGATOR_TEXT_VIEW (gspell_navigator_text_view_get_type ())
G_DECLARE_DERIVABLE_TYPE (GspellNavigatorTextView, gspell_navigator_text_view,
GSPELL, NAVIGATOR_TEXT_VIEW,
GObject)
GInitiallyUnowned)
struct _GspellNavigatorTextViewClass
{
GObjectClass parent_class;
GInitiallyUnownedClass parent_class;
/* Padding for future expansion */
gpointer padding[8];
......
/*
* This file is part of gspell, a spell-checking library.
*
* Copyright 2015 - Sébastien Wilmet <swilmet@gnome.org>
* Copyright 2015, 2016 - Sébastien Wilmet <swilmet@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,7 +39,7 @@
* interface.
*/
G_DEFINE_INTERFACE (GspellNavigator, gspell_navigator, G_TYPE_OBJECT)
G_DEFINE_INTERFACE (GspellNavigator, gspell_navigator, G_TYPE_INITIALLY_UNOWNED)
static gboolean
gspell_navigator_goto_next_default (GspellNavigator *navigator,
......
/*
* This file is part of gspell, a spell-checking library.
*
* Copyright 2015 - Sébastien Wilmet <swilmet@gnome.org>
* Copyright 2015, 2016 - Sébastien Wilmet <swilmet@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define GSPELL_TYPE_NAVIGATOR (gspell_navigator_get_type ())
G_DECLARE_INTERFACE (GspellNavigator, gspell_navigator,
GSPELL, NAVIGATOR,
GObject)
GInitiallyUnowned)
struct _GspellNavigatorInterface
{
......
......@@ -66,7 +66,6 @@ checker_button_clicked_cb (GtkButton *checker_button,
navigator = gspell_navigator_text_view_new (spell->view);
checker_dialog = gspell_checker_dialog_new (GTK_WINDOW (window), navigator);
g_object_unref (navigator);
gtk_widget_show (checker_dialog);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment