diff --git a/gnome-system-monitor-fate302198.diff b/gnome-system-monitor-fate302198.diff new file mode 100644 index 0000000..c45aea1 --- /dev/null +++ b/gnome-system-monitor-fate302198.diff @@ -0,0 +1,567 @@ +Index: configure.in +=================================================================== +--- configure.in (revision 2495) ++++ configure.in (working copy) +@@ -37,7 +37,7 @@ + RSVG_REQUIRED=2.12 + DBUS_REQUIRED=0.7 + +-PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED) ++PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED hal hwinfo) + + + AC_ARG_ENABLE(more-warnings, +Index: src/hardware.h +=================================================================== +--- src/hardware.h (revision 0) ++++ src/hardware.h (revision 0) +@@ -0,0 +1,32 @@ ++/* Gnome System Monitor - hardware.h ++ * Copyright (C) 2008 Novell, Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ */ ++ ++ ++ ++ ++#ifndef _GSM_HARDWARE_H_ ++#define _GSM_HARDWARE_H_ ++ ++#include ++ ++ ++GtkWidget* create_hardware_view(); ++ ++ ++#endif +Index: src/hardware.cpp +=================================================================== +--- src/hardware.cpp (revision 0) ++++ src/hardware.cpp (revision 0) +@@ -0,0 +1,285 @@ ++/* Gnome System Monitor - hardware.cpp ++ * Copyright (C) 2008 Novell, Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ */ ++ ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#include ++ ++#include "hardware.h" ++#include "interface.h" ++ ++enum HwColumns ++{ ++ HW_DEVICE, ++ HW_TYPE, ++ HW_ICON, ++ HW_N_COLUMNS ++}; ++ ++ ++struct hw_map_data_t { ++ hd_hw_item_t key; ++ const char * icon; ++ const char * type_label; ++}; ++ ++typedef std::map hw_map_t; ++ ++static const hw_map_t & get_map_data() ++{ ++ static hw_map_t s_map; ++ static const hw_map_data_t _s_map_data[] = { ++ { hw_sys, "system", "" }, ++ { hw_cpu, "", _("CPU") }, ++ { hw_keyboard, "keyboard", _("Keyboard") }, ++ { hw_braille, "braille", _("Braille device") }, ++ { hw_mouse, "mouse", _("Mouse") }, ++ { hw_joystick, "joystick", _("Joystick") }, ++ { hw_printer, "printer", _("Printer") }, ++ { hw_scanner, "scanner", _("Scanner") }, ++ { hw_chipcard, "", "chipcard??" }, ++ { hw_monitor, "display", _("Monitor") }, ++ { hw_tv, "", _("TV") }, ++ { hw_framebuffer, "", _("Framebuffer") }, ++ { hw_camera, "camera", _("Camera") }, ++ { hw_sound, "audio-card", _("Sound card") }, ++ { hw_storage_ctrl, "", _("Storage controller") }, ++ { hw_network_ctrl, "", _("Network controller") }, ++ { hw_isdn, "", _("ISDN adapter") }, ++ { hw_modem, "modem", _("Modem") }, ++ { hw_network, "network-wired", _("Network interface") }, ++ { hw_disk, "drive-harddisk", _("Hard drive") }, ++ { hw_partition, "", _("Partition") }, ++ { hw_cdrom, "drive-cdrom", _("CDROM Drive") }, ++ { hw_floppy, "media-floppy", _("Floppy Drive") }, ++ { hw_manual, "", "manual???" }, ++ { hw_usb_ctrl, "", _("USB Controller") }, ++ { hw_usb, "", _("USB Device") }, ++ { hw_bios, "", _("BIOS") }, ++ { hw_pci, "", _("PCI Device") }, ++ { hw_isapnp, "", _("ISA PnP Device") }, ++ { hw_bridge, "", _("Bridge") }, ++ { hw_hub, "", _("Hub") }, ++ { hw_scsi, "", _("SCSI Device") }, ++ { hw_ide, "", _("IDE Device") }, ++ { hw_memory, "", _("Memory") }, ++ { hw_dvb, "", _("DV-B Receiver") }, ++ { hw_pcmcia, "", _("PCMCIA Card") }, ++ { hw_pcmcia_ctrl, "", _("PCMCIA Controller") }, ++ { hw_ieee1394, "", _("Firewire Device") }, ++ { hw_ieee1394_ctrl, "", _("Firewire Controller") }, ++ { hw_hotplug, "", _("Hotplug Device") }, ++ { hw_hotplug_ctrl, "", _("Hotplug Controller") }, ++ { hw_zip, "media-zip", _("Zip Drive") }, ++ { hw_pppoe, "", _("PPPoE Interface") }, ++ { hw_wlan, "", _("WLAN Interface") }, ++ { hw_redasd, "", "redasd??" }, ++ { hw_dsl, "", _("DSL Modem") }, ++ { hw_block, "", _("Block Device") }, ++ { hw_tape, "media-tape", _("Tape Drive") }, ++ { hw_vbe, "", _("vbe???") }, ++ { hw_bluetooth, "", _("Bluetooth Device") }, ++ { hw_fingerprint, "", _("Fingerprint Reader") }, ++ ++ { hw_none, NULL, NULL } ++ }; ++ if (s_map.empty()) { ++ const struct hw_map_data_t *p = _s_map_data; ++ while ((p->key != hw_none) && (p->key != hw_bridge)) { ++ s_map.insert(std::make_pair(p->key, p)); ++ p++; ++ } ++ } ++ return s_map; ++} ++ ++static ++const char * get_hardware_type(hd_hw_item_t hwclass) ++{ ++ const hw_map_t & hw_map(get_map_data()); ++ ++ hw_map_t::const_iterator iter = hw_map.find(hwclass); ++ if(iter != hw_map.end() && iter->second) { ++ return iter->second->type_label; ++ } ++ return NULL; ++} ++ ++ ++static ++Glib::RefPtr get_hardware_icon(hd_hw_item_t hwclass) ++{ ++ Glib::RefPtr pixbuf; ++ ++ Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); ++ ++ const hw_map_t & hw_map(get_map_data()); ++ ++ hw_map_t::const_iterator iter = hw_map.find(hwclass); ++ if(iter != hw_map.end() && iter->second && iter->second->icon ++ && *iter->second->icon) { ++ pixbuf = icon_theme->load_icon(iter->second->icon, 16, ++ Gtk::ICON_LOOKUP_USE_BUILTIN); ++ } ++ ++ return pixbuf; ++} ++ ++ ++void populate_hardware_view(GtkTreeStore * model) ++{ ++ hd_data_t *hd_data; ++ hd_t *hd; ++ ++ std::map item_map; ++ std::list unparented; ++ hd_data = (hd_data_t *)calloc(1, sizeof *hd_data); ++ ++ hd = hd_list(hd_data, hw_all, 1, NULL); ++ for(; hd; hd = hd->next) { ++ const char * name = hd->model; ++ hd_hw_item_t iclass = hd->hw_class; ++ // for now skip network interfaces. ++ if(iclass == hw_network) ++ continue; ++ GtkTreeIter *parent = NULL; ++ if(hd->parent_id) { ++ std::map::iterator iter; ++ iter = item_map.find(hd->parent_id); ++ if(iter != item_map.end()) { ++ parent = iter->second.gobj(); ++ } ++ } ++ ++ Glib::RefPtr pixbuf = get_hardware_icon(iclass); ++ const char * device_type = get_hardware_type(iclass); ++ if(name && *name) { ++ Gtk::TreeIter iter; ++ gtk_tree_store_append(model, iter.gobj(), parent); ++ gtk_tree_store_set(model, iter.gobj(), HW_DEVICE, name, ++ HW_ICON, pixbuf ? pixbuf->gobj() : NULL, ++ HW_TYPE, device_type ? device_type : "", ++ -1); ++ item_map[hd->unique_id] = iter; ++ if(hd->parent_id && !parent) { ++ // has a parent id but no parent found ++ unparented.push_front(iter); ++ } ++ } ++ } ++ ++ while(!unparented.empty()) { ++ Gtk::TreeIter treeiter(unparented.front()); ++ ++ printf("TODO reparent\n"); ++ // reparent ++ unparented.pop_front(); ++ } ++ ++ ++ hd_free_hd_list(hd); /* free it */ ++ hd_free_hd_data(hd_data); ++ free(hd_data); ++} ++ ++ ++ ++GtkWidget* create_hardware_view() ++{ ++ GtkWidget *vbox; ++ GtkWidget *label; ++ GtkWidget *scrolled; ++ GtkWidget *hw_tree; ++ GtkTreeStore *model; ++ GtkTreeViewColumn *col; ++ GtkCellRenderer *cell; ++ ++ const gchar * const titles[] = { ++ N_("Device"), ++ N_("Type") ++ }; ++ ++ vbox = gtk_vbox_new (FALSE, 6); ++ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); ++ label = make_title_label(_("Hardware")); ++ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); ++ ++ scrolled = gtk_scrolled_window_new(NULL, NULL); ++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), ++ GTK_POLICY_AUTOMATIC, ++ GTK_POLICY_AUTOMATIC); ++ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), ++ GTK_SHADOW_IN); ++ ++ gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); ++ ++ model = gtk_tree_store_new(HW_N_COLUMNS, /* n columns */ ++ G_TYPE_STRING, /* HW_DEVICE */ ++ G_TYPE_STRING, /* HW_TYPE */ ++ GDK_TYPE_PIXBUF /* HW_ICON */ ++ ); ++ ++ hw_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); ++ gtk_container_add(GTK_CONTAINER(scrolled), hw_tree); ++ gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(hw_tree), TRUE); ++ g_object_unref(G_OBJECT(model)); ++ ++ /* icon + device */ ++ ++ col = gtk_tree_view_column_new(); ++ cell = gtk_cell_renderer_pixbuf_new(); ++ gtk_tree_view_column_pack_start(col, cell, FALSE); ++ gtk_tree_view_column_set_attributes(col, cell, "pixbuf", HW_ICON, ++ NULL); ++ cell = gtk_cell_renderer_text_new(); ++ gtk_tree_view_column_pack_start(col, cell, FALSE); ++ gtk_tree_view_column_set_attributes(col, cell, "text", HW_DEVICE, ++ NULL); ++ gtk_tree_view_column_set_title(col, titles[HW_DEVICE]); ++ gtk_tree_view_column_set_sort_column_id(col, HW_DEVICE); ++ gtk_tree_view_column_set_reorderable(col, TRUE); ++ gtk_tree_view_column_set_resizable(col, TRUE); ++ gtk_tree_view_append_column(GTK_TREE_VIEW(hw_tree), col); ++ ++ /* type */ ++ col = gtk_tree_view_column_new(); ++ cell = gtk_cell_renderer_text_new(); ++ gtk_tree_view_column_pack_start(col, cell, FALSE); ++ gtk_tree_view_column_set_attributes(col, cell, "text", HW_TYPE, ++ NULL); ++ gtk_tree_view_column_set_title(col, titles[HW_TYPE]); ++ gtk_tree_view_column_set_sort_column_id(col, HW_TYPE); ++ gtk_tree_view_column_set_reorderable(col, TRUE); ++ gtk_tree_view_column_set_resizable(col, TRUE); ++ gtk_tree_view_append_column(GTK_TREE_VIEW(hw_tree), col); ++ ++ populate_hardware_view(model); ++ ++ gtk_widget_show_all(vbox); ++ ++ return vbox; ++} ++ ++ +Index: src/interface.cpp +=================================================================== +--- src/interface.cpp (revision 2495) ++++ src/interface.cpp (working copy) +@@ -1,5 +1,6 @@ + /* Procman - main window + * Copyright (C) 2001 Kevin Vandersloot ++ * Copyright (C) 2008 Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -40,6 +41,7 @@ + #include "disks.h" + #include "sysinfo.h" + #include "gsm_color_button.h" ++#include "hardware.h" + + static void cb_toggle_tree (GtkAction *action, gpointer data); + +@@ -610,9 +612,9 @@ + GtkWidget *menubar; + GtkWidget *main_box; + GtkWidget *notebook; +- GtkWidget *tab_label1, *tab_label2, *tab_label3; ++ GtkWidget *tab_label1, *tab_label2, *tab_label3 , *tab_label4; + GtkWidget *vbox1; +- GtkWidget *sys_box, *devices_box; ++ GtkWidget *sys_box, *devices_box, *hardware_box; + GtkWidget *sysinfo_box, *sysinfo_label; + + app = gtk_window_new(GTK_WINDOW_TOPLEVEL); +@@ -702,6 +704,10 @@ + tab_label3 = gtk_label_new (_("File Systems")); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), devices_box, tab_label3); + ++ hardware_box = create_hardware_view (); ++ tab_label4 = gtk_label_new (_("Hardware")); ++ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hardware_box, tab_label4); ++ + g_signal_connect (G_OBJECT (notebook), "switch-page", + G_CALLBACK (cb_switch_page), procdata); + g_signal_connect (G_OBJECT (notebook), "change-current-page", +Index: src/Makefile.am +=================================================================== +--- src/Makefile.am (revision 2495) ++++ src/Makefile.am (working copy) +@@ -24,6 +24,7 @@ + smooth_refresh.cpp smooth_refresh.h \ + defaulttable.h \ + disks.cpp disks.h \ ++ hardware.cpp hardware.h \ + selinux.h selinux.cpp \ + procman_gnomesu.h procman_gnomesu.cpp \ + procman_gksu.h procman_gksu.cpp \ +Index: src/sysinfo.cpp +=================================================================== +--- src/sysinfo.cpp (revision 2495) ++++ src/sysinfo.cpp (working copy) +@@ -13,6 +13,8 @@ + #include + #include + ++#include ++ + #include + #include + #include +@@ -36,6 +38,18 @@ + + namespace { + ++ string get_hal_property(LibHalContext * ctx, const char *udi, const char *prop_name, ++ DBusError * error) ++ { ++ string prop_val; ++ char * property; ++ property = libhal_device_get_property_string(ctx, udi, prop_name, error); ++ if(property) { ++ prop_val = property; ++ libhal_free_string(property); ++ } ++ return prop_val; ++ } + + class SysInfo + { +@@ -51,6 +65,12 @@ + guint n_processors; + vector processors; + ++ /* system info */ ++ string bios_version; ++ string bios_date; ++ string machine_type_model; ++ string system_serial; ++ string system_board_serial; + + SysInfo() + { +@@ -59,6 +79,7 @@ + this->load_disk_info(); + this->load_uname_info(); + this->load_gnome_version(); ++ this->load_system_info(); + } + + virtual ~SysInfo() +@@ -182,6 +203,45 @@ + + this->gnome_version = values[0] + '.' + values[1] + '.' + values[2]; + } ++ ++ void load_system_info() ++ { ++ // ++ DBusError error; ++ DBusConnection *connection; ++ ++ dbus_error_init (&error); ++ connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); ++ ++ LibHalContext * ctx = libhal_ctx_new(); ++ ++ if(ctx) { ++ libhal_ctx_set_dbus_connection (ctx, connection); ++ if(!libhal_ctx_init (ctx, &error)) { ++ printf("ctx init failed\n"); ++ } ++ ++ this->bios_version = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.firmware.version", &error); ++ this->bios_date = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.firmware.release_date", &error); ++ this->machine_type_model = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.product", &error); ++ if(this->machine_type_model.empty()) { ++ dbus_error_init(&error); ++ this->machine_type_model = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.hardware.product", &error); ++ } ++ this->system_serial = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.hardware.serial", &error); ++ this->system_board_serial = get_hal_property(ctx, "/org/freedesktop/Hal/devices/computer", ++ "system.hardware.uuid", &error); ++ ++ libhal_ctx_shutdown (ctx, &error); ++ libhal_ctx_free(ctx); ++ } ++ dbus_error_free(&error); ++ } + }; + + +@@ -485,6 +545,10 @@ + GtkWidget *memory_label; + GtkWidget *processor_label; + ++ GtkWidget *bios_table; ++ GtkWidget *bios_version_label; ++ GtkWidget *bios_date_label; ++ + GtkWidget *disk_space_table; + GtkWidget *disk_space_label; + +@@ -571,17 +635,20 @@ + + /* hardware section */ + +- markup = g_strdup_printf(_("Hardware")); +- hardware_table = add_section(GTK_BOX(vbox), markup, data->processors.size(), 2, NULL); +- g_free(markup); ++ hardware_table = add_section(GTK_BOX(vbox), _("Hardware"), ++ data->processors.size() + 4, 2, NULL); + ++ add_row(GTK_TABLE(hardware_table), _("Machine model:"), ++ data->machine_type_model.c_str(), 0); ++ + markup = procman::format_size(data->memory_bytes); + memory_label = add_row(GTK_TABLE(hardware_table), _("Memory:"), +- markup, 0); ++ markup, 1); + g_free(markup); + header = gtk_label_new(_("Memory:")); + +- for (guint i = 0; i < data->processors.size(); ++i) { ++ guint i; ++ for (i = 0; i < data->processors.size(); ++i) { + const gchar * t; + if (data->processors.size() > 1) { + markup = g_strdup_printf(_("Processor %d:"), i); +@@ -593,18 +660,31 @@ + } + + processor_label = add_row(GTK_TABLE(hardware_table), t, +- data->processors[i].c_str(), 1 + i); ++ data->processors[i].c_str(), 2 + i); + + if(markup) + g_free(markup); + } + ++ ++ add_row(GTK_TABLE(hardware_table), _("Serial number:"), ++ data->system_serial.c_str(), 2 + i); ++ add_row(GTK_TABLE(hardware_table), _("System UUID:"), ++ data->system_board_serial.c_str(), 3 + i); ++ ++ /* bios section */ ++ ++ bios_table = add_section(GTK_BOX(vbox), _("BIOS"), 2, 2, NULL); ++ ++ bios_version_label = add_row(GTK_TABLE(bios_table), _("BIOS version:"), ++ data->bios_version.c_str(), 0); ++ bios_date_label = add_row(GTK_TABLE(bios_table), _("BIOS date:"), ++ data->bios_date.c_str(), 1); ++ + /* disk space section */ ++ disk_space_table = add_section(GTK_BOX(vbox), _("System Status"), ++ 1, 2, NULL); + +- markup = g_strdup_printf(_("System Status")); +- disk_space_table = add_section(GTK_BOX(vbox), markup, 1, 2, NULL); +- g_free(markup); +- + markup = procman::format_size(data->free_space_bytes); + disk_space_label = add_row(GTK_TABLE(disk_space_table), + _("Available disk space:"), markup, diff --git a/gnome-system-monitor-fate304741.diff b/gnome-system-monitor-fate304741.diff new file mode 100644 index 0000000..897b022 --- /dev/null +++ b/gnome-system-monitor-fate304741.diff @@ -0,0 +1,441 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 91c81f5..bcb3bc4 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -24,7 +24,8 @@ gnome_system_monitor_SOURCES = \ + smooth_refresh.cpp smooth_refresh.h \ + defaulttable.h \ + disks.cpp disks.h \ + hardware.cpp hardware.h \ ++ acpiview.cpp acpiview.h \ + selinux.h selinux.cpp \ + procman_gnomesu.h procman_gnomesu.cpp \ + procman_gksu.h procman_gksu.cpp \ +diff --git a/src/acpiview.cpp b/src/acpiview.cpp +new file mode 100644 +index 0000000..e0c320e +--- /dev/null ++++ b/src/acpiview.cpp +@@ -0,0 +1,310 @@ ++/* Gnome System Monitor - acpiview.cpp ++ * Copyright (C) 2008 Novell, Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "interface.h" ++#include "acpiview.h" ++ ++#define PROC_ACPI_IBM_DIR "/proc/acpi/ibm/" ++ ++#define UNSUPPORTED -1 ++#define DISABLED 0 ++#define ENABLED 1 ++#define OFF 0 ++#define ON 1 ++ ++AcpiData *acpi_data_new () ++{ ++ AcpiData * d = (AcpiData *)calloc(sizeof(AcpiData), 1); ++ d->bluetooth = -1; ++ d->fan = -1; ++ d->brightness = -1; ++ d->in_dock = -1; ++ d->thinklight = -1; ++ d->cpu_temp = -1; ++ d->gpu_temp = -1; ++ d->battery_temp = -1; ++ return d; ++} ++ ++static ++const char * enabled_value_to_string(int v) ++{ ++ if (v == DISABLED) ++ { ++ return _("disabled"); ++ } ++ else if (v == ENABLED) ++ { ++ return _("enabled"); ++ } ++ return _("unsupported"); ++} ++ ++static ++const char * onoff_value_to_string(int v) ++{ ++ if (v == ON) ++ { ++ return _("on"); ++ } ++ else if (v == OFF) ++ { ++ return _("off"); ++ } ++ return _("unsupported"); ++} ++ ++ ++static ++char * read_value(const char *value, const char * format, ++ char * buffer) ++{ ++ int ret; ++ char * rvalue = NULL; ++ FILE *file = fopen(value, "r"); ++ if (file) ++ { ++ ret = fscanf (file, format, buffer); ++ if(ret == 1) ++ { ++ rvalue = buffer; ++ } ++ ret = fclose(file); ++ } ++ return rvalue; ++} ++ ++/* MUST free() the return value */ ++static ++char * read_value_line(const char *value) ++{ ++ int ret; ++ char * rvalue = NULL; ++ size_t len = 0; ++ FILE *file = fopen(value, "r"); ++ if (file) ++ { ++ ret = getline (&rvalue, &len, file); ++ ret = fclose(file); ++ } ++ return rvalue; ++} ++ ++static int get_bluetooth () ++{ ++ int value = -1; ++ char s[10] = ""; ++ char * svalue = read_value(PROC_ACPI_IBM_DIR "bluetooth", "status: %9s", s); ++ if(svalue) ++ { ++ if(strcmp(s,"enabled") == 0) ++ { ++ value = ENABLED; ++ } ++ else ++ { ++ value = DISABLED; ++ } ++ } ++ return value; ++} ++ ++ ++static int get_fan () ++{ ++ int value = -1; ++ char s[10] = ""; ++ char * svalue = read_value(PROC_ACPI_IBM_DIR "fan", "status: %9s", s); ++ if(svalue) ++ { ++ if(strcmp(s,"enabled") == 0) ++ { ++ value = ENABLED; ++ } ++ else ++ { ++ value = DISABLED; ++ } ++ } ++ return value; ++} ++ ++ ++static int get_brightness () ++{ ++ int value = -1; ++ int ret; ++ char rvalue[512]; ++ char *prvalue = rvalue; ++ size_t len = 512; ++ FILE *file = fopen("/proc/acpi/video/VID1/LCD0/brightness", "r"); ++ if (file) ++ { ++ ret = getline (&prvalue, &len, file); ++ ret = fscanf (file, "current: %d", &value); ++ ret = fclose(file); ++ } ++ ++ return value; ++} ++ ++static int get_in_dock () ++{ ++ return -1; ++} ++ ++static int get_thinklight () ++{ ++ int value = -1; ++ char s[10] = ""; ++ char * svalue = read_value(PROC_ACPI_IBM_DIR "light", "status: %9s", s); ++ if(svalue) ++ { ++ if(strcmp(s,"on") == 0) ++ { ++ value = ON; ++ } ++ else ++ { ++ value = OFF; ++ } ++ } ++ return value; ++} ++ ++static void get_temps (int & cpu, int & gpu, int & batt) ++{ ++ cpu = gpu = batt = -1; ++ char * svalue = read_value_line(PROC_ACPI_IBM_DIR "thermal"); ++ if(svalue) ++ { ++ int t1, t2, t3, t4, t5, t6, t7, t8, ++ t9, t10, t11, t12, t13, t14, t15, t16; ++ ++// printf("svalue -> %s\n", svalue); ++ sscanf(svalue, "temperatures: %d %d %d %d %d %d %d %d %d " ++ "%d %d %d %d %d %d %d", &t1, &t2, &t3, &t4, &t5, ++ &t6, &t7, &t8, &t9, &t10, &t11, &t12, &t13, &t14, ++ &t15, &t16); ++ // I'm not sure which one is what. ++ cpu = t1; ++ gpu = t2; ++ batt = t4; ++ free (svalue); ++ } ++} ++ ++ ++void acpi_data_init (AcpiData * d) ++{ ++ d->bluetooth = get_bluetooth (); ++ d->fan = get_fan (); ++ d->brightness = get_brightness (); ++ d->in_dock = get_in_dock(); ++ d->thinklight = get_thinklight (); ++ get_temps (d->cpu_temp, d->gpu_temp, d->battery_temp); ++} ++ ++void acpi_data_free (AcpiData * d) ++{ ++ free(d); ++} ++ ++ ++bool is_thinkpad () ++{ ++ struct stat s; ++ int r = stat(PROC_ACPI_IBM_DIR, &s); ++ return ((r == 0) && S_ISDIR(s.st_mode)); ++} ++ ++static ++void add_row (GtkTable *table, int row, ++ const gchar * label, const gchar * value) ++{ ++ GtkWidget *header = gtk_label_new(label); ++ gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5); ++ gtk_table_attach( ++ table, header, ++ 0, 1, row, row + 1, ++ GTK_FILL, GTK_FILL, 6, 6 ++ ); ++ ++ GtkWidget *label_widget = gtk_label_new(value); ++ gtk_misc_set_alignment(GTK_MISC(label_widget), 0.0, 0.5); ++ gtk_table_attach( ++ table, label_widget, ++ 1, 2, row, row + 1, ++ GTK_FILL, GTK_FILL, 6, 6 ++ ); ++} ++ ++GtkWidget* create_acpi_view (AcpiData * d) ++{ ++ GtkWidget *table; ++ GtkWidget *vbox; ++ GtkWidget *label; ++ ++ vbox = gtk_vbox_new(FALSE, 6); ++ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); ++ ++ label = make_title_label(_("ThinkPad")); ++ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); ++ ++ table = gtk_table_new(5, 2, FALSE); ++ ++ gtk_table_set_row_spacings(GTK_TABLE(table), 6); ++ gtk_table_set_col_spacings(GTK_TABLE(table), 6); ++ gtk_container_set_border_width(GTK_CONTAINER(table), 6); ++ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0); ++ ++ int row = 0; ++ char buf[32]; ++ add_row(GTK_TABLE(table), row++, _("Bluetooth"), ++ enabled_value_to_string (d->bluetooth)); ++ add_row(GTK_TABLE(table), row++, _("Fan"), ++ enabled_value_to_string (d->fan)); ++ snprintf(buf, 32, "%d", d->brightness); ++ add_row(GTK_TABLE(table), row++, _("Screen brightness"), buf); ++ add_row(GTK_TABLE(table), row++, _("In Docking station"), _("no")); ++ add_row(GTK_TABLE(table), row++, _("Lenovo ThinkLight"), ++ onoff_value_to_string (d->thinklight)); ++ ++ snprintf(buf, 32, "%d C", d->cpu_temp); ++ add_row(GTK_TABLE(table), row++, _("CPU Temp"), buf); ++ snprintf(buf, 32, "%d C", d->gpu_temp); ++ add_row(GTK_TABLE(table), row++, _("GPU Temp"), buf); ++ snprintf(buf, 32, "%d C", d->battery_temp); ++ add_row(GTK_TABLE(table), row++, _("Battery Temp"), buf); ++ ++ return vbox; ++} +diff --git a/src/acpiview.h b/src/acpiview.h +new file mode 100644 +index 0000000..276c1eb +--- /dev/null ++++ b/src/acpiview.h +@@ -0,0 +1,45 @@ ++/* Gnome System Monitor - acpiview.h ++ * Copyright (C) 2008 Novell, Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ */ ++ ++#ifndef _GSM_ACPIVIEW_H_ ++#define _GSM_ACPIVIEW_H_ ++ ++#include ++ ++ ++struct AcpiData ++{ ++ int bluetooth; ++ int fan; ++ int brightness; ++ int in_dock; ++ int thinklight; ++ int cpu_temp; ++ int gpu_temp; ++ int battery_temp; ++}; ++ ++AcpiData *acpi_data_new (); ++void acpi_data_init (AcpiData *); ++void acpi_data_free (AcpiData *); ++ ++bool is_thinkpad (); ++GtkWidget* create_acpi_view (AcpiData *); ++ ++#endif +diff --git a/src/interface.cpp b/src/interface.cpp +index 61b9bf1..057a77e 100644 +--- a/src/interface.cpp ++++ b/src/interface.cpp +@@ -41,7 +41,8 @@ + #include "disks.h" + #include "sysinfo.h" + #include "gsm_color_button.h" + #include "hardware.h" ++#include "acpiview.h" + + static void cb_toggle_tree (GtkAction *action, gpointer data); + +@@ -612,9 +613,9 @@ create_main_window (ProcData *procdata) + GtkWidget *menubar; + GtkWidget *main_box; + GtkWidget *notebook; +- GtkWidget *tab_label1, *tab_label2, *tab_label3 , *tab_label4; ++ GtkWidget *tab_label1, *tab_label2, *tab_label3, *tab_label4, *tab_label5; + GtkWidget *vbox1; +- GtkWidget *sys_box, *devices_box, *hardware_box; ++ GtkWidget *sys_box, *devices_box, *hardware_box, *acpi_box; + GtkWidget *sysinfo_box, *sysinfo_label; + + app = gtk_window_new(GTK_WINDOW_TOPLEVEL); +@@ -708,6 +709,15 @@ create_main_window (ProcData *procdata) + tab_label3 = gtk_label_new (_("File Systems")); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), devices_box, tab_label3); + ++ if (is_thinkpad ()) ++ { ++ procdata->acpi = acpi_data_new (); ++ acpi_data_init (procdata->acpi); ++ acpi_box = create_acpi_view (procdata->acpi); ++ tab_label5 = gtk_label_new (_("ThinkPad")); ++ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), acpi_box, tab_label5); ++ } ++ + g_signal_connect (G_OBJECT (notebook), "switch-page", + G_CALLBACK (cb_switch_page), procdata); + g_signal_connect (G_OBJECT (notebook), "change-current-page", +diff --git a/src/procman.h b/src/procman.h +index 9d51eee..c38b681 100644 +--- a/src/procman.h ++++ b/src/procman.h +@@ -36,6 +36,7 @@ + struct ProcInfo; + struct ProcData; + struct LoadGraph; ++struct AcpiData; + + #include "smooth_refresh.h" + #include "prettytable.h" +@@ -218,6 +219,7 @@ struct ProcData + guint64 cpu_total_time; + guint64 cpu_total_time_last; + ++ AcpiData* acpi; + private: + ProcData(); + /* undefined */ ProcData(const ProcData &); diff --git a/gnome-system-monitor.changes b/gnome-system-monitor.changes index 0aa5854..addc9fa 100644 --- a/gnome-system-monitor.changes +++ b/gnome-system-monitor.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Fri Sep 12 01:58:54 EDT 2008 - hfiguiere@suse.de + +- Add gnome-system-monitor-fate304741.diff + * FATE#304741: add a thinkpad ACPI tab. (only on thinkpad) + +------------------------------------------------------------------- +Tue Sep 9 10:24:04 EDT 2008 - hfiguiere@suse.de + +- Add gnome-system-monitor-fate302198.diff + * FATE 302198: add a hardware tab in g-s-m. + * new requirements: hal and hwinfo. + * call autoreconf in the spec. + ------------------------------------------------------------------- Tue Sep 01 23:25:58 CEST 2008 - mboman@novell.com diff --git a/gnome-system-monitor.spec b/gnome-system-monitor.spec index 21c6b95..d32196f 100644 --- a/gnome-system-monitor.spec +++ b/gnome-system-monitor.spec @@ -25,11 +25,16 @@ BuildRequires: gnome-icon-theme-devel gnome-vfs2-devel gtk2-devel BuildRequires: gtkmm2-devel intltool libglade2-devel libgnomeui-devel BuildRequires: libgtop-devel librsvg-devel libwnck-devel libxml2-devel BuildRequires: perl-XML-Parser scrollkeeper update-desktop-files +BuildRequires: hal-devel hwinfo-devel License: GPL v2 or later Group: System/GUI/GNOME Version: 2.23.91 -Release: 1 +Release: 5 Source0: ftp://ftp.gnome.org/pub/GNOME/sources/gnome-system-monitor/2.20/%{name}-%{version}.tar.bz2 +# FATE 302198 - hfiguiere@novell.com +Patch0: gnome-system-monitor-fate302198.diff +# FATE 304741 - hfiguiere@novell.com +Patch1: gnome-system-monitor-fate304741.diff Url: http://www.gnome.org BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: A Simple Process Monitor @@ -51,8 +56,11 @@ Authors: %lang_package %prep %setup -q +%patch0 +%patch1 -p1 %build +autoreconf -si %configure \ --disable-scrollkeeper \ --enable-pcrecpp @@ -90,17 +98,25 @@ rm -rf $RPM_BUILD_ROOT %files lang -f %{name}.lang %changelog -* Tue Sep 02 2008 mboman@novell.com +* Fri Sep 12 2008 hfiguiere@suse.de +- Add gnome-system-monitor-fate304741.diff + * FATE#304741: add a thinkpad ACPI tab. (only on thinkpad) +* Tue Sep 09 2008 hfiguiere@suse.de +- Add gnome-system-monitor-fate302198.diff + * FATE 302198: add a hardware tab in g-s-m. + * new requirements: hal and hwinfo. + * call autoreconf in the spec. +* Mon Sep 01 2008 mboman@novell.com - Update to version 2.23.91: + Fixed bgo#549383 – network assertion in the resource tab. -* Wed Aug 27 2008 mboman@novell.com +* Tue Aug 26 2008 mboman@novell.com - Update to version 2.23.90: + Fixed truncated process names. -* Wed Aug 06 2008 captain.magnus@opensuse.org +* Tue Aug 05 2008 captain.magnus@opensuse.org - Update to version 2.23.6: + Don't segfault in the disk list when icon cannot be retried from gvfs. + Fixed network speed when there are pseudo-devices with no address. -* Thu Jun 26 2008 maw@suse.de +* Wed Jun 25 2008 maw@suse.de - Update to version 2.23.3: + New option to start with the system tab + Port to gio @@ -109,7 +125,7 @@ rm -rf $RPM_BUILD_ROOT - Drop the following upstreamed patches: gnome-system-monitor-sysinfo.patch and gnome-system-monitor-performance.patch. -* Fri May 09 2008 jpr@suse.de +* Thu May 08 2008 jpr@suse.de - Update to version 2.22.1 * lsof: don't crash on invalid regex (#524162). * graphs: fixed the time scale (#521394). @@ -120,7 +136,7 @@ rm -rf $RPM_BUILD_ROOT + Updated translations. * Thu Mar 13 2008 sbrabec@suse.cz - Custom look'n'feel gconf keys moved to gconf2-branding-openSUSE. -* Wed Mar 05 2008 maw@suse.de +* Tue Mar 04 2008 maw@suse.de - Update to version 2.21.92: + Dropped dependency on pcrecpp (and thus drop pcre-devel from BuildRequires) @@ -165,7 +181,7 @@ rm -rf $RPM_BUILD_ROOT + Build fix + Fixed logo mis-rendering in the system info tab (b.g.o [#405739]). -* Fri Aug 31 2007 sreeves@suse.de +* Thu Aug 30 2007 sreeves@suse.de - fix for #253997 * Tue Aug 07 2007 maw@suse.de - Split off a -lang subpackage. @@ -197,12 +213,12 @@ rm -rf $RPM_BUILD_ROOT buildrequire pcre-devel. * Fri Apr 27 2007 sbrabec@suse.cz - Do not call meinproc (#227624). -* Thu Apr 12 2007 maw@suse.de +* Wed Apr 11 2007 maw@suse.de - Update to version 2.18.1 - Minor code cleanups - Improved startup time - Updated translations. -* Thu Apr 05 2007 maw@suse.de +* Wed Apr 04 2007 maw@suse.de - Update to version 2.18.0 - Cleaned up .desktop files - b.g.o 413919, 412953, and 409427. @@ -256,7 +272,7 @@ rm -rf $RPM_BUILD_ROOT - Fixed gksu password prompt - Fixed a small memory leak - Fixed schema -* Thu Aug 31 2006 jhargadon@suse.de +* Wed Aug 30 2006 jhargadon@suse.de - update to version 2.15.92 - Fixed LoadGraph overlay - Fixed tiny leak @@ -278,7 +294,7 @@ rm -rf $RPM_BUILD_ROOT - Fixed a couple of small leaks. * Thu Jul 20 2006 jpr@suse.de - Call aclocal to fix build after altering configure.in in %%prep -* Wed Jun 07 2006 jimmyk@suse.de +* Tue Jun 06 2006 jimmyk@suse.de - Modify existing gnome-system-monitor-sysinfo.patch to properly parse /proc/cpuinfo on ppc architecture and avoid crashing, BNC #179031. * Mon May 22 2006 jpr@suse.de @@ -305,11 +321,11 @@ rm -rf $RPM_BUILD_ROOT - added system info tab (BNC #67255) * Wed Jan 25 2006 mls@suse.de - converted neededforbuild to BuildRequires -* Thu Dec 01 2005 gekker@suse.de +* Wed Nov 30 2005 gekker@suse.de - Update to version 2.12.2 * Thu Oct 13 2005 gekker@suse.de - Update to version 2.12.1 -* Tue Sep 06 2005 gekker@suse.de +* Mon Sep 05 2005 gekker@suse.de - Update to version 2.12.0 (GNOME 2.12) * Tue Aug 23 2005 gekker@suse.de - Update to version 2.11.92 @@ -317,14 +333,14 @@ rm -rf $RPM_BUILD_ROOT - Update to 2.11.91 * Tue Aug 02 2005 gekker@suse.de - Update to version 2.11.90 -* Sat Jul 23 2005 gekker@suse.de +* Fri Jul 22 2005 gekker@suse.de - Update to version 2.11.5 -* Tue Jun 21 2005 gekker@suse.de +* Mon Jun 20 2005 gekker@suse.de - Update to version 2.11.3 * Wed Mar 16 2005 clahey@suse.de - Remove patch to remove icon. - Add patch to fix menu name. -* Thu Mar 10 2005 gekker@suse.de +* Wed Mar 09 2005 gekker@suse.de - Update to version 2.10.0 (GNOME 2.10). * Thu Mar 03 2005 gekker@suse.de - Update to version 2.9.92 @@ -333,13 +349,13 @@ rm -rf $RPM_BUILD_ROOT - Update to version 2.9.91 * Fri Feb 04 2005 hhetter@suse.de - updated to version 2.9.90 -* Thu Nov 25 2004 ro@suse.de +* Wed Nov 24 2004 ro@suse.de - added suse_update_desktop_file * Fri Nov 19 2004 ro@suse.de - update to 2.8.0 (makes it build with recent gtk2) * Tue Nov 02 2004 ro@suse.de - locale rename: no -> nb -* Fri Aug 27 2004 clahey@suse.de +* Thu Aug 26 2004 clahey@suse.de - Cache gnome-system-monitor help and show gnome-system-monitor in khelpcenter. * Fri Apr 30 2004 hhetter@suse.de - updated to 2.6.0 [GNOME2.6]