summaryrefslogtreecommitdiff
path: root/sensors-applet
diff options
context:
space:
mode:
Diffstat (limited to 'sensors-applet')
-rw-r--r--sensors-applet/active-sensor.c22
-rw-r--r--sensors-applet/active-sensor.h4
-rw-r--r--sensors-applet/sensor-config-dialog.c20
-rw-r--r--sensors-applet/sensors-applet.c27
4 files changed, 12 insertions, 61 deletions
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c
index f542055..91456da 100644
--- a/sensors-applet/active-sensor.c
+++ b/sensors-applet/active-sensor.c
@@ -348,33 +348,16 @@ void active_sensor_destroy(ActiveSensor *active_sensor) {
g_free(active_sensor);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gboolean graph_draw_cb(GtkWidget *graph,
cairo_t *cr,
gpointer data) {
-#else
-gboolean graph_expose_event_cb(GtkWidget *graph,
- GdkEventExpose *event,
- gpointer data) {
-#endif
ActiveSensor *as;
as = (ActiveSensor *)data;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr;
- cr = gdk_cairo_create (event->window);
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-#endif
-
active_sensor_update_graph(as, cr);
/* propagate event onwards */
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
@@ -469,13 +452,8 @@ ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
(horizontal ? sensors_applet->size : graph_size));
g_signal_connect(G_OBJECT(active_sensor->graph),
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK(graph_draw_cb),
-#else
- "expose_event",
- G_CALLBACK(graph_expose_event_cb),
-#endif
active_sensor);
active_sensor->updated = FALSE;
diff --git a/sensors-applet/active-sensor.h b/sensors-applet/active-sensor.h
index 3147367..375fa75 100644
--- a/sensors-applet/active-sensor.h
+++ b/sensors-applet/active-sensor.h
@@ -36,11 +36,7 @@ struct _ActiveSensor {
GtkWidget *graph;
GtkWidget *graph_frame;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA graph_color;
-#else
- GdkColor graph_color;
-#endif
GtkTreeRowReference *sensor_row;
diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c
index d45df9c..bc25dbb 100644
--- a/sensors-applet/sensor-config-dialog.c
+++ b/sensors-applet/sensor-config-dialog.c
@@ -325,7 +325,6 @@ static void sensor_config_dialog_graph_color_set(GtkColorButton *color_button,
GtkTreeIter iter;
GtkWidget *content_area;
gchar *color_string;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
gtk_color_button_get_rgba(color_button,
@@ -334,15 +333,6 @@ static void sensor_config_dialog_graph_color_set(GtkColorButton *color_button,
color_string = g_strdup_printf ("#%02X%02X%02X", (int)(0.5 + CLAMP (color.red, 0., 1.) * 255.),
(int)(0.5 + CLAMP (color.green, 0., 1.) * 255.),
(int)(0.5 + CLAMP (color.blue, 0., 1.) * 255.));
-#else
- GdkColor color;
-
- gtk_color_button_get_color(color_button,
- &color);
-
- color_string = g_strdup_printf("#%02X%02X%02X", color.red / 256,
- color.green / 256, color.blue / 256);
-#endif
gtk_tree_selection_get_selected(config_dialog->sensors_applet->selection,
&model,
@@ -371,12 +361,7 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) {
GtkListStore *icon_store;
IconType count;
GdkPixbuf *pixbuf;
-
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA graph_color;
-#else
- GdkColor graph_color;
-#endif
gchar *sensor_label;
gchar *header_text;
@@ -444,13 +429,8 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) {
g_free(header_text);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse(&graph_color, graph_color_string);
config_dialog->graph_color_button = GTK_COLOR_BUTTON(gtk_color_button_new_with_rgba(&graph_color));
-#else
- gdk_color_parse(graph_color_string, &graph_color);
- config_dialog->graph_color_button = GTK_COLOR_BUTTON(gtk_color_button_new_with_color(&graph_color));
-#endif
config_dialog->graph_color_button_aligner = g_object_new(GTK_TYPE_ALIGNMENT,
"child", config_dialog->graph_color_button,
"xalign", 0.0,
diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c
index b4f58cc..7ee04c7 100644
--- a/sensors-applet/sensors-applet.c
+++ b/sensors-applet/sensors-applet.c
@@ -50,9 +50,6 @@
* real value is stored */
#define COLUMN_SPACING 2
#define ROW_SPACING 1
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_widget_size_request(X,Y) gtk_widget_get_preferred_size(X,Y,NULL)
-#endif
/* callbacks for panel menu */
static void prefs_cb(GtkAction *action,
@@ -525,8 +522,8 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) {
switch (display_mode) {
case DISPLAY_VALUE:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->value),
+ &req, NULL);
value_width = req.width + COLUMN_SPACING;
value_height = req.height + ROW_SPACING;
@@ -548,14 +545,14 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) {
/* even though we end up packing the event boxes into the
* panel, these dont give back request sizes, so need to ask
* widgets directly */
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->value),
+ &req, NULL);
value_width = req.width + COLUMN_SPACING;
value_height = req.height + ROW_SPACING;
- gtk_widget_size_request(GTK_WIDGET(first_sensor->label),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->label),
+ &req, NULL);
label_width = req.width + COLUMN_SPACING;
label_height = req.height + ROW_SPACING;
@@ -586,13 +583,13 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) {
break;
case DISPLAY_ICON_WITH_VALUE:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->value),
+ &req, NULL);
value_width = req.width + COLUMN_SPACING;
value_height = req.height + ROW_SPACING;
- gtk_widget_size_request(GTK_WIDGET(first_sensor->icon),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->icon),
+ &req, NULL);
icon_width = req.width + COLUMN_SPACING;
icon_height = req.height + ROW_SPACING;
@@ -618,8 +615,8 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) {
break;
case DISPLAY_ICON:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->icon),
- &req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(first_sensor->icon),
+ &req, NULL);
icon_width = req.width + COLUMN_SPACING;
icon_height = req.height + ROW_SPACING;