Ejemplo n.º 1
0
		static NotebookManager ()
		{
			notebooks = new Gtk.ListStore (typeof (Notebook));

			sortedNotebooks = new Gtk.TreeModelSort (notebooks);
			sortedNotebooks.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareNotebooksSortFunc));
			sortedNotebooks.SetSortColumnId (0, Gtk.SortType.Ascending);
			
			filteredNotebooks = new Gtk.TreeModelFilter (sortedNotebooks, null);
			filteredNotebooks.VisibleFunc = FilterNotebooks;
			
			AllNotesNotebook allNotesNotebook = new AllNotesNotebook ();
			Gtk.TreeIter iter = notebooks.Append ();
			notebooks.SetValue (iter, 0, allNotesNotebook);
			
			UnfiledNotesNotebook unfiledNotesNotebook = new UnfiledNotesNotebook ();
			iter = notebooks.Append ();
			notebooks.SetValue (iter, 0, unfiledNotesNotebook);

			// <summary>
			// The key for this dictionary is Notebook.Name.ToLower ().
			// </summary>
			notebookMap = new Dictionary<string, Gtk.TreeIter> ();
			
			// Load the notebooks now if the notes have already been loaded
			// or wait for the NotesLoaded event otherwise.
			if (Tomboy.DefaultNoteManager.Initialized)
				LoadNotebooks ();
			else
				Tomboy.DefaultNoteManager.NotesLoaded += OnNotesLoaded;
		}
