static void list_box_row_activated (GtkListBox *listbox, GtkListBoxRow *row, CcDateTimePanel *self) { CcDateTimePanelPrivate *priv = self->priv; gchar *widget_name, *found; widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row))); if (!widget_name) return; gtk_list_box_select_row (listbox, NULL); if (!g_strcmp0 (widget_name, "auto-datetime-row")) { toggle_switch (W ("network_time_switch")); } else if (!g_strcmp0 (widget_name, "auto-timezone-row")) { toggle_switch (W ("auto_timezone_switch")); } else if ((found = g_strrstr (widget_name, "button"))) { /* replace "button" with "dialog" */ memcpy (found, "dialog", 6); run_dialog (self, widget_name); } g_free (widget_name); }
static void activate_row (CcUaPanel *self, GtkListBoxRow *row) { GtkWidget *dialog; const gchar *dialog_id; const gchar *widget_name; // Check switches to toggle widget_name = gtk_buildable_get_name (GTK_BUILDABLE (row)); if (widget_name) { if (!g_strcmp0 (widget_name, "row_highcontrast")) { toggle_switch (WID ("value_highcontrast")); return; } if (!g_strcmp0 (widget_name, "row_large_text")) { toggle_switch (WID ("value_large_text")); return; } if (!g_strcmp0 (widget_name, "row_screen_keyboard")) { toggle_switch (WID ("screen_keyboard_switch")); return; } if (!g_strcmp0 (widget_name, "row_mouse_keys")) { toggle_switch (WID ("mouse_keys_switch")); return; } } // Check dialog to open dialog_id = (const gchar *)g_object_get_data (G_OBJECT (row), "dialog-id"); if (g_strcmp0 (dialog_id, "zoom") == 0) { zoom_options_launch (self); return; } dialog = (GtkWidget *)g_object_get_data (G_OBJECT (row), "dialog"); if (dialog == NULL) return; gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); gtk_window_present (GTK_WINDOW (dialog)); }
bool AdminRequestHandler::handleCheckRequest(const std::string &cmd, Transport *transport) { if (cmd == "check-load") { int count = HttpServer::Server->getPageServer()->getActiveWorker(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-queued") { int count = HttpServer::Server->getPageServer()->getQueuedJobs(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-mem") { return toggle_switch(transport, RuntimeOption::CheckMemory); } if (cmd == "check-apc") { string stats = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; stats += "<APC>\n"; stats += SharedStores::ReportStats(1); stats += "</APC>\n"; transport->sendString(stats); return true; } if (cmd == "check-sql") { string stats = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; stats += "<SQL>\n"; stats += MySqlStats::ReportStats(); stats += "</SQL>\n"; transport->sendString(stats); return true; } return false; }
bool AdminRequestHandler::handleStatsRequest(const std::string &cmd, Transport *transport) { if (cmd == "stats-on") { RuntimeOption::EnableStats = true; transport->sendString("OK\n"); return true; } if (cmd == "stats-off") { RuntimeOption::EnableStats = false; transport->sendString("OK\n"); return true; } if (cmd == "stats-clear") { ServerStats::Clear(); transport->sendString("OK\n"); return true; } if (cmd == "stats-web") { return toggle_switch(transport, RuntimeOption::EnableWebStats); } if (cmd == "stats-mem") { toggle_switch(transport, RuntimeOption::EnableMemoryStats); return true; } if (cmd == "stats-malloc") { toggle_switch(transport, RuntimeOption::EnableMallocStats); LeakDetectable::EnableMallocStats(RuntimeOption::EnableMallocStats); return true; } if (cmd == "stats-apc") { return toggle_switch(transport, RuntimeOption::EnableAPCStats); } if (cmd == "stats-apc-key") { return toggle_switch(transport, RuntimeOption::EnableAPCKeyStats); } if (cmd == "stats-mcc") { return toggle_switch(transport, RuntimeOption::EnableMemcacheStats); } if (cmd == "stats-sql") { return toggle_switch(transport, RuntimeOption::EnableSQLStats); } if (cmd == "stats-mutex") { int sampling = transport->getIntParam("sampling"); if (sampling > 0) { LockProfiler::s_profile_sampling = sampling; } return toggle_switch(transport, LockProfiler::s_profile); } if (cmd == "stats.keys") { int64 from = transport->getInt64Param("from"); int64 to = transport->getInt64Param("to"); string out; ServerStats::GetKeys(out, from, to); transport->sendString(out); return true; } if (cmd == "stats.xml") { return send_report(transport, ServerStats::XML, "application/xml"); } if (cmd == "stats.json") { return send_report(transport, ServerStats::JSON, "application/json"); } if (cmd == "stats.kvp") { return send_report(transport, ServerStats::KVP, "text/plain"); } if (cmd == "stats.html" || cmd == "stats.htm") { return send_report(transport, ServerStats::HTML, "text/html"); } if (cmd == "stats.xsl") { string xsl; if (!RuntimeOption::StatsXSLProxy.empty()) { StringBuffer response; if (HttpClient().get(RuntimeOption::StatsXSLProxy.c_str(), response) == 200) { xsl = response.data(); if (!xsl.empty()) { transport->addHeader("Content-Type", "application/xml"); transport->sendString(xsl); return true; } } } transport->sendString("Not Found\n", 404); return true; } return false; }
bool AdminRequestHandler::handleCheckRequest(const std::string &cmd, Transport *transport) { if (cmd == "check-load") { int count = HttpServer::Server->getPageServer()->getActiveWorker(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-ev") { int count = HttpServer::Server->getPageServer()->getLibEventConnectionCount(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-queued") { int count = HttpServer::Server->getPageServer()->getQueuedJobs(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-health") { std::stringstream out; bool first = true; out << "{" << endl; auto appendStat = [&](const char* name, int64_t value) { out << (!first ? "," : "") << " \"" << name << "\":" << value << endl; first = false; }; ServerPtr server = HttpServer::Server->getPageServer(); appendStat("load", server->getActiveWorker()); appendStat("queued", server->getQueuedJobs()); Transl::Translator* tx = Transl::Translator::Get(); appendStat("hhbc-roarena-capac", hhbc_arena_capacity()); appendStat("tc-size", tx->getCodeSize()); appendStat("tc-stubsize", tx->getStubSize()); appendStat("targetcache", tx->getTargetCacheSize()); appendStat("units", Eval::FileRepository::getLoadedFiles()); out << "}" << endl; transport->sendString(out.str()); return true; } if (cmd == "check-pl-load") { int count = PageletServer::GetActiveWorker(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-pl-queued") { int count = PageletServer::GetQueuedJobs(); transport->sendString(lexical_cast<string>(count)); return true; } if (cmd == "check-mem") { return toggle_switch(transport, RuntimeOption::CheckMemory); } if (cmd == "check-sql") { string stats = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; stats += "<SQL>\n"; stats += MySqlStats::ReportStats(); stats += "</SQL>\n"; transport->sendString(stats); return true; } return false; }