viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1.  
  2. using System;
  3. using Gtk;
  4.  
  5. namespace Dizzy
  6. {
  7.  
  8. /*
  9. * Problema: Supponiamo di avere un thread disperso per il programma
  10. * che ad un certo punto decide che deve comunicare all'utente che è
  11. * successo un gran casino. Come va?
  12. *
  13. * Soluzione 1: Emette un evento che da qualche altra parte è stato
  14. * collegato ad una funzione che crea un dialog. Questo crea problemi
  15. * con il fatto che le chiamate alle gtk vengono fatte dal thread sbagliato.
  16. *
  17. * Soluzione attuale: Riceviamo le chiamate qua dentro. Questo oggetto
  18. * inserisce le chiamate corrette nel thread principale.
  19. */
  20.  
  21. public class EventManager
  22. {
  23.  
  24. public static MessageDialog searchInProgress = null;
  25.  
  26. // Gestione dei file e dei task. Questi devono essere inizializzati
  27. // Appena sono creati.
  28. public static FileTreeView fileTreeView = null;
  29. public static TaskTreeView taskTreeView = null;
  30. public static void RegisterFileTreeView (ref FileTreeView f) { fileTreeView = f; }
  31. public static void RegisterTaskTreeView (ref TaskTreeView t) { taskTreeView = t; }
  32.  
  33. public EventManager () {}
  34.  
  35. // Metodo generico per segnalare un'errore dell'applicazione.
  36. public static void ErrorMessage (string message) {
  37.  
  38. GLib.Idle.Add(delegate {
  39. Log.Error (message);
  40.  
  41. MessageDialog d = new Gtk.MessageDialog(null,
  42. Gtk.DialogFlags.DestroyWithParent,
  43. Gtk.MessageType.Error,
  44. Gtk.ButtonsType.Ok, "");
  45. d.Markup = message;
  46. d.Run ();
  47. d.Destroy ();
  48. return false;
  49. });
  50. }
  51.  
  52. // Metodi per gestire la ricerca
  53. public static void SearchStarted () {
  54.  
  55. // Questo significa che stiamo già effettuando una ricerca
  56. if (searchInProgress != null)
  57. return;
  58.  
  59. searchInProgress = new MessageDialog(null,
  60. DialogFlags.Modal,
  61. MessageType.Info,
  62. ButtonsType.None,
  63. true, "");
  64. searchInProgress.Markup = "Ricerca in corso, attendere.";
  65. GLib.Idle.Add (delegate {
  66. EventManager.searchInProgress.Run ();
  67. return false;
  68. });
  69. }
  70.  
  71. public static void SearchFinished () {
  72. if (searchInProgress == null)
  73. return;
  74. else
  75. {
  76. GLib.Idle.Add(delegate {
  77. searchInProgress.Destroy ();
  78. searchInProgress = null;
  79. return false;
  80. });
  81. }
  82. }
  83.  
  84. public static void FileTreeViewAddFile(File f)
  85. {
  86. if (fileTreeView == null) { return; }
  87. GLib.Idle.Add(delegate {
  88. fileTreeView.AddFile (f);
  89. return false;
  90. });
  91. }
  92.  
  93. public static void FileTreeViewClear() {
  94. if (fileTreeView == null) { return; }
  95. GLib.Idle.Add(delegate {
  96. fileTreeView.Clear ();
  97. return false;
  98. });
  99. }
  100. }
  101. }