[gedit] spell: reorder functions



commit 04bd20ba59266e48980ea59bc02607443c75b175
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jan 9 15:10:59 2016 +0100

    spell: reorder functions
    
    Better group together related stuff.

 plugins/spell/gedit-spell-plugin.c |  152 ++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 76 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index 4e1b92f..d436f83 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -61,26 +61,6 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditSpellPlugin,
                                G_ADD_PRIVATE_DYNAMIC (GeditSpellPlugin))
 
 static void
-gedit_spell_plugin_init (GeditSpellPlugin *plugin)
-{
-       gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin initializing");
-
-       plugin->priv = gedit_spell_plugin_get_instance_private (plugin);
-}
-
-static void
-gedit_spell_plugin_dispose (GObject *object)
-{
-       GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (object);
-
-       gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin disposing");
-
-       g_clear_object (&plugin->priv->window);
-
-       G_OBJECT_CLASS (gedit_spell_plugin_parent_class)->dispose (object);
-}
-
-static void
 gedit_spell_plugin_set_property (GObject      *object,
                                 guint         prop_id,
                                 const GValue *value,
@@ -121,24 +101,40 @@ gedit_spell_plugin_get_property (GObject    *object,
 }
 
 static void
-language_notify_cb (GspellChecker *checker,
-                   GParamSpec    *pspec,
-                   GeditDocument *doc)
+gedit_spell_plugin_dispose (GObject *object)
 {
-       const GspellLanguage *lang;
-       const gchar *language_code;
+       GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (object);
 
-       g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
+       gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin disposing");
 
-       lang = gspell_checker_get_language (checker);
-       g_return_if_fail (lang != NULL);
+       g_clear_object (&plugin->priv->window);
 
-       language_code = gspell_language_get_code (lang);
-       g_return_if_fail (language_code != NULL);
+       G_OBJECT_CLASS (gedit_spell_plugin_parent_class)->dispose (object);
+}
 
-       gedit_document_set_metadata (doc,
-                                    GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE, language_code,
-                                    NULL);
+static void
+gedit_spell_plugin_class_init (GeditSpellPluginClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->set_property = gedit_spell_plugin_set_property;
+       object_class->get_property = gedit_spell_plugin_get_property;
+       object_class->dispose = gedit_spell_plugin_dispose;
+
+       g_object_class_override_property (object_class, PROP_WINDOW, "window");
+}
+
+static void
+gedit_spell_plugin_class_finalize (GeditSpellPluginClass *klass)
+{
+}
+
+static void
+gedit_spell_plugin_init (GeditSpellPlugin *plugin)
+{
+       gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin initializing");
+
+       plugin->priv = gedit_spell_plugin_get_instance_private (plugin);
 }
 
 static const GspellLanguage *
@@ -159,6 +155,32 @@ get_language_from_metadata (GeditDocument *doc)
 }
 
 static void
+check_spell_cb (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       data)
+{
+       GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (data);
+       GeditSpellPluginPrivate *priv;
+       GeditView *view;
+       GspellNavigator *navigator;
+       GtkWidget *dialog;
+
+       gedit_debug (DEBUG_PLUGINS);
+
+       priv = plugin->priv;
+
+       view = gedit_window_get_active_view (priv->window);
+       g_return_if_fail (view != NULL);
+
+       navigator = gspell_navigator_gtv_new (GTK_TEXT_VIEW (view));
+       dialog = gspell_checker_dialog_new (GTK_WINDOW (priv->window), navigator);
+       g_object_unref (navigator);
+
+       gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+       gtk_widget_show (dialog);
+}
+
+static void
 language_dialog_response_cb (GtkDialog *dialog,
                             gint       response_id,
                             gpointer   user_data)
@@ -226,32 +248,6 @@ set_language_cb (GSimpleAction *action,
 }
 
 static void
-check_spell_cb (GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       data)
-{
-       GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (data);
-       GeditSpellPluginPrivate *priv;
-       GeditView *view;
-       GspellNavigator *navigator;
-       GtkWidget *dialog;
-
-       gedit_debug (DEBUG_PLUGINS);
-
-       priv = plugin->priv;
-
-       view = gedit_window_get_active_view (priv->window);
-       g_return_if_fail (view != NULL);
-
-       navigator = gspell_navigator_gtv_new (GTK_TEXT_VIEW (view));
-       dialog = gspell_checker_dialog_new (GTK_WINDOW (priv->window), navigator);
-       g_object_unref (navigator);
-
-       gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-       gtk_widget_show (dialog);
-}
-
-static void
 inline_checker_activate_cb (GSimpleAction *action,
                            GVariant      *parameter,
                            gpointer       data)
@@ -413,6 +409,27 @@ setup_inline_checker_from_metadata (GeditSpellPlugin *plugin,
 }
 
 static void
+language_notify_cb (GspellChecker *checker,
+                   GParamSpec    *pspec,
+                   GeditDocument *doc)
+{
+       const GspellLanguage *lang;
+       const gchar *language_code;
+
+       g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
+
+       lang = gspell_checker_get_language (checker);
+       g_return_if_fail (lang != NULL);
+
+       language_code = gspell_language_get_code (lang);
+       g_return_if_fail (language_code != NULL);
+
+       gedit_document_set_metadata (doc,
+                                    GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE, language_code,
+                                    NULL);
+}
+
+static void
 on_document_loaded (GeditDocument    *doc,
                    GeditSpellPlugin *plugin)
 {
@@ -614,23 +631,6 @@ gedit_spell_plugin_update_state (GeditWindowActivatable *activatable)
 }
 
 static void
-gedit_spell_plugin_class_init (GeditSpellPluginClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       object_class->dispose = gedit_spell_plugin_dispose;
-       object_class->set_property = gedit_spell_plugin_set_property;
-       object_class->get_property = gedit_spell_plugin_get_property;
-
-       g_object_class_override_property (object_class, PROP_WINDOW, "window");
-}
-
-static void
-gedit_spell_plugin_class_finalize (GeditSpellPluginClass *klass)
-{
-}
-
-static void
 gedit_window_activatable_iface_init (GeditWindowActivatableInterface *iface)
 {
        iface->activate = gedit_spell_plugin_activate;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]