Merge lp:~rodrigo-moya/ubuntuone-client/fix-625525 into lp:ubuntuone-client

Proposed by Rodrigo Moya
Status: Merged
Approved by: Roman Yepishev
Approved revision: 670
Merged at revision: 668
Proposed branch: lp:~rodrigo-moya/ubuntuone-client/fix-625525
Merge into: lp:ubuntuone-client
Diff against target: 184 lines (+35/-105)
1 file modified
nautilus/utils.c (+35/-105)
To merge this branch: bzr merge lp:~rodrigo-moya/ubuntuone-client/fix-625525
Reviewer Review Type Date Requested Status
Roman Yepishev (community) fieldtest Approve
Natalia Bidart (community) Abstain
John Lenton (community) Approve
Review via email: mp+34281@code.launchpad.net

Commit message

- Fix crash when disabling UDFs
- Only show one question dialog when disabling UDFs

Description of the change

- Fix crash when disabling UDFs
- Only show one question dialog when disabling UDFs

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) :
review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Seem correct but I can't test it IRL since my syncdaemon won't authenticate due to bug #627960.

review: Abstain
Revision history for this message
Roman Yepishev (rye) wrote :

Bug: pressing Escape when confirmation dialog is shown causes the share to be deleted.
Expected: The same behavior as clicking No

review: Needs Fixing (fieldtest)
669. By Rodrigo Moya

Only return FALSE if the user presses NO or cancels the dialog

Revision history for this message
Roman Yepishev (rye) wrote :

<rye> rodrigo, so if I create a folder, the other party accepts that share, and then I remove the folder then nautilus will not warn me about that since it won't have the most up-to-date view
 hm
 in my case it had not updated
 hm
<rodrigo> if syncdaemon doesn't return the share in a signal, not
 although the share should show inmediately, isn't it for you (u1sdtool --list-shares)
 --list-shared, sorry
<rye> rodrigo, it is
 rodrigo, it is but the confirmation window does not show me that the folder is shared
<rodrigo> and what path does it show for the shared folder? in --list-shared
<rye> rodrigo, even after nautilus restart and triggering state change
<rodrigo> what value does it have in path= ?
<muffinresearch> Night all
<rye> rodrigo, id=c708a966-3f2c-443a-9cbb-799c55b4264c subscribed=True path=/home/rtg/tmp/search_files ; id=efe44633-3989-47cf-afd7-9484097616de name=folder accepted=True access_level=Modify to=https://login.ubuntu.com/+id/BKQsnfL path=/home/rtg/tmp/search_files/folder
 rodrigo, first is the UDF id, second id is the Share Id or whatever it is called
 rodrigo, let me add some debug and I will tell you why it's so
<rodrigo> rye, this means nautilus didn't get the signal from syncdaemon, it seems
<rye> rodrigo, checking...
 rodrigo, (nautilus:29216): UbuntuOne-Nautilus-WARNING **: checking /home/rtg/Documents against /home/rtg/tmp/search_files
 (nautilus:29216): UbuntuOne-Nautilus-WARNING **: checking /home/rtg/Documents against /home/rtg/tmp/search_files
 (nautilus:29216): UbuntuOne-Nautilus-WARNING **: checking /home/rtg/Documents against /home/rtg/tmp/search_files
 rodrigo, it looks like it does not advance through the list
 rodrigo, 44 SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (shared_list->data);
 rodrigo, should be l->data

review: Needs Fixing
670. By Rodrigo Moya

Use the correct list item

