diff options
-rw-r--r-- | libmm-common/Makefile.am | 8 | ||||
-rw-r--r-- | libmm-common/libmm-common.h | 2 | ||||
-rw-r--r-- | libmm-common/mm-common-sms-properties.h | 87 | ||||
-rw-r--r-- | libmm-common/mm-sms-properties.c (renamed from libmm-common/mm-common-sms-properties.c) | 149 | ||||
-rw-r--r-- | libmm-common/mm-sms-properties.h | 75 | ||||
-rw-r--r-- | libmm-glib/Makefile.am | 3 | ||||
-rw-r--r-- | libmm-glib/mm-modem-messaging.c | 6 | ||||
-rw-r--r-- | libmm-glib/mm-sms-properties.c | 76 | ||||
-rw-r--r-- | libmm-glib/mm-sms-properties.h | 54 | ||||
-rw-r--r-- | libmm-glib/mm-sms.h | 2 | ||||
-rw-r--r-- | src/mm-iface-modem-messaging.c | 4 | ||||
-rw-r--r-- | src/mm-sms.c | 18 | ||||
-rw-r--r-- | src/mm-sms.h | 2 |
13 files changed, 185 insertions, 301 deletions
diff --git a/libmm-common/Makefile.am b/libmm-common/Makefile.am index 9e817a9c..2af348d4 100644 --- a/libmm-common/Makefile.am +++ b/libmm-common/Makefile.am @@ -152,7 +152,7 @@ mm-common-helpers.c: mm-errors-types.h mm-enums-types.h mm-common-simple-properties.c: mm-errors-types.h mm-enums-types.h mm-common-connect-properties.c: mm-errors-types.h mm-common-bearer-properties.c: mm-errors-types.h -mm-common-sms-properties.c: mm-errors-types.h +mm-sms-properties.c: mm-errors-types.h mm-common-bearer-ip-config.c: mm-errors-types.h mm-common-location-3gpp.c: mm-errors-types.h mm-errors-quarks.c: mm-errors-types.h @@ -166,7 +166,7 @@ include_HEADERS = \ mm-common-simple-properties.h \ mm-common-connect-properties.h \ mm-common-bearer-properties.h \ - mm-common-sms-properties.h \ + mm-sms-properties.h \ mm-common-bearer-ip-config.h \ mm-common-location-3gpp.h \ mm-unlock-retries.h \ @@ -190,8 +190,8 @@ libmm_common_la_SOURCES = \ mm-common-connect-properties.c \ mm-common-bearer-properties.h \ mm-common-bearer-properties.c \ - mm-common-sms-properties.h \ - mm-common-sms-properties.c \ + mm-sms-properties.h \ + mm-sms-properties.c \ mm-common-bearer-ip-config.h \ mm-common-bearer-ip-config.c \ mm-common-location-3gpp.h \ diff --git a/libmm-common/libmm-common.h b/libmm-common/libmm-common.h index 819c2b73..7e266f37 100644 --- a/libmm-common/libmm-common.h +++ b/libmm-common/libmm-common.h @@ -28,7 +28,7 @@ #include "mm-common-helpers.h" #include "mm-common-simple-properties.h" #include "mm-common-connect-properties.h" -#include "mm-common-sms-properties.h" +#include "mm-sms-properties.h" #include "mm-common-bearer-properties.h" #include "mm-common-bearer-ip-config.h" #include "mm-common-location-3gpp.h" diff --git a/libmm-common/mm-common-sms-properties.h b/libmm-common/mm-common-sms-properties.h deleted file mode 100644 index cfa0ad88..00000000 --- a/libmm-common/mm-common-sms-properties.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#ifndef MM_COMMON_SMS_PROPERTIES_H -#define MM_COMMON_SMS_PROPERTIES_H - -#include <ModemManager.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define MM_TYPE_COMMON_SMS_PROPERTIES (mm_common_sms_properties_get_type ()) -#define MM_COMMON_SMS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_SMS_PROPERTIES, MMCommonSmsProperties)) -#define MM_COMMON_SMS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_SMS_PROPERTIES, MMCommonSmsPropertiesClass)) -#define MM_IS_COMMON_SMS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_SMS_PROPERTIES)) -#define MM_IS_COMMON_SMS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_SMS_PROPERTIES)) -#define MM_COMMON_SMS_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_SMS_PROPERTIES, MMCommonSmsPropertiesClass)) - -typedef struct _MMCommonSmsProperties MMCommonSmsProperties; -typedef struct _MMCommonSmsPropertiesClass MMCommonSmsPropertiesClass; -typedef struct _MMCommonSmsPropertiesPrivate MMCommonSmsPropertiesPrivate; - -struct _MMCommonSmsProperties { - GObject parent; - MMCommonSmsPropertiesPrivate *priv; -}; - -struct _MMCommonSmsPropertiesClass { - GObjectClass parent; -}; - -GType mm_common_sms_properties_get_type (void); - -MMCommonSmsProperties *mm_common_sms_properties_new (void); -MMCommonSmsProperties *mm_common_sms_properties_new_from_string ( - const gchar *str, - GError **error); -MMCommonSmsProperties *mm_common_sms_properties_new_from_dictionary ( - GVariant *dictionary, - GError **error); - -MMCommonSmsProperties *mm_common_sms_properties_dup (MMCommonSmsProperties *orig); - -void mm_common_sms_properties_set_text ( - MMCommonSmsProperties *properties, - const gchar *text); -void mm_common_sms_properties_set_number ( - MMCommonSmsProperties *properties, - const gchar *number); -void mm_common_sms_properties_set_smsc ( - MMCommonSmsProperties *properties, - const gchar *smsc); -void mm_common_sms_properties_set_validity ( - MMCommonSmsProperties *properties, - guint validity); -void mm_common_sms_properties_set_class ( - MMCommonSmsProperties *properties, - guint class); - -const gchar *mm_common_sms_properties_get_text ( - MMCommonSmsProperties *properties); -const gchar *mm_common_sms_properties_get_number ( - MMCommonSmsProperties *properties); -const gchar *mm_common_sms_properties_get_smsc ( - MMCommonSmsProperties *properties); -guint mm_common_sms_properties_get_validity ( - MMCommonSmsProperties *properties); -guint mm_common_sms_properties_get_class ( - MMCommonSmsProperties *properties); - -GVariant *mm_common_sms_properties_get_dictionary (MMCommonSmsProperties *self); - -G_END_DECLS - -#endif /* MM_COMMON_SMS_PROPERTIES_H */ diff --git a/libmm-common/mm-common-sms-properties.c b/libmm-common/mm-sms-properties.c index ccdc8c54..ca186a81 100644 --- a/libmm-common/mm-common-sms-properties.c +++ b/libmm-common/mm-sms-properties.c @@ -19,9 +19,9 @@ #include "mm-errors-types.h" #include "mm-common-helpers.h" -#include "mm-common-sms-properties.h" +#include "mm-sms-properties.h" -G_DEFINE_TYPE (MMCommonSmsProperties, mm_common_sms_properties, G_TYPE_OBJECT); +G_DEFINE_TYPE (MMSmsProperties, mm_sms_properties, G_TYPE_OBJECT); #define PROPERTY_TEXT "text" #define PROPERTY_NUMBER "number" @@ -29,7 +29,7 @@ G_DEFINE_TYPE (MMCommonSmsProperties, mm_common_sms_properties, G_TYPE_OBJECT); #define PROPERTY_VALIDITY "validity" #define PROPERTY_CLASS "class" -struct _MMCommonSmsPropertiesPrivate { +struct _MMSmsPropertiesPrivate { gchar *text; gchar *number; gchar *smsc; @@ -42,41 +42,51 @@ struct _MMCommonSmsPropertiesPrivate { /*****************************************************************************/ void -mm_common_sms_properties_set_text (MMCommonSmsProperties *self, - const gchar *text) +mm_sms_properties_set_text (MMSmsProperties *self, + const gchar *text) { + g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); + g_free (self->priv->text); self->priv->text = g_strdup (text); } void -mm_common_sms_properties_set_number (MMCommonSmsProperties *self, - const gchar *number) +mm_sms_properties_set_number (MMSmsProperties *self, + const gchar *number) { + g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); + g_free (self->priv->number); self->priv->number = g_strdup (number); } void -mm_common_sms_properties_set_smsc (MMCommonSmsProperties *self, - const gchar *smsc) +mm_sms_properties_set_smsc (MMSmsProperties *self, + const gchar *smsc) { + g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); + g_free (self->priv->smsc); self->priv->smsc = g_strdup (smsc); } void -mm_common_sms_properties_set_validity (MMCommonSmsProperties *self, - guint validity) +mm_sms_properties_set_validity (MMSmsProperties *self, + guint validity) { + g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); + self->priv->validity_set = TRUE; self->priv->validity = validity; } void -mm_common_sms_properties_set_class (MMCommonSmsProperties *self, - guint class) +mm_sms_properties_set_class (MMSmsProperties *self, + guint class) { + g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); + self->priv->class_set = TRUE; self->priv->class = class; } @@ -84,39 +94,49 @@ mm_common_sms_properties_set_class (MMCommonSmsProperties *self, /*****************************************************************************/ const gchar * -mm_common_sms_properties_get_text (MMCommonSmsProperties *self) +mm_sms_properties_get_text (MMSmsProperties *self) { + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), NULL); + return self->priv->text; } const gchar * -mm_common_sms_properties_get_number (MMCommonSmsProperties *self) +mm_sms_properties_get_number (MMSmsProperties *self) { + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), NULL); + return self->priv->number; } const gchar * -mm_common_sms_properties_get_smsc (MMCommonSmsProperties *self) +mm_sms_properties_get_smsc (MMSmsProperties *self) { + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), NULL); + return self->priv->smsc; } guint -mm_common_sms_properties_get_validity (MMCommonSmsProperties *self) +mm_sms_properties_get_validity (MMSmsProperties *self) { + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), 0); + return self->priv->validity; } guint -mm_common_sms_properties_get_class (MMCommonSmsProperties *self) +mm_sms_properties_get_class (MMSmsProperties *self) { + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), 0); + return self->priv->class; } /*****************************************************************************/ GVariant * -mm_common_sms_properties_get_dictionary (MMCommonSmsProperties *self) +mm_sms_properties_get_dictionary (MMSmsProperties *self) { GVariantBuilder builder; @@ -124,6 +144,8 @@ mm_common_sms_properties_get_dictionary (MMCommonSmsProperties *self) if (!self) return NULL; + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), NULL); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (self->priv->text) @@ -175,23 +197,23 @@ parse_uint (const gchar *str, g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, - "Invalid properties string, cannot parset '%s' as uint", + "Invalid properties string, cannot parse '%s' as uint", str); return 0; } static gboolean -consume_string (MMCommonSmsProperties *self, +consume_string (MMSmsProperties *self, const gchar *key, const gchar *value, GError **error) { if (g_str_equal (key, PROPERTY_TEXT)) - mm_common_sms_properties_set_text (self, value); + mm_sms_properties_set_text (self, value); else if (g_str_equal (key, PROPERTY_NUMBER)) - mm_common_sms_properties_set_number (self, value); + mm_sms_properties_set_number (self, value); else if (g_str_equal (key, PROPERTY_SMSC)) - mm_common_sms_properties_set_smsc (self, value); + mm_sms_properties_set_smsc (self, value); else if (g_str_equal (key, PROPERTY_VALIDITY)) { GError *inner_error = NULL; guint n; @@ -202,7 +224,7 @@ consume_string (MMCommonSmsProperties *self, return FALSE; } - mm_common_sms_properties_set_validity (self, n); + mm_sms_properties_set_validity (self, n); } else if (g_str_equal (key, PROPERTY_CLASS)) { GError *inner_error = NULL; guint n; @@ -213,7 +235,7 @@ consume_string (MMCommonSmsProperties *self, return FALSE; } - mm_common_sms_properties_set_class (self, n); + mm_sms_properties_set_class (self, n); } else { g_set_error (error, MM_CORE_ERROR, @@ -227,7 +249,7 @@ consume_string (MMCommonSmsProperties *self, } typedef struct { - MMCommonSmsProperties *properties; + MMSmsProperties *properties; GError *error; } ParseKeyValueContext; @@ -242,13 +264,13 @@ key_value_foreach (const gchar *key, &ctx->error); } -MMCommonSmsProperties * -mm_common_sms_properties_new_from_string (const gchar *str, - GError **error) +MMSmsProperties * +mm_sms_properties_new_from_string (const gchar *str, + GError **error) { ParseKeyValueContext ctx; - ctx.properties = mm_common_sms_properties_new (); + ctx.properties = mm_sms_properties_new (); ctx.error = NULL; mm_common_parse_key_value_string (str, @@ -269,29 +291,29 @@ mm_common_sms_properties_new_from_string (const gchar *str, /*****************************************************************************/ static gboolean -consume_variant (MMCommonSmsProperties *properties, +consume_variant (MMSmsProperties *properties, const gchar *key, GVariant *value, GError **error) { if (g_str_equal (key, PROPERTY_TEXT)) - mm_common_sms_properties_set_text ( + mm_sms_properties_set_text ( properties, g_variant_get_string (value, NULL)); else if (g_str_equal (key, PROPERTY_NUMBER)) - mm_common_sms_properties_set_number ( + mm_sms_properties_set_number ( properties, g_variant_get_string (value, NULL)); else if (g_str_equal (key, PROPERTY_SMSC)) - mm_common_sms_properties_set_smsc ( + mm_sms_properties_set_smsc ( properties, g_variant_get_string (value, NULL)); else if (g_str_equal (key, PROPERTY_VALIDITY)) - mm_common_sms_properties_set_validity ( + mm_sms_properties_set_validity ( properties, g_variant_get_uint32 (value)); else if (g_str_equal (key, PROPERTY_CLASS)) - mm_common_sms_properties_set_class ( + mm_sms_properties_set_class ( properties, g_variant_get_uint32 (value)); else { @@ -307,20 +329,30 @@ consume_variant (MMCommonSmsProperties *properties, return TRUE; } -MMCommonSmsProperties * -mm_common_sms_properties_new_from_dictionary (GVariant *dictionary, - GError **error) +MMSmsProperties * +mm_sms_properties_new_from_dictionary (GVariant *dictionary, + GError **error) { GError *inner_error = NULL; GVariantIter iter; gchar *key; GVariant *value; - MMCommonSmsProperties *properties; + MMSmsProperties *properties; - properties = mm_common_sms_properties_new (); + properties = mm_sms_properties_new (); if (!dictionary) return properties; + if (!g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{sv}"))) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Cannot create SMS properties from dictionary: " + "invalid variant type received"); + g_object_unref (properties); + return NULL; + } + g_variant_iter_init (&iter, dictionary); while (!inner_error && g_variant_iter_next (&iter, "{sv}", &key, &value)) { @@ -344,15 +376,17 @@ mm_common_sms_properties_new_from_dictionary (GVariant *dictionary, /*****************************************************************************/ -MMCommonSmsProperties * -mm_common_sms_properties_dup (MMCommonSmsProperties *orig) +MMSmsProperties * +mm_sms_properties_dup (MMSmsProperties *orig) { GVariant *dict; - MMCommonSmsProperties *copy; + MMSmsProperties *copy; GError *error = NULL; - dict = mm_common_sms_properties_get_dictionary (orig); - copy = mm_common_sms_properties_new_from_dictionary (dict, &error); + g_return_val_if_fail (MM_IS_SMS_PROPERTIES (orig), NULL); + + dict = mm_sms_properties_get_dictionary (orig); + copy = mm_sms_properties_new_from_dictionary (dict, &error); g_assert_no_error (error); g_variant_unref (dict); @@ -361,39 +395,38 @@ mm_common_sms_properties_dup (MMCommonSmsProperties *orig) /*****************************************************************************/ -MMCommonSmsProperties * -mm_common_sms_properties_new (void) +MMSmsProperties * +mm_sms_properties_new (void) { - return (MM_COMMON_SMS_PROPERTIES ( - g_object_new (MM_TYPE_COMMON_SMS_PROPERTIES, NULL))); + return (MM_SMS_PROPERTIES (g_object_new (MM_TYPE_SMS_PROPERTIES, NULL))); } static void -mm_common_sms_properties_init (MMCommonSmsProperties *self) +mm_sms_properties_init (MMSmsProperties *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), - MM_TYPE_COMMON_SMS_PROPERTIES, - MMCommonSmsPropertiesPrivate); + MM_TYPE_SMS_PROPERTIES, + MMSmsPropertiesPrivate); } static void finalize (GObject *object) { - MMCommonSmsProperties *self = MM_COMMON_SMS_PROPERTIES (object); + MMSmsProperties *self = MM_SMS_PROPERTIES (object); g_free (self->priv->text); g_free (self->priv->number); g_free (self->priv->smsc); - G_OBJECT_CLASS (mm_common_sms_properties_parent_class)->finalize (object); + G_OBJECT_CLASS (mm_sms_properties_parent_class)->finalize (object); } static void -mm_common_sms_properties_class_init (MMCommonSmsPropertiesClass *klass) +mm_sms_properties_class_init (MMSmsPropertiesClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (object_class, sizeof (MMCommonSmsPropertiesPrivate)); + g_type_class_add_private (object_class, sizeof (MMSmsPropertiesPrivate)); object_class->finalize = finalize; } diff --git a/libmm-common/mm-sms-properties.h b/libmm-common/mm-sms-properties.h new file mode 100644 index 00000000..752abade --- /dev/null +++ b/libmm-common/mm-sms-properties.h @@ -0,0 +1,75 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details: + * + * Copyright (C) 2012 Google, Inc. + */ + +#ifndef MM_SMS_PROPERTIES_H +#define MM_SMS_PROPERTIES_H + +#include <ModemManager.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MM_TYPE_SMS_PROPERTIES (mm_sms_properties_get_type ()) +#define MM_SMS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SMS_PROPERTIES, MMSmsProperties)) +#define MM_SMS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SMS_PROPERTIES, MMSmsPropertiesClass)) +#define MM_IS_SMS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SMS_PROPERTIES)) +#define MM_IS_SMS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SMS_PROPERTIES)) +#define MM_SMS_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SMS_PROPERTIES, MMSmsPropertiesClass)) + +typedef struct _MMSmsProperties MMSmsProperties; +typedef struct _MMSmsPropertiesClass MMSmsPropertiesClass; +typedef struct _MMSmsPropertiesPrivate MMSmsPropertiesPrivate; + +struct _MMSmsProperties { + GObject parent; + MMSmsPropertiesPrivate *priv; +}; + +struct _MMSmsPropertiesClass { + GObjectClass parent; +}; + +GType mm_sms_properties_get_type (void); + +MMSmsProperties *mm_sms_properties_new (void); +MMSmsProperties *mm_sms_properties_new_from_string (const gchar *str, + GError **error); +MMSmsProperties *mm_sms_properties_new_from_dictionary (GVariant *dictionary, + GError **error); + +MMSmsProperties *mm_sms_properties_dup (MMSmsProperties *orig); + +void mm_sms_properties_set_text (MMSmsProperties *properties, + const gchar *text); +void mm_sms_properties_set_number (MMSmsProperties *properties, + const gchar *number); +void mm_sms_properties_set_smsc (MMSmsProperties *properties, + const gchar *smsc); +void mm_sms_properties_set_validity (MMSmsProperties *properties, + guint validity); +void mm_sms_properties_set_class (MMSmsProperties *properties, + guint class); + +const gchar *mm_sms_properties_get_text (MMSmsProperties *properties); +const gchar *mm_sms_properties_get_number (MMSmsProperties *properties); +const gchar *mm_sms_properties_get_smsc (MMSmsProperties *properties); +guint mm_sms_properties_get_validity (MMSmsProperties *properties); +guint mm_sms_properties_get_class (MMSmsProperties *properties); + +GVariant *mm_sms_properties_get_dictionary (MMSmsProperties *self); + +G_END_DECLS + +#endif /* MM_SMS_PROPERTIES_H */ diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index 4cb2e9a0..a44312a0 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -36,8 +36,6 @@ libmm_glib_la_SOURCES = \ mm-modem-location.c \ mm-sim.h \ mm-sim.c \ - mm-sms-properties.h \ - mm-sms-properties.c \ mm-sms.h \ mm-sms.c \ mm-modem-messaging.h \ @@ -64,7 +62,6 @@ include_HEADERS = \ mm-modem-simple-status-properties.h \ mm-modem-simple.h \ mm-sim.h \ - mm-sms-properties.h \ mm-sms.h \ mm-bearer-properties.h \ mm-bearer-ip-config.h \ diff --git a/libmm-glib/mm-modem-messaging.c b/libmm-glib/mm-modem-messaging.c index 7eabf6a3..7cd473b2 100644 --- a/libmm-glib/mm-modem-messaging.c +++ b/libmm-glib/mm-modem-messaging.c @@ -405,8 +405,7 @@ mm_modem_messaging_create (MMModemMessaging *self, if (cancellable) ctx->cancellable = g_object_ref (cancellable); - dictionary = (mm_common_sms_properties_get_dictionary ( - MM_COMMON_SMS_PROPERTIES (properties))); + dictionary = (mm_sms_properties_get_dictionary (properties)); mm_gdbus_modem_messaging_call_create ( self, dictionary, @@ -443,8 +442,7 @@ mm_modem_messaging_create_sync (MMModemMessaging *self, g_return_val_if_fail (MM_GDBUS_IS_MODEM_MESSAGING (self), NULL); - dictionary = (mm_common_sms_properties_get_dictionary ( - MM_COMMON_SMS_PROPERTIES (properties))); + dictionary = (mm_sms_properties_get_dictionary (properties)); mm_gdbus_modem_messaging_call_create_sync (self, dictionary, &sms_path, diff --git a/libmm-glib/mm-sms-properties.c b/libmm-glib/mm-sms-properties.c deleted file mode 100644 index 161ac1fc..00000000 --- a/libmm-glib/mm-sms-properties.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#include "mm-sms-properties.h" - -void -mm_sms_properties_set_text (MMSmsProperties *self, - const gchar *text) -{ - g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); - - mm_common_sms_properties_set_text (self, text); -} - -void -mm_sms_properties_set_number (MMSmsProperties *self, - const gchar *number) -{ - g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); - - mm_common_sms_properties_set_number (self, number); -} - -void -mm_sms_properties_set_smsc (MMSmsProperties *self, - const gchar *smsc) -{ - g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); - - mm_common_sms_properties_set_smsc (self, smsc); -} - -void -mm_sms_properties_set_validity (MMSmsProperties *self, - guint validity) -{ - g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); - - mm_common_sms_properties_set_validity (self, validity); -} - -void -mm_sms_properties_set_class (MMSmsProperties *self, - guint class) -{ - g_return_if_fail (MM_IS_SMS_PROPERTIES (self)); - - mm_common_sms_properties_set_class (self, class); -} - -/*****************************************************************************/ - -MMSmsProperties * -mm_sms_properties_new_from_string (const gchar *str, - GError **error) -{ - return mm_common_sms_properties_new_from_string (str, error); -} - -MMSmsProperties * -mm_sms_properties_new (void) -{ - return mm_common_sms_properties_new (); -} diff --git a/libmm-glib/mm-sms-properties.h b/libmm-glib/mm-sms-properties.h deleted file mode 100644 index f37e499d..00000000 --- a/libmm-glib/mm-sms-properties.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#ifndef MM_SMS_PROPERTIES_H -#define MM_SMS_PROPERTIES_H - -#include <ModemManager.h> -#include <glib-object.h> - -#include <libmm-common.h> - -G_BEGIN_DECLS - -typedef MMCommonSmsProperties MMSmsProperties; -#define MM_TYPE_SMS_PROPERTIES(o) MM_TYPE_COMMON_SMS_PROPERTIES (o) -#define MM_SMS_PROPERTIES(o) MM_COMMON_SMS_PROPERTIES(o) -#define MM_IS_SMS_PROPERTIES(o) MM_IS_COMMON_SMS_PROPERTIES(o) - -MMSmsProperties *mm_sms_properties_new (void); -MMSmsProperties *mm_sms_properties_new_from_string ( - const gchar *str, - GError **error); - -void mm_sms_properties_set_text ( - MMSmsProperties *properties, - const gchar *text); -void mm_sms_properties_set_number ( - MMSmsProperties *properties, - const gchar *number); -void mm_sms_properties_set_smsc ( - MMSmsProperties *properties, - const gchar *smsc); -void mm_sms_properties_set_validity ( - MMSmsProperties *properties, - guint validity); -void mm_sms_properties_set_class ( - MMSmsProperties *properties, - guint class); - -G_END_DECLS - -#endif /* MM_SMS_PROPERTIES_H */ diff --git a/libmm-glib/mm-sms.h b/libmm-glib/mm-sms.h index 09e256ba..7d836909 100644 --- a/libmm-glib/mm-sms.h +++ b/libmm-glib/mm-sms.h @@ -26,8 +26,6 @@ #include <ModemManager.h> #include <libmm-common.h> -#include "mm-sms-properties.h" - G_BEGIN_DECLS typedef MmGdbusSms MMSms; diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index d450d61e..6a30bd60 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -204,7 +204,7 @@ handle_create_auth_ready (MMBaseModem *self, MMModemState modem_state = MM_MODEM_STATE_UNKNOWN; MMSmsList *list = NULL; GError *error = NULL; - MMCommonSmsProperties *properties; + MMSmsProperties *properties; MMSms *sms; if (!mm_base_modem_authorize_finish (self, res, &error)) { @@ -227,7 +227,7 @@ handle_create_auth_ready (MMBaseModem *self, } /* Parse input properties */ - properties = mm_common_sms_properties_new_from_dictionary (ctx->dictionary, &error); + properties = mm_sms_properties_new_from_dictionary (ctx->dictionary, &error); if (!properties) { g_dbus_method_invocation_take_error (ctx->invocation, error); handle_create_context_free (ctx); diff --git a/src/mm-sms.c b/src/mm-sms.c index 4848a0a3..11399f18 100644 --- a/src/mm-sms.c +++ b/src/mm-sms.c @@ -1077,28 +1077,28 @@ mm_sms_multipart_new (MMBaseModem *modem, MMSms * mm_sms_new_from_properties (MMBaseModem *modem, - MMCommonSmsProperties *properties, + MMSmsProperties *properties, GError **error) { MMSmsPart *part; /* Don't create SMS from properties if either text or number is missing */ - if (!mm_common_sms_properties_get_text (properties) || - !mm_common_sms_properties_get_number (properties)) { + if (!mm_sms_properties_get_text (properties) || + !mm_sms_properties_get_number (properties)) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "Cannot create SMS: mandatory parameter '%s' is missing", - (mm_common_sms_properties_get_text (properties) == NULL ? + (mm_sms_properties_get_text (properties) == NULL ? "text" : "number")); } part = mm_sms_part_new (SMS_PART_INVALID_INDEX); - mm_sms_part_set_text (part, mm_common_sms_properties_get_text (properties)); - mm_sms_part_set_number (part, mm_common_sms_properties_get_number (properties)); - mm_sms_part_set_smsc (part, mm_common_sms_properties_get_smsc (properties)); - mm_sms_part_set_validity (part, mm_common_sms_properties_get_validity (properties)); - mm_sms_part_set_class (part, mm_common_sms_properties_get_class (properties)); + mm_sms_part_set_text (part, mm_sms_properties_get_text (properties)); + mm_sms_part_set_number (part, mm_sms_properties_get_number (properties)); + mm_sms_part_set_smsc (part, mm_sms_properties_get_smsc (properties)); + mm_sms_part_set_validity (part, mm_sms_properties_get_validity (properties)); + mm_sms_part_set_class (part, mm_sms_properties_get_class (properties)); return mm_sms_singlepart_new (modem, MM_SMS_STATE_UNKNOWN, diff --git a/src/mm-sms.h b/src/mm-sms.h index 7f6f731c..df232157 100644 --- a/src/mm-sms.h +++ b/src/mm-sms.h @@ -83,7 +83,7 @@ GType mm_sms_get_type (void); MMSms *mm_sms_new (MMBaseModem *modem); MMSms *mm_sms_new_from_properties (MMBaseModem *modem, - MMCommonSmsProperties *properties, + MMSmsProperties *properties, GError **error); MMSms *mm_sms_singlepart_new (MMBaseModem *modem, |