Example #1
0
        public PageNavigationEntry(TrackEditorDialog dialog, string completionTable, string completionColumn)
        {
            this.dialog          = dialog;
            entry                = new TextEntry(completionTable, completionColumn);
            entry.Changed       += OnChanged;
            entry.Activated     += EditNextTitle;
            entry.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                if ((args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) &&
                    (args.Event.State & Gdk.ModifierType.ControlMask) != 0 && dialog.CanGoBackward)
                {
                    dialog.NavigateBackward();
                    entry.GrabFocus();
                }
            };
            entry.Show();

            Spacing = 1;
            PackStart(entry, true, true, 0);

            if (dialog.TrackCount > 1)
            {
                dialog.Navigated += delegate {
                    forward_button.Sensitive = dialog.CanGoForward;
                };
                forward_button = EditorUtilities.CreateSmallStockButton(Stock.GoForward);
                object tooltip_host = Hyena.Gui.TooltipSetter.CreateHost();
                Hyena.Gui.TooltipSetter.Set(tooltip_host, forward_button, Catalog.GetString("Advance to the next track and edit its title"));
                forward_button.Sensitive = dialog.CanGoForward;
                forward_button.Show();
                forward_button.Clicked += EditNextTitle;
                PackStart(forward_button, false, false, 0);
            }
        }
Example #2
0
        private static bool UpdateCancelMessage(TrackEditorDialog trackEditor, HigMessageDialog messageDialog)
        {
            if (messageDialog == null)
            {
                return(false);
            }

            messageDialog.MessageLabel.Text = String.Format(Catalog.GetString(
                                                                "If you don't save, changes from the last {0} will be permanently lost."),
                                                            Banshee.Sources.DurationStatusFormatters.ApproximateVerboseFormatter(
                                                                DateTime.Now - trackEditor.dialog_launch_datetime
                                                                )
                                                            );

            return(messageDialog.IsMapped);
        }
Example #3
0
 public void Initialize(TrackEditorDialog dialog)
 {
 }
Example #4
0
 public PageNavigationEntry(TrackEditorDialog dialog) : this(dialog, null, null)
 {
 }
Example #5
0
        private static void Run(TrackEditorDialog track_editor)
        {
            track_editor.Response += delegate(object o, ResponseArgs args) {
                if (args.ResponseId == ResponseType.Ok)
                {
                    track_editor.Save();
                }
                else
                {
                    int changed_count = 0;
                    for (int i = 0; i < track_editor.TrackCount; i++)
                    {
                        EditorTrackInfo track = track_editor.LoadTrack(i, false);
                        if (track != null)
                        {
                            track.GenerateDiff();
                            if (track.DiffCount > 0)
                            {
                                changed_count++;
                            }
                        }
                    }

                    if (changed_count == 0)
                    {
                        track_editor.Destroy();
                        return;
                    }

                    HigMessageDialog message_dialog = new HigMessageDialog(
                        track_editor, DialogFlags.Modal, MessageType.Warning, ButtonsType.None,

                        String.Format(Catalog.GetPluralString(
                                          "Save the changes made to the open track?",
                                          "Save the changes made to {0} of {1} open tracks?",
                                          track_editor.TrackCount), changed_count, track_editor.TrackCount),

                        String.Empty
                        );

                    UpdateCancelMessage(track_editor, message_dialog);
                    uint timeout = 0;
                    timeout = GLib.Timeout.Add(1000, delegate {
                        bool result = UpdateCancelMessage(track_editor, message_dialog);
                        if (!result)
                        {
                            timeout = 0;
                        }
                        return(result);
                    });

                    message_dialog.AddButton(Catalog.GetString("Close _without Saving"), ResponseType.Close, false);
                    message_dialog.AddButton(Stock.Cancel, ResponseType.Cancel, false);
                    message_dialog.AddButton(Stock.Save, ResponseType.Ok, true);

                    try {
                        switch ((ResponseType)message_dialog.Run())
                        {
                        case ResponseType.Ok:
                            track_editor.Save();
                            break;

                        case ResponseType.Close:
                            break;

                        case ResponseType.Cancel:
                        case ResponseType.DeleteEvent:
                            return;
                        }
                    } finally {
                        if (timeout > 0)
                        {
                            GLib.Source.Remove(timeout);
                        }
                        message_dialog.Destroy();
                    }
                }

                track_editor.Destroy();
            };

            //track_editor.Run ();
            track_editor.Show();
        }
 public void Initialize(TrackEditorDialog dialog)
 {
     this.dialog = dialog;
     AddFields();
 }
Example #7
0
 public void Initialize(TrackEditorDialog dialog)
 {
     this.dialog = dialog;
 }