示例#1
0
 void ReloadQueries(bool threadsOnly)
 {
     foreach (var gridQuery in this.gridQueries)
     {
         if (gridQuery.ModelType == YamsterModelType.Thread)
         {
             var copyQuery = gridQuery.Query.Clone();
             if (!chkShowReadThreads.Active)
             {
                 // Add a filter clause to hide threads that were already read
                 copyQuery.FilterNode = new YqlOperationNode(YqlOperation.And,
                                                             new YqlOperationNode(YqlOperation.Not,
                                                                                  new YqlThreadPropertyNode(YqlThreadProperty.Read)
                                                                                  ),
                                                             copyQuery.FilterNode
                                                             );
             }
             gridQuery.View.LoadQuery(copyQuery);
         }
         else if (!threadsOnly)
         {
             gridQuery.View.LoadQuery(gridQuery.Query);
         }
     }
     validateViewsLagger.RequestAction();
     showFocusedGridQueryLagger.RequestAction();
 }
示例#2
0
        public void LoadThread(YamsterThread thread, YamsterMessage messageToHighlight = null)
        {
            if (messageToHighlight != null && messageToHighlight.Thread != thread)
            {
                throw new ArgumentException("messageToHighlight must belong to the specified thread");
            }

            this.threadToLoad       = thread;
            this.messagesToLoad     = threadToLoad.Messages;
            this.messageToHighlight = messageToHighlight;

            rebuildViewLagger.RequestAction();
            UpdateUI();
        }
示例#3
0
        void UpdateViewAction()
        {
            bool fireEvent = focusedItemChangedLagger.ActionQueued;

            try
            {
                Debug.Assert(!suppressFocusedItemChangedEvent);
                suppressFocusedItemChangedEvent = true;

                object oldFocusedItem = this.FocusedItem;
                ctlTreeView.Selection.UnselectAll();

                int startTime = Environment.TickCount;
                ApplyFilterAndSort();
                int totalMs = unchecked (Environment.TickCount - startTime);
                if (totalMs > 50)
                {
                    Debug.WriteLine("Grid: ApplyFilterAndSort() took " + totalMs + " ms");
                }

                int index = viewItems.IndexOf(oldFocusedItem);
                if (index >= 0)
                {
                    var treePath = this.GetTreePathFromItemIndex(index);
                    ctlTreeView.Selection.SelectPath(treePath);
                }
                else
                {
                    fireEvent = true;
                }
                ctlTreeView.QueueDraw();
            }
            finally
            {
                suppressFocusedItemChangedEvent = false;
            }
            if (fireEvent)
            {
                focusedItemChangedLagger.RequestAction();
            }

            if (ViewUpdated != null)
            {
                ViewUpdated(this, EventArgs.Empty);
            }
        }
示例#4
0
 void YamsterCache_GroupChanged(object sender, YamsterGroupChangedEventArgs e)
 {
     switch (e.ChangeType)
     {
     case YamsterModelChangeType.Added:
     case YamsterModelChangeType.PropertyChanged:     // might be the ShowInYamster property
         reloadGroupsLagger.RequestAction();
         break;
     }
 }
示例#5
0
        public AddGroupWindow() :
            base(Gtk.WindowType.Toplevel)
        {
            this.appContext = AppContext.Default;
            this.Build();

            ctlGrid.ItemType = typeof(JsonSearchedGroup);
            SetupColumns();

            searchLagger = new ActionLagger(SearchAction, 100);
            searchLagger.RequestAction(ActionLaggerQueueing.ForceDelayed);

            UpdateUI();
        }
示例#6
0
        public GroupConfigScreen()
        {
            this.Build();

            this.appContext = AppContext.Default;
            yamsterCache    = appContext.YamsterCache;

            reloadGroupsLagger = new ActionLagger(ReloadGroupsAction);
            reloadGroupsLagger.RequestAction();

            appContext.YamsterCache.GroupChanged += YamsterCache_GroupChanged;

            suspendEvents = false;
            UpdateUI();
        }
示例#7
0
        public ConversationsScreen()
        {
            appContext   = AppContext.Default;
            yamsterCache = appContext.YamsterCache;

            this.Build();

            ctlGrid.ItemType = typeof(YamsterConversation);
            SetupColumns();

            reloadConversationsLagger = new ActionLagger(ReloadConversationsAction, 1000);
            reloadConversationsLagger.RequestAction();

            ctlGrid.FilterDelegate = ctlGrid_Filter;

            this.yamsterCache.MessageChanged += yamsterCache_MessageChanged;
        }
