summaryrefslogtreecommitdiff
path: root/mate-window-picker-applet
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-23 22:25:19 +0300
committermonsta <[email protected]>2016-11-23 22:25:19 +0300
commiteed121741ae9127dac854e865210e733b008c7e9 (patch)
treeeac0f25030edca96008ac42bd257b00970e76af3 /mate-window-picker-applet
parentb9e04a89438db9e98d1a6fe9287bedef9ebaab24 (diff)
downloadmate-netbook-eed121741ae9127dac854e865210e733b008c7e9.tar.bz2
mate-netbook-eed121741ae9127dac854e865210e733b008c7e9.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 'mate-window-picker-applet')
-rw-r--r--mate-window-picker-applet/applet.c16
-rw-r--r--mate-window-picker-applet/task-item.c37
-rw-r--r--mate-window-picker-applet/task-title.c68
3 files changed, 1 insertions, 120 deletions
diff --git a/mate-window-picker-applet/applet.c b/mate-window-picker-applet/applet.c
index e3f3129..9629f9b 100644
--- a/mate-window-picker-applet/applet.c
+++ b/mate-window-picker-applet/applet.c
@@ -159,11 +159,7 @@ cw_applet_fill (MatePanelApplet *applet,
force_no_focus_padding (GTK_WIDGET (applet));
gtk_container_set_border_width (GTK_CONTAINER (applet), 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
eb = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- eb = gtk_hbox_new (FALSE, 6);
-#endif
gtk_container_add (GTK_CONTAINER (applet), eb);
gtk_container_set_border_width (GTK_CONTAINER (eb), 0);
@@ -251,22 +247,14 @@ display_prefs_dialog (GtkAction *action,
GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-#else
- box = gtk_vbox_new (FALSE, 8);
-#endif
gtk_container_add (GTK_CONTAINER (window), box);
nb = gtk_notebook_new ();
g_object_set (nb, "show-tabs", FALSE, "show-border", TRUE, NULL);
gtk_box_pack_start (GTK_BOX (box), nb, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-#else
- vbox = gtk_vbox_new (FALSE, 8);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), vbox, NULL);
@@ -282,11 +270,7 @@ display_prefs_dialog (GtkAction *action,
gtk_widget_set_size_request (nb, -1, 100);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
label = gtk_label_new (" ");
diff --git a/mate-window-picker-applet/task-item.c b/mate-window-picker-applet/task-item.c
index e9d0085..1eca186 100644
--- a/mate-window-picker-applet/task-item.c
+++ b/mate-window-picker-applet/task-item.c
@@ -96,10 +96,7 @@ update_hints (TaskItem *item)
{
x1 = y1 = 0;
gdkwindow = gtk_widget_get_window (parent);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- if (GDK_IS_WINDOW (gdkwindow))
-#endif
- gdk_window_get_origin (gdkwindow, &x1, &y1);
+ gdk_window_get_origin (gdkwindow, &x1, &y1);
x += x1; y += y1;
break;
}
@@ -202,8 +199,6 @@ task_item_set_visibility (TaskItem *item)
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
-
static void
task_item_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
@@ -220,19 +215,6 @@ task_item_get_preferred_height (GtkWidget *widget,
*minimal_height = *natural_height = DEFAULT_TASK_ITEM_HEIGHT;
}
-#else
-
-static void
-task_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- /* Candidate for terrible hack of the year award */
- requisition->width = DEFAULT_TASK_ITEM_WIDTH;
- requisition->height = DEFAULT_TASK_ITEM_HEIGHT;
-}
-
-#endif
-
static GdkPixbuf *
task_item_sized_pixbuf_for_window (TaskItem *item,
WnckWindow *window,
@@ -280,13 +262,8 @@ task_item_sized_pixbuf_for_window (TaskItem *item,
return pbuf;
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
task_item_draw (GtkWidget *widget,
cairo_t *unused)
-#else
-task_item_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-#endif
{
cairo_t *cr;
TaskItem *item;
@@ -296,9 +273,6 @@ task_item_expose_event (GtkWidget *widget,
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (TASK_IS_ITEM (widget), FALSE);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_return_val_if_fail (event != NULL, FALSE);
-#endif
item = TASK_ITEM (widget);
priv = item->priv;
@@ -306,11 +280,7 @@ task_item_expose_event (GtkWidget *widget,
g_return_val_if_fail (WNCK_IS_WINDOW (priv->window), FALSE);
area = priv->area;
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#else
- cr = gdk_cairo_create (event->window);
-#endif
pbuf = priv->pixbuf;
@@ -743,14 +713,9 @@ task_item_class_init (TaskItemClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
obj_class->finalize = task_item_finalize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = task_item_draw;
widget_class->get_preferred_width = task_item_get_preferred_width;
widget_class->get_preferred_height = task_item_get_preferred_height;
-#else
- widget_class->expose_event = task_item_expose_event;
- widget_class->size_request = task_item_size_request;
-#endif
g_type_class_add_private (obj_class, sizeof (TaskItemPrivate));
diff --git a/mate-window-picker-applet/task-title.c b/mate-window-picker-applet/task-title.c
index bcc594f..8e52532 100644
--- a/mate-window-picker-applet/task-title.c
+++ b/mate-window-picker-applet/task-title.c
@@ -107,7 +107,6 @@ on_leave_notify (GtkWidget *widget,
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
on_button_draw (GtkWidget *widget,
cairo_t *cr,
@@ -142,36 +141,6 @@ on_button_draw (GtkWidget *widget,
}
return FALSE;
}
-#else
-static gboolean
-on_button_expose (GtkWidget *widget,
- GdkEventExpose *event,
- TaskTitle *title)
-{
- g_return_val_if_fail (TASK_IS_TITLE (title), FALSE);
-
- TaskTitlePrivate *priv;
- priv = title->priv;
-
- if (priv->mouse_in_close_button)
- {
- GtkStyle *style = gtk_widget_get_style (widget);
-
- gtk_paint_box (style,
- event->window,
- GTK_STATE_PRELIGHT,
- GTK_SHADOW_NONE,
- NULL,
- NULL,
- NULL,
- event->area.x,
- event->area.y + 2,
- event->area.width,
- event->area.height - 4);
- }
- return FALSE;
-}
-#endif
static void
on_name_changed (WnckWindow *window, TaskTitle *title)
@@ -389,8 +358,6 @@ on_button_release (GtkWidget *title, GdkEventButton *event)
return FALSE;
}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
on_draw (GtkWidget *w, cairo_t *cr)
{
@@ -408,24 +375,6 @@ on_draw (GtkWidget *w, cairo_t *cr)
cr);
return TRUE;
}
-#else
-static gboolean
-on_expose (GtkWidget *w, GdkEventExpose *event)
-{
- if (w->state == GTK_STATE_ACTIVE) {
- gtk_paint_box (w->style, w->window,
- w->state, GTK_SHADOW_NONE,
- NULL, w, "button",
- w->allocation.x, w->allocation.y,
- w->allocation.width, w->allocation.height);
- }
-
- gtk_container_propagate_expose (GTK_CONTAINER (w),
- gtk_bin_get_child (GTK_BIN (w)),
- event);
- return TRUE;
-}
-#endif
/* GObject stuff */
static void
@@ -448,11 +397,7 @@ task_title_class_init (TaskTitleClass *klass)
GtkWidgetClass *wid_class = GTK_WIDGET_CLASS (klass);
obj_class->finalize = task_title_finalize;
-#if GTK_CHECK_VERSION (3, 0, 0)
wid_class->draw = on_draw;
-#else
- wid_class->expose_event = on_expose;
-#endif
g_type_class_add_private (obj_class, sizeof (TaskTitlePrivate));
}
@@ -483,23 +428,15 @@ task_title_init (TaskTitle *title)
0, 0, 6, 6);
gtk_container_add (GTK_CONTAINER (title), priv->align);
-#if GTK_CHECK_VERSION (3, 0, 0)
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
-#else
- priv->box = gtk_hbox_new (FALSE, 2);
-#endif
gtk_container_add (GTK_CONTAINER (priv->align), priv->box);
gtk_widget_set_no_show_all (priv->box, TRUE);
gtk_widget_show (priv->box);
priv->label = gtk_label_new (_("Home"));
gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_END);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (priv->label, GTK_ALIGN_START);
gtk_widget_set_valign (priv->label, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
-#endif
PangoAttrList *attr_list = pango_attr_list_new ();
PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
@@ -527,13 +464,8 @@ task_title_init (TaskTitle *title)
G_CALLBACK (on_enter_notify), title);
g_signal_connect (priv->button, "leave-notify-event",
G_CALLBACK (on_leave_notify), title);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (priv->button, "draw",
G_CALLBACK (on_button_draw), title);
-#else
- g_signal_connect (priv->button, "expose-event",
- G_CALLBACK (on_button_expose), title);
-#endif
gdkscreen = gtk_widget_get_screen (GTK_WIDGET (title));
theme = gtk_icon_theme_get_for_screen (gdkscreen);