Merge lp:~rodrigo-moya/ubuntuone-client/use-a-checkbox-and-an-expander into lp:ubuntuone-client
- use-a-checkbox-and-an-expander
- Merge into trunk
Proposed by
Rodrigo Moya
Status: | Merged |
---|---|
Approved by: | Natalia Bidart |
Approved revision: | 605 |
Merged at revision: | 606 |
Proposed branch: | lp:~rodrigo-moya/ubuntuone-client/use-a-checkbox-and-an-expander |
Merge into: | lp:ubuntuone-client |
Diff against target: |
352 lines (+132/-54) 2 files modified
nautilus/location-widget.c (+125/-52) nautilus/location-widget.h (+7/-2) |
To merge this branch: | bzr merge lp:~rodrigo-moya/ubuntuone-client/use-a-checkbox-and-an-expander |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Alejandro J. Cura (community) | Approve | ||
John Lenton | Pending | ||
Review via email: mp+31028@code.launchpad.net |
Commit message
Use a expander and a checkbox in the Nautilus location bar
Description of the change
Use a expander and a checkbox in the Nautilus location bar
To post a comment you must log in.
- 602. By Rodrigo Moya
-
Store expander status in GConf
- 603. By Rodrigo Moya
-
Always show the checkbox
- 604. By Rodrigo Moya
-
Always show the checkbox
- 605. By Rodrigo Moya
-
Fixed resizing
Revision history for this message
Natalia Bidart (nataliabidart) wrote : | # |
review:
Needs Information
Revision history for this message
John Lenton (chipaca) wrote : | # |
On Wed, Jul 28, 2010 at 05:19:43PM -0000, Naty Bidart wrote:
> Review: Needs Information
> Can you please add some instruction about what to test/see? I'm a bit lost on how to be able to see this in action. What should I do in nautilus?
http://
:)
Revision history for this message
Alejandro J. Cura (alecu) wrote : | # |
Looks and works great.
review:
Approve
Revision history for this message
Natalia Bidart (nataliabidart) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'nautilus/location-widget.c' | |||
2 | --- nautilus/location-widget.c 2010-07-21 11:41:51 +0000 | |||
3 | +++ nautilus/location-widget.c 2010-07-27 11:29:41 +0000 | |||
4 | @@ -24,6 +24,9 @@ | |||
5 | 24 | #include <libsyncdaemon/syncdaemon-shares-interface.h> | 24 | #include <libsyncdaemon/syncdaemon-shares-interface.h> |
6 | 25 | #include "location-widget.h" | 25 | #include "location-widget.h" |
7 | 26 | 26 | ||
8 | 27 | #define EXPANDER_STATUS_SECTION "/apps/ubuntuone/nautilus" | ||
9 | 28 | #define EXPANDER_STATUS_KEY EXPANDER_STATUS_SECTION "/expand-location" | ||
10 | 29 | |||
11 | 27 | G_DEFINE_TYPE(LocationWidget, location_widget, GTK_TYPE_HBOX) | 30 | G_DEFINE_TYPE(LocationWidget, location_widget, GTK_TYPE_HBOX) |
12 | 28 | 31 | ||
13 | 29 | static void | 32 | static void |
14 | @@ -36,7 +39,8 @@ | |||
15 | 36 | gtk_widget_hide (location->help_label); | 39 | gtk_widget_hide (location->help_label); |
16 | 37 | } else { | 40 | } else { |
17 | 38 | labeltext = g_strdup_printf ("<b>Ubuntu One</b> - %s", _("folder not synchronized")); | 41 | labeltext = g_strdup_printf ("<b>Ubuntu One</b> - %s", _("folder not synchronized")); |
19 | 39 | gtk_widget_show (location->help_label); | 42 | if (location->expander_status == GTK_ARROW_DOWN) |
20 | 43 | gtk_widget_show (location->help_label); | ||
21 | 40 | } | 44 | } |
22 | 41 | 45 | ||
23 | 42 | gtk_label_set_markup (GTK_LABEL (location->info_label), labeltext); | 46 | gtk_label_set_markup (GTK_LABEL (location->info_label), labeltext); |
24 | @@ -69,14 +73,11 @@ | |||
25 | 69 | if (g_strcmp0 (path, location->path) == 0) { | 73 | if (g_strcmp0 (path, location->path) == 0) { |
26 | 70 | set_label_text (location, success); | 74 | set_label_text (location, success); |
27 | 71 | if (success) { | 75 | if (success) { |
31 | 72 | gtk_widget_hide (location->enable_button); | 76 | gtk_widget_hide (location->expander); |
32 | 73 | gtk_widget_show (location->disable_button); | 77 | gtk_widget_set_sensitive (location->toggle_button, TRUE); |
30 | 74 | gtk_widget_set_sensitive (location->disable_button, TRUE); | ||
33 | 75 | gtk_widget_hide (location->help_label); | 78 | gtk_widget_hide (location->help_label); |
34 | 76 | } else { | 79 | } else { |
38 | 77 | gtk_widget_show (location->enable_button); | 80 | gtk_widget_set_sensitive (location->toggle_button, TRUE); |
36 | 78 | gtk_widget_set_sensitive (location->enable_button, TRUE); | ||
37 | 79 | gtk_widget_hide (location->disable_button); | ||
39 | 80 | ubuntuone_show_error_dialog (location->uon, _("Error enabling folder"), | 81 | ubuntuone_show_error_dialog (location->uon, _("Error enabling folder"), |
40 | 81 | _("Could not enable folder %s for synchronizing to Ubuntu One"), | 82 | _("Could not enable folder %s for synchronizing to Ubuntu One"), |
41 | 82 | location->path); | 83 | location->path); |
42 | @@ -95,16 +96,14 @@ | |||
43 | 95 | path = syncdaemon_folder_info_get_path (folder_info); | 96 | path = syncdaemon_folder_info_get_path (folder_info); |
44 | 96 | if (g_strcmp0 (path, location->path) == 0) { | 97 | if (g_strcmp0 (path, location->path) == 0) { |
45 | 97 | if (success) { | 98 | if (success) { |
46 | 99 | gtk_widget_show (location->expander); | ||
47 | 98 | set_label_text (location, FALSE); | 100 | set_label_text (location, FALSE); |
52 | 99 | gtk_widget_show (location->enable_button); | 101 | gtk_widget_set_sensitive (location->toggle_button, TRUE); |
53 | 100 | gtk_widget_set_sensitive (location->enable_button, TRUE); | 102 | if (location->expander_status == GTK_ARROW_DOWN) |
54 | 101 | gtk_widget_hide (location->disable_button); | 103 | gtk_widget_show (location->help_label); |
51 | 102 | gtk_widget_show (location->help_label); | ||
55 | 103 | } else { | 104 | } else { |
56 | 104 | set_label_text (location, TRUE); | 105 | set_label_text (location, TRUE); |
60 | 105 | gtk_widget_hide (location->enable_button); | 106 | gtk_widget_set_sensitive (location->toggle_button, TRUE); |
58 | 106 | gtk_widget_show (location->disable_button); | ||
59 | 107 | gtk_widget_set_sensitive (location->disable_button, TRUE); | ||
61 | 108 | ubuntuone_show_error_dialog (location->uon, _("Error disabling folder"), | 107 | ubuntuone_show_error_dialog (location->uon, _("Error disabling folder"), |
62 | 109 | _("Could not disable folder %s for synchronizing to Ubuntu One"), | 108 | _("Could not disable folder %s for synchronizing to Ubuntu One"), |
63 | 110 | location->path); | 109 | location->path); |
64 | @@ -122,6 +121,12 @@ | |||
65 | 122 | g_signal_handlers_disconnect_by_func (location->uon->syncdaemon, folder_created_cb, location); | 121 | g_signal_handlers_disconnect_by_func (location->uon->syncdaemon, folder_created_cb, location); |
66 | 123 | g_signal_handlers_disconnect_by_func (location->uon->syncdaemon, folder_deleted_cb, location); | 122 | g_signal_handlers_disconnect_by_func (location->uon->syncdaemon, folder_deleted_cb, location); |
67 | 124 | 123 | ||
68 | 124 | if (location->conf_notify_id != 0) | ||
69 | 125 | gconf_client_notify_remove (location->conf_client, location->conf_notify_id); | ||
70 | 126 | |||
71 | 127 | if (location->conf_client != NULL) | ||
72 | 128 | g_object_unref (G_OBJECT (location->conf_client)); | ||
73 | 129 | |||
74 | 125 | if (location->path != NULL) | 130 | if (location->path != NULL) |
75 | 126 | g_free (location->path); | 131 | g_free (location->path); |
76 | 127 | 132 | ||
77 | @@ -221,7 +226,7 @@ | |||
78 | 221 | GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (location))), | 226 | GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (location))), |
79 | 222 | 0, GTK_MESSAGE_QUESTION, | 227 | 0, GTK_MESSAGE_QUESTION, |
80 | 223 | GTK_BUTTONS_YES_NO, | 228 | GTK_BUTTONS_YES_NO, |
82 | 224 | question->str); | 229 | "%s", question->str); |
83 | 225 | if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) | 230 | if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) |
84 | 226 | result = FALSE; | 231 | result = FALSE; |
85 | 227 | 232 | ||
86 | @@ -236,10 +241,9 @@ | |||
87 | 236 | } | 241 | } |
88 | 237 | 242 | ||
89 | 238 | static void | 243 | static void |
91 | 239 | disable_u1_cb (GtkButton *button, gpointer user_data) | 244 | disable_u1 (LocationWidget *location) |
92 | 240 | { | 245 | { |
93 | 241 | SyncdaemonInterface *interface; | 246 | SyncdaemonInterface *interface; |
94 | 242 | LocationWidget *location = LOCATION_WIDGET (user_data); | ||
95 | 243 | 247 | ||
96 | 244 | /* Perform the removal of this folder */ | 248 | /* Perform the removal of this folder */ |
97 | 245 | interface = syncdaemon_daemon_get_folders_interface (location->uon->syncdaemon); | 249 | interface = syncdaemon_daemon_get_folders_interface (location->uon->syncdaemon); |
98 | @@ -251,9 +255,7 @@ | |||
99 | 251 | location->path); | 255 | location->path); |
100 | 252 | if (folder_info != NULL && check_shared_for_folder (location, folder_info)) { | 256 | if (folder_info != NULL && check_shared_for_folder (location, folder_info)) { |
101 | 253 | set_label_text (location, FALSE); | 257 | set_label_text (location, FALSE); |
105 | 254 | gtk_widget_hide (location->disable_button); | 258 | gtk_widget_set_sensitive (location->toggle_button, FALSE); |
103 | 255 | gtk_widget_show (location->enable_button); | ||
104 | 256 | gtk_widget_set_sensitive (location->enable_button, FALSE); | ||
106 | 257 | 259 | ||
107 | 258 | syncdaemon_folders_interface_delete ( | 260 | syncdaemon_folders_interface_delete ( |
108 | 259 | SYNCDAEMON_FOLDERS_INTERFACE (interface), | 261 | SYNCDAEMON_FOLDERS_INTERFACE (interface), |
109 | @@ -265,10 +267,9 @@ | |||
110 | 265 | } | 267 | } |
111 | 266 | 268 | ||
112 | 267 | static void | 269 | static void |
114 | 268 | enable_u1_cb (GtkButton *button, gpointer user_data) | 270 | enable_u1 (LocationWidget *location) |
115 | 269 | { | 271 | { |
116 | 270 | SyncdaemonInterface *interface; | 272 | SyncdaemonInterface *interface; |
117 | 271 | LocationWidget *location = LOCATION_WIDGET (user_data); | ||
118 | 272 | 273 | ||
119 | 273 | /* Perform the addition of this folder */ | 274 | /* Perform the addition of this folder */ |
120 | 274 | interface = syncdaemon_daemon_get_folders_interface (location->uon->syncdaemon); | 275 | interface = syncdaemon_daemon_get_folders_interface (location->uon->syncdaemon); |
121 | @@ -281,7 +282,7 @@ | |||
122 | 281 | g_free (labeltext); | 282 | g_free (labeltext); |
123 | 282 | 283 | ||
124 | 283 | start_spinner (location); | 284 | start_spinner (location); |
126 | 284 | gtk_widget_set_sensitive (location->enable_button, FALSE); | 285 | gtk_widget_set_sensitive (location->toggle_button, FALSE); |
127 | 285 | 286 | ||
128 | 286 | syncdaemon_folders_interface_create (SYNCDAEMON_FOLDERS_INTERFACE (interface), | 287 | syncdaemon_folders_interface_create (SYNCDAEMON_FOLDERS_INTERFACE (interface), |
129 | 287 | location->path); | 288 | location->path); |
130 | @@ -289,54 +290,114 @@ | |||
131 | 289 | } | 290 | } |
132 | 290 | 291 | ||
133 | 291 | static void | 292 | static void |
134 | 293 | sync_toggled_cb (GtkToggleButton *button, gpointer user_data) | ||
135 | 294 | { | ||
136 | 295 | LocationWidget *location = LOCATION_WIDGET (user_data); | ||
137 | 296 | |||
138 | 297 | if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (location->toggle_button))) | ||
139 | 298 | enable_u1 (location); | ||
140 | 299 | else | ||
141 | 300 | disable_u1 (location); | ||
142 | 301 | } | ||
143 | 302 | |||
144 | 303 | static gboolean | ||
145 | 304 | expander_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) | ||
146 | 305 | { | ||
147 | 306 | LocationWidget *location = LOCATION_WIDGET (user_data); | ||
148 | 307 | |||
149 | 308 | if (event->button == 1) { | ||
150 | 309 | switch (location->expander_status) { | ||
151 | 310 | case GTK_ARROW_DOWN: /* expanded */ | ||
152 | 311 | gconf_client_set_bool (location->conf_client, EXPANDER_STATUS_KEY, FALSE, NULL); | ||
153 | 312 | break; | ||
154 | 313 | case GTK_ARROW_RIGHT: /* collapsed */ | ||
155 | 314 | gconf_client_set_bool (location->conf_client, EXPANDER_STATUS_KEY, TRUE, NULL); | ||
156 | 315 | break; | ||
157 | 316 | } | ||
158 | 317 | } | ||
159 | 318 | |||
160 | 319 | return FALSE; | ||
161 | 320 | } | ||
162 | 321 | |||
163 | 322 | static void | ||
164 | 323 | config_changed_cb (GConfClient *client, guint cnx_id, GConfEntry *entry, gpointer user_data) | ||
165 | 324 | { | ||
166 | 325 | LocationWidget *location = LOCATION_WIDGET (user_data); | ||
167 | 326 | |||
168 | 327 | if (g_strcmp0 (gconf_entry_get_key (entry), EXPANDER_STATUS_KEY) == 0) { | ||
169 | 328 | if (gconf_value_get_bool (gconf_entry_get_value (entry))) { | ||
170 | 329 | location->expander_status = GTK_ARROW_DOWN; | ||
171 | 330 | gtk_widget_show (location->help_label); | ||
172 | 331 | } else { | ||
173 | 332 | location->expander_status = GTK_ARROW_RIGHT; | ||
174 | 333 | gtk_widget_hide (location->help_label); | ||
175 | 334 | } | ||
176 | 335 | |||
177 | 336 | gtk_arrow_set (GTK_ARROW (location->expander), location->expander_status, GTK_SHADOW_IN); | ||
178 | 337 | } | ||
179 | 338 | } | ||
180 | 339 | |||
181 | 340 | static void | ||
182 | 292 | location_widget_init (LocationWidget *location) | 341 | location_widget_init (LocationWidget *location) |
183 | 293 | { | 342 | { |
184 | 294 | GtkWidget *table, *box; | 343 | GtkWidget *table, *box; |
185 | 295 | 344 | ||
186 | 296 | location->path = NULL; | 345 | location->path = NULL; |
188 | 297 | location->info_label = location->enable_button = NULL; | 346 | location->info_label = NULL; |
189 | 347 | |||
190 | 348 | /* Read expander status from GConf */ | ||
191 | 349 | location->conf_client = gconf_client_get_default (); | ||
192 | 350 | gconf_client_add_dir (location->conf_client, EXPANDER_STATUS_SECTION, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); | ||
193 | 351 | location->conf_notify_id = gconf_client_notify_add (location->conf_client, | ||
194 | 352 | EXPANDER_STATUS_SECTION, | ||
195 | 353 | (GConfClientNotifyFunc) config_changed_cb, | ||
196 | 354 | location, | ||
197 | 355 | NULL, | ||
198 | 356 | NULL); | ||
199 | 357 | |||
200 | 358 | if (gconf_client_get_bool (location->conf_client, EXPANDER_STATUS_KEY, NULL)) | ||
201 | 359 | location->expander_status = GTK_ARROW_DOWN; | ||
202 | 360 | else | ||
203 | 361 | location->expander_status = GTK_ARROW_RIGHT; | ||
204 | 298 | 362 | ||
205 | 299 | /* Create the widgets in the interface */ | 363 | /* Create the widgets in the interface */ |
207 | 300 | table = gtk_table_new (3, 2, FALSE); | 364 | table = gtk_table_new (2, 4, FALSE); |
208 | 301 | gtk_widget_show (table); | 365 | gtk_widget_show (table); |
209 | 302 | gtk_box_pack_start (GTK_BOX (location), table, TRUE, TRUE, 0); | 366 | gtk_box_pack_start (GTK_BOX (location), table, TRUE, TRUE, 0); |
210 | 303 | 367 | ||
211 | 368 | box = gtk_event_box_new (); | ||
212 | 369 | g_signal_connect (G_OBJECT (box), "button-press-event", | ||
213 | 370 | G_CALLBACK (expander_clicked_cb), location); | ||
214 | 371 | gtk_widget_show (box); | ||
215 | 372 | gtk_table_attach (GTK_TABLE (table), box, 0, 1, 0, 1, | ||
216 | 373 | GTK_FILL, GTK_FILL, 3, 3); | ||
217 | 374 | |||
218 | 375 | location->expander = gtk_arrow_new (location->expander_status, GTK_SHADOW_IN); | ||
219 | 376 | gtk_widget_show (location->expander); | ||
220 | 377 | gtk_container_add (GTK_CONTAINER (box), location->expander); | ||
221 | 378 | |||
222 | 304 | location->info_label = gtk_label_new ("<b>Ubuntu One</b>"); | 379 | location->info_label = gtk_label_new ("<b>Ubuntu One</b>"); |
223 | 305 | gtk_label_set_use_markup (GTK_LABEL (location->info_label), TRUE); | 380 | gtk_label_set_use_markup (GTK_LABEL (location->info_label), TRUE); |
224 | 306 | gtk_misc_set_alignment (GTK_MISC (location->info_label), 0.0, 0.5); | 381 | gtk_misc_set_alignment (GTK_MISC (location->info_label), 0.0, 0.5); |
225 | 307 | gtk_widget_show (location->info_label); | 382 | gtk_widget_show (location->info_label); |
233 | 308 | gtk_table_attach (GTK_TABLE (table), location->info_label, 0, 1, 0, 1, | 383 | gtk_table_attach (GTK_TABLE (table), location->info_label, 1, 2, 0, 1, |
234 | 309 | GTK_EXPAND | GTK_FILL, GTK_FILL, 3, 3); | 384 | GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 3, 3); |
228 | 310 | |||
229 | 311 | box = gtk_vbox_new (FALSE, 3); | ||
230 | 312 | gtk_widget_show (box); | ||
231 | 313 | gtk_table_attach (GTK_TABLE (table), box, 0, 1, 1, 2, | ||
232 | 314 | GTK_FILL | GTK_EXPAND, GTK_FILL, 3, 3); | ||
235 | 315 | 385 | ||
236 | 316 | location->help_label = gtk_label_new (_("These files are not backed up and will not be available in your other computers")); | 386 | location->help_label = gtk_label_new (_("These files are not backed up and will not be available in your other computers")); |
237 | 317 | gtk_label_set_use_markup (GTK_LABEL (location->help_label), TRUE); | 387 | gtk_label_set_use_markup (GTK_LABEL (location->help_label), TRUE); |
238 | 318 | gtk_misc_set_alignment (GTK_MISC (location->help_label), 0.0, 0.5); | 388 | gtk_misc_set_alignment (GTK_MISC (location->help_label), 0.0, 0.5); |
240 | 319 | gtk_box_pack_start (GTK_BOX (box), location->help_label, TRUE, TRUE, 0); | 389 | gtk_table_attach (GTK_TABLE (table), location->help_label, 1, 3, 1, 2, |
241 | 390 | GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 3, 3); | ||
242 | 320 | 391 | ||
243 | 321 | location->spinner = gtk_spinner_new (); | 392 | location->spinner = gtk_spinner_new (); |
245 | 322 | gtk_table_attach (GTK_TABLE (table), location->spinner, 1, 2, 0, 2, | 393 | gtk_table_attach (GTK_TABLE (table), location->spinner, 2, 3, 0, 1, |
246 | 323 | GTK_SHRINK, GTK_SHRINK, 3, 3); | 394 | GTK_SHRINK, GTK_SHRINK, 3, 3); |
247 | 324 | 395 | ||
248 | 325 | /* Buttons */ | 396 | /* Buttons */ |
252 | 326 | box = gtk_vbox_new (FALSE, 3); | 397 | location->toggle_button = gtk_check_button_new_with_label (_("Synchronize folder")); |
253 | 327 | gtk_widget_show (box); | 398 | gtk_widget_show (location->toggle_button); |
254 | 328 | gtk_table_attach (GTK_TABLE (table), box, 2, 3, 0, 2, | 399 | gtk_table_attach (GTK_TABLE (table), location->toggle_button, 3, 4, 0, 1, |
255 | 329 | GTK_FILL, GTK_FILL, 3, 3); | 400 | GTK_FILL, GTK_FILL, 3, 3); |
256 | 330 | |||
257 | 331 | location->disable_button = gtk_button_new_with_label (_("Cancel Sync")); | ||
258 | 332 | g_signal_connect (G_OBJECT (location->disable_button), "clicked", | ||
259 | 333 | G_CALLBACK (disable_u1_cb), location); | ||
260 | 334 | gtk_box_pack_start (GTK_BOX (box), location->disable_button, FALSE, FALSE, 0); | ||
261 | 335 | |||
262 | 336 | location->enable_button = gtk_button_new_with_label (_("Sync now")); | ||
263 | 337 | g_signal_connect (G_OBJECT (location->enable_button), "clicked", | ||
264 | 338 | G_CALLBACK (enable_u1_cb), location); | ||
265 | 339 | gtk_box_pack_start (GTK_BOX (box), location->enable_button, FALSE, FALSE, 0); | ||
266 | 340 | } | 401 | } |
267 | 341 | 402 | ||
268 | 342 | static gboolean | 403 | static gboolean |
269 | @@ -393,13 +454,18 @@ | |||
270 | 393 | 454 | ||
271 | 394 | if (ubuntuone_is_storagefs (uon, path, &is_root)) { | 455 | if (ubuntuone_is_storagefs (uon, path, &is_root)) { |
272 | 395 | /* Create label and disable button */ | 456 | /* Create label and disable button */ |
273 | 457 | gtk_widget_hide (location->expander); | ||
274 | 396 | set_label_text (location, TRUE); | 458 | set_label_text (location, TRUE); |
277 | 397 | if (is_root && !is_special_udf (uon, path)) | 459 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (location->toggle_button), TRUE); |
278 | 398 | gtk_widget_show (location->disable_button); | 460 | if (!is_root || is_special_udf (uon, path)) |
279 | 461 | gtk_widget_set_sensitive (location->toggle_button, FALSE); | ||
280 | 399 | } else { | 462 | } else { |
281 | 400 | /* Check if this is the 'Shared with me' folder */ | 463 | /* Check if this is the 'Shared with me' folder */ |
282 | 401 | if (is_special_udf (uon, path)) { | 464 | if (is_special_udf (uon, path)) { |
283 | 465 | gtk_widget_hide (location->expander); | ||
284 | 402 | set_label_text (location, TRUE); | 466 | set_label_text (location, TRUE); |
285 | 467 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (location->toggle_button), TRUE); | ||
286 | 468 | gtk_widget_set_sensitive (location->toggle_button, FALSE); | ||
287 | 403 | } else { | 469 | } else { |
288 | 404 | GSList *udfs, *l; | 470 | GSList *udfs, *l; |
289 | 405 | SyncdaemonInterface *interface; | 471 | SyncdaemonInterface *interface; |
290 | @@ -416,10 +482,10 @@ | |||
291 | 416 | } | 482 | } |
292 | 417 | 483 | ||
293 | 418 | g_slist_free (udfs); | 484 | g_slist_free (udfs); |
295 | 419 | 485 | ||
296 | 486 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (location->toggle_button), FALSE); | ||
297 | 420 | if (allow_enabling) { | 487 | if (allow_enabling) { |
298 | 421 | set_label_text (location, FALSE); | 488 | set_label_text (location, FALSE); |
299 | 422 | gtk_widget_show (location->enable_button); | ||
300 | 423 | } else { | 489 | } else { |
301 | 424 | gchar *labeltext; | 490 | gchar *labeltext; |
302 | 425 | 491 | ||
303 | @@ -431,11 +497,18 @@ | |||
304 | 431 | gtk_label_set_text (GTK_LABEL (location->help_label), | 497 | gtk_label_set_text (GTK_LABEL (location->help_label), |
305 | 432 | _("This folder cannot be synchronized because it contains " | 498 | _("This folder cannot be synchronized because it contains " |
306 | 433 | "one or more folders that already synchronized")); | 499 | "one or more folders that already synchronized")); |
308 | 434 | gtk_widget_show (location->help_label); | 500 | if (location->expander_status == GTK_ARROW_DOWN) |
309 | 501 | gtk_widget_show (location->help_label); | ||
310 | 502 | |||
311 | 503 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (location->toggle_button), FALSE); | ||
312 | 504 | gtk_widget_set_sensitive (location->toggle_button, FALSE); | ||
313 | 435 | } | 505 | } |
314 | 436 | } | 506 | } |
315 | 437 | } | 507 | } |
316 | 438 | 508 | ||
317 | 509 | g_signal_connect (G_OBJECT (location->toggle_button), "toggled", | ||
318 | 510 | G_CALLBACK (sync_toggled_cb), location); | ||
319 | 511 | |||
320 | 439 | gtk_widget_show (GTK_WIDGET (location)); | 512 | gtk_widget_show (GTK_WIDGET (location)); |
321 | 440 | 513 | ||
322 | 441 | return GTK_WIDGET (location); | 514 | return GTK_WIDGET (location); |
323 | 442 | 515 | ||
324 | === modified file 'nautilus/location-widget.h' | |||
325 | --- nautilus/location-widget.h 2010-07-13 20:46:57 +0000 | |||
326 | +++ nautilus/location-widget.h 2010-07-27 11:29:41 +0000 | |||
327 | @@ -23,6 +23,7 @@ | |||
328 | 23 | #define __LOCATION_WIDGET_H__ | 23 | #define __LOCATION_WIDGET_H__ |
329 | 24 | 24 | ||
330 | 25 | #include <gtk/gtk.h> | 25 | #include <gtk/gtk.h> |
331 | 26 | #include <gconf/gconf-client.h> | ||
332 | 26 | #include "ubuntuone-nautilus.h" | 27 | #include "ubuntuone-nautilus.h" |
333 | 27 | 28 | ||
334 | 28 | #define TYPE_LOCATION_WIDGET (location_widget_get_type ()) | 29 | #define TYPE_LOCATION_WIDGET (location_widget_get_type ()) |
335 | @@ -38,11 +39,15 @@ | |||
336 | 38 | /* Private data */ | 39 | /* Private data */ |
337 | 39 | UbuntuOneNautilus *uon; | 40 | UbuntuOneNautilus *uon; |
338 | 40 | gchar *path; | 41 | gchar *path; |
339 | 42 | GtkWidget *expander; | ||
340 | 43 | GtkArrowType expander_status; | ||
341 | 41 | GtkWidget *info_label; | 44 | GtkWidget *info_label; |
342 | 42 | GtkWidget *help_label; | 45 | GtkWidget *help_label; |
343 | 43 | GtkWidget *spinner; | 46 | GtkWidget *spinner; |
346 | 44 | GtkWidget *enable_button; | 47 | GtkWidget *toggle_button; |
347 | 45 | GtkWidget *disable_button; | 48 | |
348 | 49 | GConfClient *conf_client; | ||
349 | 50 | guint conf_notify_id; | ||
350 | 46 | } LocationWidget; | 51 | } LocationWidget; |
351 | 47 | 52 | ||
352 | 48 | typedef struct { | 53 | typedef struct { |
Can you please add some instruction about what to test/see? I'm a bit lost on how to be able to see this in action. What should I do in nautilus?