~dobey/ubuntuone-client/update-2-0

« back to all changes in this revision

Viewing changes to nautilus/utils.c

  • Committer: Rodrigo Moya
  • Date: 2010-10-18 11:05:29 UTC
  • mto: This revision was merged to the branch mainline in revision 742.
  • Revision ID: rodrigo.moya@canonical.com-20101018110529-mle053e12h5mc6ct
Use public files cache in libsyncdaemon

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        }
60
60
 
61
61
        /* Now check for published files */
62
 
        if (uon->gotpubs) {
63
 
                GHashTableIter iter;
64
 
                gchar *key, *value;
65
 
 
66
 
                g_hash_table_iter_init (&iter, uon->public);
67
 
                while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) {
68
 
                        if (g_str_has_prefix (key, syncdaemon_folder_info_get_path (folder_info))) {
 
62
        interface = syncdaemon_daemon_get_publicfiles_interface (uon->syncdaemon);
 
63
        if (SYNCDAEMON_IS_PUBLICFILES_INTERFACE (interface)) {
 
64
                GSList *public_files, *l;
 
65
                public_files = syncdaemon_publicfiles_interface_get_public_files (SYNCDAEMON_PUBLICFILES_INTERFACE (interface));
 
66
 
 
67
                for (l = public_files; l != NULL; l = l->next) {
 
68
                        const gchar *path;
 
69
 
 
70
                        path = syncdaemon_file_info_get_path (SYNCDAEMON_FILE_INFO (l->data));
 
71
                        if (g_str_has_prefix (path, syncdaemon_folder_info_get_path (folder_info))) {
69
72
                                has_published = TRUE;
70
73
 
71
74
                                question = g_string_append (question, "\t- ");
72
 
                                question = g_string_append (question, key);
 
75
                                question = g_string_append (question, path);
73
76
                                question = g_string_append (question, _(" (Published at "));
74
 
                                question = g_string_append (question, value);
 
77
                                question = g_string_append (question, syncdaemon_file_info_get_public_url (SYNCDAEMON_FILE_INFO (l->data)));
75
78
                                question = g_string_append (question, ")\n");
76
79
                        }
77
80
                }
 
81
 
 
82
                g_slist_free (public_files);
78
83
        }
79
84
 
80
85
        if (has_shares || has_published) {
101
106
}
102
107
 
103
108
gboolean
 
109
ubuntuone_is_folder_shared (UbuntuOneNautilus *uon, const gchar *path)
 
110
{
 
111
        GSList *shares, *l;
 
112
        SyncdaemonInterface *interface;
 
113
        gboolean is_shared = FALSE;
 
114
 
 
115
        interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon);
 
116
        if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) {
 
117
                shares = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface));
 
118
                for (l = shares; l != NULL; l = l->next) {
 
119
                        SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (l->data);
 
120
 
 
121
                        if (g_strcmp0 (syncdaemon_share_info_get_path (share_info), path) == 0) {
 
122
                                is_shared = TRUE;
 
123
                                break;
 
124
                        }
 
125
                }
 
126
 
 
127
                g_slist_free (shares);
 
128
        }
 
129
 
 
130
        return is_shared;
 
131
}
 
132
 
 
133
gboolean
104
134
ubuntuone_is_location_bar_enabled (void)
105
135
{
106
136
        GConfClient *conf_client;