Ejemplo n.º 2
0
        public void UpdateTask(IceTask task)
        {
            // Set the task in the store so the model will update the UI.
            Gtk.TreeIter iter;

            if (!taskIters.ContainsKey(task.Id))
            {
                // This must be a new task that should be added in.
                iter = tasks.Append();
                taskIters [task.Id] = iter;
            }
            else
            {
                iter = taskIters [task.Id];
            }

            if (task.State == TaskState.Deleted)
            {
                taskIters.Remove(task.Id);
                if (!tasks.Remove(ref iter))
                {
                    Logger.Debug("Successfully deleted from taskStore: {0}",
                                 task.Name);
                }
                else
                {
                    Logger.Debug("Problem removing from taskStore: {0}",
                                 task.Name);
                }
            }
            else
            {
                tasks.SetValue(iter, 0, task);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new Task with the specified summary.
        /// <param name="summary">The summary of the new task.  This may be an
        /// empty string but should not be null.</param>
        /// </summary>
        public Task Create(string summary)
        {
            if (summary == null)
            {
                throw new ArgumentNullException("summary", "You cannot create the a new task with a null summary.  Use String.Empty instead.");
            }

//   if (summary.Length > 0 && Find (summary) != null)
//    throw new Exception ("A task with this summary already exists");

            string filename = MakeNewFileName();

            Task new_task = Task.CreateNewTask(summary, filename, this);

            new_task.Renamed       += OnTaskRenamed;
            new_task.Saved         += OnTaskSaved;
            new_task.StatusChanged += OnTaskStatusChanged;

            Gtk.TreeIter iter = tasks.Append();
            tasks.SetValue(iter, 0, new_task);
            task_iters [new_task.Uri] = iter;

            if (TaskAdded != null)
            {
                TaskAdded(this, new_task);
            }

            return(new_task);
        }
Ejemplo n.º 4
0
        public static Notebook GetOrCreateNotebook(string notebookName)
        {
            if (notebookName == null)
            {
                throw new ArgumentNullException("NotebookManager.GetNotebook () called with a null name.");
            }

            Notebook notebook = GetNotebook(notebookName);

            if (notebook != null)
            {
                return(notebook);
            }

            Gtk.TreeIter iter = Gtk.TreeIter.Zero;
            lock (locker) {
                notebook = GetNotebook(notebookName);
                if (notebook != null)
                {
                    return(notebook);
                }

                try {
                    AddingNotebook = true;
                    notebook       = new Notebook(notebookName);
                } finally {
                    AddingNotebook = false;
                }
                iter = notebooks.Append();
                notebooks.SetValue(iter, 0, notebook);
                notebookMap [notebook.NormalizedName] = iter;

                // Create the template note so the system tag
                // that represents the notebook actually gets
                // saved to a note (and persisted after Tomboy
                // is shut down).
                Note templateNote = notebook.GetTemplateNote();

                // Make sure the template note has the notebook tag.
                // Since it's possible for the template note to already
                // exist, we need to make sure it gets tagged.
                templateNote.AddTag(notebook.Tag);
                if (NoteAddedToNotebook != null)
                {
                    NoteAddedToNotebook(templateNote, notebook);
                }
            }

            return(notebook);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Update the model to match what is in RTM
        /// FIXME: This is a lame implementation and needs to be optimized
        /// </summary>
        private void UpdateCategories(Lists lists)
        {
            Logger.Debug("RtmBackend.UpdateCategories was called");

            try {
                foreach (List list in lists.listCollection)
                {
                    RtmCategory rtmCategory = new RtmCategory(list);

                    lock (catLock)
                    {
                        Gtk.TreeIter iter;

                        Gtk.Application.Invoke(delegate {
                            if (categories.ContainsKey(rtmCategory.ID))
                            {
                                iter = categories[rtmCategory.ID].Iter;
                                categoryListStore.SetValue(iter, 0, rtmCategory);
                            }
                            else
                            {
                                iter = categoryListStore.Append();
                                categoryListStore.SetValue(iter, 0, rtmCategory);
                                rtmCategory.Iter = iter;
                                categories.Add(rtmCategory.ID, rtmCategory);
                            }
                        });
                    }
                }
            } catch (Exception e) {
                Logger.Debug("Exception in fetch " + e.Message);
            }
            Logger.Debug("RtmBackend.UpdateCategories is done");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Set the list of completions that will be shown by the entry
        /// </summary>
        /// <param name="completions">The list of completion or null if no completions should be shown</param>
        public void SetCompletions(string[] completions)
        {
            var widgetCompletion = Widget.Completion;

            if (completions == null || completions.Length == 0)
            {
                if (widgetCompletion != null)
                {
                    widgetCompletion.Model = null;
                }
                return;
            }

            if (widgetCompletion == null)
            {
                Widget.Completion = widgetCompletion = CreateCompletion();
            }

            var model = new Gtk.ListStore(typeof(string));

            foreach (var c in completions)
            {
                model.SetValue(model.Append(), 0, c);
            }
            widgetCompletion.Model = model;
        }
Ejemplo n.º 7
0
        public void Initialize()
        {
            if (db == null)
            {
                db = new Database();
            }

            db.Open();

            //
            // Add in the "All" Category
            //
            AllCategory allCategory = new Tasque.AllCategory();

            Gtk.TreeIter iter = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, allCategory);


            RefreshCategories();
            RefreshTasks();


            initialized = true;
            if (BackendInitialized != null)
            {
                BackendInitialized();
            }
        }
Ejemplo n.º 8
0
        public void Initialize()
        {
            Gtk.TreeIter iter;
            try {
                string username, password;
                LoadCredentials(out username, out password);
                this.hm    = new Hiveminder.Hiveminder(username, password);
                configured = true;
            } catch (HiveminderAuthException e) {
                Logger.Debug(e.ToString());
                Logger.Error("Hiveminder authentication failed.");
            } catch (Exception e) {
                Logger.Debug(e.ToString());
                Logger.Error("Unable to connect to Hiveminder");
            }
            //
            // Add in the "All" Category
            //
            AllCategory allCategory = new Tasque.AllCategory();

            iter = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, allCategory);

            runningRefreshThread = true;
            if (refreshThread == null || refreshThread.ThreadState == ThreadState.Running)
            {
                Logger.Debug("RtmBackend refreshThread already running");
            }
            else
            {
                if (!refreshThread.IsAlive)
                {
                    refreshThread = new Thread(RefreshThreadLoop);
                }
                refreshThread.Start();
            }
            runRefreshEvent.Set();
        }
Ejemplo n.º 9
0
        public void Initialize()
        {
            Gtk.TreeIter iter;

            AllCategory allCategory = new Tasque.AllCategory();

            iter = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, allCategory);

            Logger.Debug("Initializing EDS Backend ");

            try {
                ListenForGroups();
            } catch (Exception e) {
                Logger.Debug("Fatal : " + e);
            }

            initialized = true;
            if (BackendInitialized != null)
            {
                BackendInitialized();
            }
        }
Ejemplo n.º 10
0
        static NotebookManager()
        {
            notebooks = new Gtk.ListStore(typeof(Notebook));

            sortedNotebooks = new Gtk.TreeModelSort(notebooks);
            sortedNotebooks.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareNotebooksSortFunc));
            sortedNotebooks.SetSortColumnId(0, Gtk.SortType.Ascending);

            filteredNotebooks             = new Gtk.TreeModelFilter(sortedNotebooks, null);
            filteredNotebooks.VisibleFunc = FilterNotebooks;

            AllNotesNotebook allNotesNotebook = new AllNotesNotebook();

            Gtk.TreeIter iter = notebooks.Append();
            notebooks.SetValue(iter, 0, allNotesNotebook);

            UnfiledNotesNotebook unfiledNotesNotebook = new UnfiledNotesNotebook();

            iter = notebooks.Append();
            notebooks.SetValue(iter, 0, unfiledNotesNotebook);

            // <summary>
            // The key for this dictionary is Notebook.Name.ToLower ().
            // </summary>
            notebookMap = new Dictionary <string, Gtk.TreeIter> ();

            // Load the notebooks now if the notes have already been loaded
            // or wait for the NotesLoaded event otherwise.
            if (Tomboy.DefaultNoteManager.Initialized)
            {
                LoadNotebooks();
            }
            else
            {
                Tomboy.DefaultNoteManager.NotesLoaded += OnNotesLoaded;
            }
        }
Ejemplo n.º 11
0
		public SourceCitationView()
		{
			this.Build();
			
			Gtk.ListStore certaintyTypes = new Gtk.ListStore(typeof(string));
			foreach (GedcomCertainty certainty in Enum.GetValues(typeof(GedcomCertainty)))
			{
				Gtk.TreeIter iter = certaintyTypes.Append();
				certaintyTypes.SetValue(iter, 0, certainty.ToString());
			}
			Gtk.CellRenderer rend = new Gtk.CellRendererText();
			CertaintyComboBox.PackStart(rend,true);
			CertaintyComboBox.AddAttribute(rend, "text", 0);
			CertaintyComboBox.Model = certaintyTypes;
			
			Notebook.Page = 0;
		}
Ejemplo n.º 12
0
        void UpdateIconStore()
        {
            // Read ~/.config/tomboy/BugzillaIcons/"

            if (!Directory.Exists(BugzillaNoteAddin.ImageDirectory))
            {
                return;
            }

            icon_store.Clear();              // clear out the old entries

            string [] icon_files = Directory.GetFiles(BugzillaNoteAddin.ImageDirectory);
            foreach (string icon_file in icon_files)
            {
                FileInfo file_info = new FileInfo(icon_file);

                Gdk.Pixbuf pixbuf = null;
                try {
                    pixbuf = new Gdk.Pixbuf(icon_file);
                } catch (Exception e) {
                    Logger.Warn("Error loading Bugzilla Icon {0}: {1}", icon_file, e.Message);
                }

                if (pixbuf == null)
                {
                    continue;
                }

                string host = ParseHost(file_info);
                if (host != null)
                {
                    Gtk.TreeIter iter = icon_store.Append();
                    icon_store.SetValue(iter, 0, pixbuf);
                    icon_store.SetValue(iter, 1, host);
                    icon_store.SetValue(iter, 2, icon_file);
                }
            }
        }
Ejemplo n.º 13
0
        public RtmBackend()
        {
            initialized = false;
            configured = false;

            taskIters = new Dictionary<string, Gtk.TreeIter> ();
            taskLock = new Object();

            categories = new Dictionary<string, RtmCategory> ();
            catLock = new Object();

            // *************************************
            // Data Model Set up
            // *************************************
            taskStore = new Gtk.TreeStore (typeof (ITask));

            sortedTasksModel = new Gtk.TreeModelSort (taskStore);
            sortedTasksModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareTasksSortFunc));
            sortedTasksModel.SetSortColumnId (0, Gtk.SortType.Ascending);

            categoryListStore = new Gtk.ListStore (typeof (ICategory));

            sortedCategoriesModel = new Gtk.TreeModelSort (categoryListStore);
            sortedCategoriesModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareCategorySortFunc));
            sortedCategoriesModel.SetSortColumnId (0, Gtk.SortType.Ascending);

            // make sure we have the all Category in our list
            Gtk.Application.Invoke ( delegate {
                AllCategory allCategory = new Tasque.AllCategory ();
                Gtk.TreeIter iter = categoryListStore.Append ();
                categoryListStore.SetValue (iter, 0, allCategory);
            });

            runRefreshEvent = new AutoResetEvent(false);

            runningRefreshThread = false;
            refreshThread  = new Thread(RefreshThreadLoop);
        }
Ejemplo n.º 14
0
        public RtmBackend()
        {
            initialized = false;
            configured  = false;

            taskIters = new Dictionary <string, Gtk.TreeIter> ();
            taskLock  = new Object();

            categories = new Dictionary <string, RtmCategory> ();
            catLock    = new Object();

            // *************************************
            // Data Model Set up
            // *************************************
            taskStore = new Gtk.TreeStore(typeof(ITask));

            sortedTasksModel = new Gtk.TreeModelSort(taskStore);
            sortedTasksModel.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareTasksSortFunc));
            sortedTasksModel.SetSortColumnId(0, Gtk.SortType.Ascending);

            categoryListStore = new Gtk.ListStore(typeof(ICategory));

            sortedCategoriesModel = new Gtk.TreeModelSort(categoryListStore);
            sortedCategoriesModel.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareCategorySortFunc));
            sortedCategoriesModel.SetSortColumnId(0, Gtk.SortType.Ascending);

            // make sure we have the all Category in our list
            Gtk.Application.Invoke(delegate {
                AllCategory allCategory = new Tasque.AllCategory();
                Gtk.TreeIter iter       = categoryListStore.Append();
                categoryListStore.SetValue(iter, 0, allCategory);
            });

            runRefreshEvent = new AutoResetEvent(false);

            runningRefreshThread = false;
            refreshThread        = new Thread(RefreshThreadLoop);
        }
Ejemplo n.º 15
0
		/// <summary>
		/// Set the list of completions that will be shown by the entry
		/// </summary>
		/// <param name="completions">The list of completion or null if no completions should be shown</param>
		public void SetCompletions (string[] completions)
		{
			var widgetCompletion = Widget.Completion;

			if (completions == null || completions.Length == 0) {
				if (widgetCompletion != null)
					widgetCompletion.Model = null;
				return;
			}

			if (widgetCompletion == null)
				Widget.Completion = widgetCompletion = CreateCompletion ();

			var model = new Gtk.ListStore (typeof(string));
			foreach (var c in completions)
				model.SetValue (model.Append (), 0, c);
			widgetCompletion.Model = model;
		}
