250
220
if (interface != NULL) {
251
221
SyncdaemonFolderInfo *folder_info;
253
folder_info = syncdaemon_folders_interface_get_info (
254
SYNCDAEMON_FOLDERS_INTERFACE (interface),
256
if (folder_info != NULL && check_shared_for_folder (location, folder_info)) {
257
set_label_text (location, FALSE);
258
gtk_widget_set_sensitive (location->toggle_button, FALSE);
260
syncdaemon_folders_interface_delete (
261
SYNCDAEMON_FOLDERS_INTERFACE (interface),
262
syncdaemon_folder_info_get_volume_id (folder_info));
264
g_object_unref (G_OBJECT (folder_info));
223
folder_info = syncdaemon_folders_interface_get_info (
224
SYNCDAEMON_FOLDERS_INTERFACE (interface),
226
if (folder_info != NULL) {
227
if (location_widget_check_shared_for_folder (location->uon->syncdaemon, folder_info, GTK_WIDGET (location))) {
228
gtk_widget_set_sensitive (location->toggle_button, FALSE);
230
syncdaemon_folders_interface_delete (
231
SYNCDAEMON_FOLDERS_INTERFACE (interface),
232
syncdaemon_folder_info_get_volume_id (folder_info));
235
g_object_unref (G_OBJECT (folder_info));
269
240
static void enable_u1 (LocationWidget *location);
347
308
LocationWidget *location = LOCATION_WIDGET (user_data);
349
310
if (g_strcmp0 (gconf_entry_get_key (entry), EXPANDER_STATUS_KEY) == 0) {
350
if (gconf_value_get_bool (gconf_entry_get_value (entry))) {
351
location->expander_status = GTK_ARROW_DOWN;
352
gtk_widget_show (location->help_label);
354
location->expander_status = GTK_ARROW_RIGHT;
355
gtk_widget_hide (location->help_label);
358
gtk_arrow_set (GTK_ARROW (location->expander), location->expander_status, GTK_SHADOW_IN);
311
gboolean expanded = gconf_client_get_bool (location->conf_client,
314
gtk_expander_set_expanded (GTK_EXPANDER (location->expander),
316
location->expander_status = expanded;
321
allocate_cb (GtkWidget *label, GtkAllocation *allocation, gpointer user_data)
325
if (allocation->width < 100)
326
width = 100; /* some number */
328
width = allocation->width - 2;
329
gtk_widget_set_size_request(label, width, -1);
363
333
location_widget_init (LocationWidget *location)
365
GtkWidget *table, *box;
335
GtkWidget *hbox, *align;
367
337
location->path = NULL;
368
338
location->info_label = NULL;
370
340
/* Read expander status from GConf */
371
341
location->conf_client = gconf_client_get_default ();
372
gconf_client_add_dir (location->conf_client, EXPANDER_STATUS_SECTION, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
342
gconf_client_add_dir (location->conf_client, EXPANDER_STATUS_SECTION,
343
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
373
344
location->conf_notify_id = gconf_client_notify_add (location->conf_client,
374
345
EXPANDER_STATUS_SECTION,
375
346
(GConfClientNotifyFunc) config_changed_cb,
380
if (gconf_client_get_bool (location->conf_client, EXPANDER_STATUS_KEY, NULL))
381
location->expander_status = GTK_ARROW_DOWN;
383
location->expander_status = GTK_ARROW_RIGHT;
350
location->expander_status = gconf_client_get_bool (location->conf_client,
351
EXPANDER_STATUS_KEY, NULL);
385
353
/* Create the widgets in the interface */
386
table = gtk_table_new (2, 4, FALSE);
387
gtk_widget_show (table);
388
gtk_box_pack_start (GTK_BOX (location), table, TRUE, TRUE, 0);
390
box = gtk_event_box_new ();
391
g_signal_connect (G_OBJECT (box), "button-press-event",
392
G_CALLBACK (expander_clicked_cb), location);
393
gtk_widget_show (box);
394
gtk_table_attach (GTK_TABLE (table), box, 0, 1, 0, 1,
395
GTK_FILL, GTK_FILL, 3, 3);
397
location->expander = gtk_arrow_new (location->expander_status, GTK_SHADOW_IN);
354
hbox = gtk_hbox_new (FALSE, 0);
355
gtk_widget_show (hbox);
356
gtk_box_pack_start (GTK_BOX (location), hbox, TRUE, TRUE, 0);
358
location->expander = gtk_expander_new ("<b>Ubuntu One</b>");
398
359
gtk_widget_show (location->expander);
399
gtk_container_add (GTK_CONTAINER (box), location->expander);
401
location->info_label = gtk_label_new ("<b>Ubuntu One</b>");
402
gtk_label_set_use_markup (GTK_LABEL (location->info_label), TRUE);
403
gtk_misc_set_alignment (GTK_MISC (location->info_label), 0.0, 0.5);
404
gtk_widget_show (location->info_label);
405
gtk_table_attach (GTK_TABLE (table), location->info_label, 1, 2, 0, 1,
406
GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 3, 3);
360
gtk_expander_set_use_markup (GTK_EXPANDER (location->expander), TRUE);
361
gtk_expander_set_expanded (GTK_EXPANDER (location->expander),
362
location->expander_status);
363
g_signal_connect_after (G_OBJECT (location->expander), "activate",
364
G_CALLBACK (expander_clicked_cb), location);
365
gtk_box_pack_start (GTK_BOX (hbox), location->expander, TRUE, TRUE, 0);
366
location->info_label = gtk_expander_get_label_widget (GTK_EXPANDER (location->expander));
408
368
location->help_label = gtk_label_new (_("These files are not backed up and will not be available in your other computers"));
369
gtk_widget_show (location->help_label);
409
370
gtk_label_set_use_markup (GTK_LABEL (location->help_label), TRUE);
371
gtk_label_set_line_wrap (GTK_LABEL (location->help_label), TRUE);
410
372
gtk_misc_set_alignment (GTK_MISC (location->help_label), 0.0, 0.5);
411
gtk_table_attach (GTK_TABLE (table), location->help_label, 1, 3, 1, 2,
412
GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 3, 3);
373
gtk_misc_set_padding (GTK_MISC (location->help_label), 4, 4);
374
g_signal_connect (G_OBJECT (location->help_label), "size-allocate",
375
G_CALLBACK (allocate_cb), NULL );
376
gtk_container_add (GTK_CONTAINER (location->expander),
377
location->help_label);
414
379
location->spinner = gtk_spinner_new ();
415
gtk_table_attach (GTK_TABLE (table), location->spinner, 2, 3, 0, 1,
416
GTK_SHRINK, GTK_SHRINK, 3, 3);
380
gtk_box_pack_start (GTK_BOX (hbox), location->spinner, FALSE, FALSE, 0);
419
location->toggle_button = gtk_check_button_new_with_label (_("Synchronize folder"));
383
align = gtk_alignment_new (1.0, 0.0, 0.0, 0.0);
384
gtk_widget_show (align);
385
gtk_box_pack_start (GTK_BOX (hbox), align,
388
location->toggle_button = gtk_check_button_new_with_label (_("Synchronize this folder"));
420
389
gtk_widget_show (location->toggle_button);
421
gtk_table_attach (GTK_TABLE (table), location->toggle_button, 3, 4, 0, 1,
422
GTK_FILL, GTK_FILL, 3, 3);
390
gtk_container_add (GTK_CONTAINER (align), location->toggle_button);