~ubuntu-branches/ubuntu/oneiric/gnome-system-monitor/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/sysinfo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-21 16:49:23 UTC
  • mto: (2.1.7 sid) (1.1.59 upstream)
  • mto: This revision was merged to the branch mainline in revision 78.
  • Revision ID: james.westby@ubuntu.com-20110621164923-o6titd2srek1uh84
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
      const glibtop_sysinfo *info = glibtop_get_sysinfo();
106
106
 
107
107
      for (guint i = 0; i != info->ncpu; ++i) {
108
 
        const char * const keys[] = { "model name", "cpu" };
 
108
        const char * const keys[] = { "model name", "cpu", "Processor" };
109
109
        gchar *model = 0;
110
110
 
111
111
        for (guint j = 0; !model && j != G_N_ELEMENTS(keys); ++j)
113
113
                                                         keys[j]));
114
114
 
115
115
        if (!model)
116
 
          model = _("Unknown CPU model");
 
116
          continue;
117
117
 
118
118
        this->processors.push_back(model);
119
119
      }
173
173
                                "string(/gnome-version/micro)" };
174
174
      string values[3];
175
175
 
176
 
      if (not (document = xmlParseFile(DATADIR "/gnome-about/gnome-version.xml")))
 
176
      if (not (document = xmlParseFile(DATADIR "/gnome/gnome-version.xml")))
177
177
        return;
178
178
 
179
179
      if (not (context = xmlXPathNewContext(document)))
183
183
        {
184
184
          xmlXPathObjectPtr xpath;
185
185
          xpath = xmlXPathEvalExpression(BAD_CAST nodes[i].c_str(), context);
186
 
          
 
186
 
187
187
          if (xpath and xpath->type == XPATH_STRING)
188
188
            values[i] = reinterpret_cast<const char*>(xpath->stringval);
189
189
 
412
412
#define RADIUS 5
413
413
 
414
414
static gboolean
415
 
sysinfo_logo_expose (GtkWidget *widget,
416
 
                     GdkEventExpose *event,
417
 
                     gpointer data_ptr)
 
415
sysinfo_logo_draw (GtkWidget *widget,
 
416
                   cairo_t *context,
 
417
                   gpointer data_ptr)
418
418
{
 
419
  GtkAllocation allocation;
 
420
  GtkStyle *style;
419
421
  cairo_t *cr;
420
422
  cairo_pattern_t *cp;
421
423
 
422
 
  cr = gdk_cairo_create(widget->window);
 
424
  cr = gdk_cairo_create(gtk_widget_get_window(widget));
423
425
 
424
 
  cairo_translate(cr, widget->allocation.x, widget->allocation.y);
 
426
  gtk_widget_get_allocation (widget, &allocation);
 
427
  cairo_translate(cr, allocation.x, allocation.y);
425
428
 
426
429
  cairo_move_to(cr, X_PAD + RADIUS, Y_PAD);
427
430
  cairo_line_to(cr, X_PAD + LOGO_W - RADIUS, Y_PAD);
434
437
  cairo_arc(cr,  X_PAD + RADIUS, Y_PAD + RADIUS, RADIUS, -1.0 * M_PI, -0.5 * M_PI);
435
438
 
436
439
  cp = cairo_pattern_create_linear(0, Y_PAD, 0, Y_PAD + LOGO_H);
 
440
  style = gtk_widget_get_style (widget);
437
441
  cairo_pattern_add_color_stop_rgba(cp, 0.0,
438
 
                                    widget->style->base[GTK_STATE_SELECTED].red / 65535.0,
439
 
                                    widget->style->base[GTK_STATE_SELECTED].green / 65535.0,
440
 
                                    widget->style->base[GTK_STATE_SELECTED].blue / 65535.0,
 
442
                                    style->base[GTK_STATE_SELECTED].red / 65535.0,
 
443
                                    style->base[GTK_STATE_SELECTED].green / 65535.0,
 
444
                                    style->base[GTK_STATE_SELECTED].blue / 65535.0,
441
445
                                    1.0);
442
446
  cairo_pattern_add_color_stop_rgba(cp, 1.0,
443
 
                                    widget->style->base[GTK_STATE_SELECTED].red / 65535.0,
444
 
                                    widget->style->base[GTK_STATE_SELECTED].green / 65535.0,
445
 
                                    widget->style->base[GTK_STATE_SELECTED].blue / 65535.0,
 
447
                                    style->base[GTK_STATE_SELECTED].red / 65535.0,
 
448
                                    style->base[GTK_STATE_SELECTED].green / 65535.0,
 
449
                                    style->base[GTK_STATE_SELECTED].blue / 65535.0,
446
450
                                    0.0);
447
451
  cairo_set_source(cr, cp);
448
452
  cairo_fill(cr);
484
488
}
485
489
 
486
490
 
487
 
static GtkWidget* 
 
491
static GtkWidget*
488
492
add_row(GtkTable * table, const char * label, const char * value, int row)
489
493
{
490
494
  GtkWidget *header = gtk_label_new(label);
542
546
  gtk_misc_set_padding(GTK_MISC(logo), 5, 12);
543
547
  gtk_box_pack_start(GTK_BOX(hbox), logo, FALSE, FALSE, 0);
544
548
 
545
 
  g_signal_connect(G_OBJECT(logo), "expose-event",
546
 
                   G_CALLBACK(sysinfo_logo_expose), NULL);
 
549
  g_signal_connect(G_OBJECT(logo), "draw",
 
550
                   G_CALLBACK(sysinfo_logo_draw), NULL);
547
551
 
548
552
  vbox = gtk_vbox_new(FALSE, 12);
549
553
  gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
644
648
  g_free(markup);
645
649
 
646
650
  markup = procman::format_size(data->free_space_bytes);
647
 
  disk_space_label = add_row(GTK_TABLE(disk_space_table), 
 
651
  disk_space_label = add_row(GTK_TABLE(disk_space_table),
648
652
                             _("Available disk space:"), markup,
649
653
                             0);
650
654
  g_free(markup);