[libgit2-glib] Fix GgitSubmoduleUpdateOptions for the api breaks



commit 79c3ac57f9a95e92abb4638fa5cd5d464c4a9de4
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Jul 13 22:47:10 2015 +0200

    Fix GgitSubmoduleUpdateOptions for the api breaks

 libgit2-glib/ggit-submodule-update-options.c |  134 ++++++-------------------
 libgit2-glib/ggit-submodule-update-options.h |   10 +--
 2 files changed, 35 insertions(+), 109 deletions(-)
---
diff --git a/libgit2-glib/ggit-submodule-update-options.c b/libgit2-glib/ggit-submodule-update-options.c
index 479ef1a..fa4073b 100644
--- a/libgit2-glib/ggit-submodule-update-options.c
+++ b/libgit2-glib/ggit-submodule-update-options.c
@@ -21,8 +21,7 @@
 #include "ggit-submodule-update-options.h"
 #include "ggit-enum-types.h"
 #include "ggit-checkout-options.h"
-#include "ggit-remote-callbacks.h"
-#include "ggit-signature.h"
+#include "ggit-fetch-options.h"
 
 #define GGIT_SUBMODULE_UPDATE_OPTIONS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GGIT_TYPE_SUBMODULE_UPDATE_OPTIONS, GgitSubmoduleUpdateOptionsPrivate))
 
@@ -31,8 +30,7 @@ struct _GgitSubmoduleUpdateOptionsPrivate
        git_submodule_update_options options;
 
        GgitCheckoutOptions *checkout_options;
-       GgitRemoteCallbacks *remote_callbacks;
-       GgitSignature *signature;
+       GgitFetchOptions *fetch_options;
 };
 
 G_DEFINE_TYPE (GgitSubmoduleUpdateOptions, ggit_submodule_update_options, G_TYPE_OBJECT)
@@ -41,9 +39,8 @@ enum
 {
        PROP_0,
        PROP_CHECKOUT_OPTIONS,
-       PROP_REMOTE_CALLBACKS,
+       PROP_FETCH_OPTIONS,
        PROP_CLONE_CHECKOUT_STRATEGY,
-       PROP_SIGNATURE
 };
 
 static void
@@ -54,8 +51,7 @@ ggit_submodule_update_options_finalize (GObject *object)
        options = GGIT_SUBMODULE_UPDATE_OPTIONS (object);
 
        g_clear_object (&options->priv->checkout_options);
-       g_clear_object (&options->priv->remote_callbacks);
-       g_clear_object (&options->priv->signature);
+       g_clear_pointer (&options->priv->fetch_options, ggit_fetch_options_free);
 
        G_OBJECT_CLASS (ggit_submodule_update_options_parent_class)->finalize (object);
 }
