示例#1
0
        bool pbIsReadOnly = false;                      //wether current phone book is no editable.

        public GfaxPhonebook()
        {
            myPhoneBooks = Phonetools.get_phonebooks();

            Application.Init();
            gxml = new Glade.XML(null, "send-druid.glade", "PhbookWindow", null);
            gxml.Autoconnect(this);

            ItemStore = new ListStore(typeof(string), typeof(string), typeof(string));
            ItemView  = new G_ListView(ItemTreeview, ItemStore);
            ItemView.AddColumnTitle(Catalog.GetString("Organization"), 0, COLUMN_0);
            ItemView.AddColumnTitle(Catalog.GetString("Phone Number"), 1, COLUMN_1);
            ItemView.AddColumnTitle(Catalog.GetString("Contact"), 2, COLUMN_2);
            ItemTreeview.HeadersVisible = true;
            //ItemTreeview.Selection.Mode = SelectionMode.Multiple;
            ItemTreeview.Selection.Changed +=
                new EventHandler(on_ItemTreeview_selection);

            // Populate the drop down combo box with phonebooks and populate
            // the list with the first phonebook.
            // TODO sort these alphabetically
            if (myPhoneBooks.Length > 0)
            {
                string[] list = new string[myPhoneBooks.Length];

                if (myPhoneBooks != null)
                {
                    // populate the list
                    int i = 0;
                    PhonebookComboBox.RemoveText(0);
                    foreach (Phonebook p in myPhoneBooks)
                    {
                        list[i++] = p.Name;
                        PhonebookComboBox.AppendText(p.Name);
                    }
                    PhonebookComboBox.Active = 0;
                }

                //Console.WriteLine(list[PhonebookComboBox.Active]);
                DeletePhonebookButton.Sensitive = true;
            }
            else
            {
                DeletePhonebookButton.Sensitive = false;
            }

            SaveCloseButton.Sensitive = false;
            UpdateButton.Sensitive    = false;
            ClearButton.Sensitive     = false;
            AddButton.Sensitive       = false;

            Application.Run();
        }
示例#2
0
        private void Initialize()
        {
            // Pressing enter should save and close the dialog
            //Dialog.DefaultResponse = Gtk.ResponseType.Ok;
            ok_button.HasDefault = true;

            Gdk.Geometry limits = new Gdk.Geometry();
            limits.MinWidth  = Dialog.SizeRequest().Width;
            limits.MaxWidth  = Gdk.Screen.Default.Width;
            limits.MinHeight = -1;
            limits.MaxHeight = -1;
            Dialog.SetGeometryHints(Dialog, limits, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);

            type_combo.RemoveText(0);
            int active_type = 0;
            int i           = 0;

            foreach (StationType type in StationType.Types)
            {
                if (!type.SubscribersOnly || lastfm.Account.Subscriber)
                {
                    type_combo.AppendText(type.Label);
                    if (source != null && type == source.Type)
                    {
                        active_type = i;
                    }
                    i++;
                }
            }

            type_combo.Changed += HandleTypeChanged;
            type_combo.Active   = active_type;
            ok_button.Sensitive = true;
            type_combo.GrabFocus();
        }
示例#3
0
        private void Initialize ()
        {
            DefaultResponse = Gtk.ResponseType.Ok;
            AddStockButton (Stock.Cancel, ResponseType.Cancel);
            AddStockButton (Stock.Ok, ResponseType.Ok, true);

            SetGeometryHints (this, new Gdk.Geometry () {
                    MinWidth = SizeRequest ().Width,
                    MaxWidth = Gdk.Screen.Default.Width,
                    MinHeight = -1,
                    MaxHeight = -1
                }, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);

            var table = new Table (2, 2, false) {
                RowSpacing = 12,
                ColumnSpacing = 6
            };

            table.Attach (new Label () {
                    Text = Catalog.GetString ("Station _Type:"),
                    UseUnderline = true,
                    Xalign = 0.0f
                }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach (arg_label = new Label () {
                    Xalign = 0.0f
                }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach (type_combo = ComboBox.NewText (),
                1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            table.Attach (arg_entry = new Entry (),
                1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            VBox.PackStart (table, true, true, 0);
            VBox.Spacing = 12;
            VBox.ShowAll ();

            type_combo.RemoveText (0);
            int active_type = 0;
            int i = 0;
            foreach (StationType type in StationType.Types) {
                if (!type.SubscribersOnly || lastfm.Account.Subscriber) {
                    type_combo.AppendText (type.Label);
                    if (source != null && type == source.Type) {
                        active_type = i;
                    }
                    i++;
                }
            }

            type_combo.Changed += HandleTypeChanged;
            type_combo.Active = active_type;
            type_combo.GrabFocus ();
        }
示例#4
0
        private void Initialize()
        {
            DefaultResponse = Gtk.ResponseType.Ok;
            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            AddStockButton(Stock.Ok, ResponseType.Ok, true);

            SetGeometryHints(this, new Gdk.Geometry()
            {
                MinWidth  = SizeRequest().Width,
                MaxWidth  = Gdk.Screen.Default.Width,
                MinHeight = -1,
                MaxHeight = -1
            }, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);

            var table = new Table(2, 2, false)
            {
                RowSpacing    = 12,
                ColumnSpacing = 6
            };

            table.Attach(new Label()
            {
                Text         = Catalog.GetString("Station _Type:"),
                UseUnderline = true,
                Xalign       = 0.0f
            }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach(arg_label = new Label()
            {
                Xalign = 0.0f
            }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach(type_combo = ComboBox.NewText(),
                         1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            table.Attach(arg_entry = new Entry(),
                         1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            VBox.PackStart(table, true, true, 0);
            VBox.Spacing = 12;
            VBox.ShowAll();

            type_combo.RemoveText(0);
            int active_type = 0;
            int i           = 0;

            foreach (StationType type in StationType.Types)
            {
                if (!type.SubscribersOnly || lastfm.Account.Subscriber)
                {
                    type_combo.AppendText(type.Label);
                    if (source != null && type == source.Type)
                    {
                        active_type = i;
                    }
                    i++;
                }
            }

            type_combo.Changed += HandleTypeChanged;
            type_combo.Active   = active_type;
            type_combo.GrabFocus();
        }