diff options
author | monsta <[email protected]> | 2016-11-23 21:46:17 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-11-23 21:46:17 +0300 |
commit | 5ec8b38b3706e5014316d17ddbf46b64e4bafc9b (patch) | |
tree | f75c33455aed0ce4cb6dc76e9dbfc81556d86028 | |
parent | 6bbbccfde430a26b4d288a97117c87c622986f69 (diff) | |
download | mate-sensors-applet-5ec8b38b3706e5014316d17ddbf46b64e4bafc9b.tar.bz2 mate-sensors-applet-5ec8b38b3706e5014316d17ddbf46b64e4bafc9b.tar.xz |
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require mate-panel >= 1.17
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | configure.ac | 29 | ||||
-rw-r--r-- | sensors-applet/active-sensor.c | 22 | ||||
-rw-r--r-- | sensors-applet/active-sensor.h | 4 | ||||
-rw-r--r-- | sensors-applet/sensor-config-dialog.c | 20 | ||||
-rw-r--r-- | sensors-applet/sensors-applet.c | 27 |
7 files changed, 18 insertions, 89 deletions
diff --git a/Makefile.am b/Makefile.am index e60dd16..3776231 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,9 +49,6 @@ DISTCLEANFILES = intltool-extract \ intltool-merge \ intltool-update -DISTCHECK_CONFIGURE_FLAGS = \ - --with-gtk=$(GTK_API_VERSION) - # Build ChangeLog from GIT history ChangeLog: $(AM_V_GEN) if test -d $(top_srcdir)/.git; then \ @@ -1,3 +1,5 @@ +1.17.0 + 1.16.0 * Make distcheck use currently selected GTK+ version diff --git a/configure.ac b/configure.ac index d670165..649f71d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # ================= initialization =================== # -AC_INIT([MATE Sensors Applet], [1.16.0], [http://www.mate-desktop.org], +AC_INIT([MATE Sensors Applet], [1.17.0], [http://www.mate-desktop.org], [mate-sensors-applet]) AC_CONFIG_SRCDIR([sensors-applet/main.c]) @@ -48,39 +48,18 @@ AC_CHECK_HEADERS( ) GLIB_REQUIRED=2.36.0 -LIBPANEL_REQUIRED=1.1.0 +GTK_REQUIRED=3.14.0 +LIBPANEL_REQUIRED=1.17.0 LIBNOTIFY_REQUIRED=0.7.0 LIBCAIRO_REQUIRED=1.0.4 LIBDBUSGLIB_REQUIRED=0.80 LIBATASMART_REQUIRED=0.16 -# ================= GTK+ API version ================= # -AC_MSG_CHECKING([which gtk+ version to compile against]) -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], - [case "$with_gtk" in - 2.0|3.0) ;; - *) AC_MSG_ERROR([invalid gtk version specified]) ;; - esac], - [with_gtk=2.0]) -AC_MSG_RESULT([$with_gtk]) - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - GTK_REQUIRED=2.24.0 - ;; - 3.0) GTK_API_VERSION=3.0 - GTK_REQUIRED=3.0.0 - ;; -esac - -AC_SUBST(GTK_API_VERSION) - PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gio-2.0) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) -PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) +PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) 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; |