summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/brightness/Makefile.am1
-rw-r--r--applets/brightness/brightness-applet.c64
-rw-r--r--applets/brightness/gpm-common.c4
-rw-r--r--applets/inhibit/Makefile.am1
-rw-r--r--applets/inhibit/gpm-common.c4
-rw-r--r--applets/inhibit/inhibit-applet.c56
6 files changed, 125 insertions, 5 deletions
diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am
index 5e9e834..fd8b54c 100644
--- a/applets/brightness/Makefile.am
+++ b/applets/brightness/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-DEGG_LOGGING="\"GPM_LOGGING\"" \
-DEGG_CONSOLE="\"GPM_CONSOLE\"" \
-I$(top_srcdir)/libdbus-glib \
+ $(DISABLE_DEPRECATED)
$(NULL)
libexec_PROGRAMS=mate-brightness-applet
diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c
index d516bdc..f442765 100644
--- a/applets/brightness/brightness-applet.c
+++ b/applets/brightness/brightness-applet.c
@@ -35,6 +35,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#define GtkObject GtkWidget
+#endif
#include <glib-object.h>
#include <dbus/dbus-glib.h>
@@ -85,7 +89,11 @@ 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);
@@ -259,9 +267,16 @@ 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) {
@@ -284,37 +299,74 @@ 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;
}
@@ -327,7 +379,11 @@ 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));
}
@@ -600,6 +656,9 @@ gpm_applet_create_popup (GpmBrightnessApplet *applet)
/* window */
applet->popup = gtk_window_new (GTK_WINDOW_POPUP);
+#if !GTK_CHECK_VERSION (2, 90, 0)
+ GTK_WIDGET_UNSET_FLAGS (applet->popup, GTK_TOPLEVEL);
+#endif
gtk_window_set_type_hint (GTK_WINDOW(applet->popup), GDK_WINDOW_TYPE_HINT_UTILITY);
gtk_widget_set_parent (applet->popup, GTK_WIDGET(applet));
gtk_container_add (GTK_CONTAINER(applet->popup), frame);
@@ -974,8 +1033,13 @@ 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/brightness/gpm-common.c b/applets/brightness/gpm-common.c
index 0d0e536..2249d63 100644
--- a/applets/brightness/gpm-common.c
+++ b/applets/brightness/gpm-common.c
@@ -173,9 +173,9 @@ gpm_help_display (const gchar *link_id)
gchar *uri;
if (link_id != NULL)
- uri = g_strconcat ("ghelp:mate-power-manager?", link_id, NULL);
+ uri = g_strconcat ("help:mate-power-manager?", link_id, NULL);
else
- uri = g_strdup ("ghelp:mate-power-manager");
+ uri = g_strdup ("help:mate-power-manager");
gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, &error);
diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am
index fa12b4b..c3244c1 100644
--- a/applets/inhibit/Makefile.am
+++ b/applets/inhibit/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-DEGG_LOGGING="\"GPM_LOGGING\"" \
-DEGG_CONSOLE="\"GPM_CONSOLE\"" \
-I$(top_srcdir)/libdbus-glib \
+ $(DISABLE_DEPRECATED) \
$(NULL)
libexec_PROGRAMS=mate-inhibit-applet
diff --git a/applets/inhibit/gpm-common.c b/applets/inhibit/gpm-common.c
index 0d0e536..2249d63 100644
--- a/applets/inhibit/gpm-common.c
+++ b/applets/inhibit/gpm-common.c
@@ -173,9 +173,9 @@ gpm_help_display (const gchar *link_id)
gchar *uri;
if (link_id != NULL)
- uri = g_strconcat ("ghelp:mate-power-manager?", link_id, NULL);
+ uri = g_strconcat ("help:mate-power-manager?", link_id, NULL);
else
- uri = g_strdup ("ghelp:mate-power-manager");
+ uri = g_strdup ("help:mate-power-manager");
gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, &error);
diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c
index 3f70ec4..2421cef 100644
--- a/applets/inhibit/inhibit-applet.c
+++ b/applets/inhibit/inhibit-applet.c
@@ -48,6 +48,10 @@
#define GPM_IS_INHIBIT_APPLET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_INHIBIT_APPLET))
#define GPM_INHIBIT_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_INHIBIT_APPLET, GpmInhibitAppletClass))
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define GtkObject GtkWidget
+#endif
+
typedef struct{
MatePanelApplet parent;
/* applet state */
@@ -283,17 +287,26 @@ 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);
@@ -311,27 +324,58 @@ 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;
}
@@ -344,7 +388,12 @@ gpm_applet_draw_cb (GpmInhibitApplet *applet)
static void
gpm_applet_change_background_cb (GpmInhibitApplet *applet,
MatePanelAppletBackgroundType arg1,
- GdkColor *arg2, GdkPixmap *arg3, gpointer data)
+#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));
}
@@ -626,8 +675,13 @@ 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