[gedit/wip/loader-saver: 23/52] GeditDocument: remove error param of the "loaded" and "saved" signals



commit 97b94f3e204ab3fff486f57dd273ce93ecb1ed09
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jun 26 22:00:43 2014 +0200

    GeditDocument: remove error param of the "loaded" and "saved" signals
    
    Plugins don't need the error paramater, the signals are useful only on
    success.
    
    The signal marshallers are set to NULL to use the generic marshaller.

 gedit/gedit-document.c                    |   26 +++++++----------------
 gedit/gedit-document.h                    |    6 +---
 gedit/gedit-tab.c                         |    4 +-
 plugins/modelines/gedit-modeline-plugin.c |    1 -
 plugins/spell/gedit-spell-plugin.c        |   31 ++++++++++------------------
 5 files changed, 23 insertions(+), 45 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 5180ba4..ebe635c 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -45,11 +45,9 @@
 
 #define NO_LANGUAGE_NAME "_NORMAL_"
 
-static void    gedit_document_loaded_real      (GeditDocument *doc,
-                                                const GError  *error);
+static void    gedit_document_loaded_real      (GeditDocument *doc);
 
-static void    gedit_document_saved_real       (GeditDocument *doc,
-                                                const GError  *error);
+static void    gedit_document_saved_real       (GeditDocument *doc);
 
 struct _GeditDocumentPrivate
 {
@@ -560,11 +558,8 @@ gedit_document_class_init (GeditDocumentClass *klass)
                              G_OBJECT_CLASS_TYPE (object_class),
                              G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GeditDocumentClass, loaded),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__BOXED,
-                             G_TYPE_NONE,
-                             1,
-                             G_TYPE_ERROR);
+                             NULL, NULL, NULL,
+                             G_TYPE_NONE, 0);
 
        /**
         * GeditDocument::save:
@@ -587,11 +582,8 @@ gedit_document_class_init (GeditDocumentClass *klass)
                              G_OBJECT_CLASS_TYPE (object_class),
                              G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GeditDocumentClass, saved),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__BOXED,
-                             G_TYPE_NONE,
-                             1,
-                             G_TYPE_ERROR);
+                             NULL, NULL, NULL,
+                             G_TYPE_NONE, 0);
 }
 
 static void
@@ -1229,8 +1221,7 @@ loaded_query_info_cb (GFile         *location,
 }
 
 static void
-gedit_document_loaded_real (GeditDocument *doc,
-                           const GError  *error)
+gedit_document_loaded_real (GeditDocument *doc)
 {
        GFile *location = gtk_source_file_get_location (doc->priv->file);
 
@@ -1290,8 +1281,7 @@ saved_query_info_cb (GFile         *location,
 }
 
 static void
-gedit_document_saved_real (GeditDocument *doc,
-                          const GError  *error)
+gedit_document_saved_real (GeditDocument *doc)
 {
        GFile *location = gtk_source_file_get_location (doc->priv->file);
 
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index afe88dd..9600f88 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -96,13 +96,11 @@ struct _GeditDocumentClass
 
        void (* load)                   (GeditDocument *document);
 
-       void (* loaded)                 (GeditDocument *document,
-                                        const GError  *error);
+       void (* loaded)                 (GeditDocument *document);
 
        void (* save)                   (GeditDocument *document);
 
-       void (* saved)                  (GeditDocument *document,
-                                        const GError  *error);
+       void (* saved)                  (GeditDocument *document);
 };
 
 #define GEDIT_DOCUMENT_ERROR gedit_document_error_quark ()
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index be55d31..7128bd4 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1874,7 +1874,7 @@ load_cb (GtkSourceFileLoader *loader,
                clear_loading (tab);
        }
 
-       g_signal_emit_by_name (doc, "loaded", NULL);
+       g_signal_emit_by_name (doc, "loaded");
 
 end:
        /* Async operation finished. */
@@ -2181,7 +2181,7 @@ save_cb (GtkSourceFileSaver *saver,
 
                clear_saving (tab);
 
-               g_signal_emit_by_name (doc, "saved", NULL);
+               g_signal_emit_by_name (doc, "saved");
        }
 
        /* Async operation finished. */
diff --git a/plugins/modelines/gedit-modeline-plugin.c b/plugins/modelines/gedit-modeline-plugin.c
index 812a045..07b0a23 100644
--- a/plugins/modelines/gedit-modeline-plugin.c
+++ b/plugins/modelines/gedit-modeline-plugin.c
@@ -143,7 +143,6 @@ gedit_modeline_plugin_get_property (GObject    *object,
 
 static void
 on_document_loaded_or_saved (GeditDocument *document,
-                            const GError  *error,
                             GtkSourceView *view)
 {
        modeline_parser_apply_modeline (view);
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index 83404ed..dde1e13 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -1006,41 +1006,31 @@ set_auto_spell_from_metadata (GeditSpellPlugin *plugin,
 
 static void
 on_document_loaded (GeditDocument    *doc,
-                   const GError     *error,
                    GeditSpellPlugin *plugin)
 {
-       if (error == NULL)
-       {
-               GeditSpellChecker *spell;
-               GeditView *view;
+       GeditSpellChecker *spell;
+       GeditView *view;
 
-               spell = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
-                                                                spell_checker_id));
-               if (spell != NULL)
-               {
-                       set_language_from_metadata (spell, doc);
-               }
+       spell = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
+                                                        spell_checker_id));
+       if (spell != NULL)
+       {
+               set_language_from_metadata (spell, doc);
+       }
 
-               view = GEDIT_VIEW (g_object_get_data (G_OBJECT (doc), GEDIT_AUTOMATIC_SPELL_VIEW));
+       view = GEDIT_VIEW (g_object_get_data (G_OBJECT (doc), GEDIT_AUTOMATIC_SPELL_VIEW));
 
-               set_auto_spell_from_metadata (plugin, view);
-       }
+       set_auto_spell_from_metadata (plugin, view);
 }
 
 static void
 on_document_saved (GeditDocument    *doc,
-                  const GError     *error,
                   GeditSpellPlugin *plugin)
 {
        GeditAutomaticSpellChecker *autospell;
        GeditSpellChecker *spell;
        const gchar *key;
 
-       if (error != NULL)
-       {
-               return;
-       }
-
        /* Make sure to save the metadata here too */
        autospell = gedit_automatic_spell_checker_get_from_document (doc);
        spell = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
@@ -1081,6 +1071,7 @@ tab_added_cb (GeditWindow      *window,
                          "loaded",
                          G_CALLBACK (on_document_loaded),
                          plugin);
+
        g_signal_connect (doc,
                          "saved",
                          G_CALLBACK (on_document_saved),


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