* src/modest-account-mgr-helpers.[ch],
authorJose Dapena Paz <jdapena@igalia.com>
Sat, 12 Jan 2008 18:23:08 +0000 (18:23 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Sat, 12 Jan 2008 18:23:08 +0000 (18:23 +0000)
  src/maemo/modest-connection-specific-smtp-window.c:
  src/modest-tny-account-store.c:
        * Now we store and use connection id instead of connection
          names (the second one is not unique, and then, lead to
          problems) (fixes NB#79204).
* src/mdoest-ui-dimming-rules.c:
        * Now on editor paste do not require a "clipboard wait"
          operation as it can cause a lock.
* src/modest-window-mgr.c:
        * Remove some debug g_messages.

pmo-trunk-r4025

src/maemo/modest-connection-specific-smtp-window.c
src/modest-account-mgr-helpers.c
src/modest-account-mgr-helpers.h
src/modest-tny-account-store.c
src/modest-ui-dimming-rules.c
src/widgets/modest-window-mgr.c

index 8c55609..22ce95f 100644 (file)
@@ -194,7 +194,7 @@ modest_connection_specific_smtp_window_fill_with_connections (ModestConnectionSp
                        /* Get any already-associated connection-specific server account: */
                        gchar *server_account_name = NULL;
                        server_account_name = modest_account_mgr_get_connection_specific_smtp (
-                               priv->account_manager, connection_name);
+                               priv->account_manager, connection_id);
                                        
                        /* Add the row to the model: */
                        GtkTreeIter iter;
@@ -521,7 +521,7 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe
                                
                                /* associate the specific server account with this connection for this account: */
                                success = success && modest_account_mgr_set_connection_specific_smtp (
-                                       priv->account_manager, connection_name, server_account_name);
+                                       priv->account_manager, id, server_account_name);
                                
                                /* Save the new name in the treemodel, so it can be edited again later: */
                                gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter, 
@@ -530,10 +530,10 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe
                        } else {
                                modest_account_mgr_save_server_settings (mgr, server_settings);
                        }
-               } else if (connection_name && server_name && 
+               } else if (id && server_name && 
                           !strcmp (server_name, _("mcen_ia_optionalsmtp_notdefined"))) {
                        modest_account_mgr_remove_connection_specific_smtp (priv->account_manager, 
-                                                                           connection_name);
+                                                                           id);
                        gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter, 
                                            MODEL_COL_SERVER_ACCOUNT_NAME, NULL, -1);
                }
index eecde23..671e4e2 100644 (file)
@@ -98,9 +98,9 @@ ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccoun
 
 
 gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self, 
