Esempio n. 1
0
        void RemoveClicked(object sender, EventArgs args)
        {
            // Remove the icon file and call UpdateIconStore ().
            Gtk.TreeIter iter;
            if (!icon_tree.Selection.GetSelected(out iter))
            {
                return;
            }

            string icon_path = icon_store.GetValue(iter, 2) as string;

            HIGMessageDialog dialog =
                new HIGMessageDialog(
                    null,
                    Gtk.DialogFlags.DestroyWithParent,
                    Gtk.MessageType.Question,
                    Gtk.ButtonsType.None,
                    Catalog.GetString("Really remove this icon?"),
                    Catalog.GetString("If you remove an icon it is " +
                                      "permanently lost."));

            Gtk.Button button;

            button            = new Gtk.Button(Gtk.Stock.Cancel);
            button.CanDefault = true;
            button.Show();
            dialog.AddActionWidget(button, Gtk.ResponseType.Cancel);
            dialog.DefaultResponse = Gtk.ResponseType.Cancel;

            button            = new Gtk.Button(Gtk.Stock.Delete);
            button.CanDefault = true;
            button.Show();
            dialog.AddActionWidget(button, 666);

            int result = dialog.Run();

            if (result == 666)
            {
                try {
                    File.Delete(icon_path);
                    UpdateIconStore();
                } catch (Exception e) {
                    Logger.Error("Error removing icon {0}: {1}",
                                 icon_path,
                                 e.Message);
                }
            }

            dialog.Destroy();
        }
Esempio n. 2
0
        void ShowDeletionDialog(List <Task> tasks)
        {
            HIGMessageDialog dialog =
                new HIGMessageDialog(
                    this,
                    Gtk.DialogFlags.DestroyWithParent,
                    Gtk.MessageType.Question,
                    Gtk.ButtonsType.None,
                    tasks.Count > 1 ?
                    Catalog.GetString("Really delete these tasks?") :
                    Catalog.GetString("Really delete this task?"),
                    Catalog.GetString("If you delete a task it is " +
                                      "permanently lost."));

            Gtk.Button button;

            button            = new Gtk.Button(Gtk.Stock.Cancel);
            button.CanDefault = true;
            button.Show();
            dialog.AddActionWidget(button, Gtk.ResponseType.Cancel);
            dialog.DefaultResponse = Gtk.ResponseType.Cancel;

            button            = new Gtk.Button(Gtk.Stock.Delete);
            button.CanDefault = true;
            button.Show();
            dialog.AddActionWidget(button, 666);

            int result = dialog.Run();

            if (result == 666)
            {
                // Disable the selection changed handler while we nuke tasks
                tree.Selection.Changed -= OnSelectionChanged;

                foreach (Task task in tasks)
                {
                    task.Manager.Delete(task);
                }

                tree.Selection.Changed += OnSelectionChanged;
            }

            dialog.Destroy();
        }
Esempio n. 3
0
		void ShowDeletionDialog (List<Task> tasks)
		{
			HIGMessageDialog dialog =
			        new HIGMessageDialog (
			        this,
			        Gtk.DialogFlags.DestroyWithParent,
			        Gtk.MessageType.Question,
			        Gtk.ButtonsType.None,
			        tasks.Count > 1 ?
			        Catalog.GetString ("Really delete these tasks?") :
			        Catalog.GetString ("Really delete this task?"),
			        Catalog.GetString ("If you delete a task it is " +
			                           "permanently lost."));

			Gtk.Button button;

			button = new Gtk.Button (Gtk.Stock.Cancel);
			button.CanDefault = true;
			button.Show ();
			dialog.AddActionWidget (button, Gtk.ResponseType.Cancel);
			dialog.DefaultResponse = Gtk.ResponseType.Cancel;

			button = new Gtk.Button (Gtk.Stock.Delete);
			button.CanDefault = true;
			button.Show ();
			dialog.AddActionWidget (button, 666);

			int result = dialog.Run ();
			if (result == 666) {
				// Disable the selection changed handler while we nuke tasks
				tree.Selection.Changed -= OnSelectionChanged;

				foreach (Task task in tasks) {
					task.Manager.Delete (task);
				}

				tree.Selection.Changed += OnSelectionChanged;
			}

			dialog.Destroy();
		}
Esempio n. 4
0
File: Note.cs Progetto: GNOME/tomboy
		public static void ShowDeletionDialog (List<Note> notes, Gtk.Window parent)
		{
			string message;

			if ((bool) Preferences.Get (Preferences.ENABLE_DELETE_CONFIRM)) {
				// show confirmation dialog
				if (notes.Count == 1) {
					Note note = notes[0];
					message = string.Format (Catalog.GetString ("Really delete \"{0}\"?"), note.Title) ;	
				} else
					message = string.Format (Catalog.GetPluralString (
						"Really delete this {0} note?",
						"Really delete these {0} notes?",
						notes.Count), notes.Count);
			
				HIGMessageDialog dialog =
				        new HIGMessageDialog (
				        parent,
				        Gtk.DialogFlags.DestroyWithParent,
				        Gtk.MessageType.Question,
				        Gtk.ButtonsType.None,
				        message,
				        Catalog.GetString ("If you delete a note it is " +
			                           "permanently lost."));

				Gtk.Button button;

				button = new Gtk.Button (Gtk.Stock.Cancel);
				button.CanDefault = true;
				button.Show ();
				dialog.AddActionWidget (button, Gtk.ResponseType.Cancel);
				dialog.DefaultResponse = Gtk.ResponseType.Cancel;

				button = new Gtk.Button (Gtk.Stock.Delete);
				button.CanDefault = true;
				button.Show ();
				dialog.AddActionWidget (button, 666);

				int result = dialog.Run ();
				if (result == 666) {
					foreach (Note note in notes) {
						note.Manager.Delete (note);
					}
				}

				dialog.Destroy();
			} else {
				// no confirmation dialog, just delete
				foreach (Note note in notes) {
					note.Manager.Delete (note);
				}
			}
		}
		void RemoveClicked (object sender, EventArgs args)
		{
			// Remove the icon file and call UpdateIconStore ().
			Gtk.TreeIter iter;
			if (!icon_tree.Selection.GetSelected (out iter))
				return;

			string icon_path = icon_store.GetValue (iter, 2) as string;

			HIGMessageDialog dialog =
			        new HIGMessageDialog (
			        null,
			        Gtk.DialogFlags.DestroyWithParent,
			        Gtk.MessageType.Question,
			        Gtk.ButtonsType.None,
			        Catalog.GetString ("Really remove this icon?"),
			        Catalog.GetString ("If you remove an icon it is " +
			                           "permanently lost."));

			Gtk.Button button;

			button = new Gtk.Button (Gtk.Stock.Cancel);
			button.CanDefault = true;
			button.Show ();
			dialog.AddActionWidget (button, Gtk.ResponseType.Cancel);
			dialog.DefaultResponse = Gtk.ResponseType.Cancel;

			button = new Gtk.Button (Gtk.Stock.Delete);
			button.CanDefault = true;
			button.Show ();
			dialog.AddActionWidget (button, 666);

			int result = dialog.Run ();
			if (result == 666) {
				try {
					File.Delete (icon_path);
					UpdateIconStore ();
				} catch (Exception e) {
					Logger.Error ("Error removing icon {0}: {1}",
					              icon_path,
					              e.Message);
				}
			}

			dialog.Destroy();
		}