/// <summary> /// Make sure all references to obsolete Tag object is removed. /// </summary> /// <param name='tag'> /// Tag. /// </param> private void DeleteTag(Tag tag) { Gtk.TreeIter treeIter = tag.TreeIter; TagStore.Remove(ref treeIter); //tag.TreeIter = Gtk.TreeIter.Zero; //might not be necessary -- our only source to tag is tagDict tagDict.Remove(tag.Name); //also damn important }
void MergeTags(Tag tag_to_merge) { TagStore from_store = from_db.Tags; TagStore to_store = to_db.Tags; if (tag_to_merge != from_store.RootCategory) //Do not merge RootCategory { Tag dest_tag = to_store.GetTagByName(tag_to_merge.Name); if (dest_tag == null) { Category parent = (tag_to_merge.Category == from_store.RootCategory) ? to_store.RootCategory : to_store.GetTagByName(tag_to_merge.Category.Name) as Category; dest_tag = to_store.CreateTag(parent, tag_to_merge.Name, false); //FIXME: copy the tag icon and commit } tag_map [tag_to_merge.Id] = dest_tag; } if (!(tag_to_merge is Category)) { return; } foreach (Tag t in (tag_to_merge as Category).Children) { MergeTags(t); } }
TagInfo li_root_tag; // This is the Last Import root tag public MetadataImporter () { tag_store = App.Instance.Database.Tags; tags_created = new Stack<Tag> (); li_root_tag = new TagInfo (Catalog.GetString ("Imported Tags"), LastImportIcon); }
readonly TagInfo li_root_tag; // This is the Last Import root tag public MetadataImporter(TagStore tagStore) { tag_store = tagStore; tags_created = new Stack <Tag> (); li_root_tag = new TagInfo(Strings.ImportedTags, LastImportIcon); }
public void Init(string path, bool create_if_missing) { bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); face_store = new FaceStore(Database, new_db); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; }
public TagEntry (TagStore tag_store, bool update_on_focus_out) : base () { this.tag_store = tag_store; this.KeyPressEvent += HandleKeyPressEvent; if (update_on_focus_out) this.FocusOutEvent += HandleFocusOutEvent; }
public TagSelectionDialog(TagStore tags) : base("tag_selection_dialog.ui", "tag_selection_dialog") { tag_selection_widget = new TagSelectionWidget (tags); tag_selection_scrolled.Add (tag_selection_widget); tag_selection_widget.Show (); }
public TagEntry(TagStore tagStore, bool updateOnFocusOut = true) { _tagStore = tagStore; this.KeyPressEvent += HandleKeyPressEvent; if (updateOnFocusOut) this.FocusOutEvent += HandleFocusOutEvent; }
TagInfo li_root_tag; // This is the Last Import root tag public MetadataImporter(TagStore tagStore) { tag_store = tagStore; tags_created = new Stack <Tag> (); li_root_tag = new TagInfo(Catalog.GetString("Imported Tags"), LastImportIcon); }
TagInfo li_root_tag; // This is the Last Import root tag public MetadataImporter() { this.tag_store = App.Instance.Database.Tags; tags_created = new Stack <Tag> (); li_root_tag = new TagInfo(Catalog.GetString("Imported Tags"), LastImportIcon); }
// Constructor. public TagSelectionWidget(TagStore tag_store) : base(new TreeStore (typeof(uint), typeof(string))) { database = MainWindow.Toplevel.Database; HeadersVisible = false; complete_column = new TreeViewColumn (); pix_render = new CellRendererPixbuf (); complete_column.PackStart (pix_render, false); complete_column.SetCellDataFunc (pix_render, new TreeCellDataFunc (IconDataFunc)); //complete_column.AddAttribute (pix_render, "pixbuf", OpenIconColumn); //icon_column = AppendColumn ("icon", //, new TreeCellDataFunc (IconDataFunc)); //icon_column = AppendColumn ("icon", new CellRendererPixbuf (), new TreeCellDataFunc (IconDataFunc)); text_render = new CellRendererText (); complete_column.PackStart (text_render, true); complete_column.SetCellDataFunc (text_render, new TreeCellDataFunc (NameDataFunc)); AppendColumn (complete_column); this.tag_store = tag_store; Update (); ExpandDefaults (); tag_store.ItemsAdded += HandleTagsAdded; tag_store.ItemsRemoved += HandleTagsRemoved; tag_store.ItemsChanged += HandleTagsChanged; // TODO make the search find tags that are not currently expanded EnableSearch = true; SearchColumn = NameColumn; // Transparent white empty_pixbuf.Fill(0xffffff00); /* set up drag and drop */ DragDataGet += HandleDragDataGet; DragDrop += HandleDragDrop; DragBegin += HandleDragBegin; Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask, tag_source_target_table, DragAction.Copy | DragAction.Move); DragDataReceived += HandleDragDataReceived; DragMotion += HandleDragMotion; Gtk.Drag.DestSet (this, DestDefaults.All, tag_dest_target_table, DragAction.Copy | DragAction.Move); }
public TagMenu (MenuItem item, TagStore store) { if (item != null) { item.Submenu = this; item.Activated += HandlePopulate; } tag_store = store; }
public TagEntry(TagStore tag_store, bool update_on_focus_out) : base() { this.tag_store = tag_store; this.KeyPressEvent += HandleKeyPressEvent; if (update_on_focus_out) { this.FocusOutEvent += HandleFocusOutEvent; } }
public TagMenu(MenuItem item, TagStore store) { if (item != null) { item.Submenu = this; item.Activated += HandlePopulate; } tag_store = store; }
public TagEntry(TagStore tagStore, bool updateOnFocusOut = true) { _tagStore = tagStore; KeyPressEvent += HandleKeyPressEvent; if (updateOnFocusOut) { FocusOutEvent += HandleFocusOutEvent; } }
public Face(uint id, uint ph, uint tg, Gdk.Rectangle r) : base(id) { TagStore tag_store = FSpot.Core.Database.Tags; rect = r; photo_id = ph; tag_id = tg; tag = tag_store.GetTagById((int)tag_id); }
public XmpTagsImporter(PhotoStore photo_store, TagStore tag_store) { this.tag_store = tag_store; tags_created = new Stack<Tag> (); li_root_tag = new TagInfo (Catalog.GetString ("Imported Tags"), LastImportIcon); taginfo_table [(Entity)Location] = new TagInfo (Catalog.GetString ("Location"), PlacesIcon); taginfo_table [(Entity)Country] = new TagInfo (Catalog.GetString ("Country"), PlacesIcon); taginfo_table [(Entity)City] = new TagInfo (Catalog.GetString ("City"), PlacesIcon); taginfo_table [(Entity)State] = new TagInfo (Catalog.GetString ("State"), PlacesIcon); }
public XmpTagsImporter(PhotoStore photo_store, TagStore tag_store) { this.tag_store = tag_store; tags_created = new Stack(); li_root_tag = new TagInfo(Catalog.GetString("Import Tags"), LastImportIcon); taginfo_table [(Entity)Location] = new TagInfo(Catalog.GetString("Location"), PlacesIcon); taginfo_table [(Entity)Country] = new TagInfo(Catalog.GetString("Country"), PlacesIcon); taginfo_table [(Entity)City] = new TagInfo(Catalog.GetString("City"), PlacesIcon); taginfo_table [(Entity)State] = new TagInfo(Catalog.GetString("State"), PlacesIcon); }
private FSpot.Core.Tag [] SelectTags() { TagStore tag_store = FSpot.App.Instance.Database.Tags; TagSelectionDialog tagDialog = new TagSelectionDialog(tag_store); FSpot.Core.Tag [] tags = tagDialog.Run(); tagDialog.Hide(); return(tags); }
public LogicWidget(PhotoQuery query, TagStore tagStore) { //SetFlag (WidgetFlags.NoWindow); this.query = query; CanFocus = true; Sensitive = true; Init(); tagStore.ItemsChanged += HandleTagChanged; tagStore.ItemsRemoved += HandleTagDeleted; Show(); logic_widget = this; }
private void RemoveTagsFrom(Note note, IEnumerable <string> tags) { foreach (String tagStr in tags) { Tag tag = tagDict[tagStr]; if (tag.Count == 1) { DeleteTag(tag); } else { tag.Notes.Remove(note); TagStore.SetValue(tag.TreeIter, (int)TagCols.Count, tag.Count); } } }
public LogicWidget(PhotoQuery query, TagStore tagStore) { //SetFlag (WidgetFlags.NoWindow); this.query = query; CanFocus = true; Sensitive = true; Init (); tagStore.ItemsChanged += HandleTagChanged; tagStore.ItemsRemoved += HandleTagDeleted; Show (); logic_widget = this; }
// Constructor. public TagSelectionWidget(TagStore tag_store) : base(new TreeStore(typeof(uint), typeof(string))) { HeadersVisible = false; Selection.Mode = SelectionMode.Multiple; complete_column = new TreeViewColumn(); pix_render = new CellRendererPixbuf(); complete_column.PackStart(pix_render, false); complete_column.SetCellDataFunc(pix_render, new TreeCellDataFunc(IconDataFunc)); //complete_column.AddAttribute (pix_render, "pixbuf", OpenIconColumn); //icon_column = AppendColumn ("icon", //, new TreeCellDataFunc (IconDataFunc)); //icon_column = AppendColumn ("icon", new CellRendererPixbuf (), new TreeCellDataFunc (IconDataFunc)); text_render = new CellRendererText(); complete_column.PackStart(text_render, true); complete_column.SetCellDataFunc(text_render, new TreeCellDataFunc(NameDataFunc)); AppendColumn(complete_column); this.tag_store = tag_store; Update(); ExpandDefaults(); tag_store.ItemsAdded += HandleTagsAdded; tag_store.ItemsRemoved += HandleTagsRemoved; tag_store.ItemsChanged += HandleTagsChanged; // TODO make the search find tags that are not currently expanded EnableSearch = true; SearchColumn = NameColumn; // Transparent white empty_pixbuf.Fill(0xffffff00); }
public LogicWidget(PhotoQuery query, TagStore tag_store, TagSelectionWidget selector) : base() { //SetFlag (WidgetFlags.NoWindow); this.query = query; this.tag_selection_widget = selector; CanFocus = true; Sensitive = true; Literal.Tips = tips; tips.Enable(); Init(); tag_store.ItemsChanged += HandleTagChanged; tag_store.ItemsRemoved += HandleTagDeleted; Show(); logic_widget = this; }
public void Init(string path, bool create_if_missing) { uint timer = Log.DebugTimerStart(); bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); database.ExceptionThrown += HandleDbException; if (database.GetFileVersion(path) == 2) { SqliteUpgrade(); } // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; Log.DebugTimerPrint(timer, "Db Initialization took {0}"); }
internal TagProxy(TagStore store) { tag_store = store; }
/// <summary> /// Creates a tenant, user on the tenant and some todos with tags /// </summary> public static async Task SeedData(this IServiceProvider services, ILogger log) { /** * Get registered services. */ var context = services.GetRequiredService <IDynamoDBContext>(); var idGenerator = services.GetRequiredService <IIdGenerator>(); var userRightsStore = services.GetRequiredService <IUserRightStore>(); var configuration = services.GetRequiredService <IConfiguration>(); /** * Setup the provisioning user */ var provisioningUser = new User { Id = TrustDefaults.ProvisioningId }; /** * Hand make up these because we want to inject the user with the provisioning user */ var tenantStore = new TenantStore( provisioningUser, context, idGenerator, userRightsStore, services.GetRequiredService <ILogger <TenantStore> >()); var userStore = new UserStore( provisioningUser, context, idGenerator, userRightsStore, services.GetRequiredService <ILogger <UserStore> >()); var tagStore = new TagStore( provisioningUser, context, idGenerator, userRightsStore, services.GetRequiredService <ILogger <TagStore> >()); var todoStore = new TodoStore( provisioningUser, context, idGenerator, userRightsStore, tagStore, tenantStore, services.GetRequiredService <ILogger <TodoStore> >()); // ensure the database is up and tables are created await services.GetRequiredService <IAmazonDynamoDB>() .WaitForAllTables(log); log.Info("[Seed] create sample data"); ////////////////////////// // Authentication // ============== // // A precreated user (in third-party system) [or decoded JWT through https://jwt.io // grab it from the Authorization header in a request] var knownAuth0Id = configuration.GetSection("TestSeedUser").Value; log.DebugFormat("[Seed] found seed user '{0}'", knownAuth0Id); var rootUser = (await userStore.GetByExternalId(TrustDefaults.KnownRootIdentifier)) .ThrowConfigurationErrorsExceptionIfNull(() => "Root user has not been configured"); ////////////////////////// // Seed a user // ============= // // Assume a known Auth0 (test) user, register a user and then link to tenant // var userData = new UserCreateData { Email = "*****@*****.**", Name = "test", ExternalId = knownAuth0Id }; // create seeed data if the user doesn't exist if ((await userStore.GetByExternalId(userData.ExternalId)).IsNull()) { log.Info($"[Seed] user {userData.Email}"); var userId = await userStore.Create( rootUser.Id, TrustDefaults.KnownHomeResourceId, userData, Permission.FullControl | Permission.Owner, CallerCollectionRights.User); ////////////////////////// // Seed a tenant // ============= // var tenantCreateData = new TenantCreateData { Code = "rewire.semanticlink.io", Name = "Rewire", Description = "A sample tenant (company/organisation)" }; log.Info($"[Seed] tenant '{tenantCreateData.Code}'"); var tenantId = await tenantStore.Create( rootUser.Id, TrustDefaults.KnownHomeResourceId, tenantCreateData, Permission.FullControl | Permission.Owner, CallerCollectionRights.Tenant); ////////////////////////// // Add user to tenant // ================== // if (!await tenantStore.IsRegisteredOnTenant(tenantId, userId)) { await tenantStore.IncludeUser( tenantId, userId, Permission.Get | Permission.Owner, CallerCollectionRights.Tenant); } log.Info($"[Seed] registered user '{userData.Email}' against tenant '{tenantCreateData.Code}'"); ////////////////////////// // Seed global tags // ============= // // create some global tags // var tagIds = (await Task.WhenAll( new[] { "Work", "Personal", "Grocery List" } .Select(tag => tagStore.Create( userId, TrustDefaults.KnownHomeResourceId, new TagCreateData { Name = tag }, Permission.Get, CallerCollectionRights.Tag) ))) .Where(result => result != null) .ToList(); log.InfoFormat("[Seed] tags: [{0}]", tagIds.ToCsvString(tagId => tagId)); ///////////////////////////////////// // Seed a named todo list // ====================== // var todoCreateData = new TodoCreateData { Parent = tenantId, Name = "Shopping Todo List", Type = TodoType.List }; var todoListId = await todoStore.Create( userId, tenantId, todoCreateData, Permission.FullControl | Permission.Owner, CallerCollectionRights.Todo); log.InfoFormat("[Seed] todo list [{0}]", todoListId); ////////////////////////// // Seed some todos // =============== // var createTodoDatas = new List <TodoCreateData> { new TodoCreateData { Name = "One Todo", Parent = todoListId, Type = TodoType.Item }, new TodoCreateData { Name = "Two Todo (tag)", Tags = new List <string> { tagIds.First() }, State = TodoState.Complete, Parent = todoListId, Type = TodoType.Item }, new TodoCreateData { Name = "Three Todo (tagged)", Tags = tagIds, Parent = todoListId, Type = TodoType.Item } }; var ids = await Task.WhenAll(createTodoDatas .Select(data => todoStore.Create( userId, userId, data, Permission.FullControl | Permission.Owner, CallerCollectionRights.Todo))); log.InfoFormat("[Seed] todos: [{0}]", ids.ToCsvString(id => id)); } else { log.Debug("[Seed] test data already setup"); } }
public Create (TagStore tag_store, Gtk.Window parent_window) { this.tag_store = tag_store; this.parent_window = parent_window; }
public LogicWidget (PhotoQuery query, TagStore tag_store, TagSelectionWidget selector) : base () { //SetFlag (WidgetFlags.NoWindow); this.query = query; this.tag_selection_widget = selector; CanFocus = true; Sensitive = true; Literal.Tips = tips; tips.Enable (); Init (); tag_store.ItemsChanged += HandleTagChanged; tag_store.ItemsRemoved += HandleTagDeleted; Show (); logic_widget = this; }
public Create(TagStore tag_store, Gtk.Window parent_window) { this.tag_store = tag_store; this.parent_window = parent_window; }
internal TagProxy (TagStore store) { tag_store = store; }
public void Init(string path, bool create_if_missing) { uint timer = Log.DebugTimerStart (); bool new_db = !File.Exists (path); this.path = path; if (new_db && !create_if_missing) throw new Exception (path + ": File not found"); Database = new FSpotDatabaseConnection (path); // Load or create the meta table Meta = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (Database); Database.BeginTransaction (); Tags = new TagStore (Database, new_db); Rolls = new RollStore (Database, new_db); Exports = new ExportStore (Database, new_db); Jobs = new JobStore (Database, new_db); Photos = new PhotoStore (Database, new_db); Database.CommitTransaction (); Empty = new_db; Log.DebugTimerPrint (timer, "Db Initialization took {0}"); }
public Create(TagStore tag_store) : base("CreateTagDialog.ui", "create_tag_dialog") { this.tag_store = tag_store; }
// FIXME clicking the spinbutton too fast seems to switch the view to browse public FaceBox (Gtk.Box tb, PhotoImageView vw) : base() { m_list = new ArrayList(); face_store = Core.Database.Faces; View = vw; tag_store = FSpot.Core.Database.Tags; Gtk.Label lab = new Gtk.Label("Face det:"); lab.Show(); tb.PackStart(lab, false, true, 0); face_button = new ToolbarButton (); face_button.Add (new Gtk.Image ("f-spot-sepia", IconSize.Button)); tb.PackStart (face_button, false, true, 0); face_button.Clicked += HandleFaceButtonClicked; tag_entry = new Gtk.Entry ("test"); tag_entry.Show(); tag_entry.Sensitive = false; tb.PackStart(tag_entry, false, true, 0); m_newtag_button = new ToolbarButton (); m_newtag_button.Add (new Gtk.Image ("f-spot-new-tag", IconSize.Button)); m_newtag_button.Show(); m_newtag_button.Sensitive = false; tb.PackStart(m_newtag_button,false,true,0); m_newtag_button.Clicked += HandleNewTagButtonClicked; m_spin = new SpinButton(1,1,1); m_spin.Show(); m_spin.Sensitive = false; tb.PackStart(m_spin, false, true, 0); m_spin.Changed += HandleSpinChanged; //m.spin.ValueChanged += jesli w bazie, to pokaz jego tag //this.Add(tag_widget); }
public TagEntry(TagStore tag_store) : this(tag_store, true) { }
// Constructor. public TagSelectionWidget (TagStore tag_store) : base (new TreeStore (typeof(uint), typeof(string))) { HeadersVisible = false; Selection.Mode = SelectionMode.Multiple; complete_column = new TreeViewColumn (); pix_render = new CellRendererPixbuf (); complete_column.PackStart (pix_render, false); complete_column.SetCellDataFunc (pix_render, new TreeCellDataFunc (IconDataFunc)); //complete_column.AddAttribute (pix_render, "pixbuf", OpenIconColumn); //icon_column = AppendColumn ("icon", //, new TreeCellDataFunc (IconDataFunc)); //icon_column = AppendColumn ("icon", new CellRendererPixbuf (), new TreeCellDataFunc (IconDataFunc)); text_render = new CellRendererText (); complete_column.PackStart (text_render, true); complete_column.SetCellDataFunc (text_render, new TreeCellDataFunc (NameDataFunc)); AppendColumn (complete_column); this.tag_store = tag_store; Update (); ExpandDefaults (); tag_store.ItemsAdded += HandleTagsAdded; tag_store.ItemsRemoved += HandleTagsRemoved; tag_store.ItemsChanged += HandleTagsChanged; // TODO make the search find tags that are not currently expanded EnableSearch = true; SearchColumn = NameColumn; // Transparent white empty_pixbuf.Fill(0xffffff00); }
protected virtual void Dispose(bool disposing) { if (disposed) return; disposed = true; // free managed resources if (disposing) { if (Tags != null) { Tags.Dispose (); Tags = null; } if (Database != null) { Database.Dispose (); Database = null; } } // free unmanaged resources }
public TagEntry (TagStore tag_store) : this (tag_store, true) { }
public TagSelectionDialog(TagStore tags) : base("tag_selection_dialog.ui", "tag_selection_dialog") { tag_selection_widget = new TagSelectionWidget(tags); tag_selection_scrolled.Add(tag_selection_widget); tag_selection_widget.Show(); }
public void Init (string path, bool create_if_missing) { bool new_db = ! File.Exists (path); this.path = path; if (new_db && ! create_if_missing) throw new Exception (path + ": File not found"); database = new QueuedSqliteDatabase(path); // Load or create the meta table meta_store = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (this); Database.BeginTransaction (); face_store = new FaceStore (Database, new_db); tag_store = new TagStore (Database, new_db); roll_store = new RollStore (Database, new_db); export_store = new ExportStore (Database, new_db); job_store = new JobStore (Database, new_db); photo_store = new PhotoStore (Database, new_db); Database.CommitTransaction (); empty = new_db; }
public void Init (string path, bool create_if_missing) { uint timer = Log.DebugTimerStart (); bool new_db = ! File.Exists (path); this.path = path; if (new_db && ! create_if_missing) throw new Exception (path + ": File not found"); database = new QueuedSqliteDatabase(path); database.ExceptionThrown += HandleDbException; if (database.GetFileVersion(path) == 2) SqliteUpgrade (); // Load or create the meta table meta_store = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (this); Database.BeginTransaction (); tag_store = new TagStore (Database, new_db); roll_store = new RollStore (Database, new_db); export_store = new ExportStore (Database, new_db); job_store = new JobStore (Database, new_db); photo_store = new PhotoStore (Database, new_db); Database.CommitTransaction (); empty = new_db; Log.DebugTimerPrint (timer, "Db Initialization took {0}"); }