Logo Search packages:      
Sourcecode: hardware-monitor version File versions  Download package


/* The preferences window.
 * Copyright (c) 2003, 04 Ole Laursen.
 * 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
 * GNU General Public License for more details.
 * You should have received a copy of the GNU 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 <memory>
#include <vector>

#include <libglademm/xml.h>
#include <sigc++/trackable.h>
#include <sigc++/connection.h>
#include <gconfmm/entry.h>
#include <gtkmm/button.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/label.h>
#include <gtkmm/liststore.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/scale.h>
#include <gtkmm/treeview.h>
#include <gtkmm/window.h>

#include <libgnomeuimm/color-picker.h>
#include <libgnomeuimm/font-picker.h>

#include "monitor.hpp"

class Applet;

class PreferencesWindow: public sigc::trackable
  PreferencesWindow(Applet &applet, monitor_seq monitors);

  void show();
  Glib::RefPtr<Gnome::Glade::Xml> ui;

  Gtk::Window *window;
  Gtk::SpinButton *update_interval_spinbutton;
  Gtk::RadioButton *panel_background_radiobutton;
  Gtk::RadioButton *background_color_radiobutton;
  Gnome::UI::ColorPicker *background_colorpicker;
  Gtk::RadioButton *curve_radiobutton;
  Gtk::RadioButton *bar_radiobutton;
  Gtk::RadioButton *column_radiobutton;
  Gtk::RadioButton *text_radiobutton;
  Gtk::RadioButton *flame_radiobutton;

  Gtk::Widget *size_outer_vbox;
  Gtk::Scale *size_scale;
  Gtk::Widget *font_outer_vbox;
  Gtk::CheckButton *font_checkbutton;
  Gnome::UI::FontPicker *fontpicker;

  Gtk::Button *remove_button;
  Gtk::Button *change_button;
  Gtk::TreeView *monitor_treeview;
  Gtk::Widget *monitor_options;

  Gtk::Widget *monitor_curve_options;
  Gnome::UI::ColorPicker *line_colorpicker;
  Gtk::Widget *monitor_bar_options;
  Gnome::UI::ColorPicker *bar_colorpicker;
  Gtk::Widget *monitor_column_options;
  Gnome::UI::ColorPicker *column_colorpicker;
  Gtk::Widget *monitor_flame_options;
  Gnome::UI::ColorPicker *flame_colorpicker;
  class MonitorColumns: public Gtk::TreeModel::ColumnRecord
    Gtk::TreeModelColumn<Glib::ustring> name;
    Gtk::TreeModelColumn<Monitor *> monitor;

    MonitorColumns() { add(name); add(monitor); }
  Glib::RefPtr<Gtk::ListStore> monitor_store;
  typedef Gtk::ListStore::iterator store_iter;
  // GConf
  void viewer_type_listener(unsigned int, Gnome::Conf::Entry entry);
  void background_color_listener(unsigned int, Gnome::Conf::Entry entry);
  void use_background_color_listener(unsigned int, Gnome::Conf::Entry entry);
  void size_listener(unsigned int, Gnome::Conf::Entry entry);
  void font_listener(unsigned int, Gnome::Conf::Entry entry);
  void monitor_color_listener(unsigned int, Gnome::Conf::Entry entry);

  void stop_monitor_listeners();
  std::vector<unsigned int> monitor_listeners;

  // GUI
  void on_background_colorpicker_set(unsigned int r, unsigned int g,
                             unsigned int b, unsigned int a);
  void on_background_color_radiobutton_toggled();
  void on_curve_radiobutton_toggled();
  void on_bar_radiobutton_toggled();
  void on_column_radiobutton_toggled();
  void on_text_radiobutton_toggled();
  void on_flame_radiobutton_toggled();
  void on_size_scale_changed();
  sigc::connection size_scale_cb; 
  void on_font_checkbutton_toggled();
  void on_fontpicker_set(const Glib::ustring &font);

  void on_add_button_clicked();
  void on_remove_button_clicked();
  void on_change_button_clicked();
  void on_selection_changed();

  void on_monitor_colorpicker_set(unsigned int r, unsigned int g,
                          unsigned int b, unsigned int a);

  void on_close_button_clicked();
  bool on_closed(GdkEventAny *);

  Monitor *run_choose_monitor_window(const Glib::ustring &str);
  void add_to_monitors_list(Monitor *monitor);
  // for converting between size_scale units and pixels
  int size_scale_to_pixels(int size);
  int pixels_to_size_scale(int pixels);
  Applet &applet;


Generated by  Doxygen 1.6.0   Back to index