~ubuntu-branches/ubuntu/intrepid/gnome-system-monitor/intrepid

« back to all changes in this revision

Viewing changes to src/util.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-12-05 10:25:51 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20071205102551-m8c9vlj9hq1cm6dv
Tags: 2.21.3-0ubuntu1
* New upstream version:
  - Performance improvement in the process list
  - Removed space to the left of process name.
  - Requires GTK+ >= 2.12.
  - Documentation update
* debian/control.in:
 - updated GTK requirement

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: c++ -*-
 
2
 
1
3
#ifndef H_GNOME_SYSTEM_MONITOR_UTIL_1123178725
2
4
#define H_GNOME_SYSTEM_MONITOR_UTIL_1123178725
3
5
 
103
105
  {
104
106
    memset(&t, c, sizeof t);
105
107
  }
 
108
 
 
109
 
 
110
 
 
111
  //
 
112
  // Stuff to update a tree_store in a smart way
 
113
  //
 
114
 
 
115
  template<typename T>
 
116
  void tree_store_update(GtkTreeModel* model, GtkTreeIter* iter, int column, const T& new_value)
 
117
  {
 
118
    T current_value;
 
119
 
 
120
    gtk_tree_model_get(model, iter, column, &current_value, -1);
 
121
 
 
122
    if (current_value != new_value)
 
123
      gtk_tree_store_set(GTK_TREE_STORE(model), iter, column, new_value, -1);
 
124
  }
 
125
 
 
126
  // undefined
 
127
  // catch every thing about pointers
 
128
  // just to make sure i'm not doing anything wrong
 
129
  template<typename T>
 
130
  void tree_store_update(GtkTreeModel* model, GtkTreeIter* iter, int column, T* new_value);
 
131
 
 
132
  // specialized versions for strings
 
133
  template<>
 
134
  void tree_store_update<const char>(GtkTreeModel* model, GtkTreeIter* iter, int column, const char* new_value);
 
135
 
 
136
  template<>
 
137
  inline void tree_store_update<char>(GtkTreeModel* model, GtkTreeIter* iter, int column, char* new_value)
 
138
  {
 
139
    tree_store_update<const char>(model, iter, column, new_value);
 
140
  }
106
141
}
107
142
 
108
143