TizenRefApp-5804 [Email] Remove all static state variables from Composer module 42/59942/1
authorIgor Nazarov <i.nazarov@samsung.com>
Fri, 19 Feb 2016 13:56:51 +0000 (15:56 +0200)
committerIgor Nazarov <i.nazarov@samsung.com>
Fri, 19 Feb 2016 14:13:37 +0000 (16:13 +0200)
Change-Id: I4d537f4c324f0688c16acbe01415bb44aa930438

Project-Files/modules/composer/inc/email-composer.h
Project-Files/modules/composer/src/email-composer-recipient-callback.c
Project-Files/modules/composer/src/email-composer.c

index 8abcba4..d62f091 100644 (file)
@@ -71,6 +71,9 @@ typedef struct ug_data EmailComposerUGD;
 struct ug_data {
        email_view_t base;
 
+       GDBusConnection *dbus_conn;
+       guint dbus_network_id;
+
        /* Idlers */
        Ecore_Idler *idler_set_focus;
        Ecore_Idler *idler_show_ctx_popup;
@@ -350,6 +353,7 @@ struct ug_data {
        Eina_Bool need_to_destroy_after_initializing;
        Eina_Bool need_to_display_max_size_popup;
        Eina_Bool is_force_destroy;
+       Eina_Bool is_mbe_edit_mode;
 
        /* Related to popup translation */
        int pt_element_type;
index 5836259..353049a 100644 (file)
@@ -60,7 +60,6 @@ static Eina_Bool _recipient_mbe_dnd_dragdone_reset_cb(void *data);*/
 
 static email_string_t EMAIL_COMPOSER_STRING_NULL = { NULL, NULL };
 
-static bool edit_mode = false;
 static Elm_Genlist_Item_Class select_address_itc;
 static Elm_Genlist_Item_Class add_to_contact_popup_itc;
 
@@ -87,8 +86,8 @@ static void _request_predictive_search(EmailComposerUGD *ugd)
        debug_enter();
 
        /* To prevent displaying gal-search popup when email address is set on entry. (entry_changed_cb is called!) */
-       if (edit_mode == true) {
-               edit_mode = false;
+       if (ugd->is_mbe_edit_mode) {
+               ugd->is_mbe_edit_mode = false;
                return;
        }
 
@@ -190,7 +189,7 @@ static void _recipient_mbe_popup_edit(EmailComposerUGD *ugd)
        EmailAddressInfo *ai = (EmailAddressInfo *)eina_list_nth(ri->email_list, ri->selected_email_idx);
        retm_if(!ai, "ai is NULL!");
 
-       edit_mode = true; /* To prevent displaying gal-search popup when email address is set on entry. (entry_changed_cb is called!) */
+       ugd->is_mbe_edit_mode = true; /* To prevent displaying gal-search popup when email address is set on entry. (entry_changed_cb is called!) */
 
        char *existing_text = g_strdup(elm_entry_entry_get(ugd->selected_entry));
 
index e3f399a..ff77ab2 100644 (file)
@@ -109,9 +109,6 @@ static void _composer_set_charset_info(void *data);
 static void _composer_contacts_update_recp_info_for_mbe(EmailComposerUGD *ugd, Evas_Object *mbe);
 static void _composer_contacts_update_recp_info_for_recipients(EmailComposerUGD *ugd);
 
-GDBusConnection *_g_composer_dbus_conn = NULL;
-guint _g_composer_network_id = 0;
-
 static email_string_t EMAIL_COMPOSER_STRING_NULL = { NULL, NULL };
 static email_string_t EMAIL_COMPOSER_STRING_BUTTON_OK = { PACKAGE, "IDS_EMAIL_BUTTON_OK" };
 static email_string_t EMAIL_COMPOSER_STRING_TPOP_LOADING_ING = { PACKAGE, "IDS_EMAIL_TPOP_LOADING_ING" };
@@ -638,17 +635,17 @@ static COMPOSER_ERROR_TYPE_E _composer_initialize_dbus(EmailComposerUGD *ugd)
        debug_enter();
 
        GError *error = NULL;
-       if (_g_composer_dbus_conn == NULL) {
-               _g_composer_dbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       if (ugd->dbus_conn == NULL) {
+               ugd->dbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
                if (error) {
                        debug_error("g_bus_get_sync() failed (%s)", error->message);
                        g_error_free(error);
                        return COMPOSER_ERROR_DBUS_FAIL;
                }
 
-               _g_composer_network_id = g_dbus_connection_signal_subscribe(_g_composer_dbus_conn, NULL, "User.Email.NetworkStatus", "email", "/User/Email/NetworkStatus",
+               ugd->dbus_network_id = g_dbus_connection_signal_subscribe(ugd->dbus_conn, NULL, "User.Email.NetworkStatus", "email", "/User/Email/NetworkStatus",
                                                                                                           NULL, G_DBUS_SIGNAL_FLAGS_NONE, _composer_gdbus_signal_receiver_cb, (void *)ugd, NULL);
-               retvm_if(_g_composer_network_id == GDBUS_SIGNAL_SUBSCRIBE_FAILURE, COMPOSER_ERROR_DBUS_FAIL, "g_dbus_connection_signal_subscribe() failed!");
+               retvm_if(ugd->dbus_network_id == GDBUS_SIGNAL_SUBSCRIBE_FAILURE, COMPOSER_ERROR_DBUS_FAIL, "g_dbus_connection_signal_subscribe() failed!");
        }
 
        debug_leave();
@@ -744,10 +741,10 @@ static void _composer_finalize_dbus(EmailComposerUGD *ugd)
 {
        debug_enter();
 
-       g_dbus_connection_signal_unsubscribe(_g_composer_dbus_conn, _g_composer_network_id);
-       g_object_unref(_g_composer_dbus_conn);
-       _g_composer_dbus_conn = NULL;
-       _g_composer_network_id = 0;
+       g_dbus_connection_signal_unsubscribe(ugd->dbus_conn, ugd->dbus_network_id);
+       g_object_unref(ugd->dbus_conn);
+       ugd->dbus_conn = NULL;
+       ugd->dbus_network_id = 0;
 
        debug_leave();
 }