Exemplo n.º 1
0
        void EmitRowChangedForTask(Task task)
        {
            if (task_iters.ContainsKey(task.Uri))
            {
                Gtk.TreeIter iter = task_iters [task.Uri];

                tasks.EmitRowChanged(tasks.GetPath(iter), iter);
            }
        }
Exemplo n.º 2
0
        void Init()
        {
            f_ProtocolListStore = new Gtk.ListStore(typeof(string));

            f_ListStore = new Gtk.ListStore(
                typeof(FilterModel),
                typeof(int), // filter key
                typeof(string) // tool tip
            );
            f_TreeView.Model = f_ListStore;
            int i = 1;
            Gtk.TreeViewColumn column;
            Gtk.CellRendererText textCellr;
            Gtk.CellRendererCombo comboCellr;
            Gtk.CellRendererToggle toggleCellr;

            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_ProtocolListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnProtocolEdited;
            column = f_TreeView.AppendColumn(_("Protocol"), comboCellr);
            column.SetCellDataFunc(comboCellr, RenderProtocol);

            f_ChatTypeListStore = new Gtk.ListStore(typeof(string),
                                                    typeof(ChatType?));
            f_ChatTypeListStore.AppendValues(String.Empty, null);
            f_ChatTypeListStore.AppendValues(_("Person / Private"),  ChatType.Person);
            f_ChatTypeListStore.AppendValues(_("Group / Public"),    ChatType.Group);
            f_ChatTypeListStore.AppendValues(_("Protocol / Server"), ChatType.Protocol);
            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_ChatTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnChatTypeEdited;
            column = f_TreeView.AppendColumn(_("Chat Type"), comboCellr);
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderChatType);

            textCellr = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
                    return;
                }
                FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
                int key = (int) f_ListStore.GetValue(iter, 1);
                filter.ChatID = e.NewText;
                f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
                OnChanged(EventArgs.Empty);
            };
            column = f_TreeView.AppendColumn(_("Name"), textCellr);
            column.MinWidth = 80;
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(textCellr,
                delegate(Gtk.TreeViewColumn col,
                         Gtk.CellRenderer cellr,
                         Gtk.TreeModel model, Gtk.TreeIter iter ) {
                    FilterModel filter = (FilterModel) model.GetValue(iter, 0);
                    (cellr as Gtk.CellRendererText).Text = filter.ChatID;
                }
            );

            f_MessageTypeListStore = new Gtk.ListStore(typeof(string),
                                                       typeof(MessageType?));
            f_MessageTypeListStore.AppendValues(String.Empty, null);
            f_MessageTypeListStore.AppendValues(_("Normal"), MessageType.Normal);
            f_MessageTypeListStore.AppendValues(_("Event"),  MessageType.Event);
            comboCellr = new Gtk.CellRendererCombo();
            comboCellr.Model = f_MessageTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry = false;
            comboCellr.Editable = true;
            comboCellr.Edited += OnMessageTypeEdited;
            column = f_TreeView.AppendColumn(_("Type"), comboCellr);
            column.Resizable = true;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderMessageType);
            /*
            f_TreeView.HasTooltip = true;
            f_TreeView.QueryTooltip += delegate(object sender, Gtk.QueryTooltipArgs e) {
                e.Tooltip.Text = "Message Type";
                f_TreeView.SetTooltipCell(e.Tooltip, null, column, null);
                e.RetVal = true;
            };
            */

            textCellr = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
                    return;
                }
                FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
                int key = (int) f_ListStore.GetValue(iter, 1);
                filter.MessagePattern = e.NewText;
                f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
                OnChanged(EventArgs.Empty);
            };
            column = f_TreeView.AppendColumn(_("Pattern"), textCellr);
            column.Resizable = true;
            column.MinWidth = 80;
            column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(textCellr,
                delegate(Gtk.TreeViewColumn col,
                         Gtk.CellRenderer cellr,
                         Gtk.TreeModel model, Gtk.TreeIter iter) {
                    FilterModel filter = (FilterModel) model.GetValue(iter, 0);
                    (cellr as Gtk.CellRendererText).Text = filter.MessagePattern;
                }
            );
        }
