summaryrefslogtreecommitdiff
path: root/applets/notification_area
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-21 21:14:26 +0300
committermonsta <[email protected]>2016-11-21 21:14:26 +0300
commitd0ddaedffa7d417a699cafce73c1e418515c4a28 (patch)
tree645b7a86e32b21113e1ce14f563bfb8d8900fa53 /applets/notification_area
parent7dfeb78328039cf92a9f45d64c9b3662d967a1fe (diff)
downloadmate-panel-d0ddaedffa7d417a699cafce73c1e418515c4a28.tar.bz2
mate-panel-d0ddaedffa7d417a699cafce73c1e418515c4a28.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmate-desktop >= 1.17 WARNING: use GTK+3 build of libmateweather for this build. that lib is not migrated to GTK+3 only as we will possibly use libgweather instead of it.
Diffstat (limited to 'applets/notification_area')
-rw-r--r--applets/notification_area/fixedtip.c29
-rw-r--r--applets/notification_area/main.c46
-rw-r--r--applets/notification_area/na-tray-child.c116
-rw-r--r--applets/notification_area/na-tray-child.h3
-rw-r--r--applets/notification_area/na-tray-manager.c130
-rw-r--r--applets/notification_area/na-tray-manager.h17
-rw-r--r--applets/notification_area/na-tray.c94
-rw-r--r--applets/notification_area/na-tray.h7
-rw-r--r--applets/notification_area/testtray.c21
9 files changed, 2 insertions, 461 deletions
diff --git a/applets/notification_area/fixedtip.c b/applets/notification_area/fixedtip.c
index ce4852c9..6356de9b 100644
--- a/applets/notification_area/fixedtip.c
+++ b/applets/notification_area/fixedtip.c
@@ -51,7 +51,6 @@ button_press_handler (GtkWidget *fixedtip,
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
{
@@ -79,31 +78,12 @@ na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
return FALSE;
}
-#else
-static gboolean
-expose_handler (GtkWidget *fixedtip)
-{
- GtkRequisition req;
-
- gtk_widget_size_request (fixedtip, &req);
-
- gtk_paint_flat_box (gtk_widget_get_style (fixedtip),
- gtk_widget_get_window (fixedtip),
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, fixedtip, "tooltip",
- 0, 0, req.width, req.height);
-
- return FALSE;
-}
-#endif
static void
na_fixed_tip_class_init (NaFixedTipClass *class)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->draw = na_fixed_tip_draw;
-#endif
fixedtip_signals[CLICKED] =
g_signal_new ("clicked",
@@ -146,11 +126,6 @@ na_fixed_tip_init (NaFixedTip *fixedtip)
gtk_container_add (GTK_CONTAINER (fixedtip), label);
fixedtip->priv->label = label;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect (fixedtip, "expose_event",
- G_CALLBACK (expose_handler), NULL);
-#endif
-
gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
g_signal_connect (fixedtip, "button_press_event",
@@ -177,11 +152,7 @@ na_fixed_tip_position (NaFixedTip *fixedtip)
gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL);
-#else
- gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
-#endif
gdk_window_get_origin (parent_window, &root_x, &root_y);
parent_width = gdk_window_get_width(parent_window);
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index e431a699..54080a20 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -45,16 +45,11 @@ G_DEFINE_TYPE (NaTrayApplet, na_tray_applet, PANEL_TYPE_APPLET)
static void (*parent_class_realize) (GtkWidget *widget);
static void (*parent_class_unrealize) (GtkWidget *widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void (*parent_class_style_updated) (GtkWidget *widget);
static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern);
-#else
-static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap);
-#endif
static void (*parent_class_change_orient)(MatePanelApplet *panel_applet, MatePanelAppletOrient orient);
-
static GtkOrientation
get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient)
{
@@ -201,7 +196,6 @@ na_tray_applet_unrealize (GtkWidget *widget)
parent_class_unrealize (widget);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
na_tray_applet_style_updated (GtkWidget *widget)
{
@@ -244,24 +238,14 @@ na_tray_applet_style_updated (GtkWidget *widget)
gtk_widget_style_get (widget, "icon-size", &icon_size, NULL);
na_tray_set_icon_size (applet->priv->tray, icon_size);
}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern)
-#else
-static void
-na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap)
-#endif
{
NaTrayApplet *applet = NA_TRAY_APPLET (panel_applet);
if (parent_class_change_background) {
-#if GTK_CHECK_VERSION (3, 0, 0)
parent_class_change_background (panel_applet, type, color, pattern);
-#else
- parent_class_change_background (panel_applet, type, color, pixmap);
-#endif
}
if (!applet->priv->tray)
@@ -286,10 +270,7 @@ na_tray_applet_change_orient (MatePanelApplet *panel_applet,
get_gtk_orientation_from_applet_orient (orient));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-#if GTK_CHECK_VERSION (3, 20, 0)
-/* deprecated with gtk+-3.19.0 */
-#else
+#if !GTK_CHECK_VERSION (3, 20, 0)
static inline void
force_no_focus_padding (GtkWidget *widget)
{
@@ -308,21 +289,6 @@ force_no_focus_padding (GtkWidget *widget)
g_object_unref (provider);
}
#endif
-#else
-static inline void
-force_no_focus_padding (GtkWidget *widget)
-{
- gtk_rc_parse_string ("\n"
- " style \"na-tray-style\"\n"
- " {\n"
- " GtkWidget::focus-line-width=0\n"
- " GtkWidget::focus-padding=0\n"
- " }\n"
- "\n"
- " class \"NaTrayApplet\" style \"na-tray-style\"\n"
- "\n");
-}
-#endif
static void
na_tray_applet_class_init (NaTrayAppletClass *class)
@@ -335,10 +301,8 @@ na_tray_applet_class_init (NaTrayAppletClass *class)
parent_class_unrealize = widget_class->unrealize;
widget_class->unrealize = na_tray_applet_unrealize;
-#if GTK_CHECK_VERSION (3, 0, 0)
parent_class_style_updated = widget_class->style_updated;
widget_class->style_updated = na_tray_applet_style_updated;
-#endif
parent_class_change_background = applet_class->change_background;
applet_class->change_background = na_tray_applet_change_background;
@@ -386,13 +350,7 @@ na_tray_applet_init (NaTrayApplet *applet)
mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet),
MATE_PANEL_APPLET_HAS_HANDLE|MATE_PANEL_APPLET_EXPAND_MINOR);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet),
- GTK_WIDGET (applet));
-#endif
-#if GTK_CHECK_VERSION (3, 20, 0)
-/* deprecated with gtk+-3.19.0 */
-#else
+#if !GTK_CHECK_VERSION (3, 20, 0)
force_no_focus_padding (GTK_WIDGET (applet));
#endif
}
diff --git a/applets/notification_area/na-tray-child.c b/applets/notification_area/na-tray-child.c
index 3b5c04db..64824a74 100644
--- a/applets/notification_area/na-tray-child.c
+++ b/applets/notification_area/na-tray-child.c
@@ -55,33 +55,18 @@ na_tray_child_realize (GtkWidget *widget)
* extension. */
/* Set a transparent background */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_t *transparent = cairo_pattern_create_rgba (0, 0, 0, 0);
gdk_window_set_background_pattern (window, transparent);
-#else
- GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */
- gdk_window_set_background (window, &transparent);
-#endif
gdk_window_set_composited (window, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_destroy (transparent);
-#endif
child->parent_relative_bg = FALSE;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
else if (visual == gdk_window_get_visual(gdk_window_get_parent(window)))
-#else
- else if (visual == gdk_drawable_get_visual(GDK_DRAWABLE(gdk_window_get_parent(window))))
-#endif
{
/* Otherwise, if the visual matches the visual of the parent window, we
* can use a parent-relative background and fake transparency. */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_set_background_pattern (window, NULL);
-#else
- gdk_window_set_back_pixmap (window, NULL, TRUE);
-#endif
child->parent_relative_bg = TRUE;
}
@@ -114,7 +99,6 @@ na_tray_child_style_set (GtkWidget *widget,
*/
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
na_tray_child_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
@@ -146,36 +130,6 @@ na_tray_child_get_preferred_height (GtkWidget *widget,
if (*natural_height < 16)
*natural_height = 16;
}
-#else
-#if 0
-/* This is adapted from code that was commented out in na-tray-manager.c; the
- * code in na-tray-manager.c wouldn't have worked reliably, this will. So maybe
- * it can be reenabled. On other hand, things seem to be working fine without
- * it.
- *
- * If reenabling, you need to hook it up in na_tray_child_class_init().
- */
-static void
-na_tray_child_size_request (GtkWidget *widget,
- GtkRequisition *request)
-{
- GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_request (widget, request);
-
- /*
- * Make sure the icons have a meaningful size ..
- */
- if ((request->width < 16) || (request->height < 16))
- {
- gint nw = MAX (24, request->width);
- gint nh = MAX (24, request->height);
- g_warning ("Tray icon has requested a size of (%ix%i), resizing to (%ix%i)",
- req.width, req.height, nw, nh);
- request->width = nw;
- request->height = nh;
- }
-}
-#endif
-#endif
static void
na_tray_child_size_allocate (GtkWidget *widget,
@@ -227,39 +181,21 @@ na_tray_child_size_allocate (GtkWidget *widget,
* expose handler draws with real or fake transparency.
*/
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
na_tray_child_draw (GtkWidget *widget,
cairo_t *cr)
-#else
-na_tray_child_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-#endif
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkWindow *window = gtk_widget_get_window (widget);
-#endif
if (na_tray_child_has_alpha (child))
{
/* Clear to transparent */
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (window);
-#endif
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_paint (cr);
-#else
- gdk_cairo_region (cr, event->region);
cairo_paint (cr);
- cairo_destroy (cr);
-#endif
}
else if (child->parent_relative_bg)
{
/* Clear to parent-relative pixmap */
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *window;
cairo_surface_t *target;
GdkRectangle clip_rect;
@@ -282,11 +218,6 @@ na_tray_child_expose_event (GtkWidget *widget,
cairo_surface_mark_dirty_rectangle (target,
clip_rect.x, clip_rect.y,
clip_rect.width, clip_rect.height);
-#else
- gdk_window_clear_area (window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-#endif
}
return FALSE;
@@ -309,16 +240,10 @@ na_tray_child_class_init (NaTrayChildClass *klass)
gobject_class->finalize = na_tray_child_finalize;
widget_class->style_set = na_tray_child_style_set;
widget_class->realize = na_tray_child_realize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width = na_tray_child_get_preferred_width;
widget_class->get_preferred_height = na_tray_child_get_preferred_height;
-#endif
widget_class->size_allocate = na_tray_child_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = na_tray_child_draw;
-#else
- widget_class->expose_event = na_tray_child_expose_event;
-#endif
}
GtkWidget *
@@ -330,10 +255,6 @@ na_tray_child_new (GdkScreen *screen,
NaTrayChild *child;
GdkVisual *visual;
gboolean visual_has_alpha;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *colormap;
- gboolean new_colormap;
-#endif
int red_prec, green_prec, blue_prec, depth;
int result;
@@ -349,11 +270,7 @@ na_tray_child_new (GdkScreen *screen,
gdk_error_trap_push ();
result = XGetWindowAttributes (xdisplay, icon_window,
&window_attributes);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
if (!result) /* Window already gone */
return NULL;
@@ -363,30 +280,10 @@ na_tray_child_new (GdkScreen *screen,
if (!visual) /* Icon window is on another screen? */
return NULL;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- new_colormap = FALSE;
-
- if (visual == gdk_screen_get_rgb_visual (screen))
- colormap = gdk_screen_get_rgb_colormap (screen);
- else if (visual == gdk_screen_get_rgba_visual (screen))
- colormap = gdk_screen_get_rgba_colormap (screen);
- else if (visual == gdk_screen_get_system_visual (screen))
- colormap = gdk_screen_get_system_colormap (screen);
- else
- {
- colormap = gdk_colormap_new (visual, FALSE);
- new_colormap = TRUE;
- }
-#endif
-
child = g_object_new (NA_TYPE_TRAY_CHILD, NULL);
child->icon_window = icon_window;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_visual (GTK_WIDGET (child), visual);
-#else
- gtk_widget_set_colormap (GTK_WIDGET (child), colormap);
-#endif
/* We have alpha if the visual has something other than red, green,
* and blue */
@@ -401,11 +298,6 @@ na_tray_child_new (GdkScreen *screen,
child->composited = child->has_alpha;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- if (new_colormap)
- g_object_unref (colormap);
-#endif
-
return GTK_WIDGET (child);
}
@@ -549,12 +441,8 @@ na_tray_child_force_redraw (NaTrayChild *child)
* since that is asynchronous.
*/
XSync (xdisplay, False);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
#else
- gdk_error_trap_pop ();
-#endif
-#else
/* Hiding and showing is the safe way to do it, but can result in more
* flickering.
*/
@@ -597,11 +485,7 @@ _get_wmclass (Display *xdisplay,
gdk_error_trap_push ();
XGetClassHint (xdisplay, xwindow, &ch);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
if (res_class)
*res_class = NULL;
diff --git a/applets/notification_area/na-tray-child.h b/applets/notification_area/na-tray-child.h
index 9427d74b..2ddfed9e 100644
--- a/applets/notification_area/na-tray-child.h
+++ b/applets/notification_area/na-tray-child.h
@@ -25,10 +25,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtk/gtkx.h>
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index aaea0908..94d3003d 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -97,7 +97,6 @@ na_tray_manager_init (NaTrayManager *manager)
manager->padding = 0;
manager->icon_size = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
manager->fg.red = 0.0;
manager->fg.green = 0.0;
manager->fg.blue = 0.0;
@@ -117,23 +116,6 @@ na_tray_manager_init (NaTrayManager *manager)
manager->success.green = 1.0;
manager->success.blue = 0.0;
manager->success.alpha = 1.0;
-#else
- manager->fg.red = 0;
- manager->fg.green = 0;
- manager->fg.blue = 0;
-
- manager->error.red = 0xffff;
- manager->error.green = 0;
- manager->error.blue = 0;
-
- manager->warning.red = 0xffff;
- manager->warning.green = 0xffff;
- manager->warning.blue = 0;
-
- manager->success.red = 0;
- manager->success.green = 0xffff;
- manager->success.blue = 0;
-#endif
}
static void
@@ -344,29 +326,13 @@ pending_message_free (PendingMessage *message)
g_free (message);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
na_tray_manager_handle_message_data (NaTrayManager *manager,
XClientMessageEvent *xevent)
-#else
-static GdkFilterReturn
-na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-#endif
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- XClientMessageEvent *xevent;
- NaTrayManager *manager;
-#endif
GList *p;
int len;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- xevent = (XClientMessageEvent *) xev;
- manager = data;
-#endif
-
/* Try to see if we can find the pending message in the list */
for (p = manager->messages; p; p = p->next)
{
@@ -400,10 +366,6 @@ na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
break;
}
}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- return GDK_FILTER_REMOVE;
-#endif
}
static void
@@ -498,41 +460,6 @@ na_tray_manager_handle_cancel_message (NaTrayManager *manager,
}
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static GdkFilterReturn
-na_tray_manager_handle_client_message_opcode (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-{
- XClientMessageEvent *xevent;
- NaTrayManager *manager;
-
- xevent = (XClientMessageEvent *) xev;
- manager = data;
-
- switch (xevent->data.l[1])
- {
- case SYSTEM_TRAY_REQUEST_DOCK:
- /* Ignore this one since we don't know on which window this was received
- * and so we can't know for which screen this is. It will be handled
- * in na_tray_manager_window_filter() since we also receive it there */
- break;
-
- case SYSTEM_TRAY_BEGIN_MESSAGE:
- na_tray_manager_handle_begin_message (manager, xevent);
- return GDK_FILTER_REMOVE;
-
- case SYSTEM_TRAY_CANCEL_MESSAGE:
- na_tray_manager_handle_cancel_message (manager, xevent);
- return GDK_FILTER_REMOVE;
- default:
- break;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-#endif
-
static GdkFilterReturn
na_tray_manager_window_filter (GdkXEvent *xev,
GdkEvent *event,
@@ -552,7 +479,6 @@ na_tray_manager_window_filter (GdkXEvent *xev,
(XClientMessageEvent *) xevent);
return GDK_FILTER_REMOVE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_BEGIN_MESSAGE */
else if (xevent->xclient.message_type == manager->opcode_atom &&
xevent->xclient.data.l[1] == SYSTEM_TRAY_BEGIN_MESSAGE)
@@ -576,7 +502,6 @@ na_tray_manager_window_filter (GdkXEvent *xev,
(XClientMessageEvent *) event);
return GDK_FILTER_REMOVE;
}
-#endif
}
else if (xevent->type == SelectionClear)
{
@@ -634,12 +559,6 @@ na_tray_manager_unmanage (NaTrayManager *manager)
TRUE);
}
-/* fixed in GTK3 */
-#if !GTK_CHECK_VERSION (3, 0, 0)
- //FIXME: we should also use gdk_remove_client_message_filter when it's
- //available
- // See bug #351254
-#endif
gdk_window_remove_filter (window,
na_tray_manager_window_filter, manager);
@@ -716,14 +635,7 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
* be embedded. In almost all cases, this will be the same as the visual
* of the screen.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (manager->screen));
-#else
- GdkColormap *colormap;
-
- colormap = gdk_screen_get_default_colormap (manager->screen);
- xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap));
-#endif
}
data[0] = XVisualIDFromVisual (xvisual);
@@ -810,7 +722,6 @@ na_tray_manager_set_colors_property (NaTrayManager *manager)
atom = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_SYSTEM_TRAY_COLORS");
-#if GTK_CHECK_VERSION (3, 0, 0)
data[0] = manager->fg.red * 65535;
data[1] = manager->fg.green * 65535;
data[2] = manager->fg.blue * 65535;
@@ -823,20 +734,6 @@ na_tray_manager_set_colors_property (NaTrayManager *manager)
data[9] = manager->success.red * 65535;
data[10] = manager->success.green * 65535;
data[11] = manager->success.blue * 65535;
-#else
- data[0] = manager->fg.red;
- data[1] = manager->fg.green;
- data[2] = manager->fg.blue;
- data[3] = manager->error.red;
- data[4] = manager->error.green;
- data[5] = manager->error.blue;
- data[6] = manager->warning.red;
- data[7] = manager->warning.green;
- data[8] = manager->warning.blue;
- data[9] = manager->success.red;
- data[10] = manager->success.green;
- data[11] = manager->success.blue;
-#endif
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
@@ -935,11 +832,8 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
message_data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA",
FALSE);
-#if GTK_CHECK_VERSION (3, 0, 0)
manager->message_data_atom = gdk_x11_atom_to_xatom_for_display (display,
message_data_atom);
-#endif
-
/* Add a window filter */
#if 0
@@ -951,16 +845,6 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
/* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
gdk_window_add_filter (window,
na_tray_manager_window_filter, manager);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
- gdk_display_add_client_message_filter (display, opcode_atom,
- na_tray_manager_handle_client_message_opcode,
- manager);
- /* This is for _NET_SYSTEM_TRAY_MESSAGE_DATA */
- gdk_display_add_client_message_filter (display, message_data_atom,
- na_tray_manager_handle_client_message_message_data,
- manager);
-#endif
return TRUE;
}
else
@@ -1074,7 +958,6 @@ na_tray_manager_set_icon_size (NaTrayManager *manager,
void
na_tray_manager_set_colors (NaTrayManager *manager,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *fg,
GdkRGBA *error,
GdkRGBA *warning,
@@ -1086,19 +969,6 @@ na_tray_manager_set_colors (NaTrayManager *manager,
!gdk_rgba_equal (&manager->error, error) ||
!gdk_rgba_equal (&manager->warning, warning) ||
!gdk_rgba_equal (&manager->success, success))
-#else
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success)
-{
- g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
-
- if (!gdk_color_equal (&manager->fg, fg) ||
- !gdk_color_equal (&manager->error, error) ||
- !gdk_color_equal (&manager->warning, warning) ||
- !gdk_color_equal (&manager->success, success))
-#endif
{
manager->fg = *fg;
manager->error = *error;
diff --git a/applets/notification_area/na-tray-manager.h b/applets/notification_area/na-tray-manager.h
index d1d585fe..811791be 100644
--- a/applets/notification_area/na-tray-manager.h
+++ b/applets/notification_area/na-tray-manager.h
@@ -50,27 +50,18 @@ struct _NaTrayManager
#ifdef GDK_WINDOWING_X11
GdkAtom selection_atom;
Atom opcode_atom;
-#if GTK_CHECK_VERSION (3, 0, 0)
Atom message_data_atom;
#endif
-#endif
GtkWidget *invisible;
GdkScreen *screen;
GtkOrientation orientation;
gint padding;
gint icon_size;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA fg;
GdkRGBA error;
GdkRGBA warning;
GdkRGBA success;
-#else
- GdkColor fg;
- GdkColor error;
- GdkColor warning;
- GdkColor success;
-#endif
GList *messages;
GHashTable *socket_table;
@@ -112,18 +103,10 @@ void na_tray_manager_set_padding (NaTrayManager *manager,
void na_tray_manager_set_icon_size (NaTrayManager *manager,
gint padding);
void na_tray_manager_set_colors (NaTrayManager *manager,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *fg,
GdkRGBA *error,
GdkRGBA *warning,
GdkRGBA *success);
-#else
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success);
-#endif
-
G_END_DECLS
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index b07376c2..34fb435e 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -48,9 +48,6 @@ struct _NaTrayPrivate
TraysScreen *trays_screen;
GtkWidget *box;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkWidget *frame;
-#endif
guint idle_redraw_id;
@@ -86,27 +83,6 @@ static TraysScreen *trays_screens = NULL;
static void icon_tip_show_next (IconTip *icontip);
-#if !GTK_CHECK_VERSION (3, 0, 0)
-/* NaBox, an instantiable GtkBox */
-
-typedef GtkBox NaBox;
-typedef GtkBoxClass NaBoxClass;
-
-static GType na_box_get_type (void);
-
-G_DEFINE_TYPE (NaBox, na_box, GTK_TYPE_BOX)
-
-static void
-na_box_init (NaBox *box)
-{
-}
-
-static void
-na_box_class_init (NaBoxClass *klass)
-{
-}
-#endif
-
/* NaTray */
G_DEFINE_TYPE (NaTray, na_tray, GTK_TYPE_BIN)
@@ -536,11 +512,7 @@ update_size_and_orientation (NaTray *tray)
* gdk_window_set_composited(). We need to paint these children ourselves.
*/
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
na_tray_draw_icon (GtkWidget *widget,
-#else
-na_tray_expose_icon (GtkWidget *widget,
-#endif
gpointer data)
{
cairo_t *cr = (cairo_t *) data;
@@ -551,7 +523,6 @@ na_tray_expose_icon (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_save (cr);
gdk_cairo_set_source_window (cr,
gtk_widget_get_window (widget),
@@ -559,40 +530,16 @@ na_tray_expose_icon (GtkWidget *widget,
allocation.y);
cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height);
cairo_clip (cr);
-#else
- gdk_cairo_set_source_pixmap (cr,
- gtk_widget_get_window (widget),
- allocation.x,
- allocation.y);
-#endif
cairo_paint (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_restore (cr);
-#endif
}
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
na_tray_draw_box (GtkWidget *box,
cairo_t *cr)
-#else
-na_tray_expose_box (GtkWidget *box,
- GdkEventExpose *event)
-#endif
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
-#else
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (box));
-
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
- gtk_container_foreach (GTK_CONTAINER (box), na_tray_expose_icon, cr);
-
- cairo_destroy (cr);
-#endif
}
static void
@@ -605,22 +552,10 @@ na_tray_init (NaTray *tray)
priv->screen = NULL;
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
-#if GTK_CHECK_VERSION (3, 0, 0)
priv->box = gtk_box_new (priv->orientation, ICON_SPACING);
g_signal_connect (priv->box, "draw",
G_CALLBACK (na_tray_draw_box), NULL);
gtk_container_add (GTK_CONTAINER (tray), priv->box);
-#else
- priv->frame = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (tray), priv->frame);
- gtk_widget_show (priv->frame);
-
- priv->box = g_object_new (na_box_get_type (), NULL);
- g_signal_connect (priv->box, "expose-event",
- G_CALLBACK (na_tray_expose_box), tray);
- gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING);
- gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
-#endif
gtk_widget_show (priv->box);
}
@@ -644,16 +579,7 @@ na_tray_constructor (GType type,
if (!initialized)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
trays_screens = g_new0 (TraysScreen, 1);
-#else
- GdkDisplay *display;
- int n_screens;
-
- display = gdk_display_get_default ();
- n_screens = gdk_display_get_n_screens (display);
- trays_screens = g_new0 (TraysScreen, n_screens);
-#endif
initialized = TRUE;
}
@@ -775,7 +701,6 @@ na_tray_set_property (GObject *object,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
na_tray_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
@@ -795,14 +720,6 @@ na_tray_get_preferred_height (GtkWidget *widget,
minimal_height,
natural_height);
}
-#else
-static void
-na_tray_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), requisition);
-}
-#endif
static void
na_tray_size_allocate (GtkWidget *widget,
@@ -822,12 +739,8 @@ na_tray_class_init (NaTrayClass *klass)
gobject_class->set_property = na_tray_set_property;
gobject_class->dispose = na_tray_dispose;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width = na_tray_get_preferred_width;
widget_class->get_preferred_height = na_tray_get_preferred_height;
-#else
- widget_class->size_request = na_tray_size_request;
-#endif
widget_class->size_allocate = na_tray_size_allocate;
g_object_class_install_property
@@ -920,17 +833,10 @@ na_tray_set_icon_size (NaTray *tray,
void
na_tray_set_colors (NaTray *tray,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *fg,
GdkRGBA *error,
GdkRGBA *warning,
GdkRGBA *success)
-#else
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success)
-#endif
{
NaTrayPrivate *priv = tray->priv;
diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h
index c3d3415e..8ecac1cb 100644
--- a/applets/notification_area/na-tray.h
+++ b/applets/notification_area/na-tray.h
@@ -65,17 +65,10 @@ void na_tray_set_padding (NaTray *tray,
void na_tray_set_icon_size (NaTray *tray,
gint icon_size);
void na_tray_set_colors (NaTray *tray,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *fg,
GdkRGBA *error,
GdkRGBA *warning,
GdkRGBA *success);
-#else
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success);
-#endif
void na_tray_force_redraw (NaTray *tray);
G_END_DECLS
diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c
index 0cb38e92..f3724025 100644
--- a/applets/notification_area/testtray.c
+++ b/applets/notification_area/testtray.c
@@ -150,22 +150,14 @@ create_tray_on_screen (GdkScreen *screen,
data->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_object_weak_ref (G_OBJECT (window), (GWeakNotify) maybe_quit, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (FALSE, 6);
-#endif
gtk_container_add (GTK_CONTAINER (window), vbox);
button = gtk_button_new_with_mnemonic ("_Add another tray");
g_signal_connect (button, "clicked", G_CALLBACK (add_tray_cb), data);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
- hbox = gtk_hbox_new (FALSE, 12);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic ("_Orientation:");
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -218,28 +210,15 @@ main (int argc, char *argv[])
{
GdkDisplay *display;
GdkScreen *screen;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- int n_screens, i;
-#endif
gtk_init (&argc, &argv);
gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON);
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 0, 0)
screen = gdk_display_get_default_screen (display);
create_tray_on_screen (screen, FALSE);
-#else
- n_screens = gdk_display_get_n_screens (display);
- for (i = 0; i < n_screens; ++i) {
- screen = gdk_display_get_screen (display, i);
- create_tray_on_screen (screen, FALSE);
-
- create_tray_on_screen (screen, FALSE);
- }
-#endif
gtk_main ();