示例#8
0
        public MessageComposer()
        {
            this.Build();

            appContext = AppContext.Default;

            txtBody.Buffer.Changed += Buffer_Changed;

            ctlWidgetBox.ModifyBg(Gtk.StateType.Normal, new Color(255, 255, 255));
            ctlCancelBox.ModifyBg(Gtk.StateType.Normal, new Color(255, 255, 255));
            this.ComposerMode = MessageComposerMode.Idle;

            // This is workaround for a GTK bug where ctlReplyToBox.Visible = false
            // has no effect during initialization.
            updateUiLagger = new ActionLagger(UpdateUI, lagIntervalMs: 100);
            updateUiLagger.RequestAction(ActionLaggerQueueing.ForceDelayed);
        }
示例#9
0
        public GroupThreadScreen()
        {
            appContext   = AppContext.Default;
            yamsterCache = appContext.YamsterCache;

            this.Build();

            ctlGroupGrid.Columns[GroupGridColumn.ShouldSync].Visible = false;
            ctlGroupGrid.Columns[GroupGridColumn.TrackRead].Visible  = false;

            reloadGroupsLagger  = new ActionLagger(ReloadGroupsAction);
            reloadThreadsLagger = new ActionLagger(ReloadThreadsAction);

            reloadGroupsLagger.RequestAction();

            yamsterCache.GroupChanged  += yamsterCache_GroupChanged;
            yamsterCache.ThreadChanged += yamsterCache_ThreadChanged;
        }
示例#10
0
        public UserChooserWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build();

            // On Mac, this prevents the parent window from losing focus
            Debug.Assert(this.TypeHint == Gdk.WindowTypeHint.Normal);

            appContext   = AppContext.Default;
            yamsterCache = appContext.YamsterCache;

            ctlGrid.ItemType = typeof(YamsterUser);

            SetupColumns();

            ctlGrid.FilterDelegate = ctlGrid_Filter;

            reloadLagger = new ActionLagger(ReloadAction, 100);
            reloadLagger.RequestAction(ActionLaggerQueueing.ForceDelayed);
        }
示例#11
0
        public MainWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            appContext   = AppContext.Default;
            yamsterCache = appContext.YamsterCache;

            MainWindow.ChatPaneWidth = appContext.Settings.ChatPaneWidth;

            Build();

            this.ctlChatPaneVBox.WidthRequest = MainWindow.ChatPaneWidth;

#if YAMSTER_MAC
            ctlMenuBar.Visible = false;
#endif
            ctlStatusBarMain.Push(0, "  Version " + Utilities.YamsterTerseVersion + "  -  https://github.com/octogonz/yamster");
            ctlStatusBarTotalYams.Push(0, "");
            SetStatusBarFormat(ctlStatusBarTotalYams, x => x.Xalign = 0.5f);
            ctlStatusBarSyncStatus.Push(0, "");
            SetStatusBarFormat(ctlStatusBarSyncStatus, x => x.Xalign = 0.5f);

            yamsterCache.MessageChanged += yamsterCache_MessageChanged;

            ctlViewsScreen.ThreadViewer         = ctlThreadViewer;
            ctlGroupThreadScreen.ThreadViewer   = ctlThreadViewer;
            ctlSearchScreen.ThreadViewer        = ctlThreadViewer;
            ctlConversationsScreen.ThreadViewer = ctlThreadViewer;

            ctlGroupConfigScreen.PerformLogin += ctlGroupConfigScreen_PerformLogin;

            updateStatusBarLagger = new ActionLagger(UpdateStatusBarAction);
            updateStatusBarLagger.RequestAction();

#if !DEBUG
            btnTest.Visible = false;
#endif
        }
示例#12
0
 public void ReloadThreads()
 {
     reloadThreadsLagger.RequestAction();
 }
示例#13
0
 public void ReloadGroups()
 {
     reloadGroupsLagger.RequestAction();
 }
示例#14
0
 protected void chkShowMultiParticipant_Clicked(object sender, EventArgs e)
 {
     reloadConversationsLagger.RequestAction();
 }
示例#15
0
 protected void btnSearch_Clicked(object sender, EventArgs e)
 {
     searchLagger.RequestAction();
 }
示例#16
0
 void syncWindow_StatusChanged(object sender, EventArgs e)
 {
     updateStatusBarLagger.RequestAction();
 }