예제 #1
0
        private void ShowLogCoreEntry(LogEntry entry)
        {
            Gtk.Window      window = null;
            Gtk.MessageType mtype;

            if (ServiceManager.Contains <GtkElementsService> ())
            {
                window = ServiceManager.Get <GtkElementsService> ().PrimaryWindow;
            }

            switch (entry.Type)
            {
            case LogEntryType.Warning:
                mtype = Gtk.MessageType.Warning;
                break;

            case LogEntryType.Information:
                mtype = Gtk.MessageType.Info;
                break;

            case LogEntryType.Error:
            default:
                mtype = Gtk.MessageType.Error;
                break;
            }

            Banshee.Widgets.HigMessageDialog dialog = new Banshee.Widgets.HigMessageDialog(
                window, Gtk.DialogFlags.Modal, mtype, Gtk.ButtonsType.Close, entry.Message, entry.Details);

            dialog.Title = String.Empty;
            dialog.Run();
            dialog.Destroy();
        }
예제 #2
0
        private void OnCancelClicked(object o, EventArgs args)
        {
            if (cancel_dialog != null)
            {
                return;
            }

            Window parent = null;

            if (ServiceManager.Contains <GtkElementsService> ())
            {
                parent = ServiceManager.Get <GtkElementsService> ().PrimaryWindow;
            }

            cancel_dialog = new Banshee.Widgets.HigMessageDialog(parent,
                                                                 DialogFlags.Modal, MessageType.Question, ButtonsType.None,
                                                                 job.Title == null
                    ? Catalog.GetString("Stop Operation")
                    : String.Format(Catalog.GetString("Stop {0}"), job.Title),
                                                                 job.CancelMessage == null
                    ? (job.Title == null
                        ? Catalog.GetString("This operation is still performing work. Would you like to stop it?")
                        : String.Format(Catalog.GetString(
                                            "The '{0}' operation is still performing work. Would you like to stop it?"), job.Title))
                    : job.CancelMessage);

            cancel_dialog.AddButton(job.Title == null
                ? Catalog.GetString("Continue")
                : String.Format(Catalog.GetString("Continue {0}"), job.Title),
                                    ResponseType.No, true);
            cancel_dialog.AddButton(Stock.Stop, ResponseType.Yes, false);
            cancel_dialog.DefaultResponse = ResponseType.Cancel;

            if (cancel_dialog.Run() == (int)ResponseType.Yes)
            {
                if (job.CanCancel)
                {
                    ServiceManager.JobScheduler.Cancel(job);
                }
            }

            cancel_dialog.Destroy();
            cancel_dialog = null;
        }
예제 #3
0
        private static bool ConfirmUnmap(IUnmapableSource source)
        {
            string key        = "no_confirm_unmap_" + source.GetType().Name.ToLower();
            bool   do_not_ask = ConfigurationClient.Get <bool> ("sources", key, false);

            if (do_not_ask)
            {
                return(true);
            }

            Banshee.Widgets.HigMessageDialog dialog = new Banshee.Widgets.HigMessageDialog(
                ServiceManager.Get <GtkElementsService> ("GtkElementsService").PrimaryWindow,
                Gtk.DialogFlags.Modal,
                Gtk.MessageType.Question,
                Gtk.ButtonsType.Cancel,
                String.Format(Catalog.GetString("Are you sure you want to delete this {0}?"),
                              source.GenericName.ToLower()),
                source.Name);

            dialog.AddButton(Gtk.Stock.Delete, Gtk.ResponseType.Ok, false);

            Gtk.Alignment alignment = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 0.0f);
            alignment.TopPadding = 10;
            Gtk.CheckButton confirm_button = new Gtk.CheckButton(String.Format(Catalog.GetString(
                                                                                   "Do not ask me this again"), source.GenericName.ToLower()));
            confirm_button.Toggled += delegate {
                do_not_ask = confirm_button.Active;
            };
            alignment.Add(confirm_button);
            alignment.ShowAll();
            dialog.LabelVBox.PackStart(alignment, false, false, 0);

            try {
                if (dialog.Run() == (int)Gtk.ResponseType.Ok)
                {
                    ConfigurationClient.Set <bool> ("sources", key, do_not_ask);
                    return(true);
                }

                return(false);
            } finally {
                dialog.Destroy();
            }
        }