summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-22 00:00:24 +0300
committermonsta <[email protected]>2016-11-22 00:00:24 +0300
commitce1cbb1ec0c2ca72457fedb88aef870b9a5036fd (patch)
treea149506e95dcde4970f0281867668294d7909091
parentc1c672e45ffa331677a582289691e079cdde5138 (diff)
downloadmate-power-manager-ce1cbb1ec0c2ca72457fedb88aef870b9a5036fd.tar.bz2
mate-power-manager-ce1cbb1ec0c2ca72457fedb88aef870b9a5036fd.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.am3
-rw-r--r--NEWS2
-rw-r--r--README5
-rw-r--r--applets/brightness/Makefile.am1
-rw-r--r--applets/brightness/brightness-applet.c119
-rw-r--r--applets/inhibit/Makefile.am1
-rw-r--r--applets/inhibit/inhibit-applet.c49
-rw-r--r--configure.ac59
-rw-r--r--src/Makefile.am18
-rw-r--r--src/egg-unique.c151
-rw-r--r--src/egg-unique.h59
-rw-r--r--src/gpm-backlight.c15
-rw-r--r--src/gpm-button.c4
-rw-r--r--src/gpm-graph-widget.c81
-rw-r--r--src/gpm-idle.c1
-rw-r--r--src/gpm-kbd-backlight.c15
-rw-r--r--src/gpm-prefs-core.c10
-rw-r--r--src/gpm-prefs-core.h4
-rw-r--r--src/gpm-prefs.c50
-rw-r--r--src/gpm-statistics.c44
-rw-r--r--src/gpm-tray-icon.c2
-rw-r--r--src/gsd-media-keys-window.c52
-rw-r--r--src/msd-osd-window.c290
-rw-r--r--src/msd-osd-window.h17
24 files changed, 18 insertions, 1034 deletions
diff --git a/Makefile.am b/Makefile.am
index 1e174e7..eb1f0f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,8 +35,7 @@ DISTCLEANFILES = \
DISTCHECK_CONFIGURE_FLAGS = \
--disable-schemas-install \
--disable-applets \
- --disable-tests \
- --with-gtk=$(GTK_API_VERSION)
+ --disable-tests
# Build ChangeLog from GIT history
ChangeLog:
diff --git a/NEWS b/NEWS
index 5ef94d9..eb99a39 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+Version 1.17.0
+
Version 1.16.0
~~~~~~~~~~~~~~
Released: 2016-09-19
diff --git a/README b/README
index 1a66e2b..3973872 100644
--- a/README
+++ b/README
@@ -14,13 +14,12 @@ MATE Power Manager comes in three main parts:
To build, MATE Power Manager requires
- Glib (2.36.0 or later)
- - Gtk2+ (2.24.0 or later)
+ - GTK+3 (3.14.0 or later)
- GNOME Keyring (3.0.0 or later)
- DBus (0.70 or later)
- libnotify (0.7.0 or later)
- Cairo (1.0.0 or later)
- - Unique (0.9.4 or later)
- - libmate-panel-applet (1.5.0 or later)
+ - libmate-panel-applet (1.17.0 or later)
- xrandr (1.3.0 or later)
- Canberra (0.10 or later)
- UPower (0.9.5 or later)
diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am
index 026133d..7962787 100644
--- a/applets/brightness/Makefile.am
+++ b/applets/brightness/Makefile.am
@@ -5,7 +5,6 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(PANEL_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
- $(GTKUNIQUE_CFLAGS) \
-DBINDIR=\"$(bindir)\" \
-DMATELOCALEDIR=\""$(datadir)/locale"\" \
-DDATADIR=\"$(datadir)\" \
diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c
index 5cd7f6b..8e5345d 100644
--- a/applets/brightness/brightness-applet.c
+++ b/applets/brightness/brightness-applet.c
@@ -85,11 +85,7 @@ static void gpm_applet_check_size (GpmBrightnessApplet *applet);
static gboolean gpm_applet_draw_cb (GpmBrightnessApplet *applet);
static void gpm_applet_change_background_cb (GpmBrightnessApplet *applet,
MatePanelAppletBackgroundType arg1,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *arg2, gpointer data);
-#else
- GdkColor *arg2, GdkPixmap *arg3, gpointer data);
-#endif
static void gpm_applet_theme_change_cb (GtkIconTheme *icon_theme, gpointer data);
static void gpm_applet_stop_scroll_events_cb (GtkWidget *widget, GdkEvent *event);
static gboolean gpm_applet_destroy_popup_cb (GpmBrightnessApplet *applet);
@@ -263,16 +259,10 @@ static gboolean
gpm_applet_draw_cb (GpmBrightnessApplet *applet)
{
gint w, h, bg_type;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
cairo_t *cr;
cairo_pattern_t *pattern;
GtkStyleContext *context;
-#else
- GdkColor color;
- GdkGC *gc;
- GdkPixmap *background;
-#endif
GtkAllocation allocation;
if (gtk_widget_get_window (GTK_WIDGET(applet)) == NULL) {
@@ -295,74 +285,38 @@ gpm_applet_draw_cb (GpmBrightnessApplet *applet)
w = allocation.width;
h = allocation.height;
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET(applet)));
-#else
- gc = gdk_gc_new (gtk_widget_get_window (GTK_WIDGET(applet)));
-#endif
/* draw pixmap background */
-#if GTK_CHECK_VERSION (3, 0, 0)
bg_type = mate_panel_applet_get_background (MATE_PANEL_APPLET (applet), &color, &pattern);
-#else
- bg_type = mate_panel_applet_get_background (MATE_PANEL_APPLET (applet), &color, &background);
-#endif
if (bg_type == PANEL_PIXMAP_BACKGROUND && !applet->popped) {
/* fill with given background pixmap */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source (cr, pattern);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
-#else
- gdk_draw_drawable (gtk_widget_get_window (GTK_WIDGET(applet)), gc, background, 0, 0, 0, 0, w, h);
-#endif
}
/* draw color background */
if (bg_type == PANEL_COLOR_BACKGROUND && !applet->popped) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
-#else
- gdk_gc_set_rgb_fg_color (gc,&color);
- gdk_gc_set_fill (gc,GDK_SOLID);
- gdk_draw_rectangle (gtk_widget_get_window (GTK_WIDGET(applet)), gc, TRUE, 0, 0, w, h);
-#endif
}
/* fill with selected color if popped */
if (applet->popped) {
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (GTK_WIDGET(applet));
gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
-#else
- color = gtk_rc_get_style (GTK_WIDGET(applet))->bg[GTK_STATE_SELECTED];
- gdk_gc_set_rgb_fg_color (gc,&color);
- gdk_gc_set_fill (gc,GDK_SOLID);
- gdk_draw_rectangle (gtk_widget_get_window (GTK_WIDGET(applet)), gc, TRUE, 0, 0, w, h);
-#endif
}
/* draw icon at center */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_pixbuf (cr, applet->icon, (w - applet->icon_width)/2, (h - applet->icon_height)/2);
cairo_paint (cr);
-#else
- gdk_draw_pixbuf (gtk_widget_get_window (GTK_WIDGET(applet)), gc, applet->icon,
- 0, 0, (w - applet->icon_width)/2, (h - applet->icon_height)/2,
- applet->icon_width, applet->icon_height,
- GDK_RGB_DITHER_NONE, 0, 0);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr);
-#else
- g_object_unref (gc);
-#endif
return TRUE;
}
@@ -375,11 +329,7 @@ gpm_applet_draw_cb (GpmBrightnessApplet *applet)
static void
gpm_applet_change_background_cb (GpmBrightnessApplet *applet,
MatePanelAppletBackgroundType arg1,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *arg2, gpointer data)
-#else
- GdkColor *arg2, GdkPixmap *arg3, gpointer data)
-#endif
{
gtk_widget_queue_draw (GTK_WIDGET (applet));
}
@@ -527,11 +477,7 @@ gpm_applet_key_press_cb (GpmBrightnessApplet *applet, GdkEventKey *event)
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gtk_grab_remove (GTK_WIDGET(applet));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_state_flags (GTK_WIDGET(applet), GTK_STATE_FLAG_NORMAL, TRUE);
-#else
- gtk_widget_set_state (GTK_WIDGET(applet), GTK_STATE_NORMAL);
-#endif
gtk_widget_hide (applet->popup);
applet->popped = FALSE;
gpm_applet_draw_cb (applet);
@@ -602,7 +548,6 @@ gpm_applet_scroll_cb (GpmBrightnessApplet *applet, GdkEventScroll *event)
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* on_popup_button_press:
* @applet: Brightness applet instance
@@ -631,7 +576,6 @@ on_popup_button_press (GtkWidget *widget,
return FALSE;
}
-#endif
/**
* gpm_applet_create_popup:
@@ -649,18 +593,10 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
/* slider */
if (MATE_PANEL_APPLET_VERTICAL(orientation)) {
-#if GTK_CHECK_VERSION (3, 0, 0)
applet->slider = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
-#else
- applet->slider = gtk_hscale_new_with_range (0, 100, 1);
-#endif
gtk_widget_set_size_request (applet->slider, 100, -1);
} else {
-#if GTK_CHECK_VERSION (3, 0, 0)
applet->slider = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 0, 100, 1);
-#else
- applet->slider = gtk_vscale_new_with_range (0, 100, 1);
-#endif
gtk_widget_set_size_request (applet->slider, -1, 100);
}
gtk_range_set_inverted (GTK_RANGE(applet->slider), TRUE);
@@ -682,17 +618,9 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
/* box */
if (MATE_PANEL_APPLET_VERTICAL(orientation)) {
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
-#else
- box = gtk_hbox_new (FALSE, 1);
-#endif
} else {
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
-#else
- box = gtk_vbox_new (FALSE, 1);
-#endif
}
gtk_box_pack_start (GTK_BOX(box), applet->btn_plus, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX(box), applet->slider, TRUE, TRUE, 0);
@@ -705,25 +633,16 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
/* window */
applet->popup = gtk_window_new (GTK_WINDOW_POPUP);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GTK_WIDGET_UNSET_FLAGS (applet->popup, GTK_TOPLEVEL);
-#endif
gtk_window_set_type_hint (GTK_WINDOW(applet->popup), GDK_WINDOW_TYPE_HINT_UTILITY);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_set_parent (applet->popup, GTK_WIDGET(applet));
-#endif
gtk_container_add (GTK_CONTAINER(applet->popup), frame);
-#if GTK_CHECK_VERSION (3, 0, 0)
/* window events */
g_signal_connect (G_OBJECT(applet->popup), "button-press-event",
G_CALLBACK (on_popup_button_press), applet);
g_signal_connect (G_OBJECT(applet->popup), "key-press-event",
G_CALLBACK(gpm_applet_key_press_cb), applet);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
/* Set volume control frame, slider and toplevel window to follow panel volume control theme */
GtkWidget *toplevel = gtk_widget_get_toplevel (frame);
GtkStyleContext *context;
@@ -733,7 +652,6 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
gtk_widget_set_visual(GTK_WIDGET(toplevel), visual);
-#endif
}
/**
@@ -747,13 +665,11 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
{
GtkAllocation allocation, popup_allocation;
gint orientation, x, y;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *window;
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *pointer;
GdkDevice *keyboard;
-#endif
/* react only to left mouse button */
if (event->button != 1) {
@@ -762,36 +678,19 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
/* if yet popped, release focus and hide then redraw applet unselected */
if (applet->popped) {
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET(applet));
- gtk_widget_set_state (GTK_WIDGET(applet), GTK_STATE_NORMAL);
-#endif
gtk_widget_hide (applet->popup);
applet->popped = FALSE;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gpm_applet_draw_cb (applet);
-#endif
gpm_applet_update_tooltip (applet);
return TRUE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/* don't show the popup if brightness is unavailable */
if (applet->level == -1) {
return FALSE;
}
-#else
- /* update UI for current brightness */
- gpm_applet_update_popup_level (applet);
-#endif
/* otherwise pop */
applet->popped = TRUE;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gpm_applet_draw_cb (applet);
-#endif
/* create a new popup (initial or if panel parameters changed) */
if (applet->popup == NULL) {
@@ -839,7 +738,6 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
gtk_window_move (GTK_WINDOW (applet->popup), x, y);
/* grab input */
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_widget_get_window (GTK_WIDGET (applet->popup));
display = gdk_window_get_display (window);
device_manager = gdk_display_get_device_manager (display);
@@ -853,18 +751,6 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
GDK_OWNERSHIP_NONE, TRUE,
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
NULL, GDK_CURRENT_TIME);
-#else
- gtk_widget_grab_focus (GTK_WIDGET(applet));
- gtk_grab_add (GTK_WIDGET(applet));
- gdk_pointer_grab (gtk_widget_get_window (GTK_WIDGET(applet)), TRUE,
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK,
- NULL, NULL, GDK_CURRENT_TIME);
- gdk_keyboard_grab (gtk_widget_get_window (GTK_WIDGET(applet)),
- TRUE, GDK_CURRENT_TIME);
- gtk_widget_set_state (GTK_WIDGET(applet), GTK_STATE_SELECTED);
-#endif
return TRUE;
}
@@ -1150,13 +1036,8 @@ gpm_brightness_applet_init (GpmBrightnessApplet *applet)
/* We use g_signal_connect_after because letting the panel draw
* the background is the only way to have the correct
* background when a theme defines a background picture. */
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect_after (G_OBJECT(applet), "draw",
G_CALLBACK(gpm_applet_draw_cb), NULL);
-#else
- g_signal_connect_after (G_OBJECT(applet), "expose-event",
- G_CALLBACK(gpm_applet_draw_cb), NULL);
-#endif
g_signal_connect (G_OBJECT(applet), "change-background",
G_CALLBACK(gpm_applet_change_background_cb), NULL);
diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am
index cc5d2d7..111ab2b 100644
--- a/applets/inhibit/Makefile.am
+++ b/applets/inhibit/Makefile.am
@@ -5,7 +5,6 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(PANEL_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
- $(GTKUNIQUE_CFLAGS) \
-DBINDIR=\"$(bindir)\" \
-DMATELOCALEDIR=\""$(datadir)/locale"\" \
-DDATADIR=\"$(datadir)\" \
diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c
index 8acec87..1c3f836 100644
--- a/applets/inhibit/inhibit-applet.c
+++ b/applets/inhibit/inhibit-applet.c
@@ -248,27 +248,16 @@ static gboolean
gpm_applet_draw_cb (GpmInhibitApplet *applet)
{
gint w, h, bg_type;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
cairo_t *cr;
cairo_pattern_t *pattern;
GtkStyleContext *context;
-#else
- GdkColor color;
- GdkGC *gc;
- GdkPixmap *background;
-#endif
GtkAllocation allocation;
if (gtk_widget_get_window (GTK_WIDGET(applet)) == NULL) {
return FALSE;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* Clear the window so we can draw on it later */
- gdk_window_clear(gtk_widget_get_window (GTK_WIDGET (applet)));
-#endif
-
/* retrieve applet size */
gpm_applet_get_icon (applet);
gpm_applet_check_size (applet);
@@ -285,58 +274,29 @@ gpm_applet_draw_cb (GpmInhibitApplet *applet)
w = allocation.width;
h = allocation.height;
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET(applet)));
-#else
- gc = gdk_gc_new (gtk_widget_get_window (GTK_WIDGET(applet)));
-#endif
/* draw pixmap background */
-#if GTK_CHECK_VERSION (3, 0, 0)
bg_type = mate_panel_applet_get_background (MATE_PANEL_APPLET (applet), &color, &pattern);
-#else
- bg_type = mate_panel_applet_get_background (MATE_PANEL_APPLET (applet), &color, &background);
-#endif
if (bg_type == PANEL_PIXMAP_BACKGROUND) {
/* fill with given background pixmap */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source (cr, pattern);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
-#else
- gdk_draw_drawable (gtk_widget_get_window (GTK_WIDGET(applet)), gc, background, 0, 0, 0, 0, w, h);
-#endif
}
/* draw color background */
if (bg_type == PANEL_COLOR_BACKGROUND) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
-#else
- gdk_gc_set_rgb_fg_color (gc,&color);
- gdk_gc_set_fill (gc,GDK_SOLID);
- gdk_draw_rectangle (gtk_widget_get_window (GTK_WIDGET(applet)), gc, TRUE, 0, 0, w, h);
-#endif
}
/* draw icon at center */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_pixbuf (cr, applet->icon, (w - applet->icon_width)/2, (h - applet->icon_height)/2);
cairo_paint (cr);
-#else
- gdk_draw_pixbuf (gtk_widget_get_window (GTK_WIDGET(applet)), gc, applet->icon,
- 0, 0, (w - applet->icon_width)/2, (h - applet->icon_height)/2,
- applet->icon_width, applet->icon_height,
- GDK_RGB_DITHER_NONE, 0, 0);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr);
-#else
- g_object_unref (gc);
-#endif
return TRUE;
}
@@ -349,11 +309,7 @@ gpm_applet_draw_cb (GpmInhibitApplet *applet)
static void
gpm_applet_change_background_cb (GpmInhibitApplet *applet,
MatePanelAppletBackgroundType arg1,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *arg2,
-#else
- GdkColor *arg2, GdkPixmap *arg3,
-#endif
gpointer data)
{
gtk_widget_queue_draw (GTK_WIDGET (applet));
@@ -645,13 +601,8 @@ gpm_inhibit_applet_init (GpmInhibitApplet *applet)
g_signal_connect (G_OBJECT(applet), "button-press-event",
G_CALLBACK(gpm_applet_click_cb), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT(applet), "draw",
G_CALLBACK(gpm_applet_draw_cb), NULL);
-#else
- g_signal_connect (G_OBJECT(applet), "expose-event",
- G_CALLBACK(gpm_applet_draw_cb), NULL);
-#endif
/* We use g_signal_connect_after because letting the panel draw
* the background is the only way to have the correct
diff --git a/configure.ac b/configure.ac
index 024aef5..adca4a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ(2.63)
-AC_INIT([mate-power-manager], [1.16.0], [http://www.mate-desktop.org/])
+AC_INIT([mate-power-manager], [1.17.0], [http://www.mate-desktop.org/])
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz check-news tar-ustar])
AC_CONFIG_HEADERS([config.h])
@@ -120,53 +120,24 @@ dnl - Library dependencies
dnl ----------------------------------------------------------------------------
GLIB_REQUIRED=2.36.0
GIO_REQUIRED=2.36.0
-GDK_REQUIRED=2.11.0
+GDK_REQUIRED=3.14.0
+GTK_REQUIRED=3.14.0
GNOME_KEYRING_REQUIRED=3.0.0
DBUS_REQUIRED=1.0
DBUS_GLIB_REQUIRED=0.70
LIBNOTIFY_REQUIRED=0.7.0
CAIRO_REQUIRED=1.0.0
-UNIQUE_REQUIRED=0.9.4
-LIBPANEL_REQUIRED=1.5.0
+LIBPANEL_REQUIRED=1.17.0
XRANDR_REQUIRED=1.3.0
CANBERRA_REQUIRED=0.10
UPOWER_REQUIRED=0.9.5
-dnl ----------------------------------------------------------------------------
-dnl GTK library version
-dnl ----------------------------------------------------------------------------
-
-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
- CANBERRA_GTK=libcanberra-gtk
- LIBUNIQUE_VERSION=1.0
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- CANBERRA_GTK=libcanberra-gtk3
- ;;
-esac
-
-AM_CONDITIONAL([GTK3], [test $GTK_REQUIRED = 3.0.0])
-AC_SUBST(GTK_API_VERSION)
-
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gio-2.0 >= $GIO_REQUIRED gio-unix-2.0)
-PKG_CHECK_MODULES(CANBERRA, $CANBERRA_GTK >= $CANBERRA_REQUIRED)
+PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= $CANBERRA_REQUIRED)
PKG_CHECK_MODULES(DBUS,[
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
@@ -174,12 +145,12 @@ PKG_CHECK_MODULES(DBUS,[
gthread-2.0])
PKG_CHECK_MODULES(CAIRO, [
- gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
+ gtk+-3.0 >= $GTK_REQUIRED
cairo >= $CAIRO_REQUIRED])
PKG_CHECK_MODULES(GDK, [
- gdk-$GTK_API_VERSION >= $GDK_REQUIRED
- gdk-x11-$GTK_API_VERSION >= $GDK_REQUIRED])
+ gdk-3.0 >= $GDK_REQUIRED
+ gdk-x11-3.0 >= $GDK_REQUIRED])
PKG_CHECK_MODULES(X11, [
xrandr >= $XRANDR_REQUIRED
@@ -189,19 +160,6 @@ PKG_CHECK_MODULES(X11, x11 xrender)
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
-if test "$GTK_REQUIRED" != "3.0.0"; then
-PKG_CHECK_MODULES(UNIQUE, unique-$LIBUNIQUE_VERSION)
-
-AC_SUBST([UNIQUE_CFLAGS])
-AC_SUBST([UNIQUE_LIBS])
-
-# this deprecated stuff should be removed from unique in most distros
-# but it's still not removed upstream in unique 1.x, so leaving it alone
-# just in case.
-UNIQUE_CFLAGS="$UNIQUE_CFLAGS -DG_CONST_RETURN=const"
-fi
-
-
PKG_CHECK_MODULES(UPOWER, upower-glib >= $UPOWER_REQUIRED)
dnl ---------------------------------------------------------------------------
@@ -401,7 +359,6 @@ echo "
gnome-keyring support: ${with_keyring}
Building extra applets: ${enable_applets}
Self test support: ${have_tests}
- GTK+ API version: ${GTK_API_VERSION}
Docbook support: ${enable_docbook_docs}
documentation dir: $DOCDIR
dbus-1 services dir: $DBUS_SERVICES_DIR
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d8ab23..48d071b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,10 +39,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
$(DISABLE_DEPRECATED)
-if !GTK3
-AM_CPPFLAGS += $(UNIQUE_CFLAGS)
-endif
-
AM_CPPFLAGS += $(NULL)
bin_PROGRAMS = \
@@ -85,12 +81,6 @@ libgpmshared_a_SOURCES = \
gpm-upower.c \
gpm-upower.h
-if !GTK3
-libgpmshared_a_SOURCES += egg-unique.h egg-unique.c
-endif
-
-libgpmshared_a_SOURCES += $(NULL)
-
mate_power_backlight_helper_SOURCES = \
gpm-backlight-helper.c \
$(NULL)
@@ -121,10 +111,6 @@ mate_power_statistics_LDADD = \
$(DBUS_LIBS) \
-lm
-if !GTK3
-mate_power_statistics_LDADD += $(UNIQUE_LIBS)
-endif
-
mate_power_statistics_CFLAGS = \
$(WARNINGFLAGS) \
$(NULL)
@@ -145,10 +131,6 @@ mate_power_preferences_LDADD = \
$(UPOWER_LIBS) \
-lm
-if !GTK3
-mate_power_preferences_LDADD += $(UNIQUE_LIBS)
-endif
-
mate_power_preferences_CFLAGS = \
$(WARNINGFLAGS) \
$(NULL)
diff --git a/src/egg-unique.c b/src/egg-unique.c
deleted file mode 100644
index 41a5182..0000000
--- a/src/egg-unique.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <[email protected]>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <glib.h>
-#include <unique/unique.h>
-
-#include "egg-unique.h"
-#include "egg-debug.h"
-
-static void egg_unique_finalize (GObject *object);
-
-#define EGG_UNIQUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_UNIQUE_TYPE, EggUniquePrivate))
-
-struct EggUniquePrivate
-{
- UniqueApp *uniqueapp;
-};
-
-enum {
- ACTIVATED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (EggUnique, egg_unique, G_TYPE_OBJECT)
-
-/**
- * egg_unique_message_cb:
- **/
-static void
-egg_unique_message_cb (UniqueApp *app, UniqueCommand command, UniqueMessageData *message_data, guint time_s, EggUnique *egg_unique)
-{
- g_return_if_fail (EGG_IS_UNIQUE (egg_unique));
- if (command == UNIQUE_ACTIVATE)
- g_signal_emit (egg_unique, signals [ACTIVATED], 0);
-}
-
-/**
- * egg_unique_assign:
- * @egg_unique: This class instance
- * @service: The service name
- * Return value: %FALSE if we should exit as another instance is running
- **/
-gboolean
-egg_unique_assign (EggUnique *egg_unique, const gchar *service)
-{
- g_return_val_if_fail (EGG_IS_UNIQUE (egg_unique), FALSE);
- g_return_val_if_fail (service != NULL, FALSE);
-
- if (egg_unique->priv->uniqueapp != NULL) {
- g_warning ("already assigned!");
- return FALSE;
- }
-
- /* check to see if the user has another instance open */
- egg_unique->priv->uniqueapp = unique_app_new (service, NULL);
- if (unique_app_is_running (egg_unique->priv->uniqueapp)) {
- egg_debug ("You have another instance running. This program will now close");
- unique_app_send_message (egg_unique->priv->uniqueapp, UNIQUE_ACTIVATE, NULL);
- return FALSE;
- }
-
- /* Listen for messages from another instances */
- g_signal_connect (G_OBJECT (egg_unique->priv->uniqueapp), "message-received",
- G_CALLBACK (egg_unique_message_cb), egg_unique);
- return TRUE;
-}
-
-/**
- * egg_unique_class_init:
- * @egg_unique: This class instance
- **/
-static void
-egg_unique_class_init (EggUniqueClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = egg_unique_finalize;
- g_type_class_add_private (klass, sizeof (EggUniquePrivate));
-
- signals [ACTIVATED] =
- g_signal_new ("activated",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggUniqueClass, activated),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-/**
- * egg_unique_init:
- * @egg_unique: This class instance
- **/
-static void
-egg_unique_init (EggUnique *egg_unique)
-{
- egg_unique->priv = EGG_UNIQUE_GET_PRIVATE (egg_unique);
- egg_unique->priv->uniqueapp = NULL;
-}
-
-/**
- * egg_unique_finalize:
- * @object: This class instance
- **/
-static void
-egg_unique_finalize (GObject *object)
-{
- EggUnique *egg_unique;
- g_return_if_fail (object != NULL);
- g_return_if_fail (EGG_IS_UNIQUE (object));
-
- egg_unique = EGG_UNIQUE_OBJECT (object);
- egg_unique->priv = EGG_UNIQUE_GET_PRIVATE (egg_unique);
-
- if (egg_unique->priv->uniqueapp != NULL)
- g_object_unref (egg_unique->priv->uniqueapp);
- G_OBJECT_CLASS (egg_unique_parent_class)->finalize (object);
-}
-
-/**
- * egg_unique_new:
- * Return value: new class instance.
- **/
-EggUnique *
-egg_unique_new (void)
-{
- EggUnique *egg_unique;
- egg_unique = g_object_new (EGG_UNIQUE_TYPE, NULL);
- return EGG_UNIQUE_OBJECT (egg_unique);
-}
-
diff --git a/src/egg-unique.h b/src/egg-unique.h
deleted file mode 100644
index 7259135..0000000
--- a/src/egg-unique.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <[email protected]>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __EGG_UNIQUE_H
-#define __EGG_UNIQUE_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define EGG_UNIQUE_TYPE (egg_unique_get_type ())
-#define EGG_UNIQUE_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EGG_UNIQUE_TYPE, EggUnique))
-#define EGG_UNIQUE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EGG_UNIQUE_TYPE, EggUniqueClass))
-#define EGG_IS_UNIQUE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EGG_UNIQUE_TYPE))
-#define EGG_IS_UNIQUE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EGG_UNIQUE_TYPE))
-#define EGG_UNIQUE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EGG_UNIQUE_TYPE, EggUniqueClass))
-
-typedef struct EggUniquePrivate EggUniquePrivate;
-
-typedef struct
-{
- GObject parent;
- EggUniquePrivate *priv;
-} EggUnique;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (* activated) (EggUnique *unique);
-} EggUniqueClass;
-
-GType egg_unique_get_type (void);
-EggUnique *egg_unique_new (void);
-
-gboolean egg_unique_assign (EggUnique *unique,
- const gchar *service);
-
-G_END_DECLS
-
-#endif /* __EGG_UNIQUE_H */
-
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 82841b3..0989640 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -55,10 +55,6 @@
#include "gpm-icon-names.h"
#include "egg-console-kit.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
#define GPM_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_BACKLIGHT, GpmBacklightPrivate))
struct GpmBacklightPrivate
@@ -214,11 +210,9 @@ gpm_backlight_dialog_show (GpmBacklight *backlight)
GdkScreen *pointer_screen;
GdkRectangle geometry;
int monitor;
-#if GTK_CHECK_VERSION(3,0,0)
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *device;
-#endif
/*
* get the window size
@@ -236,7 +230,6 @@ gpm_backlight_dialog_show (GpmBacklight *backlight)
}
pointer_screen = NULL;
-#if GTK_CHECK_VERSION(3,0,0)
display = gtk_widget_get_display (backlight->priv->popup);
device_manager = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (device_manager);
@@ -244,13 +237,7 @@ gpm_backlight_dialog_show (GpmBacklight *backlight)
&pointer_screen,
&pointer_x,
&pointer_y);
-#else
- gdk_display_get_pointer (gtk_widget_get_display (backlight->priv->popup),
- &pointer_screen,
- &pointer_x,
- &pointer_y,
- NULL);
-#endif
+
monitor = gdk_screen_get_monitor_at_point (pointer_screen,
pointer_x,
pointer_y);
diff --git a/src/gpm-button.c b/src/gpm-button.c
index 8c2e808..cbf7f45 100644
--- a/src/gpm-button.c
+++ b/src/gpm-button.c
@@ -171,11 +171,7 @@ gpm_button_grab_keystring (GpmButton *button, guint64 keycode)
/* we are not processing the error */
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
egg_debug ("Grabbed modmask=%x, keycode=%li", modmask, (long int) keycode);
return TRUE;
diff --git a/src/gpm-graph-widget.c b/src/gpm-graph-widget.c
index af74ba7..a8acf46 100644
--- a/src/gpm-graph-widget.c
+++ b/src/gpm-graph-widget.c
@@ -24,6 +24,7 @@
#include <pango/pangocairo.h>
#include <glib/gi18n.h>
#include <stdlib.h>
+#include <math.h>
#include "gpm-common.h"
#include "gpm-point-obj.h"
@@ -33,10 +34,6 @@
#include "egg-color.h"
#include "egg-precision.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#include <math.h>
-#endif
-
G_DEFINE_TYPE (GpmGraphWidget, gpm_graph_widget, GTK_TYPE_DRAWING_AREA);
#define GPM_GRAPH_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_GRAPH_WIDGET, GpmGraphWidgetPrivate))
#define GPM_GRAPH_WIDGET_FONT "Sans 8"
@@ -73,11 +70,7 @@ struct GpmGraphWidgetPrivate
GPtrArray *plot_list;
};
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean gpm_graph_widget_draw (GtkWidget *graph, cairo_t *cr);
-#else
-static gboolean gpm_graph_widget_expose (GtkWidget *graph, GdkEventExpose *event);
-#endif
static void gpm_graph_widget_finalize (GObject *object);
enum
@@ -241,11 +234,7 @@ gpm_graph_widget_class_init (GpmGraphWidgetClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = gpm_graph_widget_draw;
-#else
- widget_class->expose_event = gpm_graph_widget_expose;
-#endif
object_class->get_property = up_graph_get_property;
object_class->set_property = up_graph_set_property;
object_class->finalize = gpm_graph_widget_finalize;
@@ -1075,7 +1064,6 @@ gpm_graph_widget_legend_calculate_size (GpmGraphWidget *graph, cairo_t *cr,
return TRUE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* gpm_graph_widget_draw:
* @graph: This class instance
@@ -1111,43 +1099,6 @@ gpm_graph_widget_draw (GtkWidget *widget, cairo_t *cr)
graph->priv->box_y = 5;
gtk_widget_get_allocation (widget, &allocation);
-#else
-/**
- * gpm_graph_widget_draw_graph:
- * @graph: This class instance
- * @cr: Cairo drawing context
- *
- * Draw the complete graph, with the box, the grid, the labels and the line.
- **/
-static void
-gpm_graph_widget_draw_graph (GtkWidget *graph_widget, cairo_t *cr)
-{
- GtkAllocation allocation;
- gint legend_x = 0;
- gint legend_y = 0;
- guint legend_height = 0;
- guint legend_width = 0;
- gfloat data_x;
- gfloat data_y;
-
- GpmGraphWidget *graph = (GpmGraphWidget*) graph_widget;
- g_return_if_fail (graph != NULL);
- g_return_if_fail (GPM_IS_GRAPH_WIDGET (graph));
-
- gpm_graph_widget_legend_calculate_size (graph, cr, &legend_width, &legend_height);
- cairo_save (cr);
-
- /* we need this so we know the y text */
- if (graph->priv->autorange_x)
- gpm_graph_widget_autorange_x (graph);
- if (graph->priv->autorange_y)
- gpm_graph_widget_autorange_y (graph);
-
- graph->priv->box_x = gpm_graph_widget_get_y_label_max_width (graph, cr) + 10;
- graph->priv->box_y = 5;
-
- gtk_widget_get_allocation (graph_widget, &allocation);
-#endif
graph->priv->box_height = allocation.height - (20 + graph->priv->box_y);
/* make size adjustment for legend */
@@ -1180,38 +1131,8 @@ gpm_graph_widget_draw_graph (GtkWidget *graph_widget, cairo_t *cr)
gpm_graph_widget_draw_legend (graph, legend_x, legend_y, legend_width, legend_height);
cairo_restore (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
- return FALSE;
-#endif
-}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
-/**
- * gpm_graph_widget_expose:
- * @graph: This class instance
- * @event: The expose event
- *
- * Just repaint the entire graph widget on expose.
- **/
-static gboolean
-gpm_graph_widget_expose (GtkWidget *graph, GdkEventExpose *event)
-{
- cairo_t *cr;
-
- /* get a cairo_t */
- cr = gdk_cairo_create (gtk_widget_get_window (graph));
- cairo_rectangle (cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- cairo_clip (cr);
- ((GpmGraphWidget *)graph)->priv->cr = cr;
-
- gpm_graph_widget_draw_graph (graph, cr);
-
- cairo_destroy (cr);
return FALSE;
}
-#endif
/**
* gpm_graph_widget_new:
diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index a593fe9..d2e92e0 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -36,7 +36,6 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <gtk/gtk.h>
#include "egg-debug.h"
#include "egg-idletime.h"
diff --git a/src/gpm-kbd-backlight.c b/src/gpm-kbd-backlight.c
index cdfadbc..ae8e0fa 100644
--- a/src/gpm-kbd-backlight.c
+++ b/src/gpm-kbd-backlight.c
@@ -32,10 +32,6 @@
#include "gpm-kbd-backlight.h"
#include "gsd-media-keys-window.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
#define GPM_KBD_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_KBD_BACKLIGHT, GpmKbdBacklightPrivate))
struct GpmKbdBacklightPrivate
@@ -190,11 +186,9 @@ gpm_kbd_backlight_dialog_show (GpmKbdBacklight *backlight)
GdkScreen *pointer_screen;
GdkRectangle geometry;
int monitor;
-#if GTK_CHECK_VERSION(3,0,0)
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *device;
-#endif
/*
* get the window size
@@ -212,7 +206,6 @@ gpm_kbd_backlight_dialog_show (GpmKbdBacklight *backlight)
}
pointer_screen = NULL;
-#if GTK_CHECK_VERSION(3,0,0)
display = gtk_widget_get_display (backlight->priv->popup);
device_manager = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (device_manager);
@@ -220,13 +213,7 @@ gpm_kbd_backlight_dialog_show (GpmKbdBacklight *backlight)
&pointer_screen,
&pointer_x,
&pointer_y);
-#else
- gdk_display_get_pointer (gtk_widget_get_display (backlight->priv->popup),
- &pointer_screen,
- &pointer_x,
- &pointer_y,
- NULL);
-#endif
+
monitor = gdk_screen_get_monitor_at_point (pointer_screen,
pointer_x,
pointer_y);
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c
index 2a2459f..b33ff22 100644
--- a/src/gpm-prefs-core.c
+++ b/src/gpm-prefs-core.c
@@ -110,17 +110,11 @@ gpm_prefs_class_init (GpmPrefsClass *klass)
* Activates (shows) the window.
**/
void
-#if GTK_CHECK_VERSION (3, 0, 0)
gpm_prefs_activate_window (GtkApplication *app, GpmPrefs *prefs)
-#else
-gpm_prefs_activate_window (GpmPrefs *prefs)
-#endif
{
GtkWindow *window;
window = GTK_WINDOW (gtk_builder_get_object (prefs->priv->builder, "dialog_preferences"));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_application_add_window (GTK_APPLICATION (app), window);
-#endif
gtk_window_present (window);
}
@@ -871,10 +865,6 @@ gpm_prefs_init (GpmPrefs *prefs)
prefs_setup_ups (prefs);
prefs_setup_general (prefs);
prefs_setup_notification (prefs);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_show (main_window);
-#endif
}
/**
diff --git a/src/gpm-prefs-core.h b/src/gpm-prefs-core.h
index ed8f936..6810d4d 100644
--- a/src/gpm-prefs-core.h
+++ b/src/gpm-prefs-core.h
@@ -50,12 +50,8 @@ typedef struct
GType gpm_prefs_get_type (void);
GpmPrefs *gpm_prefs_new (void);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *gpm_window (GpmPrefs *prefs);
void gpm_prefs_activate_window (GtkApplication *app, GpmPrefs *prefs);
-#else
-void gpm_prefs_activate_window (GpmPrefs *prefs);
-#endif
G_END_DECLS
diff --git a/src/gpm-prefs.c b/src/gpm-prefs.c
index ad3c3a2..4785cc0 100644
--- a/src/gpm-prefs.c
+++ b/src/gpm-prefs.c
@@ -30,11 +30,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-/* local .la */
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#include <egg-unique.h>
-#endif
-
#include "gpm-common.h"
#include "egg-debug.h"
#include "gpm-prefs-core.h"
@@ -58,17 +53,10 @@ gpm_prefs_help_cb (GpmPrefs *prefs)
* We have been asked to show the window
**/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
gpm_prefs_activated_cb (GtkApplication *app, GpmPrefs *prefs)
{
gpm_prefs_activate_window (app, prefs);
}
-#else
-gpm_prefs_activated_cb (EggUnique *egg_unique, GpmPrefs *prefs)
-{
- gpm_prefs_activate_window (prefs);
-}
-#endif
/**
* main:
@@ -80,13 +68,9 @@ main (int argc, char **argv)
GOptionContext *context;
GpmPrefs *prefs = NULL;
gboolean ret;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkApplication *app;
GtkWidget *window;
gint status;
-#else
- EggUnique *egg_unique;
-#endif
const GOptionEntry options[] = {
{ "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose,
@@ -105,62 +89,28 @@ main (int argc, char **argv)
g_option_context_add_group (context, gtk_get_option_group (FALSE));
g_option_context_parse (context, &argc, &argv, NULL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_init (&argc, &argv);
-#endif
egg_debug_init (verbose);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_init (&argc, &argv);
app = gtk_application_new("org.mate.PowerManager.Preferences", 0);
-#else
- /* are we already activated? */
- egg_unique = egg_unique_new ();
- ret = egg_unique_assign (egg_unique, "org.mate.PowerManager.Preferences");
- if (!ret) {
- goto unique_out;
- }
-#endif
prefs = gpm_prefs_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gpm_window (prefs);
g_signal_connect (app, "activate",
-#else
- g_signal_connect (egg_unique, "activated",
-#endif
G_CALLBACK (gpm_prefs_activated_cb), prefs);
g_signal_connect (prefs, "action-help",
G_CALLBACK (gpm_prefs_help_cb), prefs);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect_swapped (prefs, "action-close",
G_CALLBACK (gtk_widget_destroy), window);
-#else
- g_signal_connect_swapped (prefs, "action-close",
- G_CALLBACK (gtk_main_quit), NULL);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
status = g_application_run (G_APPLICATION (app), argc, argv);
-#else
- gtk_main ();
-#endif
g_object_unref (prefs);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (app);
-#else
-unique_out:
- g_object_unref (egg_unique);
-#endif
/* seems to not work...
g_option_context_free (context); */
-#if GTK_CHECK_VERSION (3, 0, 0)
return status;
-#else
- return 0;
-#endif
}
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index 21a0a52..af24fbb 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -33,9 +33,6 @@
#include "egg-debug.h"
#include "egg-color.h"
#include "egg-array-float.h"
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#include "egg-unique.h"
-#endif
#include "gpm-common.h"
#include "gpm-icon-names.h"
@@ -1177,17 +1174,11 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gboolean dat
* gpm_stats_window_activated_cb
**/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
gpm_stats_window_activated_cb (GtkApplication *app, gpointer data)
-#else
-gpm_stats_window_activated_cb (EggUnique *egg_unique, gpointer data)
-#endif
{
GtkWidget *widget;
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_stats"));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (widget));
-#endif
gtk_window_present (GTK_WINDOW (widget));
}
@@ -1571,12 +1562,8 @@ main (int argc, char *argv[])
GtkBox *box;
GtkWidget *widget, *window;
GtkTreeSelection *selection;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkApplication *app;
gint status;
-#else
- EggUnique *egg_unique;
-#endif
gboolean ret;
UpClient *client;
GPtrArray *devices = NULL;
@@ -1617,21 +1604,9 @@ main (int argc, char *argv[])
egg_debug_init (verbose);
gtk_init (&argc, &argv);
-#if GTK_CHECK_VERSION (3, 0, 0)
app = gtk_application_new ("org.mate.PowerManager.Statistics", 0);
-#else
- /* are we already activated? */
- egg_unique = egg_unique_new ();
- ret = egg_unique_assign (egg_unique, "org.mate.PowerManager.Statistics");
- if (!ret)
- goto unique_out;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (app, "activate",
-#else
- g_signal_connect (egg_unique, "activated",
-#endif
G_CALLBACK (gpm_stats_window_activated_cb), NULL);
/* add application specific icons to search path */
@@ -1669,13 +1644,8 @@ main (int argc, char *argv[])
/* Get the main window quit */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_close"));
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect_swapped (window, "delete_event", G_CALLBACK (gtk_widget_destroy), window);
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_widget_destroy), window);
-#else
- g_signal_connect_swapped (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
- g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL);
-#endif
gtk_widget_grab_default (widget);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_help"));
@@ -1877,12 +1847,7 @@ main (int argc, char *argv[])
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_stats"));
-#if GTK_CHECK_VERSION (3, 0, 0)
status = g_application_run (G_APPLICATION (app), argc, argv);
-#else
- gtk_widget_show (widget);
- gtk_main ();
-#endif
#if !UP_CHECK_VERSION(0, 99, 0)
out:
#endif
@@ -1894,16 +1859,7 @@ out:
g_object_unref (wakeups);
g_object_unref (builder);
g_object_unref (list_store_info);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (app);
-#else
-unique_out:
- g_object_unref (egg_unique);
-#endif
g_free (last_device);
-#if GTK_CHECK_VERSION (3, 0, 0)
return status;
-#else
- return 0;
-#endif
}
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index 052af38..3bcd09b 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -355,7 +355,6 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon)
G_CALLBACK (gpm_tray_icon_show_preferences_cb), icon);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-#if GTK_CHECK_VERSION (3, 0, 0)
/*Set up custom panel menu theme support-gtk3 only */
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
/* Fix any failures of compiz/other wm's to communicate with gtk for transparency in menu theme */
@@ -367,7 +366,6 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon)
context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
gtk_style_context_add_class(context,"gnome-panel-menu-bar");
gtk_style_context_add_class(context,"mate-panel-menu-bar");
-#endif
/* about */
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
diff --git a/src/gsd-media-keys-window.c b/src/gsd-media-keys-window.c
index cec33f9..e59ba44 100644
--- a/src/gsd-media-keys-window.c
+++ b/src/gsd-media-keys-window.c
@@ -402,29 +402,14 @@ draw_volume_boxes (MsdMediaKeysWindow *window,
double height)
{
gdouble x1;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
-#else
- GdkColor color;
- double r, g, b;
- GtkStyle *style;
-#endif
-#if !GTK_CHECK_VERSION (3, 0, 0)
- _x0 += 0.5;
- _y0 += 0.5;
-#endif
height = round (height) - 1;
width = round (width) - 1;
x1 = round ((width - 1) * percentage);
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (GTK_WIDGET (window));
-#else
- style = gtk_widget_get_style (GTK_WIDGET (window));
-#endif
/* bar background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
@@ -444,35 +429,6 @@ draw_volume_boxes (MsdMediaKeysWindow *window,
gtk_render_frame (context, cr, _x0 + 0.5, _y0 + 0.5, x1, height -1 );
gtk_style_context_restore (context);
-#else
- msd_osd_window_color_reverse (&style->dark[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height);
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA / 2);
- cairo_fill_preserve (cr);
-
- /* bar border */
- msd_osd_window_color_reverse (&style->light[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA / 2);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
-
- /* bar progress */
- if (percentage < 0.01)
- return;
- color = style->bg[GTK_STATE_NORMAL];
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0 + 0.5, _y0 + 0.5, height / 6 - 0.5, x1, height - 1);
- cairo_set_source_rgba (cr, r, g, b, MSD_OSD_WINDOW_FG_ALPHA);
- cairo_fill (cr);
-#endif
}
static void
@@ -664,11 +620,7 @@ draw_action_custom (MsdMediaKeysWindow *window,
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
msd_media_keys_window_draw_when_composited (MsdOsdWindow *osd_window,
-#else
-msd_media_keys_window_expose_when_composited (MsdOsdWindow *osd_window,
-#endif
cairo_t *cr)
{
MsdMediaKeysWindow *window = MSD_MEDIA_KEYS_WINDOW (osd_window);
@@ -690,11 +642,7 @@ msd_media_keys_window_class_init (MsdMediaKeysWindowClass *klass)
{
MsdOsdWindowClass *osd_window_class = MSD_OSD_WINDOW_CLASS (klass);
-#if GTK_CHECK_VERSION (3, 0, 0)
osd_window_class->draw_when_composited = msd_media_keys_window_draw_when_composited;
-#else
- osd_window_class->expose_when_composited = msd_media_keys_window_expose_when_composited;
-#endif
g_type_class_add_private (klass, sizeof (MsdMediaKeysWindowPrivate));
}
diff --git a/src/msd-osd-window.c b/src/msd-osd-window.c
index 1b97df1..d40cd13 100644
--- a/src/msd-osd-window.c
+++ b/src/msd-osd-window.c
@@ -55,11 +55,7 @@ struct MsdOsdWindowPrivate
};
enum {
-#if GTK_CHECK_VERSION (3, 0, 0)
DRAW_WHEN_COMPOSITED,
-#else
- EXPOSE_WHEN_COMPOSITED,
-#endif
LAST_SIGNAL
};
@@ -143,137 +139,27 @@ add_hide_timeout (MsdOsdWindow *window)
window);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-void
-msd_osd_window_draw_rounded_rectangle (cairo_t* cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height)
-{
- gdouble radius = corner_radius / aspect;
-
- cairo_move_to (cr, x + radius, y);
-
- cairo_line_to (cr,
- x + width - radius,
- y);
- cairo_arc (cr,
- x + width - radius,
- y + radius,
- radius,
- -90.0f * G_PI / 180.0f,
- 0.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x + width,
- y + height - radius);
- cairo_arc (cr,
- x + width - radius,
- y + height - radius,
- radius,
- 0.0f * G_PI / 180.0f,
- 90.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x + radius,
- y + height);
- cairo_arc (cr,
- x + radius,
- y + height - radius,
- radius,
- 90.0f * G_PI / 180.0f,
- 180.0f * G_PI / 180.0f);
- cairo_line_to (cr,
- x,
- y + radius);
- cairo_arc (cr,
- x + radius,
- y + radius,
- radius,
- 180.0f * G_PI / 180.0f,
- 270.0f * G_PI / 180.0f);
- cairo_close_path (cr);
-}
-
-void
-msd_osd_window_color_reverse (const GdkColor *a,
- GdkColor *b)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h;
- gdouble s;
- gdouble v;
-
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-
- gtk_rgb_to_hsv (red, green, blue, &h, &s, &v);
-
- v = 0.5 + (0.5 - v);
- if (v > 1.0)
- v = 1.0;
- else if (v < 0.0)
- v = 0.0;
-
- gtk_hsv_to_rgb (h, s, v, &red, &green, &blue);
-
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-}
-#endif
-
-/* This is our expose-event handler when the window is in a compositing manager.
+/* This is our draw-event handler when the window is in a compositing manager.
* We draw everything by hand, using Cairo, so that we can have a nice
* transparent/rounded look.
*/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
draw_when_composited (GtkWidget *widget, cairo_t *orig_cr)
-#else
-expose_when_composited (GtkWidget *widget, GdkEventExpose *event)
-#endif
{
MsdOsdWindow *window;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *context;
-#endif
cairo_t *cr;
cairo_surface_t *surface;
int width;
int height;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
-#else
- GtkStyle *style;
- GdkColor color;
- double r, g, b;
-#endif
window = MSD_OSD_WINDOW (widget);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- context = gdk_cairo_create (gtk_widget_get_window (widget));
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (widget);
cairo_set_operator (orig_cr, CAIRO_OPERATOR_SOURCE);
-#else
- style = gtk_widget_get_style (widget);
- cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
-#endif
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = cairo_surface_create_similar (cairo_get_target (orig_cr),
-#else
- surface = cairo_surface_create_similar (cairo_get_target (context),
-#endif
CAIRO_CONTENT_COLOR_ALPHA,
width,
height);
@@ -286,66 +172,26 @@ expose_when_composited (GtkWidget *widget, GdkEventExpose *event)
if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
goto done;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint (cr);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_render_background (context, cr, 0, 0, width, height);
gtk_render_frame (context, cr, 0, 0, width, height);
-#else
- /* draw a box */
- msd_osd_window_draw_rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1);
- msd_osd_window_color_reverse (&style->bg[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA);
- cairo_fill_preserve (cr);
-
- msd_osd_window_color_reverse (&style->text_aa[GTK_STATE_NORMAL], &color);
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA / 2);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_emit (window, signals[DRAW_WHEN_COMPOSITED], 0, cr);
-#else
- g_signal_emit (window, signals[EXPOSE_WHEN_COMPOSITED], 0, cr);
-#endif
cairo_destroy (cr);
/* Make sure we have a transparent background */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle (orig_cr, 0, 0, width, height);
cairo_set_source_rgba (orig_cr, 0.0, 0.0, 0.0, 0.0);
cairo_fill (orig_cr);
cairo_set_source_surface (orig_cr, surface, 0, 0);
cairo_paint_with_alpha (orig_cr, window->priv->fade_out_alpha);
-#else
- cairo_rectangle (context, 0, 0, width, height);
- cairo_set_source_rgba (context, 0.0, 0.0, 0.0, 0.0);
- cairo_fill (context);
-
- cairo_set_source_surface (context, surface, 0, 0);
- cairo_paint_with_alpha (context, window->priv->fade_out_alpha);
-#endif
done:
if (surface != NULL) {
cairo_surface_destroy (surface);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (context);
-#endif
}
/* This is our expose/draw-event handler when the window is *not* in a compositing manager.
@@ -354,7 +200,6 @@ done:
* either case (composited or non-composited), callers can assume that this works
* identically to a GtkWindow without any intermediate widgetry.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
draw_when_not_composited (GtkWidget *widget, cairo_t *cr)
{
@@ -374,29 +219,7 @@ draw_when_not_composited (GtkWidget *widget, cairo_t *cr)
width,
height);
}
-#else
-static void
-expose_when_not_composited (GtkWidget *widget, GdkEventExpose *event)
-{
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
-
- gtk_paint_shadow (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
- gtk_widget_get_state (widget),
- GTK_SHADOW_OUT,
- &event->area,
- widget,
- NULL, /* NULL detail -> themes should use the MsdOsdWindow widget name, probably */
- 0,
- 0,
- allocation.width,
- allocation.height);
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
msd_osd_window_draw (GtkWidget *widget,
cairo_t *cr)
@@ -417,28 +240,6 @@ msd_osd_window_draw (GtkWidget *widget,
return FALSE;
}
-#else
-static gboolean
-msd_osd_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MsdOsdWindow *window;
- GtkWidget *child;
-
- window = MSD_OSD_WINDOW (widget);
-
- if (window->priv->is_composited)
- expose_when_composited (widget, event);
- else
- expose_when_not_composited (widget, event);
-
- child = gtk_bin_get_child (GTK_BIN (window));
- if (child)
- gtk_container_propagate_expose (GTK_CONTAINER (window), child, event);
-
- return FALSE;
-}
-#endif
static void
msd_osd_window_real_show (GtkWidget *widget)
@@ -470,7 +271,6 @@ msd_osd_window_real_hide (GtkWidget *widget)
static void
msd_osd_window_real_realize (GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkScreen *screen;
GdkVisual *visual;
cairo_region_t *region;
@@ -492,40 +292,8 @@ msd_osd_window_real_realize (GtkWidget *widget)
region = cairo_region_create ();
gtk_widget_input_shape_combine_region (widget, region);
cairo_region_destroy (region);
-#else
- GdkColormap *colormap;
- GtkAllocation allocation;
- GdkBitmap *mask;
- cairo_t *cr;
-
- colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget));
-
- if (colormap != NULL) {
- gtk_widget_set_colormap (widget, colormap);
- }
-
- if (GTK_WIDGET_CLASS (msd_osd_window_parent_class)->realize) {
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->realize (widget);
- }
-
- gtk_widget_get_allocation (widget, &allocation);
- mask = gdk_pixmap_new (gtk_widget_get_window (widget),
- allocation.width,
- allocation.height,
- 1);
- cr = gdk_cairo_create (mask);
-
- cairo_set_source_rgba (cr, 1., 1., 1., 0.);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_paint (cr);
-
- /* make the whole window ignore events */
- gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0);
- g_object_unref (mask);
- cairo_destroy (cr);
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
static void
msd_osd_window_style_updated (GtkWidget *widget)
{
@@ -543,25 +311,7 @@ msd_osd_window_style_updated (GtkWidget *widget)
gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &padding);
gtk_container_set_border_width (GTK_CONTAINER (widget), 12 + MAX (padding.left, padding.top));
}
-#else
-static void
-msd_osd_window_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- GtkStyle *style;
-
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->style_set (widget, previous_style);
- /* We set our border width to 12 (per the MATE standard), plus the
- * thickness of the frame that we draw in our expose handler. This will
- * make our child be 12 pixels away from the frame.
- */
-
- style = gtk_widget_get_style (widget);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 12 + MAX (style->xthickness, style->ythickness));
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
msd_osd_window_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -599,23 +349,6 @@ msd_osd_window_get_preferred_height (GtkWidget *widget,
*minimum += padding.top;
*natural += padding.top;
}
-#else
-static void
-msd_osd_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkStyle *style;
-
- GTK_WIDGET_CLASS (msd_osd_window_parent_class)->size_request (widget, requisition);
-
- /* See the comment in msd_osd_window_style_set() for why we add the thickness here */
-
- style = gtk_widget_get_style (widget);
-
- requisition->width += style->xthickness;
- requisition->height += style->ythickness;
-}
-#endif
static GObject *
msd_osd_window_constructor (GType type,
@@ -634,11 +367,9 @@ msd_osd_window_constructor (GType type,
"focus-on-map", FALSE,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *widget = GTK_WIDGET (object);
GtkStyleContext *style_context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class (style_context, "osd");
-#endif
return object;
}
@@ -654,29 +385,15 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass)
widget_class->show = msd_osd_window_real_show;
widget_class->hide = msd_osd_window_real_hide;
widget_class->realize = msd_osd_window_real_realize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->style_updated = msd_osd_window_style_updated;
widget_class->get_preferred_width = msd_osd_window_get_preferred_width;
widget_class->get_preferred_height = msd_osd_window_get_preferred_height;
widget_class->draw = msd_osd_window_draw;
-#else
- widget_class->style_set = msd_osd_window_style_set;
- widget_class->size_request = msd_osd_window_size_request;
- widget_class->expose_event = msd_osd_window_expose_event;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
signals[DRAW_WHEN_COMPOSITED] = g_signal_new ("draw-when-composited",
-#else
- signals[EXPOSE_WHEN_COMPOSITED] = g_signal_new ("expose-when-composited",
-#endif
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_FIRST,
-#if GTK_CHECK_VERSION (3, 0, 0)
G_STRUCT_OFFSET (MsdOsdWindowClass, draw_when_composited),
-#else
- G_STRUCT_OFFSET (MsdOsdWindowClass, expose_when_composited),
-#endif
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
@@ -685,7 +402,6 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass)
#if GTK_CHECK_VERSION (3, 20, 0)
gtk_widget_class_set_css_name (widget_class, "MsdOsdWindow");
#endif
-
g_type_class_add_private (klass, sizeof (MsdOsdWindowPrivate));
}
@@ -733,10 +449,8 @@ msd_osd_window_init (MsdOsdWindow *window)
gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (style, "window-frame");
-#endif
/* assume 130x130 on a 640x480 display and scale from there */
scalew = gdk_screen_get_width (screen) / 640.0;
diff --git a/src/msd-osd-window.h b/src/msd-osd-window.h
index 42229f4..ac3325a 100644
--- a/src/msd-osd-window.h
+++ b/src/msd-osd-window.h
@@ -70,11 +70,7 @@ struct MsdOsdWindow {
struct MsdOsdWindowClass {
GtkWindowClass parent_class;
-#if GTK_CHECK_VERSION (3, 0, 0)
void (* draw_when_composited) (MsdOsdWindow *window, cairo_t *cr);
-#else
- void (* expose_when_composited) (MsdOsdWindow *window, cairo_t *cr);
-#endif
};
GType msd_osd_window_get_type (void);
@@ -84,19 +80,6 @@ gboolean msd_osd_window_is_composited (MsdOsdWindow *windo
gboolean msd_osd_window_is_valid (MsdOsdWindow *window);
void msd_osd_window_update_and_hide (MsdOsdWindow *window);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-void msd_osd_window_draw_rounded_rectangle (cairo_t *cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height);
-
-void msd_osd_window_color_reverse (const GdkColor *a,
- GdkColor *b);
-#endif
-
#ifdef __cplusplus
}
#endif