Ejemplo n.º 16
0
        public void Initialize()
        {
            Gtk.TreeIter iter;

            //
            // Add in the "All" Category
            //
            AllCategory allCategory = new Tasque.AllCategory();

            iter = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, allCategory);

            //
            // Add in some fake categories
            //
            homeCategory = new DummyCategory("Home");
            iter         = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, homeCategory);

            workCategory = new DummyCategory("Work");
            iter         = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, workCategory);

            projectsCategory = new DummyCategory("Projects");
            iter             = categoryListStore.Append();
            categoryListStore.SetValue(iter, 0, projectsCategory);

            //
            // Add in some fake tasks
            //

            DummyTask task = new DummyTask(this, newTaskId, "Buy some nails");

            task.Category = projectsCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.Medium;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Call Roger");
            task.Category = homeCategory;
            task.DueDate  = DateTime.Now.AddDays(-1);
            task.Complete();
            task.CompletionDate = task.DueDate;
            iter = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Replace burnt out lightbulb");
            task.Category = homeCategory;
            task.DueDate  = DateTime.Now;
            task.Priority = TaskPriority.Low;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "File taxes");
            task.Category = homeCategory;
            task.DueDate  = new DateTime(2008, 4, 1);
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Purchase lumber");
            task.Category = projectsCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.High;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Estimate drywall requirements");
            task.Category = projectsCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.Low;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Borrow framing nailer from Ben");
            task.Category = projectsCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.High;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Call for an insulation estimate");
            task.Category = projectsCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.Medium;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Pay storage rental fee");
            task.Category = homeCategory;
            task.DueDate  = DateTime.Now.AddDays(1);
            task.Priority = TaskPriority.None;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Place carpet order");
            task.Category = projectsCategory;
            task.Priority = TaskPriority.None;
            iter          = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            task          = new DummyTask(this, newTaskId, "Test task overdue");
            task.Category = workCategory;
            task.DueDate  = DateTime.Now.AddDays(-89);
            task.Priority = TaskPriority.None;
            task.Complete();
            iter = taskStore.AppendNode();
            taskStore.SetValue(iter, 0, task);
            taskIters [newTaskId] = iter;
            newTaskId++;

            initialized = true;
            if (BackendInitialized != null)
            {
                BackendInitialized();
            }
        }
Ejemplo n.º 17
0
		public Gtk.Widget MakeSyncPane ()
		{
			Gtk.VBox vbox = new Gtk.VBox (false, 0);
			vbox.Spacing = 4;
			vbox.BorderWidth = 8;

			Gtk.HBox hbox = new Gtk.HBox (false, 4);

			Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:"));
			label.Xalign = 0;
			label.Show ();
			hbox.PackStart (label, false, false, 0);

			// Populate the store with all the available SyncServiceAddins
			syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin));
			syncAddinIters = new Dictionary<string,Gtk.TreeIter> ();
			SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins ();
			Array.Sort (addins, CompareSyncAddinsByName);
			foreach (SyncServiceAddin addin in addins) {
				Gtk.TreeIter iter = syncAddinStore.Append ();
				syncAddinStore.SetValue (iter, 0, addin);
				syncAddinIters [addin.Id] = iter;
			}

			syncAddinCombo = new Gtk.ComboBox (syncAddinStore);
			label.MnemonicWidget = syncAddinCombo;
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			syncAddinCombo.PackStart (crt, true);
			syncAddinCombo.SetCellDataFunc (crt,
			                                new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc));

			// Read from Preferences which service is configured and select it
			// by default.  Otherwise, just select the first one in the list.
			string addin_id = Preferences.Get (
			                          Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String;

			Gtk.TreeIter active_iter;
			if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) {
				active_iter = syncAddinIters [addin_id];
				syncAddinCombo.SetActiveIter (active_iter);
			} else {
				if (syncAddinStore.GetIterFirst (out active_iter) == true) {
					syncAddinCombo.SetActiveIter (active_iter);
				}
			}

			syncAddinCombo.Changed += OnSyncAddinComboChanged;

			syncAddinCombo.Show ();
			hbox.PackStart (syncAddinCombo, true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			// Get the preferences GUI for the Sync Addin
			if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp)
				selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin;

			if (selectedSyncAddin != null)
				syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged);
			if (syncAddinPrefsWidget == null) {
				Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable"));
				l.Yalign = 0.5f;
				l.Yalign = 0.5f;
				syncAddinPrefsWidget = l;
			}
			if (syncAddinPrefsWidget != null && addin_id != null &&
			                syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured)
				syncAddinPrefsWidget.Sensitive = false;

			syncAddinPrefsWidget.Show ();
			syncAddinPrefsContainer = new Gtk.VBox (false, 0);
			syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
			syncAddinPrefsContainer.Show ();
			vbox.PackStart (syncAddinPrefsContainer, true, true, 10);

			// Autosync preference
			int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
			if (timeout > 0 && timeout < 5) {
				timeout = 5;
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
			}
			Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
			// Translators: This is and the next string go together.
			// Together they look like "Automatically Sync in Background Every [_] Minutes",
			// where "[_]" is a GtkSpinButton.
			autosyncCheck =
				new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
			autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
			autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
			Gtk.Label autosyncExtraText =
				// Translators: See above comment for details on
				// this string.
				new Gtk.Label (Catalog.GetString ("Minutes"));
			autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
			EventHandler updateTimeoutPref = (o, e) => {
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
				                 autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
			};
			autosyncCheck.Toggled += (o, e) => {
				autosyncSpinner.Sensitive = autosyncCheck.Active;
				updateTimeoutPref (o, e);
			};
			autosyncSpinner.ValueChanged += updateTimeoutPref;

			autosyncBox.PackStart (autosyncCheck);
			autosyncBox.PackStart (autosyncSpinner);
			autosyncBox.PackStart (autosyncExtraText);
			vbox.PackStart (autosyncBox, false, true, 0);

			Gtk.HButtonBox bbox = new Gtk.HButtonBox ();
			bbox.Spacing = 4;
			bbox.LayoutStyle = Gtk.ButtonBoxStyle.End;

			// "Advanced..." button to bring up extra sync config dialog
			Gtk.Button advancedConfigButton = new Gtk.Button (Catalog.GetString ("_Advanced..."));
			advancedConfigButton.Clicked += OnAdvancedSyncConfigButton;
			advancedConfigButton.Show ();
			bbox.PackStart (advancedConfigButton, false, false, 0);
			bbox.SetChildSecondary (advancedConfigButton, true);

			resetSyncAddinButton = new Gtk.Button (Gtk.Stock.Clear);
			resetSyncAddinButton.Clicked += OnResetSyncAddinButton;
			resetSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         addin_id == selectedSyncAddin.Id &&
			         selectedSyncAddin.IsConfigured);
			resetSyncAddinButton.Show ();
			bbox.PackStart (resetSyncAddinButton, false, false, 0);

			// TODO: Tabbing should go directly from sync prefs widget to here
			// TODO: Consider connecting to "Enter" pressed in sync prefs widget
			saveSyncAddinButton = new Gtk.Button (Gtk.Stock.Save);
			saveSyncAddinButton.Clicked += OnSaveSyncAddinButton;
			saveSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         (addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured));
			saveSyncAddinButton.Show ();
			bbox.PackStart (saveSyncAddinButton, false, false, 0);

			syncAddinCombo.Sensitive =
			        (selectedSyncAddin == null ||
			         addin_id != selectedSyncAddin.Id ||
			         !selectedSyncAddin.IsConfigured);

			bbox.Show ();
			vbox.PackStart (bbox, false, false, 0);

			vbox.ShowAll ();
			return vbox;
		}
Ejemplo n.º 18
0
		public SourceView()
		{
			this.Build();
			
			_eventModel = new EventModel(EventModel.EventModelType.All);
			Gtk.TreeViewColumn eventNameCol = new Gtk.TreeViewColumn();
			Gtk.CellRenderer rend = new Gtk.CellRendererToggle();
			eventNameCol.Title = "Event";
			eventNameCol.PackStart(rend, false);
			eventNameCol.AddAttribute(rend, "active", (int)EventModel.Columns.Included);
			((Gtk.CellRendererToggle)rend).Activatable = true;
			((Gtk.CellRendererToggle)rend).Toggled += new Gtk.ToggledHandler(OnIncluded_Toggle);
			rend = new Gtk.CellRendererText();
			eventNameCol.PackStart(rend, true);
			eventNameCol.AddAttribute(rend, "text", (int)EventModel.Columns.Readable);

			EventTypeTreeView.AppendColumn(eventNameCol);		
			EventTypeTreeView.Model = _eventModel;

			
			Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
			GtkCellRendererButton butRend = new GtkCellRendererButton();
			butRend.StockId = "gtk-remove";
			buttonCol.PackStart(butRend,true);
			
			Gtk.TreeViewColumn noteCountCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			noteCountCol.Title = "No.";
			noteCountCol.PackStart(rend,true);
			noteCountCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventRecordedCount));
		
			EventGroupTreeView.AppendColumn(buttonCol);
			EventGroupTreeView.AppendColumn(noteCountCol);

			Gtk.TreeSelection selection = EventGroupTreeView.Selection;
			selection.Changed += new EventHandler(OnEventGroupSelection_Changed);
			
			_eventGroups = new GenericListModel<GedcomRecordedEvent>();
			EventGroupTreeView.Model = _eventGroups.Adapter;
			
			Gtk.TreeViewColumn callNumberCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			callNumberCol.Title = "Call Number";
			callNumberCol.PackStart(rend,true);
			callNumberCol.AddAttribute(rend, "text", 0);
			
			Gtk.TreeViewColumn mediaTypeCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			mediaTypeCol.Title = "Media Type";
			mediaTypeCol.PackStart(rend,true);
			mediaTypeCol.AddAttribute(rend, "text", 1);
			
			CallNumberTreeView.AppendColumn(callNumberCol);
			CallNumberTreeView.AppendColumn(mediaTypeCol);
			
			RepositoryCitationListModel repoCitationListModel = new RepositoryCitationListModel();
			CallNumberTreeView.Model = repoCitationListModel;
			
			selection = CallNumberTreeView.Selection;
			selection.Changed += new EventHandler(OnCallNumberSelection_Changed);
					
			// How to handle SourceMediaType.Other ?
			// don't include in initial and if the select one is SourceMediaType.Other
			// add an item into the dropdown for its value?
			// as other isn't really valid this seems like a reasonable idea
			Gtk.ListStore mediaTypes = new Gtk.ListStore(typeof(string));
			foreach (SourceMediaType mediaType in Enum.GetValues(typeof(SourceMediaType)))
			{
				if (mediaType != SourceMediaType.Other)
				{
					Gtk.TreeIter iter = mediaTypes.Append();
					mediaTypes.SetValue(iter, 0, mediaType.ToString());
				}
			}
			rend = new Gtk.CellRendererText();
			MediaTypeCombo.PackStart(rend,true);
			MediaTypeCombo.AddAttribute(rend, "text", 0);
			MediaTypeCombo.Model = mediaTypes;
			
			Notebook.Page = 0;
		}
Ejemplo n.º 19
0
        /// <summary>
        /// Refreshes the backend.
        /// </summary>
        public void Refresh()
        {
            // TODO: Eventually don't clear out existing entries, but match up
            // the updates
//			categories.Clear ();

            // TODO: Eventually don't clear out existing tasks, but match them
            // up with the updates
//			tasks.Clear ();

            Teamspace [] teams = null;
            try {
                teams = deskIceDaemon.GetTeamList();
            } catch {
                Logger.Warn("Exception thrown getting team list");
                return;
            }

            foreach (Teamspace team in teams)
            {
                Logger.Debug("Team Found: {0} ({1})", team.Name, team.ID);

                // Check to see if the team has tasks enabled
                TaskFolder [] taskFolders = null;
                try {
                    taskFolders = deskIceDaemon.GetTaskFolders(team.ID);
                } catch {
                    Logger.Warn("Exception thrown getting task folders");
                    return;
                }

                foreach (TaskFolder taskFolder in taskFolders)
                {
                    // Create an IceCategory for each folder
                    IceCategory  category = new IceCategory(team, taskFolder);
                    Gtk.TreeIter iter;
                    if (categoryIters.ContainsKey(category.Id))
                    {
                        iter = categoryIters [category.Id];
                    }
                    else
                    {
                        iter = categories.Append();
                        categoryIters [category.Id] = iter;
                    }

                    categories.SetValue(iter, 0, category);

                    LoadTasksFromCategory(category);
                }
            }

            // TODO: Wrap this in a try/catch
            if (BackendSyncFinished != null)
            {
                try {
                    BackendSyncFinished();
                } catch (Exception e) {
                    Logger.Warn("Error calling BackendSyncFinished handler: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 20
0
        public void Load(DProject proj, DProjectConfiguration config)
        {
            project       = proj;
            configuration = config;

            cbUseDefaultCompiler.Active       = proj.UseDefaultCompilerVendor;
            cbIsUnittestConfig.Active         = config.UnittestMode;
            cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild;

            OnUseDefaultCompilerChanged();
            Gtk.TreeIter iter;
            if (cmbCompiler.Model.GetIterFirst(out iter))
            {
                do
                {
                    if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string)
                    {
                        cmbCompiler.SetActiveIter(iter);
                        break;
                    }
                } while (cmbCompiler.Model.IterNext(ref iter));
            }

            extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments;
            extraLinkerTextView.Buffer.Text   = config.ExtraLinkerArguments;

            check_LinkThirdPartyLibs.Active = configuration.LinkinThirdPartyLibraries;

            text_BinDirectory.Text     = proj.GetRelativeChildPath(config.OutputDirectory);
            text_TargetFile.Text       = config.Output;
            text_ObjectsDirectory.Text = config.ObjectDirectory;
            text_DDocDir.Text          = config.DDocDirectory;

            if (config.CustomDebugIdentifiers == null)
            {
                text_debugConstants.Text = "";
            }
            else
            {
                text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers);
            }
            if (config.CustomVersionIdentifiers == null)
            {
                text_versionConstants.Text = "";
            }
            else
            {
                text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers);
            }
            spin_debugLevel.Value = (double)config.DebugLevel;

            // Disable debug-specific fields on non-debug configurations
            text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode;

            if (model_compileTarget.GetIterFirst(out iter))
            {
                do
                {
                    if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1))
                    {
                        combo_ProjectType.SetActiveIter(iter);
                        break;
                    }
                } while (model_compileTarget.IterNext(ref iter));
            }

            text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries);

            model_Platforms.Clear();
            var blackListed = new List <string>();

            foreach (var cfg in proj.Configurations)
            {
                if (cfg.Name == config.Name && cfg.Platform != config.Platform)
                {
                    blackListed.Add(cfg.Platform.ToLower());
                }
            }

            var platform_lower = config.Platform.ToLower();

            foreach (var platform in proj.SupportedPlatforms)
            {
                // Skip already taken platforms
                if (blackListed.Contains(platform.ToLower()))
                {
                    continue;
                }

                var it = model_Platforms.Append();
                if (platform_lower == platform.ToLower())
                {
                    combo_Platform.SetActiveIter(it);
                }
                model_Platforms.SetValue(it, 0, platform);
            }
        }