diff options
author | Monsta <[email protected]> | 2014-11-09 13:10:36 +0300 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-12-17 09:03:00 +0100 |
commit | 32a360d6c14df5f5338ac602cce3174c2443aa47 (patch) | |
tree | a8f5bbbf7e95c5a3f171e0cf5fc9d676257e2903 /sendto | |
parent | 60344f7a79d41ae6f0af41dd786a6918493580bd (diff) | |
download | caja-extensions-32a360d6c14df5f5338ac602cce3174c2443aa47.tar.bz2 caja-extensions-32a360d6c14df5f5338ac602cce3174c2443aa47.tar.xz |
pidgin plugin: various fixes
- add missing spaces (code looked ugly)
- remove a GError variable which has never been used actually
(and avoid dereferencing NULL pointer at the same time)
- don't leak memory
Diffstat (limited to 'sendto')
-rw-r--r-- | sendto/plugins/pidgin/pidgin.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sendto/plugins/pidgin/pidgin.c b/sendto/plugins/pidgin/pidgin.c index 941d2b6..3189c71 100644 --- a/sendto/plugins/pidgin/pidgin.c +++ b/sendto/plugins/pidgin/pidgin.c @@ -371,7 +371,6 @@ static gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, GList *file_list) { - GError *error; GList *file_iter; GFile *file; @@ -387,7 +386,7 @@ gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, GValue val = {0,}; - if(proxy == NULL) + if (proxy == NULL) return FALSE; gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter); @@ -403,25 +402,24 @@ gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, alias = g_value_get_string (&val); contacts_group = g_hash_table_lookup (contact_hash, alias); g_value_unset (&val); - dat = g_ptr_array_index (contacts_group, (depth == 2)?indices[1]:0); + dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0); - for(file_iter = file_list; file_iter != NULL; + for (file_iter = file_list; file_iter != NULL; file_iter = g_list_next(file_iter)) { - error= NULL; - file = g_file_new_for_uri ((gchar *)file_iter->data); file_path = g_file_get_path (file); g_object_unref (file); - if(file_path == NULL) { - g_warning("[Pidgin] %d Unable to convert URI `%s' to absolute file path", - error->code, (gchar *)file_iter->data); - g_error_free(error); + if (file_path == NULL) { + g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path", + (gchar *)file_iter->data); continue; } - if(!send_file(dat->account, dat->name, file_path)) + if (!send_file(dat->account, dat->name, file_path)) g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name); + + g_free (file_path); } return TRUE; } |