internal bool Refresh () { DaemonInformationRequest request = new DaemonInformationRequest (false, false, true, true); DaemonInformationResponse response; try { response = (DaemonInformationResponse) request.Send (); } catch (Beagle.ResponseMessageException) { Console.WriteLine ("Could not connect to the daemon."); return false; } if (response.IsIndexing) { note.Show (); } else { note.Hide (); } int i = 0; StringBuilder sb = new StringBuilder (); foreach (QueryableStatus status in response.IndexStatus) { if (i++ > 20) break; // Skip all those metadata and networking services backends if (status.ItemCount < 0) continue; sb.AppendFormat ("<b>{0}</b>: {1}", status.Name, status.ItemCount); if (status.ProgressPercent > 0) sb.AppendFormat (" ({0})", status.ProgressPercent); sb.Append ("\n"); } label.Markup = sb.ToString (); label.Show (); return true; }
private static int PrintDaemonInformation (string[] args) { DaemonInformationRequest request = new DaemonInformationRequest (); DaemonInformationResponse response; bool get_version = false; bool get_sched_info = false; bool get_index_status = false; bool get_is_indexing = false; get_version = (Array.IndexOf (args, "--daemon-version") > -1); get_sched_info = (Array.IndexOf (args, "--status") > -1); get_index_status = (Array.IndexOf (args, "--index-info") > -1); get_is_indexing = (Array.IndexOf (args, "--is-indexing") > -1); if (Array.IndexOf (args, "--all-info") > -1) get_version = get_sched_info = get_index_status = get_is_indexing = true; try { response = (DaemonInformationResponse) request.Send (); } catch (Beagle.ResponseMessageException) { Console.WriteLine ("Could not connect to the daemon."); return 1; } if (get_version) Console.WriteLine ("Daemon version: {0}", response.Version); if (get_sched_info) Console.Write (response.HumanReadableStatus); if (get_index_status) { Console.WriteLine ("Index information:"); Console.WriteLine (response.IndexInformation); } if (get_is_indexing) Console.WriteLine ("Daemon indexing: {0}", response.IsIndexing); return 0; }
private void OnStartDaemon () { notification_area.Hide (); DaemonInformationRequest request = new DaemonInformationRequest (true, false, false, false); try { request.Send (); } catch (Beagle.ResponseMessageException) { // beagled is not running // Start beagled and once it is started, display the quicktips page Beagle.Search.Pages.StartDaemon.DoStartDaemon (delegate () { this.statusbar.Pop (0); this.statusbar.Push (0, Catalog.GetString ("Search service started")); }); pages.CurrentPage = pages.PageNum (quicktips); return; } catch (Exception e) { Console.WriteLine ("Stopping the Beagle daemon failed: {0}", e.Message); } // beagled is running NotificationMessage m = new NotificationMessage (); m.Icon = Gtk.Stock.DialogError; m.Title = Catalog.GetString ("Starting service failed"); m.Message = Catalog.GetString ("Service is already running!"); notification_area.Display (m); }