Merge lp:~chipaca/ubuntuone-client/nautilus-ppage into lp:ubuntuone-client

Proposed by John Lenton
Status: Rejected
Rejected by: John Lenton
Proposed branch: lp:~chipaca/ubuntuone-client/nautilus-ppage
Merge into: lp:ubuntuone-client
Diff against target: 167 lines (+138/-0)
1 file modified
nautilus/ubuntuone-nautilus.c (+138/-0)
To merge this branch: bzr merge lp:~chipaca/ubuntuone-client/nautilus-ppage
Reviewer Review Type Date Requested Status
Rodrigo Moya (community) Needs Fixing
Review via email: mp+32295@code.launchpad.net

Description of the change

these are not the property pages you are looking for.

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

yay! But a few things:

ubuntuone-nautilus.c is too crowded, so could you move the property page creation/code to its own file, like location-widget.c does?

If the data is not editable, why not just use a label? See the 'Audio' property page for MP3's, it has sections (in bold) and then the different data in labels, with nice italic strings for the "field" names. Something like that would look much better.

Also, the 'Ubuntu One' page shows for every folder/file, whether it's a UDF/inside a UDF or not.

review: Needs Fixing

Unmerged revisions

627. By John Lenton

second half of the ppage work

626. By John Lenton

whee, a page provider

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nautilus/ubuntuone-nautilus.c'
--- nautilus/ubuntuone-nautilus.c 2010-08-06 23:31:50 +0000
+++ nautilus/ubuntuone-nautilus.c 2010-08-11 07:07:44 +0000
@@ -31,6 +31,7 @@
31#include <libnautilus-extension/nautilus-info-provider.h>31#include <libnautilus-extension/nautilus-info-provider.h>
32#include <libnautilus-extension/nautilus-menu-provider.h>32#include <libnautilus-extension/nautilus-menu-provider.h>
33#include <libnautilus-extension/nautilus-location-widget-provider.h>33#include <libnautilus-extension/nautilus-location-widget-provider.h>
34#include <libnautilus-extension/nautilus-property-page-provider.h>
34#include <libsyncdaemon/libsyncdaemon.h>35#include <libsyncdaemon/libsyncdaemon.h>
35#include "ubuntuone-nautilus.h"36#include "ubuntuone-nautilus.h"
36#include "location-widget.h"37#include "location-widget.h"
@@ -585,6 +586,132 @@
585 iface->get_background_items = ubuntuone_nautilus_get_bg_menu_items;586 iface->get_background_items = ubuntuone_nautilus_get_bg_menu_items;
586}587}
587588
589static void ubuntuone_nautilus_put_label_and_value (GtkWidget *box, const char *label, const char *value) {
590 GtkWidget *widget;
591
592 widget = gtk_label_new (g_markup_printf_escaped ("<b>%s:</b>", label));
593 gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
594 gtk_misc_set_alignment (GTK_MISC (widget), 0., 0.5);
595 gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 2);
596
597 widget = gtk_entry_new ();
598 gtk_entry_set_text (GTK_ENTRY (widget), value);
599 gtk_entry_set_editable (GTK_ENTRY (widget), FALSE);
600 gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.5);
601 gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
602}
603
604typedef struct _PPdata {
605 UbuntuOneNautilus *uon;
606 GtkWidget *props;
607 GtkWidget *spinner;
608 gchar *path;
609} _PPdata;
610
611static void ubuntuone_nautilus_got_metainfo_for_ppage (SyncdaemonFilesystemInterface *interface,
612 gboolean success,
613 SyncdaemonMetadata *metadata,
614 gpointer user_data) {
615 _PPdata *data = (_PPdata *) user_data;
616 gchar *public_url;
617
618 /* kill the spinner */
619 gtk_spinner_stop (GTK_SPINNER (data->spinner));
620 gtk_widget_destroy (data->spinner);
621
622 if (success) {
623 if (data->uon && data->uon->public) {
624 public_url = g_hash_table_lookup (data->uon->public, data->path);
625 if (!public_url)
626 public_url = _("(not published)");
627 } else {
628 public_url = _("(information not yet available)");
629 }
630
631 gtk_box_pack_start (GTK_BOX (data->props), gtk_label_new (_("Ubuntu One data->props")), FALSE, FALSE, 4);
632 gtk_box_pack_start (GTK_BOX (data->props), gtk_hseparator_new (), FALSE, FALSE, 0);
633
634 ubuntuone_nautilus_put_label_and_value (data->props, _("Public URL"), public_url);
635 ubuntuone_nautilus_put_label_and_value (data->props, _("Currently synchronized"), syncdaemon_metadata_get_is_synced (metadata) ? _("Yes") : _("No"));
636
637 gtk_box_pack_start (GTK_BOX (data->props), gtk_hseparator_new (), FALSE, FALSE, 0);
638
639 ubuntuone_nautilus_put_label_and_value (data->props, _("Local hash"), syncdaemon_metadata_get_local_hash (metadata));
640 ubuntuone_nautilus_put_label_and_value (data->props, _("Server hash"), syncdaemon_metadata_get_server_hash (metadata));
641 ubuntuone_nautilus_put_label_and_value (data->props, _("Share ID"), syncdaemon_metadata_get_share_id (metadata));
642 ubuntuone_nautilus_put_label_and_value (data->props, _("Node ID"), syncdaemon_metadata_get_node_id (metadata));
643 } else {
644 gtk_box_pack_start (GTK_BOX (data->props), gtk_label_new (_("No information available")), TRUE, FALSE, 0);
645 }
646
647 g_free (data->path);
648 g_free (data);
649 gtk_widget_show_all (data->props);
650}
651
652static GList * ubuntuone_nautilus_get_ppages (NautilusPropertyPageProvider *provider, GList *files) {
653 GList *pages;
654 NautilusPropertyPage *page;
655 NautilusFileInfo *file;
656 SyncdaemonFilesystemInterface *interface;
657 UbuntuOneNautilus * uon;
658 gchar *uri, *filename;
659 _PPdata *data;
660
661 if (!files)
662 return NULL;
663
664 /* for now, only support single files */
665 if (files->next)
666 return NULL;
667
668 file = NAUTILUS_FILE_INFO (files->data);
669
670 uon = UBUNTUONE_NAUTILUS(provider);
671 interface = (SyncdaemonFilesystemInterface *) syncdaemon_daemon_get_filesystem_interface (uon->syncdaemon);
672 if (!interface)
673 return NULL;
674
675 uri = nautilus_file_info_get_uri (file);
676 if (!uri) {
677 g_warning ("no URI in file?");
678 return NULL;
679 }
680 filename = g_filename_from_uri (uri, NULL, NULL);
681 if (!filename) {
682 g_warning ("no filename from URI?");
683 return NULL;
684 }
685 g_free (uri);
686
687 /* OK, it looks like we're doing this thing */
688 data = g_new0 (struct _PPdata, 1);
689 data->path = filename;
690 data->props = gtk_vbox_new (FALSE, 8);
691 data->spinner = gtk_spinner_new ();
692 data->uon = uon;
693 gtk_spinner_start (GTK_SPINNER (data->spinner));
694 gtk_box_pack_start (GTK_BOX (data->props), data->spinner, TRUE, FALSE, 0);
695 gtk_widget_show_all (data->props);
696
697 page = nautilus_property_page_new ("ubuntuone-ppage",
698 gtk_label_new("Ubuntu One"),
699 data->props);
700
701 syncdaemon_filesystem_interface_get_metadata_async (interface,
702 filename,
703 nautilus_file_info_is_directory (file),
704 (SyncdaemonGotMetadataFunc) ubuntuone_nautilus_got_metainfo_for_ppage,
705 data);
706
707 return g_list_append (NULL, page);
708}
709
710static void
711ubuntuone_nautilus_ppage_provider_iface_init (NautilusPropertyPageProviderIface *iface) {
712 iface->get_pages = ubuntuone_nautilus_get_ppages;
713}
714
588/* GType and nautilus module stuff */715/* GType and nautilus module stuff */
589static GType un_type = 0;716static GType un_type = 0;
590717
@@ -722,6 +849,12 @@
722 NULL849 NULL
723 };850 };
724851
852 static const GInterfaceInfo ppage_provider_iface_info = {
853 (GInterfaceInitFunc) ubuntuone_nautilus_ppage_provider_iface_init,
854 NULL,
855 NULL
856 };
857
725 un_type = g_type_module_register_type (module, 858 un_type = g_type_module_register_type (module,
726 G_TYPE_OBJECT,859 G_TYPE_OBJECT,
727 "UbuntuOneNautilus",860 "UbuntuOneNautilus",
@@ -742,6 +875,11 @@
742 un_type,875 un_type,
743 NAUTILUS_TYPE_MENU_PROVIDER,876 NAUTILUS_TYPE_MENU_PROVIDER,
744 &menu_provider_iface_info);877 &menu_provider_iface_info);
878
879 g_type_module_add_interface (module,
880 un_type,
881 NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
882 &ppage_provider_iface_info);
745}883}
746884
747885

Subscribers

People subscribed via source and target branches