Revision history for this message
Roman Yepishev (rye) :
review: Approve (fieldtest)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nautilus/utils.c'
2--- nautilus/utils.c 2010-08-25 19:04:01 +0000
3+++ nautilus/utils.c 2010-09-01 17:53:38 +0000
4@@ -25,11 +25,15 @@
5
6 /* this is the wrong place for this, but it'll have to do for now */
7 gboolean
8-ubuntuone_nautilus_check_shares_and_public_files (UbuntuOneNautilus *uon, SyncdaemonFolderInfo *folder_info, GtkWidget *widget)
9+ubuntuone_nautilus_check_shares_and_public_files (UbuntuOneNautilus *uon,
10+ SyncdaemonFolderInfo *folder_info,
11+ GtkWidget *widget)
12 {
13 SyncdaemonInterface *interface;
14- GHashTable *shares = NULL;
15- gboolean result = TRUE;
16+ gboolean result = TRUE, has_shares = FALSE, has_published = FALSE;
17+ GString *question = NULL;
18+
19+ question = g_string_new (_("This folder contains shared folders and/or published files:\n\n"));
20
21 interface = syncdaemon_daemon_get_shares_interface (uon->syncdaemon);
22 if (SYNCDAEMON_IS_SHARES_INTERFACE (interface)) {
23@@ -37,100 +41,26 @@
24
25 shared_list = syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface));
26 for (l = shared_list; l != NULL; l = l->next) {
27- SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (shared_list->data);
28+ SyncdaemonShareInfo *share_info = SYNCDAEMON_SHARE_INFO (l->data);
29
30 if (g_str_has_prefix (syncdaemon_share_info_get_path (share_info),
31 syncdaemon_folder_info_get_path (folder_info))
32 && syncdaemon_share_info_get_accepted (share_info)) {
33- gchar *path;
34- const gchar *username;
35- GSList *users = NULL;
36-
37- if (shares == NULL)
38- shares = g_hash_table_new (g_str_hash, g_str_equal);
39-
40- g_hash_table_lookup_extended (shares,
41- syncdaemon_share_info_get_path (share_info),
42- (gpointer *) &path,
43- (gpointer *) &users);
44-
45- /* Add the share and the user it's shared with to the hash table */
46- if (syncdaemon_share_info_get_user_visible_name (share_info) != NULL)
47- username = syncdaemon_share_info_get_user_visible_name (share_info);
48- else
49- username = syncdaemon_share_info_get_username (share_info);
50-
51- users = g_slist_append (users, (gpointer) username);
52- g_hash_table_insert (shares,
53- (gpointer) syncdaemon_share_info_get_path (share_info),
54- (gpointer) users);
55+ has_shares = TRUE;
56+
57+ question = g_string_append (question, "\t- ");
58+ question = g_string_append (question, syncdaemon_share_info_get_path (share_info));
59+ question = g_string_append (question, _(" (Shared folder)\n"));
60 }
61 }
62
63 g_slist_free (shared_list);
64-
65- /* If there are shares, ask the user what to do */
66- if (shares != NULL) {
67- GtkWidget *dialog;
68- GHashTableIter iter;
69- GString *question;
70- gchar *path;
71- GSList *users;
72-
73- question = g_string_new (_("This folder contains folders that have been shared:\n\n"));
74-
75- g_hash_table_iter_init (&iter, shares);
76- while (g_hash_table_iter_next (&iter, (gpointer) &path, (gpointer) &users)) {
77- gint count = 0;
78-
79- question = g_string_append (question, "\t- ");
80- question = g_string_append (question, path);
81- question = g_string_append (question, " (");
82-
83- while (users != NULL) {
84- gchar *username = (gchar *) users->data;
85-
86- if (count > 0)
87- question = g_string_append (question, ", ");
88- question = g_string_append (question, username);
89-
90- users = g_slist_remove (users, username);
91- count += 1;
92- }
93-
94- question = g_string_append (question, ")\n");
95- }
96-
97- question = g_string_append (question, _("\nThis action will un-share these items. Other users"
98- " will no longer be able to access these files."
99- " Would you like to proceed?"));
100-
101- dialog = gtk_message_dialog_new (
102- GTK_WINDOW (gtk_widget_get_toplevel (widget)),
103- 0, GTK_MESSAGE_QUESTION,
104- GTK_BUTTONS_YES_NO,
105- "%s", question->str);
106- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
107- result = FALSE;
108-
109- gtk_widget_destroy (dialog);
110- g_string_free (question, TRUE);
111- g_hash_table_destroy (shares);
112-
113- if (!result)
114- return FALSE;
115- }
116-
117 }
118
119 /* Now check for published files */
120 if (uon->gotpubs) {
121 GHashTableIter iter;
122 gchar *key, *value;
123- GString *question;
124- gboolean has_published = FALSE;
125-
126- question = g_string_new (_("This folder contains files that have been published:\n\n"));
127
128 g_hash_table_iter_init (&iter, uon->public);
129 while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) {
130@@ -139,32 +69,32 @@
131
132 question = g_string_append (question, "\t- ");
133 question = g_string_append (question, key);
134- question = g_string_append (question, " (");
135+ question = g_string_append (question, _(" (Published at "));
136 question = g_string_append (question, value);
137 question = g_string_append (question, ")\n");
138 }
139 }
140-
141- question = g_string_append (question, _("\nThis action will un-publish these items. Other users"
142- " will no longer be able to access these files."
143- " Would you like to proceeed?"));
144-
145- if (has_published) {
146- GtkWidget *dialog;
147-
148- dialog = gtk_message_dialog_new (
149- GTK_WINDOW (gtk_widget_get_toplevel (widget)),
150- 0, GTK_MESSAGE_QUESTION,
151- GTK_BUTTONS_YES_NO,
152- "%s", question->str);
153- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
154- result = FALSE;
155-
156- gtk_widget_destroy (dialog);
157- }
158-
159- g_string_free (question, TRUE);
160- }
161+ }
162+
163+ if (has_shares || has_published) {
164+ GtkWidget *dialog;
165+
166+ question = g_string_append (question, _("\nThis action will make these files and folders no "
167+ "longer available to other users. Would you like to "
168+ "proceed?"));
169+ dialog = gtk_message_dialog_new (
170+ GTK_WINDOW (gtk_widget_get_toplevel (widget)),
171+ 0, GTK_MESSAGE_QUESTION,
172+ GTK_BUTTONS_YES_NO,
173+ "%s", question->str);
174+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_YES)
175+ result = FALSE;
176+
177+ gtk_widget_destroy (dialog);
178+ }
179+
180+ /* Free memory */
181+ g_string_free (question, TRUE);
182
183 return result;
184 }

Subscribers

People subscribed via source and target branches