@@ -74,18 +70,14 @@ ggit_submodule_update_options_set_property (GObject      *object,
                ggit_submodule_update_options_set_checkout_options (self,
                                                                    g_value_get_object (value));
                break;
-       case PROP_REMOTE_CALLBACKS:
-               ggit_submodule_update_options_set_remote_callbacks (self,
-                                                                   g_value_get_object (value));
+       case PROP_FETCH_OPTIONS:
+               ggit_submodule_update_options_set_fetch_options (self,
+                                                                g_value_get_boxed (value));
                break;
        case PROP_CLONE_CHECKOUT_STRATEGY:
                ggit_submodule_update_options_set_clone_checkout_strategy (self,
                                                                           g_value_get_flags (value));
                break;
-       case PROP_SIGNATURE:
-               ggit_submodule_update_options_set_signature (self,
-                                                            g_value_get_object (value));
-               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -105,16 +97,13 @@ ggit_submodule_update_options_get_property (GObject    *object,
        case PROP_CHECKOUT_OPTIONS:
                g_value_set_object (value, self->priv->checkout_options);
                break;
-       case PROP_REMOTE_CALLBACKS:
-               g_value_set_object (value, self->priv->remote_callbacks);
+       case PROP_FETCH_OPTIONS:
+               g_value_set_boxed (value, self->priv->fetch_options);
                break;
        case PROP_CLONE_CHECKOUT_STRATEGY:
                g_value_set_flags (value,
                                   ggit_submodule_update_options_get_clone_checkout_strategy (self));
                break;
-       case PROP_SIGNATURE:
-               g_value_set_object (value, self->priv->signature);
-               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -143,11 +132,11 @@ ggit_submodule_update_options_class_init (GgitSubmoduleUpdateOptionsClass *klass
                                                              G_PARAM_STATIC_STRINGS));
 
        g_object_class_install_property (object_class,
-                                        PROP_REMOTE_CALLBACKS,
-                                        g_param_spec_object ("remote-callbacks",
-                                                             "Remote Callbacks",
-                                                             "Remote callbacks",
-                                                             GGIT_TYPE_REMOTE_CALLBACKS,
+                                        PROP_FETCH_OPTIONS,
+                                        g_param_spec_object ("fetch-options",
+                                                             "Fetch options",
+                                                             "Fetch options",
+                                                             GGIT_TYPE_FETCH_OPTIONS,
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_STATIC_STRINGS));
 
@@ -160,15 +149,6 @@ ggit_submodule_update_options_class_init (GgitSubmoduleUpdateOptionsClass *klass
                                                             GGIT_CHECKOUT_NONE,
                                                             G_PARAM_READWRITE |
                                                             G_PARAM_STATIC_STRINGS));
-
-       g_object_class_install_property (object_class,
-                                        PROP_SIGNATURE,
-                                        g_param_spec_object ("signature",
-                                                             "Signature",
-                                                             "Signature",
-                                                             GGIT_TYPE_SIGNATURE,
-                                                             G_PARAM_READWRITE |
-                                                             G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -267,49 +247,48 @@ ggit_submodule_update_options_set_checkout_options (GgitSubmoduleUpdateOptions *
  * ggit_submodule_update_options_get_remote_callbacks:
  * @options: a #GgitSubmoduleUpdateOptions.
  *
- * Gets the remote callbacks.
+ * Gets the fetch options.
  *
- * Returns: (transfer none): a #GgitRemoteCallbacks.
+ * Returns: (transfer none): a #GgitFetchOptions.
  *
  **/
-GgitRemoteCallbacks *
-ggit_submodule_update_options_get_remote_callbacks (GgitSubmoduleUpdateOptions *options)
+GgitFetchOptions *
+ggit_submodule_update_options_get_fetch_options (GgitSubmoduleUpdateOptions *options)
 {
        g_return_val_if_fail (GGIT_IS_SUBMODULE_UPDATE_OPTIONS (options), NULL);
 
-       return options->priv->remote_callbacks;
+       return options->priv->fetch_options;
 
 }
 
 /**
- * ggit_submodule_update_options_set_remote_callbacks:
+ * ggit_submodule_update_options_set_fetch_options:
  * @options: a #GgitSubmoduleUpdateOptions.
- * @remote_callbacks: (allow-none): a #GgitRemoteCallbacks.
+ * @fetch_options: (allow-none): a #GgitFetchOptions.
  *
- * Set the remote callbacks.
+ * Sets the fetch options.
  **/
 void
-ggit_submodule_update_options_set_remote_callbacks (GgitSubmoduleUpdateOptions *options,
-                                                    GgitRemoteCallbacks        *remote_callbacks)
+ggit_submodule_update_options_set_fetch_options (GgitSubmoduleUpdateOptions *options,
+                                                 GgitFetchOptions           *fetch_options)
 {
        g_return_if_fail (GGIT_IS_SUBMODULE_UPDATE_OPTIONS (options));
-       g_return_if_fail (remote_callbacks == NULL || GGIT_IS_REMOTE_CALLBACKS (remote_callbacks));
 
-       if (options->priv->remote_callbacks)
+       if (options->priv->fetch_options)
        {
-               g_object_unref (options->priv->remote_callbacks);
-               options->priv->remote_callbacks = NULL;
+               ggit_fetch_options_free (options->priv->fetch_options);
+               options->priv->fetch_options = NULL;
 
-               git_remote_init_callbacks (&options->priv->options.remote_callbacks, 
GIT_REMOTE_CALLBACKS_VERSION);
+               git_fetch_init_options (&options->priv->options.fetch_opts, GIT_FETCH_OPTIONS_VERSION);
        }
 
-       if (remote_callbacks)
+       if (fetch_options)
        {
-               options->priv->remote_callbacks = g_object_ref (remote_callbacks);
-               options->priv->options.remote_callbacks = *_ggit_remote_callbacks_get_native 
(options->priv->remote_callbacks);
+               options->priv->fetch_options = ggit_fetch_options_copy (fetch_options);
+               options->priv->options.fetch_opts = *_ggit_fetch_options_get_fetch_options 
(options->priv->fetch_options);
        }
 
-       g_object_notify (G_OBJECT (options), "remote-callbacks");
+       g_object_notify (G_OBJECT (options), "fetch-options");
 }
 
 /**
@@ -350,53 +329,4 @@ ggit_submodule_update_options_set_clone_checkout_strategy (GgitSubmoduleUpdateOp
        }
 }
 
-/**
- * ggit_submodule_update_options_get_signature:
- * @options: a #GgitSubmoduleUpdateOptions.
- *
- * Gets the identity used when updating the reflog or %NULL to
- * use the default signature using the config.
- *
- * Returns: (transfer none): a #GgitSignature or %NULL.
- *
- **/
-GgitSignature *
-ggit_submodule_update_options_get_signature (GgitSubmoduleUpdateOptions *options)
-{
-       g_return_val_if_fail (GGIT_IS_SUBMODULE_UPDATE_OPTIONS (options), NULL);
-
-       return options->priv->signature;
-}
-
-/**
- * ggit_submodule_update_options_set_signature:
- * @options: a #GgitSubmoduleUpdateOptions.
- * @signature: (allow-none): a #GgitSignature.
- *
- * Sets the identity used when updating the reflog. Use %NULL to
- * use the default signature using the config.
- **/
-void
-ggit_submodule_update_options_set_signature (GgitSubmoduleUpdateOptions *options,
-                                             GgitSignature              *signature)
-{
-       g_return_if_fail (GGIT_IS_SUBMODULE_UPDATE_OPTIONS (options));
-       g_return_if_fail (signature == NULL || GGIT_IS_SIGNATURE (signature));
-
-       if (options->priv->signature)
-       {
-               g_object_unref (options->priv->signature);
-               options->priv->signature = NULL;
-               options->priv->options.signature = NULL;
-       }
-
-       if (signature)
-       {
-               options->priv->signature = g_object_ref (signature);
-               options->priv->options.signature = _ggit_native_get (signature);
-       }
-
-       g_object_notify (G_OBJECT (options), "signature");
-}
-
 /* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-submodule-update-options.h b/libgit2-glib/ggit-submodule-update-options.h
index ee8aaae..4b573f6 100644
--- a/libgit2-glib/ggit-submodule-update-options.h
+++ b/libgit2-glib/ggit-submodule-update-options.h
@@ -62,18 +62,14 @@ GgitCheckoutOptions   *ggit_submodule_update_options_get_checkout_options  (Ggit
 void                   ggit_submodule_update_options_set_checkout_options  (GgitSubmoduleUpdateOptions 
*options,
                                                                             GgitCheckoutOptions        
*checkout_options);
 
-GgitRemoteCallbacks   *ggit_submodule_update_options_get_remote_callbacks  (GgitSubmoduleUpdateOptions 
*options);
-void                   ggit_submodule_update_options_set_remote_callbacks  (GgitSubmoduleUpdateOptions 
*options,
-                                                                            GgitRemoteCallbacks        
*remote_callbacks);
+GgitFetchOptions      *ggit_submodule_update_options_get_fetch_options     (GgitSubmoduleUpdateOptions 
*options);
+void                   ggit_submodule_update_options_set_fetch_options     (GgitSubmoduleUpdateOptions 
*options,
+                                                                            GgitFetchOptions           
*fetch_options);
 
 GgitCheckoutStrategy   ggit_submodule_update_options_get_clone_checkout_strategy (GgitSubmoduleUpdateOptions 
*options);
 void                   ggit_submodule_update_options_set_clone_checkout_strategy (GgitSubmoduleUpdateOptions 
*options,
                                                                                   GgitCheckoutStrategy       
 checkout_strategy);
 
-GgitSignature         *ggit_submodule_update_options_get_signature         (GgitSubmoduleUpdateOptions 
*options);
-void                   ggit_submodule_update_options_set_signature         (GgitSubmoduleUpdateOptions 
*options,
-                                                                            GgitSignature              
*signature);
-
 G_END_DECLS
 
 #endif /* __GGIT_SUBMODULE_UPDATE_OPTIONS_H__ */


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