summaryrefslogtreecommitdiff
path: root/applets/inhibit
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 /applets/inhibit
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
Diffstat (limited to 'applets/inhibit')
-rw-r--r--applets/inhibit/Makefile.am1
-rw-r--r--applets/inhibit/inhibit-applet.c49
2 files changed, 0 insertions, 50 deletions
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