Back to index

lshw  02.16
Functions
print-gui.h File Reference
#include "hw.h"
#include <gtk/gtk.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void printmarkup (const hwNode &node, GtkTextView *textview, const string &hwpath)
string gethwpath (hwNode &node, hwNode &base)

Function Documentation

string gethwpath ( hwNode node,
hwNode base 
)

Definition at line 248 of file print-gui.cc.

{
  ostringstream out;
  hwNode *parent = find_parent(&n, &base);

  if(parent && (parent != &base))
    out << gethwpath(*parent, base) << "/" << n.getPhysId();

  return out.str();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void printmarkup ( const hwNode node,
GtkTextView *  textview,
const string &  hwpath 
)

Definition at line 90 of file print-gui.cc.

{
  vector < string > config;
  vector < string > resources;
  ostringstream out;
  GtkTextIter iter;
  GtkTextBuffer *buffer;

  buffer = gtk_text_view_get_buffer(textview);

  gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);

  resources = node.getResources(":");

  if(node.getDescription()!="")
    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, node.getDescription().c_str(), -1, "heading", NULL);
  else
  {
    if(node.getProduct()!="")
      gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, node.getProduct().c_str(), -1, "heading", NULL);
    else
      gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, node.getId().c_str(), -1, "heading", NULL);
  }
  if(!node.claimed() || node.disabled())
    out << "<span color=\"gray\">";
  if(node.disabled())
    out << _(" DISABLED");
  if(!node.claimed())
    out << _(" UNCLAIMED");
  if(!node.claimed() || node.disabled())
    out << "</span>";

  gtk_text_buffer_insert (buffer, &iter, "\n", -1);
  gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, hwpath.c_str(), -1, "monospace", NULL);

  gtk_text_buffer_insert (buffer, &iter, "\n", -1);

  if(node.getHint("icon").defined())
    inserticon(string("lshw-") + node.getHint("icon").asString(), "", buffer, iter, textview);

  if(node.getHint("bus.icon").defined())
    inserticon(string("lshw-") + node.getHint("bus.icon").asString(), "", buffer, iter, textview);

  if(node.getHint("logo").defined())
    inserticon(string("lshw-") + node.getHint("logo").asString(), "", buffer, iter, textview);

  gtk_text_buffer_insert (buffer, &iter, "\n\n", -1);

//out << printattr("description", node.getDescription());
  printattr(_("product"), node.getProduct(), buffer, iter);
  printattr(_("vendor"), node.getVendor(), buffer, iter);
  printattr(_("bus info"), node.getBusInfo(), buffer, iter);
  if (node.getLogicalName() != "")
  {
    vector<string> logicalnames = node.getLogicalNames();

    for(unsigned int i = 0; i<logicalnames.size(); i++)
      printattr(_("logical name"), logicalnames[i], buffer, iter);
  }

  printattr(_("version"), node.getVersion(), buffer, iter);
  printattr(_("serial"), node.getSerial(), buffer, iter);
  printattr(_("slot"), node.getSlot(), buffer, iter);

  if(node.getSize() > 0)
    printsize(node.getSize(), node, _("size"), buffer, iter);
  if(node.getCapacity() > 0)
    printsize(node.getCapacity(), node, _("capacity"), buffer, iter);

  if(node.getWidth() > 0)
    printattr(_("width"),tostring(node.getWidth())+" bits", buffer, iter);

  if(node.getClock() > 0)
    printattr(_("clock"), decimalkilos(node.getClock())+string("Hz") + ((node.getClass() == hw::memory)?(string(" (")+tostring((long long)(1.0e9 / node.getClock())) + string("ns)")):string("")), buffer, iter);

  config.clear();
  splitlines(node.getCapabilities(), config, ' ');

  if (config.size() > 0)
  {
    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, _("capabilities"), -1, "bold", NULL);
    gtk_text_buffer_insert (buffer, &iter, ":", -1);
    for(unsigned j=0; j<config.size(); j++)
    {
      gtk_text_buffer_insert (buffer, &iter, "\n\t", -1);
      if(node.getCapabilityDescription(config[j]) != "")
      {
        gtk_text_buffer_insert (buffer, &iter, node.getCapabilityDescription(config[j]).c_str(), -1);
      }
      else
        gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, config[j].c_str(), -1, "italic", NULL);
      if(j<config.size()-1)
        gtk_text_buffer_insert (buffer, &iter, ",", -1);
    }
  }

  gtk_text_buffer_insert (buffer, &iter, "\n", -1);

  config.clear();
  config = node.getConfigValues(": ");

  if (config.size() > 0)
  {
    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, _("configuration"), -1, "bold", NULL);
    gtk_text_buffer_insert (buffer, &iter, ":", -1);
    for(unsigned j=0; j<config.size(); j++)
    {
      gtk_text_buffer_insert (buffer, &iter, "\n\t", -1);
      gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, config[j].c_str(), -1, "italic", NULL);
    }
  }

  gtk_text_buffer_insert (buffer, &iter, "\n", -1);

  config.clear();
  config = node.getResources(": ");

  if (config.size() > 0)
  {
    gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, _("resources"), -1, "bold", NULL);
    gtk_text_buffer_insert (buffer, &iter, ":", -1);
    for(unsigned j=0; j<config.size(); j++)
    {
      gtk_text_buffer_insert (buffer, &iter, "\n\t", -1);
      gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, config[j].c_str(), -1, "italic", NULL);
    }
  }

  gtk_text_buffer_insert (buffer, &iter, "\n", -1);

  if(!node.claimed())
    inserticon(LSHW_STOCK_DISABLED, _("this device hasn't been claimed\n"), buffer, iter, textview);

  if(!node.enabled())
    inserticon(LSHW_STOCK_DISABLED, _("this device has been disabled\n"), buffer, iter, textview);

  (void) &id;                                     // avoid "id defined but not used" warning
}

Here is the call graph for this function:

Here is the caller graph for this function: