f-spot r3774 - in trunk/extensions: . FlickrExport
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r3774 - in trunk/extensions: . FlickrExport
- Date: Fri, 21 Mar 2008 10:20:18 +0000 (GMT)
Author: sdelcroix
Date: Fri Mar 21 10:20:18 2008
New Revision: 3774
URL: http://svn.gnome.org/viewvc/f-spot?rev=3774&view=rev
Log:
2008-03-21 Stephane Delcroix <sdelcroix novell com>
* FlickrExport/FlickrExport.cs:
* FlickrExport/FlickrExport.glade:
* FlickrExport/FlickrRemote.cs: option to export the tag hierarchy,
patch from Maxxer and Pascal de Bruijn. Thx. Fixes bgo #376282.
Show remaining upload quota. patch from Maxxer. Fixes bgo #356756.
* FlickrExport/FlickrExport.addin.xml: bumping addin version.
Modified:
trunk/extensions/ChangeLog
trunk/extensions/FlickrExport/FlickrExport.addin.xml
trunk/extensions/FlickrExport/FlickrExport.cs
trunk/extensions/FlickrExport/FlickrExport.glade
trunk/extensions/FlickrExport/FlickrRemote.cs
Modified: trunk/extensions/FlickrExport/FlickrExport.addin.xml
==============================================================================
--- trunk/extensions/FlickrExport/FlickrExport.addin.xml (original)
+++ trunk/extensions/FlickrExport/FlickrExport.addin.xml Fri Mar 21 10:20:18 2008
@@ -1,5 +1,5 @@
<Addin namespace="FSpot"
- version="1.3"
+ version="1.4"
name="Flickr Export"
description="This extension allows you to export your photos to Flickr and 23hq."
author="F-Spot team"
Modified: trunk/extensions/FlickrExport/FlickrExport.cs
==============================================================================
--- trunk/extensions/FlickrExport/FlickrExport.cs (original)
+++ trunk/extensions/FlickrExport/FlickrExport.cs Fri Mar 21 10:20:18 2008
@@ -27,11 +27,14 @@
[Glade.Widget] Gtk.CheckButton scale_check;
[Glade.Widget] Gtk.CheckButton meta_check;
[Glade.Widget] Gtk.CheckButton tag_check;
+ [Glade.Widget] Gtk.CheckButton hierarchy_check;
+ [Glade.Widget] Gtk.CheckButton ignore_top_level_check;
[Glade.Widget] Gtk.CheckButton open_check;
[Glade.Widget] Gtk.SpinButton size_spin;
[Glade.Widget] Gtk.ScrolledWindow thumb_scrolledwindow;
[Glade.Widget] Gtk.Button auth_flickr;
[Glade.Widget] Gtk.Button auth_done_flickr;
+ [Glade.Widget] Gtk.ProgressBar used_bandwidth;
[Glade.Widget] Gtk.Button do_export_flickr;
[Glade.Widget] Gtk.Label auth_label;
[Glade.Widget] Gtk.RadioButton public_radio;
@@ -53,6 +56,8 @@
public const string PUBLIC_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "public";
public const string FAMILY_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "family";
public const string FRIENDS_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "friends";
+ public const string TAG_HIERARCHY_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "tag_hierarchy";
+ public const string IGNORE_TOP_LEVEL_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "ignore_top_level";
bool open;
bool scale;
@@ -90,18 +95,21 @@
auth_flickr.Sensitive = true;
do_export_flickr.Sensitive = false;
auth_flickr.Label = Catalog.GetString ("Authorize");
+ used_bandwidth.Visible = false;
break;
case State.Connected:
auth_flickr.Sensitive = true;
do_export_flickr.Sensitive = false;
auth_label.Text = string.Format (Catalog.GetString ("Return to this window after you have finished the authorization process on {0} and click the \"Complete Authorization\" button below"), current_service.Name);
auth_flickr.Label = Catalog.GetString ("Complete Authorization");
+ used_bandwidth.Visible = false;
break;
case State.InAuth:
auth_flickr.Sensitive = false;
auth_label.Text = string.Format (Catalog.GetString ("Logging into {0}"), current_service.Name);
auth_flickr.Label = Catalog.GetString ("Checking credentials...");
do_export_flickr.Sensitive = false;
+ used_bandwidth.Visible = false;
break;
case State.Authorized:
do_export_flickr.Sensitive = true;
@@ -110,6 +118,11 @@
auth.User.Username,
current_service.Name);
auth_flickr.Label = String.Format (Catalog.GetString ("Sign in as a different user"), auth.User.Username);
+ used_bandwidth.Visible = true;
+ used_bandwidth.Fraction = fr.Connection.PeopleGetUploadStatus().PercentageUsed;
+ used_bandwidth.Text = string.Format (Catalog.GetString("Used {0} of your allowed {1} monthly quota"),
+ SizeUtil.ToHumanReadable(fr.Connection.PeopleGetUploadStatus().BandwidthUsed),
+ SizeUtil.ToHumanReadable(fr.Connection.PeopleGetUploadStatus().BandwidthMax));
break;
}
state = value;
@@ -155,12 +168,17 @@
HandleSizeActive (null, null);
public_radio.Toggled += HandlePublicChanged;
+ tag_check.Toggled += HandleTagChanged;
+ hierarchy_check.Toggled += HandleHierarchyChanged;
+ HandleTagChanged (null, null);
+ HandleHierarchyChanged (null, null);
Dialog.ShowAll ();
Dialog.Response += HandleResponse;
auth_flickr.Clicked += HandleClicked;
auth_text = string.Format (auth_label.Text, current_service.Name);
auth_label.Text = auth_text;
+ used_bandwidth.Visible = false;
LoadPreference (SCALE_KEY);
LoadPreference (SIZE_KEY);
@@ -388,6 +406,16 @@
family_check.Sensitive = sensitive;
}
+ private void HandleTagChanged (object sender, EventArgs args)
+ {
+ hierarchy_check.Sensitive = tag_check.Active;
+ }
+
+ private void HandleHierarchyChanged (object sender, EventArgs args)
+ {
+ ignore_top_level_check.Sensitive = hierarchy_check.Active;
+ }
+
private void HandleResponse (object sender, Gtk.ResponseArgs args)
{
if (args.ResponseId != Gtk.ResponseType.Ok) {
@@ -414,6 +442,8 @@
}
fr.ExportTags = tag_check.Active;
+ fr.ExportTagHierarchy = hierarchy_check.Active;
+ fr.ExportIgnoreTopLevel = ignore_top_level_check.Active;
open = open_check.Active;
scale = scale_check.Active;
copy_metadata = !meta_check.Active;
@@ -439,6 +469,8 @@
Preferences.Set (PUBLIC_KEY, public_radio.Active);
Preferences.Set (FAMILY_KEY, family_check.Active);
Preferences.Set (FRIENDS_KEY, friend_check.Active);
+ Preferences.Set (TAG_HIERARCHY_KEY, hierarchy_check.Active);
+ Preferences.Set (IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active);
Preferences.Set (current_service.PreferencePath, fr.Token);
}
@@ -468,6 +500,14 @@
if (tag_check.Active != (bool) val)
tag_check.Active = (bool) val;
break;
+ case TAG_HIERARCHY_KEY:
+ if (hierarchy_check.Active != (bool) val)
+ hierarchy_check.Active = (bool) val;
+ break;
+ case IGNORE_TOP_LEVEL_KEY:
+ if (ignore_top_level_check.Active != (bool) val)
+ ignore_top_level_check.Active = (bool) val;
+ break;
case STRIP_META_KEY:
if (meta_check.Active != (bool) val)
meta_check.Active = (bool) val;
Modified: trunk/extensions/FlickrExport/FlickrExport.glade
==============================================================================
--- trunk/extensions/FlickrExport/FlickrExport.glade (original)
+++ trunk/extensions/FlickrExport/FlickrExport.glade Fri Mar 21 10:20:18 2008
@@ -69,9 +69,6 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="auth_label">
<property name="visible">True</property>
<property name="label" translatable="yes">F-Spot needs your authorization in order to upload photos to your {0} account. Press the "Authorize" button to open a web browser and give F-Spot the authorization. </property>
@@ -80,7 +77,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -127,6 +123,16 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkProgressBar" id="used_bandwidth">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="text" translatable="yes"></property>
+ </widget>
+ <packing>
<property name="position">2</property>
</packing>
</child>
@@ -365,17 +371,56 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="tag_check">
+ <widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Export tags</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <widget class="GtkCheckButton" id="tag_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Export tags</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="hierarchy_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Export tag _hierarchy</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="ignore_top_level_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Ignore _top level tags</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
Modified: trunk/extensions/FlickrExport/FlickrRemote.cs
==============================================================================
--- trunk/extensions/FlickrExport/FlickrRemote.cs (original)
+++ trunk/extensions/FlickrExport/FlickrRemote.cs Fri Mar 21 10:20:18 2008
@@ -26,6 +26,8 @@
private Flickr flickr;
public bool ExportTags;
+ public bool ExportTagHierarchy;
+ public bool ExportIgnoreTopLevel;
public FSpot.ProgressItem Progress;
public FlickrRemote (string token, Service service)
@@ -135,7 +137,6 @@
try {
string tags = null;
-
filter.Convert (request);
string path = request.Current.LocalPath;
@@ -143,12 +144,30 @@
if (ExportTags && photo.Tags != null) {
StringBuilder taglist = new StringBuilder ();
FSpot.Tag [] t = photo.Tags;
+ FSpot.Tag tag_iter = null;
for (int i = 0; i < t.Length; i++) {
if (i > 0)
taglist.Append (",");
taglist.Append (String.Format ("\"{0}\"", t[i].Name));
+
+ // Go through the tag parents
+ if (ExportTagHierarchy) {
+ tag_iter = t[i].Category;
+ while (tag_iter != Core.Database.Tags.RootCategory && tag_iter != null) {
+ // Skip top level tags because they have no meaning in a linear tag database
+ if (ExportIgnoreTopLevel && tag_iter.Category == Core.Database.Tags.RootCategory) {
+ break;
+ }
+
+ // FIXME Look if the tag is already there!
+ taglist.Append (",");
+ taglist.Append (String.Format ("\"{0}\"", tag_iter.Name));
+ tag_iter = tag_iter.Category;
+ }
+ }
+
}
tags = taglist.ToString ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]