-       const gchar* connection_name, const gchar* server_account_name)
+       const gchar* connection_id, const gchar* server_account_name)
 {
-       modest_account_mgr_remove_connection_specific_smtp (self, connection_name);
+       modest_account_mgr_remove_connection_specific_smtp (self, connection_id);
        
        ModestConf *conf = MODEST_ACCOUNT_MGR_GET_PRIVATE (self)->modest_conf;
 
@@ -115,7 +115,7 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self
                result = FALSE;
        } else {        
                /* The server account is in the item after the connection name: */
-               list = g_slist_append (list, (gpointer)connection_name);
+               list = g_slist_append (list, (gpointer)connection_id);
                list = g_slist_append (list, (gpointer)server_account_name);
        
                /* Reset the changed list: */
@@ -138,22 +138,22 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self
  * modest_account_mgr_remove_connection_specific_smtp
  * @self: a ModestAccountMgr instance
  * @name: the account name
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection id
  * 
  * Disassacoiate a server account to use with the specific connection for this account.
  *
  * Returns: TRUE if it worked, FALSE otherwise
  */                             
 gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self, 
-       const gchar* connection_name)
+       const gchar* connection_id)
 {
        ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
        
        gboolean result = TRUE;
        GError *err = NULL;
        GSList *list = modest_conf_get_list (priv->modest_conf, 
-                                                       MODEST_CONF_CONNECTION_SPECIFIC_SMTP_LIST,
-                                                   MODEST_CONF_VALUE_STRING, &err);
+                                            MODEST_CONF_CONNECTION_SPECIFIC_SMTP_LIST,
+                                            MODEST_CONF_VALUE_STRING, &err);
        if (err) {
                g_printerr ("modest: %s: error getting list: %s.\n", __FUNCTION__, err->message);
                g_error_free (err);
@@ -165,7 +165,7 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s
                return FALSE;
                
        /* The server account is in the item after the connection name: */
-       GSList *list_connection = g_slist_find_custom (list, connection_name, (GCompareFunc)strcmp);
+       GSList *list_connection = g_slist_find_custom (list, connection_id, (GCompareFunc)strcmp);
        if (list_connection) {
                GSList *account_node = g_slist_next (list_connection);
                /* remove both items: */
@@ -205,13 +205,13 @@ gboolean modest_account_mgr_set_use_connection_specific_smtp (ModestAccountMgr *
 /**
  * modest_account_mgr_get_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection id
  * 
  * Retrieve a server account to use with this specific connection for this account.
  *
  * Returns: a server account name to use for this connection, or NULL if none is specified.
  */                     
-gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self,  const gchar* connection_name)
+gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self,  const gchar* connection_id)
 {
        gchar *result = NULL;
        
@@ -232,8 +232,8 @@ gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self,
        /* The server account is in the item after the connection name: */
        GSList *iter = list;
        while (iter) {
-               const gchar* this_connection_name = (const gchar*)(iter->data);
-               if (strcmp (this_connection_name, connection_name) == 0) {
+               const gchar* this_connection_id = (const gchar*)(iter->data);
+               if (strcmp (this_connection_id, connection_id) == 0) {
                        iter = g_slist_next (iter);
                        
                        if (iter) {
@@ -253,7 +253,7 @@ gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self,
                
        /*
        if (!result) {
-               printf ("  debug: no server found for connection_name=%s.\n", connection_name); 
+               printf ("  debug: no server found for connection_id=%s.\n", connection_id);     
        }
        */
                                
index 8df2c76..0378597 100644 (file)
@@ -140,7 +140,7 @@ ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccoun
 /**
  * modest_account_mgr_set_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection name
  * @server_account_name: a server account name to use for this connection.
  * 
  * Specify a server account to use with the specific connection for this account.
@@ -148,19 +148,19 @@ ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccoun
  * Returns: TRUE if it worked, FALSE otherwise
  */
 gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self, 
-                                        const gchar* connection_name, const gchar* server_account_name);
+                                        const gchar* connection_id, const gchar* server_account_name);
 
 /**
  * modest_account_mgr_remove_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection name
  * 
  * Disassociate a server account to use with the specific connection for this account.
  *
  * Returns: TRUE if it worked, FALSE otherwise
  */                             
 gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self, 
-       const gchar* connection_name);
+       const gchar* connection_id);
 
 /**
  * modest_account_mgr_get_use_connection_specific_smtp
@@ -184,14 +184,14 @@ gboolean modest_account_mgr_set_use_connection_specific_smtp (ModestAccountMgr *
 /**
  * modest_account_mgr_get_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection id
  * 
  * Retrieve a server account to use with this specific connection for this account.
  *
  * Returns: a server account name to use for this connection, or NULL if none is specified.
  */                     
 gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, 
-                                                       const gchar* connection_name);
+                                                       const gchar* connection_id);
 
 
 /**
index 54f7e17..9382fb5 100644 (file)
@@ -1365,9 +1365,9 @@ modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection
        if (!connection)
                return NULL;
                
-       const gchar *connection_name = con_ic_iap_get_name (connection);
-       /* printf ("DEBUG: %s: connection_name=%s\n", __FUNCTION__, connection_name); */
-       if (!connection_name)
+       const gchar *connection_id = con_ic_iap_get_id (connection);
+       /* printf ("DEBUG: %s: connection_id=%s\n", __FUNCTION__, connection_id); */
+       if (!connection_id)
                return NULL;
        
        /*  Get the connection-specific transport acccount, if any: */
@@ -1379,7 +1379,7 @@ modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection
        }
 
        gchar* server_account_name = modest_account_mgr_get_connection_specific_smtp (account_manager, 
-               connection_name);
+               connection_id);
 
        /* printf ("DEBUG: %s: server_account_name=%s\n", __FUNCTION__, server_account_name); */
        if (!server_account_name) {
index cebe023..b637877 100644 (file)
@@ -1515,9 +1515,10 @@ modest_ui_dimming_rules_on_editor_paste (ModestWindow *win, gpointer user_data)
 
        if (!dimmed) {
                ModestEmailClipboard *e_clipboard = modest_runtime_get_email_clipboard ();
+               const gchar *clipboard_text = modest_msg_edit_window_get_clipboard_text (MODEST_MSG_EDIT_WINDOW (win));
+
                dimmed = modest_email_clipboard_cleared (e_clipboard) && 
-                       (modest_msg_edit_window_get_clipboard_text(MODEST_MSG_EDIT_WINDOW (win)) == NULL) &&
-                        !gtk_clipboard_wait_is_text_available(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
+                 ((clipboard_text == NULL) || (clipboard_text[0] == '\0'));
        }
        
        return dimmed;
index 464a7d6..5cbae89 100644 (file)
@@ -1237,7 +1237,6 @@ modest_window_mgr_register_banner (ModestWindowMgr *self)
        priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
 
        priv->banner_counter++;
-       g_message ("REGISTER BANNER -> %d", priv->banner_counter);
        
 }
 
@@ -1250,10 +1249,8 @@ modest_window_mgr_unregister_banner (ModestWindowMgr *self)
        priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
 
        priv->banner_counter--;
-       g_message ("UNREGISTER BANNER -> %d", priv->banner_counter);
        if (priv->window_list == NULL && priv->banner_counter == 0) {
                g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
-               g_message ("WINDOW LIST EMPTY");
        }
 
 }