Exemplo n.º 3
0
        void Init()
        {
            f_ProtocolListStore = new Gtk.ListStore(typeof(string));

            f_ListStore = new Gtk.ListStore(
                typeof(FilterModel),
                typeof(int),   // filter key
                typeof(string) // tool tip
                );
            f_TreeView.Model = f_ListStore;
            int i = 1;

            Gtk.TreeViewColumn     column;
            Gtk.CellRendererText   textCellr;
            Gtk.CellRendererCombo  comboCellr;
            Gtk.CellRendererToggle toggleCellr;

            comboCellr            = new Gtk.CellRendererCombo();
            comboCellr.Model      = f_ProtocolListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry   = false;
            comboCellr.Editable   = true;
            comboCellr.Edited    += OnProtocolEdited;
            column = f_TreeView.AppendColumn(_("Protocol"), comboCellr);
            column.SetCellDataFunc(comboCellr, RenderProtocol);

            f_ChatTypeListStore = new Gtk.ListStore(typeof(string),
                                                    typeof(ChatType?));
            f_ChatTypeListStore.AppendValues(String.Empty, null);
            f_ChatTypeListStore.AppendValues(_("Person / Private"), ChatType.Person);
            f_ChatTypeListStore.AppendValues(_("Group / Public"), ChatType.Group);
            f_ChatTypeListStore.AppendValues(_("Protocol / Server"), ChatType.Protocol);
            comboCellr            = new Gtk.CellRendererCombo();
            comboCellr.Model      = f_ChatTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry   = false;
            comboCellr.Editable   = true;
            comboCellr.Edited    += OnChatTypeEdited;
            column           = f_TreeView.AppendColumn(_("Chat Type"), comboCellr);
            column.Resizable = true;
            column.Sizing    = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderChatType);

            textCellr          = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited  += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path))
                {
                    return;
                }
                FilterModel filter = (FilterModel)f_ListStore.GetValue(iter, 0);
                int         key    = (int)f_ListStore.GetValue(iter, 1);
                filter.ChatID = e.NewText;
                f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
                OnChanged(EventArgs.Empty);
            };
            column           = f_TreeView.AppendColumn(_("Name"), textCellr);
            column.MinWidth  = 80;
            column.Resizable = true;
            column.Sizing    = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(textCellr,
                                   delegate(Gtk.TreeViewColumn col,
                                            Gtk.CellRenderer cellr,
                                            Gtk.TreeModel model, Gtk.TreeIter iter) {
                FilterModel filter = (FilterModel)model.GetValue(iter, 0);
                (cellr as Gtk.CellRendererText).Text = filter.ChatID;
            }
                                   );

            f_MessageTypeListStore = new Gtk.ListStore(typeof(string),
                                                       typeof(MessageType?));
            f_MessageTypeListStore.AppendValues(String.Empty, null);
            f_MessageTypeListStore.AppendValues(_("Normal"), MessageType.Normal);
            f_MessageTypeListStore.AppendValues(_("Event"), MessageType.Event);
            comboCellr            = new Gtk.CellRendererCombo();
            comboCellr.Model      = f_MessageTypeListStore;
            comboCellr.TextColumn = 0;
            comboCellr.HasEntry   = false;
            comboCellr.Editable   = true;
            comboCellr.Edited    += OnMessageTypeEdited;
            column           = f_TreeView.AppendColumn(_("Type"), comboCellr);
            column.Resizable = true;
            column.Sizing    = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(comboCellr, RenderMessageType);

            /*
             * f_TreeView.HasTooltip = true;
             * f_TreeView.QueryTooltip += delegate(object sender, Gtk.QueryTooltipArgs e) {
             *  e.Tooltip.Text = "Message Type";
             *  f_TreeView.SetTooltipCell(e.Tooltip, null, column, null);
             *  e.RetVal = true;
             * };
             */

            textCellr          = new Gtk.CellRendererText();
            textCellr.Editable = true;
            textCellr.Edited  += delegate(object sender, Gtk.EditedArgs e) {
                Gtk.TreeIter iter;
                if (!f_ListStore.GetIterFromString(out iter, e.Path))
                {
                    return;
                }
                FilterModel filter = (FilterModel)f_ListStore.GetValue(iter, 0);
                int         key    = (int)f_ListStore.GetValue(iter, 1);
                filter.MessagePattern = e.NewText;
                f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
                OnChanged(EventArgs.Empty);
            };
            column           = f_TreeView.AppendColumn(_("Pattern"), textCellr);
            column.Resizable = true;
            column.MinWidth  = 80;
            column.Sizing    = Gtk.TreeViewColumnSizing.GrowOnly;
            column.SetCellDataFunc(textCellr,
                                   delegate(Gtk.TreeViewColumn col,
                                            Gtk.CellRenderer cellr,
                                            Gtk.TreeModel model, Gtk.TreeIter iter) {
                FilterModel filter = (FilterModel)model.GetValue(iter, 0);
                (cellr as Gtk.CellRendererText).Text = filter.MessagePattern;
            }
                                   );
        }