~facundo/ubuntuone-client/support-initial-disconnection

« back to all changes in this revision

Viewing changes to nautilus/ubuntuone-nautilus.c

  • Committer: Tarmac
  • Author(s): Rodrigo Moya
  • Date: 2010-08-25 20:19:03 UTC
  • mfrom: (649.3.9 check-published-files)
  • Revision ID: tarmac-20100825201903-jv40ycy979hg62gw
Check that the user has no published files before disabling a UDF (LP: #603576)

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
                                            SyncdaemonFolderInfo *folder_info,
99
99
                                            gpointer user_data);
100
100
static void ubuntuone_nautilus_file_published (SyncdaemonDaemon *daemon,
101
 
                                               GHashTable * hash,
 
101
                                               gboolean success,
 
102
                                               SyncdaemonFileInfo *finfo,
102
103
                                               gpointer user_data);
103
104
static void ubuntuone_nautilus_got_public_files (SyncdaemonDaemon *daemon,
104
 
                                                 GPtrArray * files,
 
105
                                                 gboolean success,
 
106
                                                 GSList *files,
105
107
                                                 gpointer user_data);
106
108
static void ubuntuone_nautilus_share_created (SyncdaemonDaemon *daemon,
107
109
                                              gboolean success,
423
425
    folder_info = syncdaemon_folders_interface_get_info (SYNCDAEMON_FOLDERS_INTERFACE (interface),
424
426
                                                         data->path);
425
427
    if (folder_info != NULL) {
426
 
      if (location_widget_check_shared_for_folder (data->uon->syncdaemon, folder_info, data->parent)) {
 
428
      if (ubuntuone_nautilus_check_shares_and_public_files (data->uon, folder_info, data->parent)) {
427
429
        syncdaemon_folders_interface_delete (SYNCDAEMON_FOLDERS_INTERFACE (interface),
428
430
                                             syncdaemon_folder_info_get_volume_id (folder_info));
429
431
      }
1122
1124
}
1123
1125
 
1124
1126
static void ubuntuone_nautilus_file_published (SyncdaemonDaemon *daemon,
1125
 
                                               GHashTable *file_info,
 
1127
                                               gboolean success,
 
1128
                                               SyncdaemonFileInfo *finfo,
1126
1129
                                               gpointer user_data) {
1127
1130
  UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);
1128
 
  gchar * path, * url, * public;
 
1131
  const gchar * path, * url;
1129
1132
  gboolean is_public;
1130
1133
 
1131
 
  path = g_hash_table_lookup (file_info, "path");
1132
 
  url = g_hash_table_lookup (file_info, "public_url");
1133
 
  public = g_hash_table_lookup (file_info, "is_public");
1134
 
  is_public = (public != NULL && strlen (public) != 0);
 
1134
  if (!success)
 
1135
    return;
 
1136
 
 
1137
  path = syncdaemon_file_info_get_path (finfo);
 
1138
  url = syncdaemon_file_info_get_public_url (finfo);
 
1139
  is_public = syncdaemon_file_info_get_is_public (finfo);
1135
1140
 
1136
1141
  if (!is_public && g_hash_table_lookup (uon->public, path))
1137
1142
    g_hash_table_remove (uon->public, path);
1144
1149
}
1145
1150
 
1146
1151
static void ubuntuone_nautilus_got_public_files (SyncdaemonDaemon *daemon,
1147
 
                                                 GPtrArray *files,
 
1152
                                                 gboolean success,
 
1153
                                                 GSList *files,
1148
1154
                                                 gpointer user_data) {
1149
1155
  UbuntuOneNautilus * uon = UBUNTUONE_NAUTILUS (user_data);
1150
1156
  int i;
1151
1157
 
1152
 
  g_hash_table_remove_all (uon->public);
1153
 
  for (i = 0; i < files->len; i++)
1154
 
    g_hash_table_insert (uon->public,
1155
 
                         g_strdup (g_hash_table_lookup (files->pdata[i], "path")),
1156
 
                         g_strdup (g_hash_table_lookup (files->pdata[i], "public_url")));
 
1158
  if (success) {
 
1159
    GSList *l;
 
1160
 
 
1161
    g_hash_table_remove_all (uon->public);
 
1162
    for (l = files; l != NULL; l = l->next) {
 
1163
      SyncdaemonFileInfo *finfo;
 
1164
 
 
1165
      g_hash_table_insert (uon->public,
 
1166
                           g_strdup (syncdaemon_file_info_get_path (finfo)),
 
1167
                           g_strdup (syncdaemon_file_info_get_public_url (finfo)));
 
1168
    }
 
1169
  }
1157
1170
}
1158
1171
 
1159
1172
static void ubuntuone_nautilus_share_created (SyncdaemonDaemon *daemon,