summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-02 00:45:36 +0300
committermonsta <[email protected]>2016-12-02 00:50:14 +0300
commit0c27d18ab5efb721a2f02549767016c81fc6ce2c (patch)
tree76b7b89cface072e011a3757a833e9090bab44f2
parent1aa83d45ebf9599c6d4d3f47211c3961282e98f0 (diff)
downloadmate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.bz2
mate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd, libmate-desktop, marco, m-s-d >= 1.17
-rw-r--r--Makefile.am3
-rw-r--r--NEWS2
-rw-r--r--capplets/about-me/e-image-chooser.c8
-rw-r--r--capplets/about-me/eel-alert-dialog.c12
-rw-r--r--capplets/about-me/mate-about-me-password.c4
-rw-r--r--capplets/about-me/mate-about-me.c8
-rw-r--r--capplets/appearance/appearance-desktop.c50
-rw-r--r--capplets/appearance/appearance-font.c16
-rw-r--r--capplets/appearance/appearance-main.c14
-rw-r--r--capplets/appearance/appearance-style.c56
-rw-r--r--capplets/appearance/appearance-themes.c23
-rw-r--r--capplets/appearance/appearance-ui.c91
-rw-r--r--capplets/appearance/mate-wp-item.c30
-rw-r--r--capplets/appearance/mate-wp-item.h5
-rw-r--r--capplets/appearance/mate-wp-xml.c25
-rw-r--r--capplets/appearance/theme-installer.c7
-rw-r--r--capplets/common/file-transfer-dialog.c14
-rw-r--r--capplets/common/mate-theme-info.c44
-rw-r--r--capplets/common/mate-theme-info.h5
-rw-r--r--capplets/common/theme-thumbnail.c149
-rw-r--r--capplets/display/scrollarea.c408
-rw-r--r--capplets/display/scrollarea.h19
-rw-r--r--capplets/display/xrandr-capplet.c80
-rw-r--r--capplets/keybindings/eggcellrendererkeys.c4
-rw-r--r--capplets/keybindings/mate-keybinding-properties.c6
-rw-r--r--capplets/keyboard/mate-keyboard-properties-a11y.c15
-rw-r--r--capplets/keyboard/mate-keyboard-properties-xkbot.c4
-rw-r--r--capplets/keyboard/mate-keyboard-properties.c4
-rw-r--r--capplets/mouse/mate-mouse-properties.c8
-rw-r--r--capplets/windows/mate-metacity-support.c4
-rw-r--r--capplets/windows/mate-window-properties.c66
-rw-r--r--configure.ac82
-rw-r--r--font-viewer/font-view.c128
-rw-r--r--libslab/app-resizer.c50
-rw-r--r--libslab/app-shell.c58
-rw-r--r--libslab/mate-slab.pc.in4
-rw-r--r--libslab/nameplate-tile.c27
-rw-r--r--libslab/search-bar.c4
-rw-r--r--libslab/search-context-picker.c14
-rw-r--r--libslab/search-entry.c43
-rw-r--r--libslab/shell-window.c33
-rw-r--r--libslab/slab-section.c4
-rw-r--r--libslab/tile.c28
-rw-r--r--libwindow-settings/mate-window-settings-2.0.pc.in2
-rw-r--r--shell/control-center.c84
-rw-r--r--typing-break/drw-break-window.c78
-rw-r--r--typing-break/drw-utils.c70
47 files changed, 100 insertions, 1793 deletions
diff --git a/Makefile.am b/Makefile.am
index 0897f97d..541e5571 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,8 +51,7 @@ EXTRA_DIST = \
$(gsettingsschema_in_files)
DISTCHECK_CONFIGURE_FLAGS = \
- --disable-update-mimedb \
- --with-gtk=$(GTK_API_VERSION)
+ --disable-update-mimedb
GITIGNOREFILES=m4
diff --git a/NEWS b/NEWS
index 6b786178..d99d04d5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+1.17.0
+
1.16.0
* Build: drop dconf 0.10 compatibility
* Appearance: change default hinting style to slight and render
diff --git a/capplets/about-me/e-image-chooser.c b/capplets/about-me/e-image-chooser.c
index d87bf0b5..c69bc204 100644
--- a/capplets/about-me/e-image-chooser.c
+++ b/capplets/about-me/e-image-chooser.c
@@ -29,10 +29,6 @@
#include "e-image-chooser.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
struct _EImageChooserPrivate {
GtkWidget *image;
@@ -128,11 +124,7 @@ e_image_chooser_class_init (EImageChooserClass *klass)
G_STRUCT_OFFSET (EImageChooserClass, changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
-#if GTK_CHECK_VERSION (3, 0, 0)
G_TYPE_NONE, 0);
-#else
- GTK_TYPE_NONE, 0);
-#endif
object_class->dispose = e_image_chooser_dispose;
}
diff --git a/capplets/about-me/eel-alert-dialog.c b/capplets/about-me/eel-alert-dialog.c
index 9fd4d52e..cbf28edf 100644
--- a/capplets/about-me/eel-alert-dialog.c
+++ b/capplets/about-me/eel-alert-dialog.c
@@ -159,12 +159,8 @@ eel_alert_dialog_init (EelAlertDialog *dialog)
dialog->details->secondary_label = gtk_label_new (NULL);
dialog->details->details_label = gtk_label_new (NULL);
dialog->details->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (dialog->details->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (dialog->details->image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (dialog->details->image), 0.5, 0.0);
-#endif
gtk_label_set_line_wrap (GTK_LABEL (dialog->details->primary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (dialog->details->primary_label), TRUE);
@@ -191,21 +187,13 @@ eel_alert_dialog_init (EelAlertDialog *dialog)
gtk_misc_set_alignment (GTK_MISC (dialog->details->details_label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
- hbox = gtk_hbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (hbox), dialog->details->image,
FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- vbox = gtk_vbox_new (FALSE, 12);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), vbox,
FALSE, FALSE, 0);
diff --git a/capplets/about-me/mate-about-me-password.c b/capplets/about-me/mate-about-me-password.c
index 91369fa6..6de5218f 100644
--- a/capplets/about-me/mate-about-me-password.c
+++ b/capplets/about-me/mate-about-me-password.c
@@ -685,11 +685,7 @@ passdlg_set_busy (PasswordDialog *pdialog, gboolean busy)
gdk_display_flush (display);
if (busy) {
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
/* Disable/Enable UI */
diff --git a/capplets/about-me/mate-about-me.c b/capplets/about-me/mate-about-me.c
index e379467a..1f94f3bb 100644
--- a/capplets/about-me/mate-about-me.c
+++ b/capplets/about-me/mate-about-me.c
@@ -345,11 +345,7 @@ about_me_icon_theme_changed (GtkWindow *window,
if (icon != NULL) {
g_free (me->person);
me->person = g_strdup (gtk_icon_info_get_filename (icon));
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (icon);
-#else
- gtk_icon_info_free (icon);
-#endif
}
if (me->have_image)
@@ -424,11 +420,7 @@ about_me_setup_dialog (void)
icon = gtk_icon_theme_lookup_icon (me->theme, "stock_person", 80, 0);
if (icon != NULL) {
me->person = g_strdup (gtk_icon_info_get_filename (icon));
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (icon);
-#else
- gtk_icon_info_free (icon);
-#endif
}
g_signal_connect_object (me->theme, "changed",
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c
index a79e3c5c..e13a54d9 100644
--- a/capplets/appearance/appearance-desktop.c
+++ b/capplets/appearance/appearance-desktop.c
@@ -214,11 +214,7 @@ wp_add_images (AppearanceData *data,
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
GDK_WATCH);
gdk_window_set_cursor (window, cursor);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
while (images != NULL)
{
@@ -368,25 +364,15 @@ wp_color_changed (AppearanceData *data,
if (item == NULL)
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (data->wp_pcpicker), item->pcolor);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (data->wp_scpicker), item->scolor);
-#else
- gtk_color_button_get_color (GTK_COLOR_BUTTON (data->wp_pcpicker), item->pcolor);
- gtk_color_button_get_color (GTK_COLOR_BUTTON (data->wp_scpicker), item->scolor);
-#endif
if (update)
{
gchar *pcolor, *scolor;
-#if GTK_CHECK_VERSION (3, 0, 0)
pcolor = gdk_rgba_to_string (item->pcolor);
scolor = gdk_rgba_to_string (item->scolor);
-#else
- pcolor = gdk_color_to_string (item->pcolor);
- scolor = gdk_color_to_string (item->scolor);
-#endif
g_settings_delay (data->wp_settings);
g_settings_set_string (data->wp_settings, WP_PCOLOR_KEY, pcolor);
g_settings_set_string (data->wp_settings, WP_SCOLOR_KEY, scolor);
@@ -509,24 +495,14 @@ wp_color1_changed (GSettings *settings,
gchar *key,
AppearanceData *data)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
gchar *colorhex;
colorhex = g_settings_get_string (settings, key);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color, colorhex);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (data->wp_pcpicker), &color);
-#else
- gdk_color_parse (colorhex, &color);
-
- gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_pcpicker), &color);
-#endif
wp_color_changed (data, FALSE);
@@ -538,26 +514,16 @@ wp_color2_changed (GSettings *settings,
gchar *key,
AppearanceData *data)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
gchar *colorhex;
wp_set_sensitivities (data);
colorhex = g_settings_get_string (settings, key);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color, colorhex);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (data->wp_scpicker), &color);
-#else
- gdk_color_parse (colorhex, &color);
-
- gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker), &color);
-#endif
wp_color_changed (data, FALSE);
@@ -597,13 +563,8 @@ wp_props_wp_set (AppearanceData *data, MateWPItem *item)
g_settings_set_enum (data->wp_settings, WP_SHADING_KEY, item->shade_type);
-#if GTK_CHECK_VERSION (3, 0, 0)
pcolor = gdk_rgba_to_string (item->pcolor);
scolor = gdk_rgba_to_string (item->scolor);
-#else
- pcolor = gdk_color_to_string (item->pcolor);
- scolor = gdk_color_to_string (item->scolor);
-#endif
g_settings_set_string (data->wp_settings, WP_PCOLOR_KEY, pcolor);
g_settings_set_string (data->wp_settings, WP_SCOLOR_KEY, scolor);
g_free (pcolor);
@@ -631,17 +592,10 @@ wp_props_wp_selected (GtkTreeSelection *selection,
wp_option_menu_set (data, item->shade_type, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (data->wp_pcpicker),
item->pcolor);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (data->wp_scpicker),
item->scolor);
-#else
- gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_pcpicker),
- item->pcolor);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker),
- item->scolor);
-#endif
wp_props_wp_set (data, item);
}
@@ -755,11 +709,7 @@ wp_drag_received (GtkWidget *widget,
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
GDK_WATCH);
gdk_window_set_cursor (window, cursor);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
for (uri = uris; *uri; ++uri)
{
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index 26db940e..af2a1a41 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -46,11 +46,7 @@
static gboolean in_change = FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
static void sample_draw(GtkWidget* darea, cairo_t* cr)
-#else
-static void sample_expose(GtkWidget* darea, GdkEventExpose* expose)
-#endif
{
cairo_surface_t* surface = g_object_get_data(G_OBJECT(darea), "sample-surface");
GtkAllocation allocation;
@@ -62,10 +58,6 @@ static void sample_expose(GtkWidget* darea, GdkEventExpose* expose)
w = cairo_image_surface_get_width (surface);
h = cairo_image_surface_get_height (surface);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (expose->window);
-#endif
-
cairo_set_line_width (cr, 1);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
@@ -78,10 +70,6 @@ static void sample_expose(GtkWidget* darea, GdkEventExpose* expose)
cairo_set_source_surface (cr, surface, (x - w) / 2, (y - h) / 2);
cairo_paint(cr);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
}
typedef enum {
@@ -188,11 +176,7 @@ static void setup_font_sample(GtkWidget* darea, Antialiasing antialiasing, Hinti
g_object_set_data_full(G_OBJECT(darea), "sample-surface", surface, (GDestroyNotify) cairo_surface_destroy);
gtk_widget_set_size_request (GTK_WIDGET(darea), width + 2, height + 2);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect(darea, "draw", G_CALLBACK(sample_draw), NULL);
-#else
- g_signal_connect(darea, "expose_event", G_CALLBACK(sample_expose), NULL);
-#endif
}
/*
diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
index 91040e62..b2b77353 100644
--- a/capplets/appearance/appearance-main.c
+++ b/capplets/appearance/appearance-main.c
@@ -40,11 +40,6 @@ init_appearance_data (int *argc, char ***argv, GOptionContext *context)
GtkBuilder *ui;
GError *err = NULL;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_init ();
- gdk_threads_enter ();
-#endif
-
theme_thumbnail_factory_init (*argc, *argv);
capplet_init (context, argc, argv);
activate_settings_daemon ();
@@ -147,9 +142,7 @@ main (int argc, char **argv)
{
AppearanceData *data;
GtkWidget *w;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
-#endif
gchar *install_filename = NULL;
gchar *start_page = NULL;
@@ -202,10 +195,9 @@ main (int argc, char **argv)
/* prepare the main window */
w = appearance_capplet_get_widget (data, "appearance_window");
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gtk_widget_get_style_context (GTK_WIDGET (w));
gtk_style_context_add_class (context, "appearance-window");
-#endif
+
capplet_set_icon (w, "preferences-desktop-theme");
gtk_widget_show_all (w);
@@ -247,10 +239,6 @@ main (int argc, char **argv)
/* start the mainloop */
gtk_main ();
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_leave ();
-#endif
-
/* free stuff */
g_free (data);
diff --git a/capplets/appearance/appearance-style.c b/capplets/appearance/appearance-style.c
index a5ad6730..e71e4f83 100644
--- a/capplets/appearance/appearance-style.c
+++ b/capplets/appearance/appearance-style.c
@@ -240,18 +240,10 @@ static void update_message_area(AppearanceData* data)
gtk_misc_set_alignment (GTK_MISC (data->style_message_label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 9);
-#else
- hbox = gtk_hbox_new (FALSE, 9);
-#endif
icon = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (icon, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), data->style_message_label, TRUE, TRUE, 0);
content = gtk_info_bar_get_content_area (GTK_INFO_BAR (data->style_message_area));
@@ -263,43 +255,13 @@ static void update_message_area(AppearanceData* data)
gtk_box_pack_start (GTK_BOX (parent), data->style_message_area, FALSE, FALSE, 0);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- if (engine != NULL)
- {
- gchar* message = g_strdup_printf(_("This theme will not look as intended because the required GTK+ theme engine '%s' is not installed."), engine);
- gtk_label_set_text(GTK_LABEL(data->style_message_label), message);
- g_free(message);
- g_free(engine);
-
- if (packagekit_available())
- {
- gtk_widget_show(data->style_install_button);
- }
- else
- {
- gtk_widget_hide(data->style_install_button);
- }
-
- gtk_widget_show(data->style_message_area);
- gtk_widget_queue_draw(data->style_message_area);
- }
- else
- {
- gtk_widget_hide(data->style_message_area);
- }
-#else
gtk_widget_hide(data->style_message_area);
-#endif
}
static void
update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *data)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA colors[NUM_SYMBOLIC_COLORS];
-#else
- GdkColor colors[NUM_SYMBOLIC_COLORS];
-#endif
GtkWidget *widget;
gint i;
@@ -309,11 +271,7 @@ update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *dat
/* now set all the buttons to the correct settings */
for (i = 0; i < NUM_SYMBOLIC_COLORS; ++i) {
widget = appearance_capplet_get_widget (data, symbolic_names[i]);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (widget), &colors[i]);
-#else
- gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), &colors[i]);
-#endif
}
}
@@ -384,11 +342,7 @@ static void
color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
{
GtkWidget *widget;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
GString *scheme = g_string_new (NULL);
gchar *colstr;
gchar *old_scheme = NULL;
@@ -396,17 +350,9 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
for (i = 0; i < NUM_SYMBOLIC_COLORS; ++i) {
widget = appearance_capplet_get_widget (data, symbolic_names[i]);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
-#else
- gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &color);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
colstr = gdk_rgba_to_string (&color);
-#else
- colstr = gdk_color_to_string (&color);
-#endif
g_string_append_printf (scheme, "%s:%s\n", symbolic_names[i], colstr);
g_free (colstr);
}
@@ -1070,10 +1016,8 @@ style_init (AppearanceData *data)
icon_theme_changed (data->interface_settings, ICON_THEME_KEY, data);
cursor_theme_changed (data->mouse_settings, CURSOR_THEME_KEY, data);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkNotebook *style_nb = GTK_NOTEBOOK (appearance_capplet_get_widget (data, "notebook2"));
gtk_notebook_remove_page (style_nb, 1);
-#endif
w = appearance_capplet_get_widget (data, "color_scheme_message_hbox");
gtk_widget_set_no_show_all (w, TRUE);
diff --git a/capplets/appearance/appearance-themes.c b/capplets/appearance/appearance-themes.c
index 6669e822..0025e90e 100644
--- a/capplets/appearance/appearance-themes.c
+++ b/capplets/appearance/appearance-themes.c
@@ -667,23 +667,14 @@ theme_message_area_update (AppearanceData *data)
gtk_misc_set_alignment (GTK_MISC (data->theme_message_label), 0.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 9);
-#else
- hbox = gtk_hbox_new (FALSE, 9);
-#endif
gtk_widget_show (hbox);
data->theme_info_icon = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG);
data->theme_error_icon = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (data->theme_info_icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (data->theme_info_icon, GTK_ALIGN_START);
gtk_widget_set_halign (data->theme_error_icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (data->theme_error_icon, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (data->theme_info_icon), 0.5, 0.0);
- gtk_misc_set_alignment (GTK_MISC (data->theme_error_icon), 0.5, 0.0);
-#endif
gtk_box_pack_start (GTK_BOX (hbox), data->theme_info_icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), data->theme_error_icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), data->theme_message_label, TRUE, TRUE, 0);
@@ -1072,20 +1063,8 @@ void themes_init(AppearanceData* data)
"wrap-mode", PANGO_WRAP_WORD_CHAR,
"wrap-width", gtk_icon_view_get_item_width (icon_view),
"width", gtk_icon_view_get_item_width (icon_view),
-#if GTK_CHECK_VERSION (3, 0, 0)
- /* The xalign property should be 0.5 here, but due to a bug
- * which was never fixed in GTK+2, it was set to 0.0.
- * In GTK+3 the bug is fixed, so this workaround causes
- * theme name to be left-aligned instead of being centered.
- * So set it to 0.5 for GTK+3.
- *
- * The fix was applied in
- * https://git.gnome.org/browse/gtk+/commit?id=09bf05b
- */
"xalign", 0.5, "yalign", 0.0, NULL);
-#else
- "xalign", 0.0, "yalign", 0.0, NULL);
-#endif
+
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (icon_view), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (icon_view), renderer,
"markup", COL_LABEL, NULL);
diff --git a/capplets/appearance/appearance-ui.c b/capplets/appearance/appearance-ui.c
index 04b8a49e..00427e96 100644
--- a/capplets/appearance/appearance-ui.c
+++ b/capplets/appearance/appearance-ui.c
@@ -50,21 +50,6 @@ show_handlebar (AppearanceData *data, gboolean show)
g_object_unref (toolbar);
}
-#if !GTK_CHECK_VERSION (3, 10, 0)
-static void
-set_toolbar_style (AppearanceData *data, const char *value)
-{
- static const GtkToolbarStyle gtk_toolbar_styles[] =
- { GTK_TOOLBAR_BOTH, GTK_TOOLBAR_BOTH_HORIZ, GTK_TOOLBAR_ICONS, GTK_TOOLBAR_TEXT };
-
- int enum_val = gtk_combo_box_get_active((GtkComboBox *)
- appearance_capplet_get_widget (data, "toolbar_style_select"));
-
- gtk_toolbar_set_style (GTK_TOOLBAR (appearance_capplet_get_widget (data, "toolbar_toolbar")),
- gtk_toolbar_styles[enum_val]);
-}
-#endif
-
static void
set_have_icons (AppearanceData *data, gboolean value)
{
@@ -101,48 +86,6 @@ set_have_icons (AppearanceData *data, gboolean value)
}
}
-/** GConf Callbacks and Conversions **/
-
-#if !GTK_CHECK_VERSION (3, 10, 0)
-static gboolean
-toolbar_to_widget (GValue *value, GVariant *variant, gpointer user_data)
-{
- const gchar *val = g_variant_get_string(variant, NULL);
- gint i = 0;
-
- if (g_strcmp0(val, "both-horiz") == 0 || g_strcmp0(val, "both_horiz") == 0)
- i = 1;
- else if (g_strcmp0(val, "icons") == 0)
- i = 2;
- else if (g_strcmp0(val, "text") == 0)
- i = 3;
-
- g_value_set_int(value, i);
-
- return TRUE;
-}
-
-static GVariant *
-toolbar_from_widget (const GValue *value,
- const GVariantType *expected_type,
- gpointer user_data)
-{
- static const char *gtk_toolbar_styles_str[] = {
- "both", "both-horiz", "icons", "text" };
-
- gint index = g_value_get_int(value);
- return g_variant_new_string(gtk_toolbar_styles_str[index]);
-}
-
-static void
-toolbar_style_cb (GSettings *settings,
- gchar *key,
- AppearanceData *data)
-{
- set_toolbar_style (data, g_settings_get_string (settings, key));
-}
-#endif
-
static void
menus_have_icons_cb (GSettings *settings,
gchar *key,
@@ -176,7 +119,7 @@ ui_init (AppearanceData *data)
{
GtkWidget* widget;
-#if GTK_CHECK_VERSION (3, 10, 0)
+ /* FIXME maybe just remove that stuff from .ui file */
GtkWidget* container = appearance_capplet_get_widget(data, "vbox24");
// Remove menu accels and toolbar style toggles for new GTK versions
@@ -184,7 +127,6 @@ ui_init (AppearanceData *data)
appearance_capplet_get_widget(data, "menu_accel_toggle"));
gtk_container_remove((GtkContainer *) container,
appearance_capplet_get_widget(data, "hbox11"));
-#endif
widget = appearance_capplet_get_widget(data, "menu_icons_toggle");
g_settings_bind (data->interface_settings,
@@ -199,37 +141,6 @@ ui_init (AppearanceData *data)
g_settings_get_boolean (data->interface_settings,
MENU_ICONS_KEY));
-#if !GTK_CHECK_VERSION (3, 10, 0)
- widget = appearance_capplet_get_widget(data, "menu_accel_toggle");
- g_settings_bind (data->interface_settings,
- ACCEL_CHANGE_KEY,
- G_OBJECT (widget),
- "active",
- G_SETTINGS_BIND_DEFAULT);
-
- widget = appearance_capplet_get_widget(data, "toolbar_style_select");
- g_settings_bind_with_mapping (data->interface_settings,
- TOOLBAR_STYLE_KEY,
- G_OBJECT (widget),
- "active",
- G_SETTINGS_BIND_DEFAULT,
- toolbar_to_widget,
- toolbar_from_widget,
- data,
- NULL);
-
- g_signal_connect (data->interface_settings, "changed::" TOOLBAR_STYLE_KEY,
- (GCallback) toolbar_style_cb, data);
-
- char* toolbar_style;
-
- toolbar_style = g_settings_get_string
- (data->interface_settings,
- TOOLBAR_STYLE_KEY);
- set_toolbar_style (data, toolbar_style);
- g_free (toolbar_style);
-#endif
-
g_signal_connect (appearance_capplet_get_widget (data, "toolbar_handlebox"),
"button_press_event",
(GCallback) button_press_block_cb, NULL);
diff --git a/capplets/appearance/mate-wp-item.c b/capplets/appearance/mate-wp-item.c
index 9daef0d0..766f1b7a 100644
--- a/capplets/appearance/mate-wp-item.c
+++ b/capplets/appearance/mate-wp-item.c
@@ -118,11 +118,7 @@ void mate_wp_item_ensure_mate_bg (MateWPItem *item)
void mate_wp_item_update (MateWPItem *item) {
GSettings *settings;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color1 = { 0, 0, 0, 1.0 }, color2 = { 0, 0, 0, 1.0 };
-#else
- GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
-#endif
gchar *s;
settings = g_settings_new (WP_SCHEMA);
@@ -133,45 +129,26 @@ void mate_wp_item_update (MateWPItem *item) {
s = g_settings_get_string (settings, WP_PCOLOR_KEY);
if (s != NULL) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color1, s);
-#else
- gdk_color_parse (s, &color1);
-#endif
g_free (s);
}
s = g_settings_get_string (settings, WP_SCOLOR_KEY);
if (s != NULL) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color2, s);
-#else
- gdk_color_parse (s, &color2);
-#endif
g_free (s);
}
g_object_unref (settings);
if (item->pcolor != NULL)
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_free (item->pcolor);
-#else
- gdk_color_free (item->pcolor);
-#endif
if (item->scolor != NULL)
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_free (item->scolor);
item->pcolor = gdk_rgba_copy (&color1);
item->scolor = gdk_rgba_copy (&color2);
-#else
- gdk_color_free (item->scolor);
-
- item->pcolor = gdk_color_copy (&color1);
- item->scolor = gdk_color_copy (&color2);
-#endif
}
MateWPItem * mate_wp_item_new (const gchar * filename,
@@ -215,17 +192,10 @@ void mate_wp_item_free (MateWPItem * item) {
g_free (item->description);
if (item->pcolor != NULL)
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_free (item->pcolor);
if (item->scolor != NULL)
gdk_rgba_free (item->scolor);
-#else
- gdk_color_free (item->pcolor);
-
- if (item->scolor != NULL)
- gdk_color_free (item->scolor);
-#endif
mate_wp_info_free (item->fileinfo);
if (item->bg)
diff --git a/capplets/appearance/mate-wp-item.h b/capplets/appearance/mate-wp-item.h
index f75b8474..0f04081b 100644
--- a/capplets/appearance/mate-wp-item.h
+++ b/capplets/appearance/mate-wp-item.h
@@ -45,13 +45,8 @@ struct _MateWPItem {
GtkTreeRowReference * rowref;
/* Real colors */
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA * pcolor;
GdkRGBA * scolor;
-#else
- GdkColor * pcolor;
- GdkColor * scolor;
-#endif
MateWPInfo * fileinfo;
diff --git a/capplets/appearance/mate-wp-xml.c b/capplets/appearance/mate-wp-xml.c
index 2ef58fa0..8a998630 100644
--- a/capplets/appearance/mate-wp-xml.c
+++ b/capplets/appearance/mate-wp-xml.c
@@ -124,13 +124,8 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
xmlNode* wpa;
xmlChar* nodelang;
const char* const* syslangs;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color1;
GdkRGBA color2;
-#else
- GdkColor color1;
- GdkColor color2;
-#endif
gint i;
wplist = xmlParseFile(filename);
@@ -275,11 +270,7 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
continue;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/* Verify the colors and alloc some GdkRGBA here */
-#else
- /* Verify the colors and alloc some GdkColors here */
-#endif
if (!have_scale)
{
wp->options = g_settings_get_enum(data->wp_settings, WP_OPTIONS_KEY);
@@ -305,7 +296,6 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
wp->artist = g_strdup ("(none)");
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse(&color1, pcolor);
gdk_rgba_parse(&color2, scolor);
g_free(pcolor);
@@ -313,15 +303,6 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
wp->pcolor = gdk_rgba_copy(&color1);
wp->scolor = gdk_rgba_copy(&color2);
-#else
- gdk_color_parse(pcolor, &color1);
- gdk_color_parse(scolor, &color2);
- g_free(pcolor);
- g_free(scolor);
-
- wp->pcolor = gdk_color_copy(&color1);
- wp->scolor = gdk_color_copy(&color2);
-#endif
if ((wp->filename != NULL && g_file_test (wp->filename, G_FILE_TEST_EXISTS)) || !strcmp (wp->filename, "(none)"))
{
@@ -523,13 +504,9 @@ void mate_wp_xml_save_list(AppearanceData* data)
filename = g_filename_to_utf8(wpitem->filename, -1, NULL, NULL, NULL);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
pcolor = gdk_rgba_to_string(wpitem->pcolor);
scolor = gdk_rgba_to_string(wpitem->scolor);
-#else
- pcolor = gdk_color_to_string(wpitem->pcolor);
- scolor = gdk_color_to_string(wpitem->scolor);
-#endif
+
scale = wp_item_option_to_string(wpitem->options);
shade = wp_item_shading_to_string(wpitem->shade_type);
diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c
index 20b89e59..2ffb1158 100644
--- a/capplets/appearance/theme-installer.c
+++ b/capplets/appearance/theme-installer.c
@@ -628,9 +628,6 @@ static void
transfer_done_cb (GtkWidget *dialog,
TransferData *tdata)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_enter ();
-#endif
/* XXX: path should be on the local filesystem by now? */
if (dialog != NULL) {
@@ -641,10 +638,6 @@ transfer_done_cb (GtkWidget *dialog,
g_free (tdata->path);
g_free (tdata);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_threads_leave ();
-#endif
}
void
diff --git a/capplets/common/file-transfer-dialog.c b/capplets/common/file-transfer-dialog.c
index 15f39ae7..a879469e 100644
--- a/capplets/common/file-transfer-dialog.c
+++ b/capplets/common/file-transfer-dialog.c
@@ -305,11 +305,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg)
gtk_widget_set_size_request (GTK_WIDGET (dlg), 350, -1);
-#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_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
@@ -327,11 +323,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox), dlg->priv->status, FALSE, FALSE, 0);
-#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 (vbox), hbox, TRUE, TRUE, 0);
table = gtk_table_new (2, 2, FALSE);
@@ -339,11 +331,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg)
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- progress_vbox = gtk_vbox_new (TRUE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), progress_vbox, FALSE, FALSE, 0);
dlg->priv->progress = gtk_progress_bar_new ();
@@ -406,9 +394,7 @@ file_transfer_job_progress (goffset current_bytes,
data->current_bytes = current_bytes;
data->total_bytes = total_bytes;
- gdk_threads_enter ();
file_transfer_job_update (data);
- gdk_threads_leave ();
}
static void
diff --git a/capplets/common/mate-theme-info.c b/capplets/common/mate-theme-info.c
index 38f2c741..c80c95f1 100644
--- a/capplets/common/mate-theme-info.c
+++ b/capplets/common/mate-theme-info.c
@@ -1598,20 +1598,6 @@ gboolean mate_theme_meta_info_validate(const MateThemeMetaInfo* info, GError** e
return FALSE;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* check for gtk theme engines */
- gchar *engine = gtk_theme_info_missing_engine(info->gtk_theme_name, TRUE);
-
- if (engine != NULL)
- {
- g_set_error (error, MATE_THEME_ERROR, MATE_THEME_ERROR_GTK_ENGINE_NOT_AVAILABLE,
- _("This theme will not look as intended because the required GTK+ theme engine '%s' is not installed."),
- engine);
- g_free (engine);
- return FALSE;
- }
-#endif
-
return TRUE;
}
@@ -1704,11 +1690,7 @@ mate_theme_info_register_theme_change (ThemeChangedCallback func,
}
gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_theme_color_scheme_parse (const gchar *scheme, GdkRGBA *colors)
-#else
-mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
-#endif
{
gchar **color_scheme_strings, **color_scheme_pair, *current_string;
gint i;
@@ -1735,7 +1717,6 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
g_strstrip (color_scheme_pair[1]);
if (!strcmp ("fg_color", color_scheme_pair[0]))
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&colors[COLOR_FG], color_scheme_pair[1]);
else if (!strcmp ("bg_color", color_scheme_pair[0]))
gdk_rgba_parse (&colors[COLOR_BG], color_scheme_pair[1]);
@@ -1751,23 +1732,6 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
gdk_rgba_parse (&colors[COLOR_TOOLTIP_FG], color_scheme_pair[1]);
else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0]))
gdk_rgba_parse (&colors[COLOR_TOOLTIP_BG], color_scheme_pair[1]);
-#else
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_FG]);
- else if (!strcmp ("bg_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_BG]);
- else if (!strcmp ("text_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TEXT]);
- else if (!strcmp ("base_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_BASE]);
- else if (!strcmp ("selected_fg_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_SELECTED_FG]);
- else if (!strcmp ("selected_bg_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_SELECTED_BG]);
- else if (!strcmp ("tooltip_fg_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_FG]);
- else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0]))
- gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_BG]);
-#endif
}
g_strfreev (color_scheme_pair);
@@ -1781,11 +1745,7 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors)
gboolean
mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS];
-#else
- GdkColor c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS];
-#endif
int i;
if (!mate_theme_color_scheme_parse (s1, c1) ||
@@ -1793,11 +1753,7 @@ mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2)
return FALSE;
for (i = 0; i < NUM_SYMBOLIC_COLORS; ++i) {
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!gdk_rgba_equal (&c1[i], &c2[i]))
-#else
- if (!gdk_color_equal (&c1[i], &c2[i]))
-#endif
return FALSE;
}
diff --git a/capplets/common/mate-theme-info.h b/capplets/common/mate-theme-info.h
index 9b45951c..1ef14b37 100644
--- a/capplets/common/mate-theme-info.h
+++ b/capplets/common/mate-theme-info.h
@@ -183,13 +183,8 @@ void mate_theme_init (void);
void mate_theme_info_register_theme_change (ThemeChangedCallback func,
gpointer data);
-#if GTK_CHECK_VERSION (3, 0, 0)
gboolean mate_theme_color_scheme_parse (const gchar *scheme,
GdkRGBA *colors);
-#else
-gboolean mate_theme_color_scheme_parse (const gchar *scheme,
- GdkColor *colors);
-#endif
gboolean mate_theme_color_scheme_equal (const gchar *s1,
const gchar *s2);
diff --git a/capplets/common/theme-thumbnail.c b/capplets/common/theme-thumbnail.c
index 775b460c..2b11d01f 100644
--- a/capplets/common/theme-thumbnail.c
+++ b/capplets/common/theme-thumbnail.c
@@ -19,14 +19,6 @@
#include "gtkrc-utils.h"
#include "capplet-util.h"
-#if !GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define GdkRegion cairo_region_t
-#define gdk_region_destroy cairo_region_destroy
-#endif
typedef struct {
gboolean set;
@@ -97,48 +89,8 @@ static int pipe_from_factory_fd[2];
#define MARCO_THUMBNAIL_WIDTH 120
#define MARCO_THUMBNAIL_HEIGHT 60
-/* This draw the thumbnail of gtk
- */
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static GdkPixmap *
-draw_window_on_pixbuf(GtkWidget* widget)
-{
- GdkVisual* visual;
- GdkPixmap* pixmap;
- GtkStyle* style;
- GdkScreen* screen = gdk_screen_get_default();
- GdkWindow* window;
- gint width, height;
-
- gtk_widget_ensure_style(widget);
-
- style = gtk_widget_get_style(widget);
-
- g_assert(style);
- g_assert(style->font_desc);
-
- gtk_window_get_size(GTK_WINDOW(widget), &width, &height);
-
- visual = gtk_widget_get_visual(widget);
- pixmap = gdk_pixmap_new(NULL, width, height, gdk_visual_get_depth (visual));
- gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), gtk_widget_get_colormap(widget));
-
- window = gtk_widget_get_window(widget);
- gdk_window_redirect_to_drawable(window, pixmap, 0, 0, 0, 0, width, height);
- gdk_window_set_override_redirect(window, TRUE);
- gtk_window_move(GTK_WINDOW(widget), gdk_screen_get_width(screen), gdk_screen_get_height(screen));
- gtk_widget_show(widget);
-
- gdk_window_process_updates(window, TRUE);
-
- gtk_widget_hide(widget);
-
- return pixmap;
-}
-#endif
-
-static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, GdkRegion* region)
+static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, cairo_region_t* region)
{
gint nchannels, rowstride, w, h;
guchar *pixels, *p;
@@ -158,11 +110,7 @@ static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, GdkRegion* region)
for (w = 0; w < gdk_pixbuf_get_width (pixbuf); ++w)
for (h = 0; h < gdk_pixbuf_get_height (pixbuf); ++h)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!cairo_region_contains_point (region, w, h))
-#else
- if (!gdk_region_point_in (region, w, h))
-#endif
{
p = pixels + h * rowstride + w * nchannels;
if (G_BYTE_ORDER == G_BIG_ENDIAN)
@@ -201,11 +149,7 @@ create_folder_icon (char *icon_theme_name)
if (folder_icon_info != NULL)
{
folder_icon = gtk_icon_info_load_icon (folder_icon_info, NULL);
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (folder_icon_info);
-#else
- gtk_icon_info_free (folder_icon_info);
-#endif
}
if (folder_icon == NULL)
@@ -236,14 +180,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
GtkRequisition requisition;
GtkAllocation allocation;
GtkAllocation vbox_allocation;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkPixmap *pixmap;
-#endif
MetaFrameFlags flags;
MetaTheme *theme;
GdkPixbuf *pixbuf, *icon;
int icon_width, icon_height;
- GdkRegion *region;
+ cairo_region_t *region;
g_object_set (gtk_settings_get_default (),
"gtk-theme-name", (char *) theme_thumbnail_data->control_theme_name->data,
@@ -272,36 +213,19 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE;
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_offscreen_window_new ();
-#else
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-#endif
preview = meta_preview_new ();
gtk_container_add (GTK_CONTAINER (window), preview);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show_all (window);
-#else
- gtk_widget_realize (window);
- gtk_widget_realize (preview);
-#endif
-#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_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (preview), vbox);
align = gtk_alignment_new (0, 0, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
stock_button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
gtk_container_add (GTK_CONTAINER (align), stock_button);
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- box = gtk_hbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
checkbox = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
@@ -325,18 +249,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
gtk_widget_size_allocate (window, &allocation);
gtk_widget_get_preferred_size (window, &requisition, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_queue_draw (window);
while (gtk_events_pending ())
gtk_main_iteration ();
pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window));
-#else
- pixmap = draw_window_on_pixbuf (window);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
- gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
-#endif
gtk_widget_get_allocation (vbox, &vbox_allocation);
@@ -351,14 +268,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
region = meta_preview_get_clip_region (META_PREVIEW (preview),
META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
pixbuf_apply_mask_region (pixbuf, region);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
g_object_unref (icon);
gtk_widget_destroy (window);
meta_theme_free (theme);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_object_unref (pixmap);
-#endif
return pixbuf;
}
@@ -370,9 +284,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
GtkWidget *window, *vbox, *box, *stock_button, *checkbox, *radio;
GtkRequisition requisition;
GtkAllocation allocation;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkPixmap *pixmap;
-#endif
GdkPixbuf *pixbuf, *retval;
gint width, height;
@@ -381,23 +292,11 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
"gtk-color-scheme", (char *) theme_thumbnail_data->gtk_color_scheme->data,
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_offscreen_window_new ();
-#else
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_container_add (GTK_CONTAINER (window), vbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- box = gtk_hbox_new (FALSE, 6);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
stock_button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
@@ -408,9 +307,7 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
radio = gtk_radio_button_new_from_widget (NULL);
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show_all (window);
-#else
gtk_widget_show_all (vbox);
gtk_widget_realize (stock_button);
gtk_widget_realize (gtk_bin_get_child (GTK_BIN (stock_button)));
@@ -420,7 +317,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
gtk_widget_map (gtk_bin_get_child (GTK_BIN (stock_button)));
gtk_widget_map (checkbox);
gtk_widget_map (radio);
-#endif
gtk_widget_get_preferred_size (window, &requisition, NULL);
allocation.x = 0;
@@ -432,18 +328,11 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_queue_draw (window);
while (gtk_events_pending ())
gtk_main_iteration ();
pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window));
-#else
- pixmap = draw_window_on_pixbuf (window);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
- gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, width, height);
-#endif
retval = gdk_pixbuf_scale_simple (pixbuf,
GTK_THUMBNAIL_SIZE,
@@ -451,9 +340,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
gtk_widget_destroy (window);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_object_unref (pixmap);
-#endif
return retval;
}
@@ -466,11 +352,8 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
MetaTheme *theme;
GtkRequisition requisition;
GtkAllocation allocation;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkPixmap *pixmap;
-#endif
GdkPixbuf *pixbuf, *retval;
- GdkRegion *region;
+ cairo_region_t *region;
theme = meta_theme_load ((char *) theme_thumbnail_data->wm_theme_name->data, NULL);
if (theme == NULL)
@@ -486,11 +369,7 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE;
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_offscreen_window_new ();
-#else
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-#endif
gtk_window_set_default_size (GTK_WINDOW (window), (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2);
preview = meta_preview_new ();
@@ -502,15 +381,7 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
dummy = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (preview), dummy);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_show_all (window);
-#else
- gtk_widget_realize (window);
- gtk_widget_realize (preview);
- gtk_widget_realize (dummy);
- gtk_widget_show_all (preview);
- gtk_widget_map (dummy);
-#endif
gtk_widget_get_preferred_size (window, &requisition, NULL);
allocation.x = 0;
@@ -520,23 +391,16 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
gtk_widget_size_allocate (window, &allocation);
gtk_widget_get_preferred_size (window, &requisition, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_queue_draw (window);
while (gtk_events_pending ())
gtk_main_iteration ();
pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window));
-#else
- pixmap = draw_window_on_pixbuf (window);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2);
- gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2);
-#endif
region = meta_preview_get_clip_region (META_PREVIEW (preview),
MARCO_THUMBNAIL_WIDTH * 1.2, MARCO_THUMBNAIL_HEIGHT * 1.2);
pixbuf_apply_mask_region (pixbuf, region);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
retval = gdk_pixbuf_scale_simple (pixbuf,
@@ -547,9 +411,6 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
gtk_widget_destroy (window);
meta_theme_free (theme);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_object_unref (pixmap);
-#endif
return retval;
}
diff --git a/capplets/display/scrollarea.c b/capplets/display/scrollarea.c
index 7a8845ab..b475fda2 100644
--- a/capplets/display/scrollarea.c
+++ b/capplets/display/scrollarea.c
@@ -20,17 +20,13 @@
#include "scrollarea.h"
#include "foo-marshal.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE_WITH_CODE (FooScrollArea, foo_scroll_area, GTK_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL));
-#else
-G_DEFINE_TYPE (FooScrollArea, foo_scroll_area, GTK_TYPE_CONTAINER);
-#endif
static GtkWidgetClass *parent_class;
typedef struct BackingStore BackingStore;
-typedef void (* ExposeFunc) (cairo_t *cr, GdkRegion *region, gpointer data);
+typedef void (* ExposeFunc) (cairo_t *cr, cairo_region_t *region, gpointer data);
typedef struct InputPath InputPath;
typedef struct InputRegion InputRegion;
@@ -52,7 +48,7 @@ struct InputPath
/* InputRegions are mutually disjoint */
struct InputRegion
{
- GdkRegion *region; /* the boundary of this area in canvas coordinates */
+ cairo_region_t *region; /* the boundary of this area in canvas coordinates */
InputPath *paths;
};
@@ -77,10 +73,10 @@ struct FooScrollAreaPrivate
GtkAdjustment *hadj;
GtkAdjustment *vadj;
-#if GTK_CHECK_VERSION (3, 0, 0)
+
GtkScrollablePolicy hscroll_policy;
GtkScrollablePolicy vscroll_policy;
-#endif
+
int x_offset;
int y_offset;
@@ -91,26 +87,14 @@ struct FooScrollAreaPrivate
AutoScrollInfo *auto_scroll_info;
- /* During expose, this region is set to the region
- * being exposed. At other times, it is NULL
- *
- * It is used for clipping of input areas
- */
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkRegion *expose_region;
-#endif
InputRegion *current_input;
gboolean grabbed;
FooScrollAreaEventFunc grab_func;
gpointer grab_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *surface;
-#else
- GdkPixmap *pixmap;
-#endif
- GdkRegion *update_region; /* In canvas coordinates */
+ cairo_region_t *update_region; /* In canvas coordinates */
};
enum
@@ -121,7 +105,6 @@ enum
LAST_SIGNAL,
};
-#if GTK_CHECK_VERSION (3, 0, 0)
enum {
PROP_0,
PROP_VADJUSTMENT,
@@ -129,40 +112,23 @@ enum {
PROP_HSCROLL_POLICY,
PROP_VSCROLL_POLICY
};
-#endif
static guint signals [LAST_SIGNAL] = { 0 };
-#if GTK_CHECK_VERSION (3, 0, 0)
static void foo_scroll_area_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void foo_scroll_area_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
-#else
-static void foo_scroll_area_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean foo_scroll_area_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gboolean foo_scroll_area_expose (GtkWidget *widget,
- GdkEventExpose *expose);
-#endif
static void foo_scroll_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-#if GTK_CHECK_VERSION (3, 0, 0)
static void foo_scroll_area_set_hadjustment (FooScrollArea *scroll_area,
GtkAdjustment *hadjustment);
static void foo_scroll_area_set_vadjustment (FooScrollArea *scroll_area,
GtkAdjustment *vadjustment);
-#else
-static void foo_scroll_area_set_scroll_adjustments (FooScrollArea *scroll_area,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-#endif
static void foo_scroll_area_realize (GtkWidget *widget);
static void foo_scroll_area_unrealize (GtkWidget *widget);
static void foo_scroll_area_map (GtkWidget *widget);
@@ -211,7 +177,6 @@ foo_scroll_area_finalize (GObject *object)
G_OBJECT_CLASS (foo_scroll_area_parent_class)->finalize (object);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
foo_scroll_area_get_property (GObject *object,
guint property_id,
@@ -263,7 +228,6 @@ foo_scroll_area_set_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
-#endif
static void
foo_scroll_area_class_init (FooScrollAreaClass *class)
@@ -272,16 +236,11 @@ foo_scroll_area_class_init (FooScrollAreaClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->finalize = foo_scroll_area_finalize;
-#if GTK_CHECK_VERSION (3, 0, 0)
object_class->set_property = foo_scroll_area_set_property;
object_class->get_property = foo_scroll_area_get_property;
widget_class->draw = foo_scroll_area_draw;
widget_class->get_preferred_width = foo_scroll_area_get_preferred_width;
widget_class->get_preferred_height = foo_scroll_area_get_preferred_height;
-#else
- widget_class->size_request = foo_scroll_area_size_request;
- widget_class->expose_event = foo_scroll_area_expose;
-#endif
widget_class->size_allocate = foo_scroll_area_size_allocate;
widget_class->realize = foo_scroll_area_realize;
widget_class->unrealize = foo_scroll_area_unrealize;
@@ -291,19 +250,13 @@ foo_scroll_area_class_init (FooScrollAreaClass *class)
widget_class->map = foo_scroll_area_map;
widget_class->unmap = foo_scroll_area_unmap;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- class->set_scroll_adjustments = foo_scroll_area_set_scroll_adjustments;
-#endif
-
parent_class = g_type_class_peek_parent (class);
-#if GTK_CHECK_VERSION (3, 0, 0)
/* Scrollable interface properties */
g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
-#endif
signals[VIEWPORT_CHANGED] =
g_signal_new ("viewport_changed",
@@ -324,34 +277,10 @@ foo_scroll_area_class_init (FooScrollAreaClass *class)
G_STRUCT_OFFSET (FooScrollAreaClass,
paint),
NULL, NULL,
-#if GTK_CHECK_VERSION (3, 0, 0)
g_cclosure_marshal_VOID__POINTER,
-#else
- foo_marshal_VOID__POINTER_BOXED_POINTER,
-#endif
G_TYPE_NONE,
-#if GTK_CHECK_VERSION (3, 0, 0)
1,
-#else
- 3,
- G_TYPE_POINTER,
- GDK_TYPE_RECTANGLE,
-#endif
G_TYPE_POINTER);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (FooScrollAreaClass,
- set_scroll_adjustments),
- NULL, NULL,
- foo_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-#endif
}
static GtkAdjustment *
@@ -377,43 +306,13 @@ foo_scroll_area_init (FooScrollArea *scroll_area)
scroll_area->priv->vadj = g_object_ref_sink (new_adjustment());
scroll_area->priv->x_offset = 0.0;
scroll_area->priv->y_offset = 0.0;
-#if GTK_CHECK_VERSION (3, 0, 0)
scroll_area->priv->min_width = 0;
scroll_area->priv->min_height = 0;
-#else
- scroll_area->priv->min_width = -1;
- scroll_area->priv->min_height = -1;
-#endif
scroll_area->priv->auto_scroll_info = NULL;
scroll_area->priv->input_regions = g_ptr_array_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
scroll_area->priv->surface = NULL;
-#else
- scroll_area->priv->pixmap = NULL;
-#endif
- scroll_area->priv->update_region = gdk_region_new ();
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_set_double_buffered (widget, FALSE);
-#endif
-}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void
-translate_cairo_device (cairo_t *cr,
- int x_offset,
- int y_offset)
-{
- cairo_surface_t *surface = cairo_get_target (cr);
- double dev_x;
- double dev_y;
-
- cairo_surface_get_device_offset (surface, &dev_x, &dev_y);
- dev_x += x_offset;
- dev_y += y_offset;
- cairo_surface_set_device_offset (surface, dev_x, dev_y);
+ scroll_area->priv->update_region = cairo_region_create ();
}
-#endif
typedef void (* PathForeachFunc) (double *x,
double *y,
@@ -469,7 +368,7 @@ static void
input_region_free (InputRegion *region)
{
input_path_free_list (region->paths);
- gdk_region_destroy (region->region);
+ cairo_region_destroy (region->region);
g_free (region);
}
@@ -500,33 +399,33 @@ allocation_to_canvas (FooScrollArea *area,
static void
clear_exposed_input_region (FooScrollArea *area,
- GdkRegion *exposed) /* in canvas coordinates */
+ cairo_region_t *exposed) /* in canvas coordinates */
{
int i;
- GdkRegion *viewport;
+ cairo_region_t *viewport;
GdkRectangle allocation;
gtk_widget_get_allocation (GTK_WIDGET (area), &allocation);
allocation.x = 0;
allocation.y = 0;
allocation_to_canvas (area, &allocation.x, &allocation.y);
- viewport = gdk_region_rectangle (&allocation);
- gdk_region_subtract (viewport, exposed);
+ viewport = cairo_region_create_rectangle (&allocation);
+ cairo_region_subtract (viewport, exposed);
for (i = 0; i < area->priv->input_regions->len; ++i)
{
InputRegion *region = area->priv->input_regions->pdata[i];
- gdk_region_intersect (region->region, viewport);
+ cairo_region_intersect (region->region, viewport);
- if (gdk_region_empty (region->region))
+ if (cairo_region_is_empty (region->region))
{
input_region_free (region);
g_ptr_array_remove_index_fast (area->priv->input_regions, i--);
}
}
- gdk_region_destroy (viewport);
+ cairo_region_destroy (viewport);
}
static void
@@ -535,7 +434,6 @@ setup_background_cr (GdkWindow *window,
int x_offset,
int y_offset)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *parent = gdk_window_get_parent (window);
cairo_pattern_t *bg_pattern;
@@ -553,27 +451,6 @@ setup_background_cr (GdkWindow *window,
cairo_set_source (cr, bg_pattern);
cairo_translate (cr, x_offset, y_offset);
}
-#else
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
- {
- x_offset += private->x;
- y_offset += private->y;
-
- setup_background_cr (GDK_WINDOW (private->parent), cr, x_offset, y_offset);
- }
- else if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
- {
- gdk_cairo_set_source_pixmap (cr, private->bg_pixmap, -x_offset, -y_offset);
- }
- else
- {
- gdk_cairo_set_source_color (cr, &private->bg_color);
- }
-#endif
}
static void
@@ -585,49 +462,26 @@ initialize_background (GtkWidget *widget,
cairo_paint (cr);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void
-clip_to_region (cairo_t *cr, GdkRegion *region)
-{
- int n_rects;
- GdkRectangle *rects;
-
- gdk_region_get_rectangles (region, &rects, &n_rects);
-
- cairo_new_path (cr);
- while (n_rects--)
- {
- GdkRectangle *rect = &(rects[n_rects]);
-
- cairo_rectangle (cr, rect->x, rect->y, rect->width, rect->height);
- }
- cairo_clip (cr);
-
- g_free (rects);
-}
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
foo_scroll_area_draw (GtkWidget *widget,
cairo_t *widget_cr)
{
FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
cairo_t *cr;
- GdkRegion *region;
+ cairo_region_t *region;
GtkAllocation widget_allocation;
/* Setup input areas */
clear_exposed_input_region (scroll_area, scroll_area->priv->update_region);
scroll_area->priv->current_input = g_new0 (InputRegion, 1);
- scroll_area->priv->current_input->region = gdk_region_copy (scroll_area->priv->update_region);
+ scroll_area->priv->current_input->region = cairo_region_copy (scroll_area->priv->update_region);
scroll_area->priv->current_input->paths = NULL;
g_ptr_array_add (scroll_area->priv->input_regions,
scroll_area->priv->current_input);
region = scroll_area->priv->update_region;
- scroll_area->priv->update_region = gdk_region_new ();
+ scroll_area->priv->update_region = cairo_region_create ();
/* Create cairo context */
cr = cairo_create (scroll_area->priv->surface);
@@ -644,84 +498,10 @@ foo_scroll_area_draw (GtkWidget *widget,
cairo_set_source_surface (widget_cr, scroll_area->priv->surface, widget_allocation.x, widget_allocation.y);
cairo_paint (widget_cr);
- gdk_region_destroy (region);
-
- return TRUE;
-}
-#else
-static gboolean
-foo_scroll_area_expose (GtkWidget *widget,
- GdkEventExpose *expose)
-{
- FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
- cairo_t *cr;
- GdkRectangle extents;
- GdkWindow *window = gtk_widget_get_window (widget);
- GdkRegion *region;
- int x_offset, y_offset;
- GtkAllocation widget_allocation;
-
- /* I don't think expose can ever recurse for the same area */
- g_assert (!scroll_area->priv->expose_region);
-
- /* Note that this function can be called at a time
- * where the adj->value is different from x_offset.
- * Ie., the GtkScrolledWindow changed the adj->value
- * without emitting the value_changed signal.
- *
- * Hence we must always use the value we got
- * the last time the signal was emitted, ie.,
- * priv->{x,y}_offset.
- */
-
- x_offset = scroll_area->priv->x_offset;
- y_offset = scroll_area->priv->y_offset;
-
- scroll_area->priv->expose_region = expose->region;
-
- /* Setup input areas */
- clear_exposed_input_region (scroll_area, scroll_area->priv->update_region);
-
- scroll_area->priv->current_input = g_new0 (InputRegion, 1);
- scroll_area->priv->current_input->region = gdk_region_copy (scroll_area->priv->update_region);
- scroll_area->priv->current_input->paths = NULL;
- g_ptr_array_add (scroll_area->priv->input_regions,
- scroll_area->priv->current_input);
-
- region = scroll_area->priv->update_region;
- scroll_area->priv->update_region = gdk_region_new ();
-
- /* Create cairo context */
- cr = gdk_cairo_create (scroll_area->priv->pixmap);
- translate_cairo_device (cr, -x_offset, -y_offset);
- clip_to_region (cr, region);
- initialize_background (widget, cr);
-
- /* Create regions */
- gdk_region_get_clipbox (region, &extents);
-
- g_signal_emit (widget, signals[PAINT], 0, cr, &extents, region);
-
- /* Destroy stuff */
- cairo_destroy (cr);
-
- scroll_area->priv->expose_region = NULL;
- scroll_area->priv->current_input = NULL;
-
- /* Finally draw the backing pixmap */
- gtk_widget_get_allocation (widget, &widget_allocation);
+ cairo_region_destroy (region);
- cr = gdk_cairo_create (window);
- gdk_cairo_set_source_pixmap (cr, scroll_area->priv->pixmap,
- widget_allocation.x, widget_allocation.y);
- gdk_cairo_region (cr, expose->region);
- cairo_fill (cr);
- cairo_destroy (cr);
- gdk_region_destroy (region);
-
return TRUE;
}
-#endif
void
foo_scroll_area_get_viewport (FooScrollArea *scroll_area,
@@ -750,10 +530,9 @@ emit_viewport_changed (FooScrollArea *scroll_area,
g_signal_emit (scroll_area, signals[VIEWPORT_CHANGED], 0,
new_viewport, old_viewport);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (scroll_area->priv->input_window == NULL)
return;
-#endif
+
gdk_window_get_pointer (scroll_area->priv->input_window, &px, &py, NULL);
process_event (scroll_area, FOO_MOTION, px, py);
@@ -813,9 +592,7 @@ foo_scroll_area_realize (GtkWidget *widget)
GtkAllocation widget_allocation;
GdkWindow *window;
gint attributes_mask;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr;
-#endif
gtk_widget_get_allocation (widget, &widget_allocation);
gtk_widget_set_realized (widget, TRUE);
@@ -844,17 +621,11 @@ foo_scroll_area_realize (GtkWidget *widget)
area->priv->input_window = gdk_window_new (window,
&attributes, attributes_mask);
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (widget));
area->priv->surface = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR,
widget_allocation.width, widget_allocation.height);
cairo_destroy (cr);
-#else
- area->priv->pixmap = gdk_pixmap_new (window,
- widget_allocation.width,
- widget_allocation.height,
- -1);
-#endif
+
gdk_window_set_user_data (area->priv->input_window, area);
gtk_widget_style_attach (widget);
@@ -875,7 +646,6 @@ foo_scroll_area_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_surface_t *
create_new_surface (GtkWidget *widget,
cairo_surface_t *old)
@@ -910,48 +680,14 @@ create_new_surface (GtkWidget *widget,
return new;
}
-#else
-static GdkPixmap *
-create_new_pixmap (GtkWidget *widget,
- GdkPixmap *old)
-{
- GtkAllocation widget_allocation;
- GdkPixmap *new;
- cairo_t *cr;
-
- gtk_widget_get_allocation (widget, &widget_allocation);
-
- new = gdk_pixmap_new (gtk_widget_get_window (widget),
- widget_allocation.width,
- widget_allocation.height,
- -1);
-
- /* Unfortunately we don't know in which direction we were resized,
- * so we just assume we were dragged from the south-east corner.
- *
- * Although, maybe we could get the root coordinates of the input-window?
- * That might just work, actually. We need to make sure marco uses
- * static gravity for the window before this will be useful.
- */
-
- cr = gdk_cairo_create (new);
- gdk_cairo_set_source_pixmap (cr, old, 0, 0);
-
- cairo_paint (cr);
- cairo_destroy (cr);
-
- return new;
-}
-#endif
static void
allocation_to_canvas_region (FooScrollArea *area,
- GdkRegion *region)
+ cairo_region_t *region)
{
- gdk_region_offset (region, area->priv->x_offset, area->priv->y_offset);
+ cairo_region_translate (region, area->priv->x_offset, area->priv->y_offset);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
_cairo_region_xor (cairo_region_t *dst, const cairo_region_t *src)
{
@@ -964,7 +700,6 @@ _cairo_region_xor (cairo_region_t *dst, const cairo_region_t *src)
cairo_region_union (dst, trb);
cairo_region_destroy (trb);
}
-#endif
static void
foo_scroll_area_size_allocate (GtkWidget *widget,
@@ -973,51 +708,37 @@ foo_scroll_area_size_allocate (GtkWidget *widget,
FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
GdkRectangle new_viewport;
GdkRectangle old_viewport;
- GdkRegion *old_allocation;
- GdkRegion *invalid;
+ cairo_region_t *old_allocation;
+ cairo_region_t *invalid;
GtkAllocation widget_allocation;
get_viewport (scroll_area, &old_viewport);
gtk_widget_get_allocation (widget, &widget_allocation);
- old_allocation = gdk_region_rectangle (&widget_allocation);
- gdk_region_offset (old_allocation,
+ old_allocation = cairo_region_create_rectangle (&widget_allocation);
+ cairo_region_translate (old_allocation,
-widget_allocation.x, -widget_allocation.y);
- invalid = gdk_region_rectangle (allocation);
- gdk_region_offset (invalid, -allocation->x, -allocation->y);
-#if GTK_CHECK_VERSION (3, 0, 0)
+ invalid = cairo_region_create_rectangle (allocation);
+ cairo_region_translate (invalid, -allocation->x, -allocation->y);
_cairo_region_xor (invalid, old_allocation);
-#else
- gdk_region_xor (invalid, old_allocation);
-#endif
allocation_to_canvas_region (scroll_area, invalid);
foo_scroll_area_invalidate_region (scroll_area, invalid);
- gdk_region_destroy (old_allocation);
- gdk_region_destroy (invalid);
+ cairo_region_destroy (old_allocation);
+ cairo_region_destroy (invalid);
gtk_widget_set_allocation (widget, allocation);
if (scroll_area->priv->input_window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *new_surface;
-#else
- GdkPixmap *new_pixmap;
-#endif
gdk_window_move_resize (scroll_area->priv->input_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
-#if GTK_CHECK_VERSION (3, 0, 0)
new_surface = create_new_surface (widget, scroll_area->priv->surface);
cairo_surface_destroy (scroll_area->priv->surface);
scroll_area->priv->surface = new_surface;
-#else
- new_pixmap = create_new_pixmap (widget, scroll_area->priv->pixmap);
- g_object_unref (scroll_area->priv->pixmap);
- scroll_area->priv->pixmap = new_pixmap;
-#endif
}
get_viewport (scroll_area, &new_viewport);
@@ -1071,7 +792,7 @@ process_event (FooScrollArea *scroll_area,
{
InputRegion *region = scroll_area->priv->input_regions->pdata[i];
- if (gdk_region_point_in (region->region, x, y))
+ if (cairo_region_contains_point (region->region, x, y))
{
InputPath *path;
@@ -1212,7 +933,6 @@ foo_scroll_area_set_size (FooScrollArea *scroll_area,
set_adjustment_values (scroll_area);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
foo_scroll_area_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -1242,17 +962,6 @@ foo_scroll_area_get_preferred_height (GtkWidget *widget,
*natural = scroll_area->priv->min_height;
}
}
-#else
-static void
-foo_scroll_area_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- FooScrollArea *scroll_area = FOO_SCROLL_AREA (widget);
-
- requisition->width = scroll_area->priv->min_width;
- requisition->height = scroll_area->priv->min_height;
-}
-#endif
static void
foo_scroll_area_scroll (FooScrollArea *area,
@@ -1262,7 +971,7 @@ foo_scroll_area_scroll (FooScrollArea *area,
GdkRectangle allocation;
GdkRectangle src_area;
GdkRectangle move_area;
- GdkRegion *invalid_region;
+ cairo_region_t *invalid_region;
gtk_widget_get_allocation (GTK_WIDGET (area), &allocation);
allocation.x = 0;
@@ -1272,18 +981,14 @@ foo_scroll_area_scroll (FooScrollArea *area,
src_area.x -= dx;
src_area.y -= dy;
- invalid_region = gdk_region_rectangle (&allocation);
+ invalid_region = cairo_region_create_rectangle (&allocation);
if (gdk_rectangle_intersect (&allocation, &src_area, &move_area))
{
- GdkRegion *move_region;
+ cairo_region_t *move_region;
cairo_t *cr;
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = cairo_create (area->priv->surface);
-#else
- cr = gdk_cairo_create (area->priv->pixmap);
-#endif
/* Cairo doesn't allow self-copies, so we do this little trick instead:
* 1) Clip so the group size is small.
@@ -1293,11 +998,7 @@ foo_scroll_area_scroll (FooScrollArea *area,
cairo_clip (cr);
cairo_push_group (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_surface (cr, area->priv->surface, dx, dy);
-#else
- gdk_cairo_set_source_pixmap (cr, area->priv->pixmap, dx, dy);
-#endif
gdk_cairo_rectangle (cr, &move_area);
cairo_fill (cr);
@@ -1308,17 +1009,17 @@ foo_scroll_area_scroll (FooScrollArea *area,
gtk_widget_queue_draw (GTK_WIDGET (area));
- move_region = gdk_region_rectangle (&move_area);
- gdk_region_offset (move_region, dx, dy);
- gdk_region_subtract (invalid_region, move_region);
- gdk_region_destroy (move_region);
+ move_region = cairo_region_create_rectangle (&move_area);
+ cairo_region_translate (move_region, dx, dy);
+ cairo_region_subtract (invalid_region, move_region);
+ cairo_region_destroy (move_region);
}
allocation_to_canvas_region (area, invalid_region);
foo_scroll_area_invalidate_region (area, invalid_region);
- gdk_region_destroy (invalid_region);
+ cairo_region_destroy (invalid_region);
}
static void
@@ -1392,7 +1093,6 @@ set_one_adjustment (FooScrollArea *scroll_area,
scroll_area);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
foo_scroll_area_set_hadjustment (FooScrollArea *scroll_area,
GtkAdjustment *hadjustment)
@@ -1410,18 +1110,6 @@ foo_scroll_area_set_vadjustment (FooScrollArea *scroll_area,
set_adjustment_values (scroll_area);
}
-#else
-static void
-foo_scroll_area_set_scroll_adjustments (FooScrollArea *scroll_area,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- set_one_adjustment (scroll_area, hadjustment, &scroll_area->priv->hadj);
- set_one_adjustment (scroll_area, vadjustment, &scroll_area->priv->vadj);
-
- set_adjustment_values (scroll_area);
-}
-#endif
FooScrollArea *
foo_scroll_area_new (void)
@@ -1524,33 +1212,33 @@ foo_scroll_area_invalidate (FooScrollArea *scroll_area)
static void
canvas_to_window (FooScrollArea *area,
- GdkRegion *region)
+ cairo_region_t *region)
{
GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET (area);
gtk_widget_get_allocation (widget, &allocation);
- gdk_region_offset (region,
+ cairo_region_translate (region,
-area->priv->x_offset + allocation.x,
-area->priv->y_offset + allocation.y);
}
static void
window_to_canvas (FooScrollArea *area,
- GdkRegion *region)
+ cairo_region_t *region)
{
GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET (area);
gtk_widget_get_allocation (widget, &allocation);
- gdk_region_offset (region,
+ cairo_region_translate (region,
area->priv->x_offset - allocation.x,
area->priv->y_offset - allocation.y);
}
void
foo_scroll_area_invalidate_region (FooScrollArea *area,
- GdkRegion *region)
+ cairo_region_t *region)
{
GtkWidget *widget;
@@ -1558,7 +1246,7 @@ foo_scroll_area_invalidate_region (FooScrollArea *area,
widget = GTK_WIDGET (area);
- gdk_region_union (area->priv->update_region, region);
+ cairo_region_union (area->priv->update_region, region);
if (gtk_widget_get_realized (widget))
{
@@ -1579,15 +1267,15 @@ foo_scroll_area_invalidate_rect (FooScrollArea *scroll_area,
int height)
{
GdkRectangle rect = { x, y, width, height };
- GdkRegion *region;
+ cairo_region_t *region;
g_return_if_fail (FOO_IS_SCROLL_AREA (scroll_area));
- region = gdk_region_rectangle (&rect);
+ region = cairo_region_create_rectangle (&rect);
foo_scroll_area_invalidate_region (scroll_area, region);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
}
void
diff --git a/capplets/display/scrollarea.h b/capplets/display/scrollarea.h
index 9e0caa67..9c39cc60 100644
--- a/capplets/display/scrollarea.h
+++ b/capplets/display/scrollarea.h
@@ -18,21 +18,6 @@
#include <cairo.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define GdkRegion cairo_region_t
-#define gdk_region_new cairo_region_create
-#define gdk_region_destroy cairo_region_destroy
-#define gdk_region_rectangle cairo_region_create_rectangle
-#define gdk_region_subtract cairo_region_subtract
-#define gdk_region_intersect cairo_region_intersect
-#define gdk_region_empty cairo_region_is_empty
-#define gdk_region_copy cairo_region_copy
-#define gdk_region_get_clipbox cairo_region_get_extents
-#define gdk_region_offset cairo_region_translate
-#define gdk_region_point_in cairo_region_contains_point
-#define gdk_region_union cairo_region_union
-#endif
-
#define FOO_TYPE_SCROLL_AREA (foo_scroll_area_get_type ())
#define FOO_SCROLL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_SCROLL_AREA, FooScrollArea))
#define FOO_SCROLL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_TYPE_SCROLL_AREA, FooScrollAreaClass))
@@ -85,7 +70,7 @@ struct FooScrollAreaClass
void (*paint) (FooScrollArea *scroll_area,
cairo_t *cr,
GdkRectangle *extents,
- GdkRegion *region);
+ cairo_region_t *region);
};
GType foo_scroll_area_get_type (void);
@@ -120,7 +105,7 @@ void foo_scroll_area_add_input_from_fill (FooScrollArea *scroll_area,
FooScrollAreaEventFunc func,
gpointer data);
void foo_scroll_area_invalidate_region (FooScrollArea *area,
- GdkRegion *region);
+ cairo_region_t *region);
void foo_scroll_area_invalidate (FooScrollArea *scroll_area);
void foo_scroll_area_invalidate_rect (FooScrollArea *scroll_area,
int x,
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 96b1900e..4a538f43 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -476,11 +476,7 @@ static void
rebuild_current_monitor_label (App *app)
{
char *str, *tmp;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
gboolean use_color;
if (app->current_output)
@@ -491,11 +487,7 @@ rebuild_current_monitor_label (App *app)
tmp = g_strdup_printf (_("Monitor: %s"), mate_rr_output_info_get_display_name (app->current_output));
str = g_strdup_printf ("<b>%s</b>", tmp);
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_rr_labeler_get_rgba_for_output (app->labeler, app->current_output, &color);
-#else
- mate_rr_labeler_get_color_for_output (app->labeler, app->current_output, &color);
-#endif
use_color = TRUE;
g_free (tmp);
}
@@ -510,7 +502,6 @@ rebuild_current_monitor_label (App *app)
if (use_color)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA black = { 0, 0, 0, 1.0 };
gtk_widget_override_background_color (app->current_monitor_event_box, gtk_widget_get_state_flags (app->current_monitor_event_box), &color);
@@ -520,28 +511,7 @@ rebuild_current_monitor_label (App *app)
* pastel background. See bgo#556050
*/
gtk_widget_override_color (app->current_monitor_label, gtk_widget_get_state_flags (app->current_monitor_label), &black);
-#else
- GdkColor black = { 0, 0, 0, 0 };
-
- gtk_widget_modify_bg (app->current_monitor_event_box, gtk_widget_get_state (app->current_monitor_event_box), &color);
-
- /* Make the label explicitly black. We don't want it to follow the
- * theme's colors, since the label is always shown against a light
- * pastel background. See bgo#556050
- */
- gtk_widget_modify_fg (app->current_monitor_label, gtk_widget_get_state (app->current_monitor_label), &black);
-#endif
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- else
- {
- /* Remove any modifications we did on the label's color */
- GtkRcStyle *reset_rc_style;
-
- reset_rc_style = gtk_rc_style_new ();
- gtk_widget_modify_style (app->current_monitor_label, reset_rc_style); /* takes ownership of, and destroys, the rc style */
- }
-#endif
gtk_event_box_set_visible_window (GTK_EVENT_BOX (app->current_monitor_event_box), use_color);
}
@@ -1503,11 +1473,7 @@ set_cursor (GtkWidget *widget, GdkCursorType type)
gdk_window_set_cursor (window, cursor);
if (cursor)
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
static void
@@ -1680,25 +1646,16 @@ paint_background (FooScrollArea *area,
{
GdkRectangle viewport;
GtkWidget *widget;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *widget_style;
GdkRGBA *base_color = NULL;
GdkRGBA dark_color;
-#else
- GtkStyle *widget_style;
-#endif
widget = GTK_WIDGET (area);
foo_scroll_area_get_viewport (area, &viewport);
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_style = gtk_widget_get_style_context (widget);
-#else
- widget_style = gtk_widget_get_style (widget);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_save (widget_style);
gtk_style_context_set_state (widget_style, GTK_STATE_FLAG_SELECTED);
gtk_style_context_get (widget_style,
@@ -1708,12 +1665,6 @@ paint_background (FooScrollArea *area,
gtk_style_context_restore (widget_style);
gdk_cairo_set_source_rgba(cr, base_color);
gdk_rgba_free (base_color);
-#else
- cairo_set_source_rgb (cr,
- widget_style->base[GTK_STATE_SELECTED].red / 65535.0,
- widget_style->base[GTK_STATE_SELECTED].green / 65535.0,
- widget_style->base[GTK_STATE_SELECTED].blue / 65535.0);
-#endif
cairo_rectangle (cr,
viewport.x, viewport.y,
@@ -1723,7 +1674,6 @@ paint_background (FooScrollArea *area,
foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_save (widget_style);
gtk_style_context_set_state (widget_style, GTK_STATE_FLAG_SELECTED);
mate_desktop_gtk_style_get_dark_color (widget_style,
@@ -1731,12 +1681,6 @@ paint_background (FooScrollArea *area,
&dark_color);
gtk_style_context_restore (widget_style);
gdk_cairo_set_source_rgba (cr, &dark_color);
-#else
- cairo_set_source_rgb (cr,
- widget_style->dark[GTK_STATE_SELECTED].red / 65535.0,
- widget_style->dark[GTK_STATE_SELECTED].green / 65535.0,
- widget_style->dark[GTK_STATE_SELECTED].blue / 65535.0);
-#endif
cairo_stroke (cr);
}
@@ -1755,11 +1699,7 @@ paint_output (App *app, cairo_t *cr, int i)
PangoLayout *layout = get_display_name (app, output);
PangoRectangle ink_extent, log_extent;
GdkRectangle viewport;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA output_color;
-#else
- GdkColor output_color;
-#endif
double r, g, b;
double available_w;
double factor;
@@ -1811,17 +1751,10 @@ paint_output (App *app, cairo_t *cr, int i)
cairo_rectangle (cr, x, y, w * scale + 0.5, h * scale + 0.5);
cairo_clip_preserve (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
mate_rr_labeler_get_rgba_for_output (app->labeler, output, &output_color);
r = output_color.red;
g = output_color.green;
b = output_color.blue;
-#else
- mate_rr_labeler_get_color_for_output (app->labeler, output, &output_color);
- r = output_color.red / 65535.0;
- g = output_color.green / 65535.0;
- b = output_color.blue / 65535.0;
-#endif
if (!mate_rr_output_info_is_active (output))
{
@@ -1881,19 +1814,10 @@ paint_output (App *app, cairo_t *cr, int i)
g_object_unref (layout);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
on_area_paint (FooScrollArea *area,
cairo_t *cr,
gpointer data)
-#else
-static void
-on_area_paint (FooScrollArea *area,
- cairo_t *cr,
- GdkRectangle *extent,
- GdkRegion *region,
- gpointer data)
-#endif
{
App *app = data;
double scale;
@@ -2280,11 +2204,7 @@ get_output_for_window (MateRRConfig *configuration, GdkWindow *window)
int largest_index;
MateRROutputInfo **outputs;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height);
-#else
- gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height, NULL);
-#endif
gdk_window_get_origin (window, &win_rect.x, &win_rect.y);
largest_area = 0;
diff --git a/capplets/keybindings/eggcellrendererkeys.c b/capplets/keybindings/eggcellrendererkeys.c
index b521cf0a..8cd91ce9 100644
--- a/capplets/keybindings/eggcellrendererkeys.c
+++ b/capplets/keybindings/eggcellrendererkeys.c
@@ -6,10 +6,6 @@
#include "eggcellrendererkeys.h"
#include "eggaccelerators.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
#ifndef EGG_COMPILATION
#ifndef _
#define _(x) dgettext (GETTEXT_PACKAGE, x)
diff --git a/capplets/keybindings/mate-keybinding-properties.c b/capplets/keybindings/mate-keybinding-properties.c
index f06ab09b..9d548569 100644
--- a/capplets/keybindings/mate-keybinding-properties.c
+++ b/capplets/keybindings/mate-keybinding-properties.c
@@ -19,10 +19,6 @@
#include "activate-settings-daemon.h"
#include "dconf-util.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 GSETTINGS_KEYBINDINGS_DIR "/org/mate/desktop/keybindings/"
#define CUSTOM_KEYBINDING_SCHEMA "org.mate.control-center.keybinding"
@@ -1891,13 +1887,11 @@ setup_dialog (GtkBuilder *builder, GSettings *marco_settings)
/* set up the dialog */
reload_key_entries (builder);
-#if GTK_CHECK_VERSION(3, 0, 0)
widget = _gtk_builder_get_widget (builder, "mate-keybinding-dialog");
gtk_window_set_default_size (GTK_WINDOW (widget), 400, 500);
widget = _gtk_builder_get_widget (builder, "label-suggest");
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (widget), 60);
-#endif
widget = _gtk_builder_get_widget (builder, "mate-keybinding-dialog");
capplet_set_icon (widget, "preferences-desktop-keyboard-shortcuts");
diff --git a/capplets/keyboard/mate-keyboard-properties-a11y.c b/capplets/keyboard/mate-keyboard-properties-a11y.c
index 7a3b566e..23aea9e1 100644
--- a/capplets/keyboard/mate-keyboard-properties-a11y.c
+++ b/capplets/keyboard/mate-keyboard-properties-a11y.c
@@ -320,19 +320,4 @@ setup_a11y_tabs (GtkBuilder *dialog)
gtk_range_get_adjustment (GTK_RANGE (WID ("mousekeys_init_delay_slide"))),
"value",
G_SETTINGS_BIND_DEFAULT);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- const char *range_names[] = {
- "slowkeys_delay_slide",
- "bouncekeys_delay_slide",
- "mousekeys_accel_time_slide",
- "mousekeys_max_speed_slide",
- "mousekeys_init_delay_slide"
- };
-
- int i;
- for (i = 0; i < 5; ++i) {
- gtk_range_set_update_policy (GTK_RANGE (WID (range_names[i])), GTK_UPDATE_DISCONTINUOUS);
- }
-#endif
}
diff --git a/capplets/keyboard/mate-keyboard-properties-xkbot.c b/capplets/keyboard/mate-keyboard-properties-xkbot.c
index 90301082..6f59498a 100644
--- a/capplets/keyboard/mate-keyboard-properties-xkbot.c
+++ b/capplets/keyboard/mate-keyboard-properties-xkbot.c
@@ -327,11 +327,7 @@ xkb_options_add_group (XklConfigRegistry * config_registry,
g_free (titlemarkup);
align = gtk_alignment_new (0, 0, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 12, 12, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (TRUE, 6);
-#endif
gtk_container_add (GTK_CONTAINER (align), vbox);
gtk_container_add (GTK_CONTAINER (current_expander), align);
diff --git a/capplets/keyboard/mate-keyboard-properties.c b/capplets/keyboard/mate-keyboard-properties.c
index d0418616..66dd13c0 100644
--- a/capplets/keyboard/mate-keyboard-properties.c
+++ b/capplets/keyboard/mate-keyboard-properties.c
@@ -186,10 +186,6 @@ setup_dialog (GtkBuilder * dialog)
gtk_notebook_remove_page (nb, tb_page);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_range_set_update_policy (GTK_RANGE (WID ("cursor_blink_time_scale")), GTK_UPDATE_DISCONTINUOUS);
-#endif
-
g_signal_connect (WID ("keyboard_dialog"), "response",
(GCallback) dialog_response, NULL);
diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c
index 3a961530..27eb573c 100644
--- a/capplets/mouse/mate-mouse-properties.c
+++ b/capplets/mouse/mate-mouse-properties.c
@@ -210,11 +210,7 @@ synaptics_check_capabilities (GtkBuilder *dialog)
XFree (data);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device);
}
@@ -264,11 +260,7 @@ find_synaptics (void)
ret = TRUE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device);
diff --git a/capplets/windows/mate-metacity-support.c b/capplets/windows/mate-metacity-support.c
index ec9ca7aa..079b18d1 100644
--- a/capplets/windows/mate-metacity-support.c
+++ b/capplets/windows/mate-metacity-support.c
@@ -46,11 +46,7 @@ mate_metacity_config_tool ()
gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-system-windows");
gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 150);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (FALSE, 6);
-#endif
str = g_strdup_printf ("<b>%s</b>", _("Compositing Manager"));
widget = gtk_label_new (str);
diff --git a/capplets/windows/mate-window-properties.c b/capplets/windows/mate-window-properties.c
index 7f8442f9..4cafde89 100644
--- a/capplets/windows/mate-window-properties.c
+++ b/capplets/windows/mate-window-properties.c
@@ -369,40 +369,22 @@ main (int argc, char **argv)
nb = gtk_notebook_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
general_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
behaviour_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
placement_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- general_vbox = gtk_vbox_new (FALSE, 0);
- behaviour_vbox = gtk_vbox_new (FALSE, 0);
- placement_vbox = gtk_vbox_new (FALSE, 0);
-#endif
widget = gtk_label_new (_("General"));
-#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 (hbox), general_vbox, FALSE, FALSE, 6);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);
widget = gtk_label_new (_("Behaviour"));
-#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 (hbox), behaviour_vbox, FALSE, FALSE, 6);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);
widget = gtk_label_new (_("Placement"));
-#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 (hbox), placement_vbox, FALSE, FALSE, 6);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);
@@ -410,15 +392,10 @@ main (int argc, char **argv)
widget = title_label_new (N_("Compositing Manager"));
gtk_box_pack_start (GTK_BOX (general_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
- hbox1 = gtk_hbox_new (FALSE, 0);
-#endif
+
compositing_checkbutton = gtk_check_button_new_with_mnemonic (_("Enable software _compositing window manager"));
compositing_fast_alt_tab_checkbutton = gtk_check_button_new_with_mnemonic (_("Disable _thumbnails in Alt-Tab"));
gtk_box_pack_start (GTK_BOX (vbox), compositing_checkbutton, FALSE, FALSE, 6);
@@ -431,11 +408,7 @@ main (int argc, char **argv)
widget = title_label_new (N_("Titlebar Buttons"));
gtk_box_pack_start (GTK_BOX (general_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
widget = gtk_label_new (_("Position:"));
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
titlebar_layout_optionmenu = gtk_combo_box_text_new ();
@@ -446,11 +419,7 @@ main (int argc, char **argv)
widget = title_label_new (N_("New Windows"));
gtk_box_pack_start (GTK_BOX (placement_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
center_new_windows_checkbutton = gtk_check_button_new_with_mnemonic (_("Center _new windows"));
gtk_box_pack_start (GTK_BOX (hbox), center_new_windows_checkbutton, FALSE, FALSE, 6);
gtk_box_pack_start (GTK_BOX (placement_vbox), hbox, FALSE, FALSE, 6);
@@ -459,11 +428,7 @@ main (int argc, char **argv)
widget = title_label_new (N_("Window Snapping"));
gtk_box_pack_start (GTK_BOX (placement_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
side_by_side_tiling_checkbutton = gtk_check_button_new_with_mnemonic (_("Enable side by side _tiling"));
gtk_box_pack_start (GTK_BOX (hbox), side_by_side_tiling_checkbutton, FALSE, FALSE, 6);
gtk_box_pack_start (GTK_BOX (placement_vbox), hbox, FALSE, FALSE, 6);
@@ -472,22 +437,12 @@ main (int argc, char **argv)
widget = title_label_new (N_("Window Selection"));
gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);
-
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
hbox3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
- vbox1 = gtk_vbox_new (FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
- hbox1 = gtk_hbox_new (FALSE, 0);
- hbox2 = gtk_hbox_new (FALSE, 0);
- hbox3 = gtk_hbox_new (FALSE, 0);
-#endif
focus_mode_checkbutton = gtk_check_button_new_with_mnemonic (_("_Select windows when the mouse moves over them"));
gtk_box_pack_start (GTK_BOX (vbox), focus_mode_checkbutton, FALSE, FALSE, 6);
@@ -500,13 +455,9 @@ main (int argc, char **argv)
gtk_box_pack_start (GTK_BOX (hbox2), autoraise_checkbutton, FALSE, FALSE, 6);
gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
autoraise_delay_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
autoraise_delay_slider = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 10, 0.2);
-#else
- autoraise_delay_hbox = gtk_hbox_new (FALSE, 0);
- autoraise_delay_slider = gtk_hscale_new_with_range (0, 10, 0.2);
-#endif
+
widget = gtk_label_new_with_mnemonic (_("_Interval before raising:"));
gtk_box_pack_start (GTK_BOX (autoraise_delay_hbox), widget, FALSE, FALSE, 6);
gtk_box_pack_start (GTK_BOX (autoraise_delay_hbox), autoraise_delay_slider, TRUE, TRUE, 6);
@@ -525,11 +476,7 @@ main (int argc, char **argv)
widget = title_label_new (N_("Titlebar Action"));
gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
widget = gtk_label_new_with_mnemonic (_("_Double-click titlebar to perform this action:"));
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
double_click_titlebar_optionmenu = gtk_combo_box_text_new ();
@@ -541,13 +488,8 @@ main (int argc, char **argv)
widget = title_label_new (N_("Movement Key"));
gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
widget = gtk_label_new_with_mnemonic (_("To move a window, press-and-hold this key then grab the window:"));
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -558,11 +500,7 @@ main (int argc, char **argv)
#endif
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
alt_click_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- alt_click_vbox = gtk_vbox_new (FALSE, 6);
-#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), alt_click_vbox);
gtk_box_pack_start (GTK_BOX (vbox), alt_click_vbox, FALSE, FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6);
diff --git a/configure.ac b/configure.ac
index e9f95e94..91b2fbf6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([mate-control-center], [1.16.0], [htts://www.mate-desktop.org/])
+AC_INIT([mate-control-center], [1.17.0], [htts://www.mate-desktop.org/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([shell])
@@ -59,42 +59,17 @@ AC_CHECK_FUNC(XScreenSaverQueryInfo, [
AC_SUBST(TYPING_BREAK)
AC_SUBST(SCREENSAVER_LIBS)
-dnl ==============================================
-dnl Check GTK+ API version
-dnl ==============================================
-
+GLIB_REQUIRED=2.36.0
+GTK_REQUIRED=3.14.0
+MARCO_REQUIRED=1.17.0
+MSD_REQUIRED=1.17.0
+MATEKBD_REQUIRED=1.17.0
+MATE_DESKTOP_REQUIRED=1.17.0
APPINDICATOR_REQUIRED=0.0.13
-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
- MATE_DESKTOP_REQUIRED=1.15.1
- LIBCANBERRA_API_VERSION=
- LIBUNIQUE_API_VERSION=1.0
- ENGINES_FOLDER="engines"
- APPINDICATOR_API_VERSION=
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- MATE_DESKTOP_REQUIRED=1.15.1
- LIBCANBERRA_API_VERSION=3
- ENGINES_FOLDER="theming-engines"
- APPINDICATOR_API_VERSION=3
- ;;
-esac
-AC_SUBST(GTK_API_VERSION)
-
-PKG_CHECK_MODULES(LIBCANBERRA_GTK, libcanberra-gtk$LIBCANBERRA_API_VERSION, [
+ENGINES_FOLDER="theming-engines"
+
+PKG_CHECK_MODULES(LIBCANBERRA_GTK, libcanberra-gtk3, [
CANBERRA_GTK=1
AC_SUBST(LIBCANBERRA_GTK_CFLAGS)
AC_SUBST(LIBCANBERRA_GTK_LIBS)
@@ -104,7 +79,7 @@ AM_CONDITIONAL(HAVE_LIBCANBERRA_GTK, test "x$CANBERRA_GTK" = "x1")
AM_CONDITIONAL(HAVE_TYPING_BREAK, test "x$TYPING_BREAK" = xtyping-break)
dnl app indicator
-APPINDICATOR_PKG=appindicator$APPINDICATOR_API_VERSION-0.1
+APPINDICATOR_PKG=appindicator3-0.1
AC_ARG_ENABLE(appindicator,
AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators ]),
@@ -149,9 +124,9 @@ dnl Check that we meet the dependencies
dnl ==============================================
PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
-COMMON_MODULES="gtk+-$GTK_API_VERSION >= $GTK_REQUIRED dnl
+COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED dnl
$GMODULE_ADD dnl
- glib-2.0 >= 2.36 dnl
+ glib-2.0 >= $GLIB_REQUIRED dnl
gthread-2.0 dnl
gio-2.0 dnl
gio-unix-2.0 dnl
@@ -159,31 +134,26 @@ COMMON_MODULES="gtk+-$GTK_API_VERSION >= $GTK_REQUIRED dnl
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED"
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(MATECC, $COMMON_MODULES libmate-menu >= 1.1.0)
-
-if test "$GTK_API_VERSION" = "3.0"; then
- PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu)
-else
- PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu unique-$LIBUNIQUE_API_VERSION)
-fi
+PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu)
PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
-PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= MATE_DESKTOP_REQUIRED)
+PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED)
PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
-PKG_CHECK_MODULES(MARCO, libmarco-private >= 1.13.1)
-PKG_CHECK_MODULES(TYPING, $GMODULE_ADD glib-2.0 > 2.36 gio-2.0 gtk+-$GTK_API_VERSION)
-PKG_CHECK_MODULES(GSD_DBUS, mate-settings-daemon >= 1.13.1)
+PKG_CHECK_MODULES(MARCO, libmarco-private >= $MARCO_REQUIRED)
+PKG_CHECK_MODULES(TYPING, $GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED gio-2.0 gtk+-3.0 >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(GSD_DBUS, mate-settings-daemon >= $MSD_REQUIRED)
PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES([DCONF], [dconf >= 0.13.4])
AC_SUBST(DCONF_CFLAGS)
AC_SUBST(DCONF_LIBS)
-gtk_lib_dir=`$PKG_CONFIG --variable libdir gtk+-$GTK_API_VERSION`
-gtk_binary_version=`$PKG_CONFIG --variable gtk_binary_version gtk+-$GTK_API_VERSION`
-GTK_ENGINE_DIR="$gtk_lib_dir/gtk-$GTK_API_VERSION/$gtk_binary_version/$ENGINES_FOLDER"
+gtk_lib_dir=`$PKG_CONFIG --variable libdir gtk+-3.0`
+gtk_binary_version=`$PKG_CONFIG --variable gtk_binary_version gtk+-3.0`
+GTK_ENGINE_DIR="$gtk_lib_dir/gtk-3.0/$gtk_binary_version/$ENGINES_FOLDER"
AC_SUBST(GTK_ENGINE_DIR)
-PKG_CHECK_MODULES(GLIB, glib-2.0 $GMODULE_ADD)
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED $GMODULE_ADD)
dnl
dnl Check dependencies of libmate-slab
@@ -226,14 +196,11 @@ PKG_CHECK_MODULES(XINPUT, xi >= 1.5)
CAPPLET_LIBS="$CAPPLET_LIBS $XINPUT_LIBS"
-dnl ==============
-dnl gswitchit
-dnl ==============
-PKG_CHECK_MODULES(LIBMATEKBD, [libmatekbd >= 1.1.0 libxklavier >= 4.0])
+PKG_CHECK_MODULES(LIBMATEKBD, [libmatekbd >= $MATEKBD_REQUIRED libxklavier >= 5.2])
AC_SUBST(LIBMATEKBD_CFLAGS)
AC_SUBST(LIBMATEKBD_LIBS)
-PKG_CHECK_MODULES(LIBMATEKBDUI, [libmatekbdui >= 1.1.0])
+PKG_CHECK_MODULES(LIBMATEKBDUI, [libmatekbdui >= $MATEKBD_REQUIRED])
AC_SUBST(LIBMATEKBDUI_CFLAGS)
AC_SUBST(LIBMATEKBDUI_LIBS)
@@ -342,7 +309,6 @@ dnl ---------------------------------------------------------------------------
echo "
mate-control-center
- GTK+ API version: ${GTK_API_VERSION}
Appindicator: ${enable_appindicator}
Libmate-slab: ${have_libmateslab}
"
diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c
index 0bd32be1..bce0859e 100644
--- a/font-viewer/font-view.c
+++ b/font-viewer/font-view.c
@@ -48,13 +48,8 @@ draw_string (cairo_t *cr,
{
cairo_text_extents_t extents;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
gdk_cairo_set_source_rgba (cr, &black);
-#else
- GdkColor black = { 0, 0, 0, 0 };
- gdk_cairo_set_source_color (cr, &black);
-#endif
cairo_text_extents (cr, text, &extents);
cairo_move_to (cr, 4, *pos_y);
@@ -217,7 +212,6 @@ draw (GtkWidget *drawing_area,
g_free (sizes);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
draw_callback (GtkWidget *drawing_area,
cairo_t *cr,
@@ -225,25 +219,9 @@ draw_callback (GtkWidget *drawing_area,
{
draw (drawing_area, cr, face);
}
-#else
-static void
-expose_callback (GtkWidget *drawing_area,
- GdkEventExpose *event,
- FT_Face face)
-{
- cairo_t *cr = gdk_cairo_create (event->window);
- draw (drawing_area, cr, face);
- cairo_destroy (cr);
-}
-#endif
static void
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (GtkWidget *grid,
-#else
-add_row (GtkWidget *table,
- gint *row_p,
-#endif
const gchar *name,
const gchar *value,
gboolean multiline,
@@ -263,12 +241,7 @@ add_row (GtkWidget *table,
#endif
gtk_label_set_use_markup (GTK_LABEL (name_w), TRUE);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_container_add (GTK_CONTAINER (grid), name_w);
-#else
- gtk_table_attach (GTK_TABLE(table), name_w, 0, 1, *row_p, *row_p + 1,
- GTK_FILL, GTK_FILL, 0, 0);
-#endif
if (multiline) {
GtkWidget *label, *viewport;
@@ -295,7 +268,7 @@ add_row (GtkWidget *table,
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (swin), viewport);
-#if GTK_CHECK_VERSION (3, 4, 0)
+
if (expand) {
gtk_widget_set_hexpand (GTK_WIDGET (swin), TRUE);
gtk_widget_set_vexpand (GTK_WIDGET (swin), TRUE);
@@ -304,18 +277,6 @@ add_row (GtkWidget *table,
gtk_container_add_with_properties (GTK_CONTAINER (grid), GTK_WIDGET (swin),
"width", 2,
NULL);
-#else
- (*row_p)++;
-
- if (expand)
- flags = GTK_FILL | GTK_EXPAND;
- else
- flags = GTK_FILL;
-
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (swin),
- 0, 2, *row_p, *row_p + 1,
- GTK_FILL | GTK_EXPAND, flags, 0, 0);
-#endif
gtk_container_add (GTK_CONTAINER (viewport), label);
} else {
@@ -326,28 +287,14 @@ add_row (GtkWidget *table,
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
gtk_label_set_selectable (GTK_LABEL(label), TRUE);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_grid_attach_next_to (GTK_GRID (grid), label,
name_w, GTK_POS_RIGHT,
1, 1);
}
-#else
- gtk_table_attach (GTK_TABLE (table), label,
- 1, 2, *row_p, *row_p + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
- }
-
- (*row_p)++;
-#endif
}
static void
-#if GTK_CHECK_VERSION (3, 4, 0)
add_face_info (GtkWidget *grid,
-#else
-add_face_info (GtkWidget *table,
- gint *row_p,
-#endif
const gchar *uri,
FT_Face face)
{
@@ -356,18 +303,10 @@ add_face_info (GtkWidget *table,
GFileInfo *info;
PS_FontInfoRec ps_info;
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Name:"), face->family_name, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Name:"), face->family_name, FALSE, FALSE);
-#endif
if (face->style_name)
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Style:"), face->style_name, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Style:"), face->style_name, FALSE, FALSE);
-#endif
file = g_file_new_for_uri (uri);
info = g_file_query_info (file,
@@ -379,19 +318,11 @@ add_face_info (GtkWidget *table,
if (info != NULL) {
s = g_content_type_get_description (g_file_info_get_content_type (info));
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Type:"), s, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Type:"), s, FALSE, FALSE);
-#endif
g_free (s);
s = g_format_size (g_file_info_get_size (info));
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Size:"), s, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Size:"), s, FALSE, FALSE);
-#endif
g_free (s);
g_object_unref (info);
@@ -436,42 +367,22 @@ add_face_info (GtkWidget *table,
}
if (version) {
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Version:"), version, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Version:"), version, FALSE, FALSE);
-#endif
g_free (version);
}
if (copyright) {
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Copyright:"), copyright, TRUE, TRUE);
-#else
- add_row (table, row_p, _("Copyright:"), copyright, TRUE, TRUE);
-#endif
g_free (copyright);
}
if (description) {
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Description:"), description, TRUE, TRUE);
-#else
- add_row (table, row_p, _("Description:"), description, TRUE, TRUE);
-#endif
g_free (description);
}
} else if (FT_Get_PS_Font_Info (face, &ps_info) == 0) {
if (ps_info.version && g_utf8_validate (ps_info.version, -1, NULL))
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Version:"), ps_info.version, FALSE, FALSE);
-#else
- add_row (table, row_p, _("Version:"), ps_info.version, FALSE, FALSE);
-#endif
if (ps_info.notice && g_utf8_validate (ps_info.notice, -1, NULL))
-#if GTK_CHECK_VERSION (3, 4, 0)
add_row (grid, _("Copyright:"), ps_info.notice, TRUE, FALSE);
-#else
- add_row (table, row_p, _("Copyright:"), ps_info.notice, TRUE, FALSE);
-#endif
}
}
@@ -594,12 +505,7 @@ main (int argc,
FT_Face face;
GFile *file;
gchar *font_file, *title;
-#if GTK_CHECK_VERSION (3, 4, 0)
GtkWidget *window, *hbox, *grid, *swin, *drawing_area;
-#else
- gint row;
- GtkWidget *window, *hbox, *table, *swin, *drawing_area;
-#endif
GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
GtkWidget *button, *align;
@@ -644,11 +550,7 @@ main (int argc,
g_free (title);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
-#if GTK_CHECK_VERSION (3, 2, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_container_add (GTK_CONTAINER (window), hbox);
swin = gtk_scrolled_window_new (NULL, NULL);
@@ -662,66 +564,38 @@ main (int argc,
drawing_area);
g_signal_connect (drawing_area, "realize",
G_CALLBACK (realize_callback), face);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (drawing_area, "draw",
G_CALLBACK (draw_callback), face);
-#else
- g_signal_connect (drawing_area, "expose-event",
- G_CALLBACK (expose_callback), face);
-#endif
/* set the minimum size on the scrolled window to prevent
* unnecessary scrolling */
/* 800 is better for GtkGrid */
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_widget_set_size_request (swin, 800, -1);
-#else
- gtk_widget_set_size_request (swin, 500, -1);
-#endif
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
-#if GTK_CHECK_VERSION (3, 4, 0)
grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
gtk_box_pack_start (GTK_BOX (hbox), grid, FALSE, TRUE, 0);
add_face_info (grid, font_file, face);
-#else
- table = gtk_table_new (1, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), 5);
- gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, TRUE, 0);
-
- row = 0;
- add_face_info (table, &row, font_file, face);
-#endif
/* add install button */
align = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_widget_set_hexpand (align, TRUE);
gtk_container_add_with_properties (GTK_CONTAINER (grid), align,
"width", 2,
NULL);
-#else
- gtk_table_attach (GTK_TABLE (table), align, 0, 2, row, row + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
-#endif
button = gtk_button_new_with_mnemonic (_("I_nstall Font"));
g_signal_connect (button, "clicked",
G_CALLBACK (install_button_clicked_cb), font_file);
gtk_container_add (GTK_CONTAINER (align), button);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_grid_set_column_spacing (GTK_GRID (grid), 8);
gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
-#else
- gtk_table_set_col_spacings (GTK_TABLE (table), 8);
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
-#endif
gtk_widget_show_all (window);
gtk_main ();
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index 300f82e3..5aadcb86 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -23,18 +23,10 @@
#include "app-shell.h"
#include "app-resizer.h"
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
static void app_resizer_class_init (AppResizerClass *);
static void app_resizer_init (AppResizer *);
static void app_resizer_size_allocate (GtkWidget * resizer, GtkAllocation * allocation);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean app_resizer_paint_window (GtkWidget * widget, cairo_t * cr, AppShellData * app_data);
-#else
-static gboolean app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellData * app_data);
-#endif
G_DEFINE_TYPE (AppResizer, app_resizer, GTK_TYPE_LAYOUT);
@@ -51,10 +43,8 @@ app_resizer_class_init (AppResizerClass * klass)
static void
app_resizer_init (AppResizer * window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)),
GTK_STYLE_CLASS_VIEW);
-#endif
}
void
@@ -91,12 +81,8 @@ resize_table (GtkTable * table, gint columns, GList * launcher_list)
static void
relayout_table (GtkTable * table, GList * element_list)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gint maxcols, maxrows;
gtk_table_get_size (GTK_TABLE (table), &maxrows, &maxcols);
-#else
- gint maxcols = (GTK_TABLE (table))->ncols;
-#endif
gint row = 0, col = 0;
do
{
@@ -223,11 +209,7 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
return;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-#else
- child_requisition = child->requisition;
-#endif
if (!resizer->cached_tables_list) /* if everthing is currently filtered out - just return */
{
@@ -248,11 +230,7 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
return;
}
GtkRequisition other_requisiton;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (resizer->cached_tables_list->data), &other_requisiton, NULL);
-#else
- other_requisiton = GTK_WIDGET (resizer->cached_tables_list->data)->requisition;
-#endif
useable_area =
allocation->width - (child_requisition.width -
@@ -292,11 +270,7 @@ app_resizer_new (GtkBox * child, gint initial_num_columns, gboolean homogeneous,
widget->setting_style = FALSE;
widget->app_data = app_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (widget), "draw", G_CALLBACK (app_resizer_paint_window), app_data);
-#else
- g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (app_resizer_paint_window), app_data);
-#endif
gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (child));
widget->child = child;
@@ -309,11 +283,7 @@ app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value)
{
GtkAdjustment *adjust;
-#if GTK_CHECK_VERSION (3, 0, 0)
adjust = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
-#else
- adjust = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
-#endif
gdouble upper = gtk_adjustment_get_upper (adjust);
gdouble page_size = gtk_adjustment_get_page_size (adjust);
@@ -325,11 +295,7 @@ app_resizer_set_vadjustment_value (GtkWidget * widget, gdouble value)
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
app_resizer_paint_window (GtkWidget * widget, cairo_t * cr, AppShellData * app_data)
-#else
-app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellData * app_data)
-#endif
{
/*
printf("ENTER - app_resizer_paint_window\n");
@@ -337,7 +303,6 @@ app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellDa
printf("Allocation:%d, %d, %d, %d\n\n", widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height);
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_save(cr);
GtkAllocation widget_allocation;
@@ -349,16 +314,10 @@ app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellDa
cairo_rectangle(cr, widget_allocation.x, widget_allocation.y, widget_allocation.width, widget_allocation.height);
cairo_stroke_preserve(cr);
cairo_fill(cr);
-#else
- gdk_draw_rectangle (GTK_LAYOUT (widget)->bin_window,
- widget->style->base_gc[GTK_STATE_NORMAL], TRUE, event->area.x, event->area.y,
- event->area.width, event->area.height);
-#endif
if (app_data->selected_group)
{
GtkWidget *selected_widget = GTK_WIDGET (app_data->selected_group);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkAllocation selected_widget_allocation;
gtk_widget_get_allocation (selected_widget, &selected_widget_allocation);
@@ -369,18 +328,9 @@ app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellDa
cairo_rectangle(cr, selected_widget_allocation.x, selected_widget_allocation.y, selected_widget_allocation.width, selected_widget_allocation.height);
cairo_stroke_preserve(cr);
cairo_fill(cr);
-#else
- gdk_draw_rectangle (selected_widget->window, /* drawing on child window and child coordinates */
- selected_widget->style->light_gc[GTK_STATE_SELECTED], TRUE,
- selected_widget->allocation.x, selected_widget->allocation.y,
- widget->allocation.width, /* drawing with our coordinates here to draw all the way to the edge. */
- selected_widget->allocation.height);
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_restore(cr);
-#endif
return FALSE;
}
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 41fb3419..ac0a0b5f 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -128,9 +128,7 @@ create_main_window (AppShellData * app_data, const gchar * app_name, const gchar
app_data->main_app = main_app;
gtk_widget_set_name (main_app, app_name);
gtk_window_set_title (GTK_WINDOW (main_app), title);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_window_set_default_size(GTK_WINDOW(main_app), width, height);
-#endif
gtk_window_set_icon_name (GTK_WINDOW (main_app), window_icon);
gtk_container_add (GTK_CONTAINER (main_app), app_data->shell);
@@ -195,9 +193,8 @@ launch_selected_app (AppShellData * app_data)
static gboolean
main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData * app_data)
{
-#if GTK_CHECK_VERSION(3,0,0)
GApplication *app;
-#endif
+
if (event->keyval == GDK_KEY_Return)
{
SlabSection *section = SLAB_SECTION (app_data->filter_section);
@@ -219,16 +216,13 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q) && (event->state & GDK_CONTROL_MASK)))
{
if (app_data->exit_on_close)
-#if GTK_CHECK_VERSION(3,0,0)
{
app=g_application_get_default();
g_application_quit(app);
}
-#else
- gtk_main_quit ();
-#endif
else
hide_shell (app_data);
+
return TRUE;
}
return FALSE;
@@ -237,18 +231,12 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
static gboolean
main_delete_callback (GtkWidget * widget, GdkEvent * event, AppShellData * app_data)
{
-#if GTK_CHECK_VERSION(3,0,0)
GApplication *app;
-#endif
+
if (app_data->exit_on_close)
{
- /*avoid "gtk_main_quit: assertion 'main_loops != NULL' failed" critical here */
-#if GTK_CHECK_VERSION(3,0,0)
app=g_application_get_default();
g_application_quit(app);
-#else
- gtk_main_quit();
-#endif
return FALSE;
}
@@ -275,11 +263,7 @@ layout_shell (AppShellData * app_data, const gchar * filter_title, const gchar *
app_data->shell = shell_window_new (app_data);
app_data->static_actions = actions;
-#if GTK_CHECK_VERSION (3, 0, 0)
right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- right_vbox = gtk_vbox_new (FALSE, 0);
-#endif
num_cols = SIZING_SCREEN_WIDTH_LARGE_NUMCOLS;
if (gdk_screen_width () <= SIZING_SCREEN_WIDTH_LARGE)
@@ -308,11 +292,7 @@ layout_shell (AppShellData * app_data, const gchar * filter_title, const gchar *
gtk_container_set_focus_vadjustment (GTK_CONTAINER (right_vbox),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw)));
-#if GTK_CHECK_VERSION (3, 0, 0)
left_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 15);
-#else
- left_vbox = gtk_vbox_new (FALSE, 15);
-#endif
filter_section = create_filter_section (app_data, filter_title);
app_data->filter_section = filter_section;
@@ -422,11 +402,7 @@ create_actions_section (AppShellData * app_data, const gchar * title,
section = slab_section_new (title, Style1);
g_object_ref (section);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
slab_section_set_contents (SLAB_SECTION (section), vbox);
if (app_data->static_actions)
@@ -468,11 +444,7 @@ create_groups_section (AppShellData * app_data, const gchar * title)
section = slab_section_new (title, Style1);
g_object_ref (section);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
slab_section_set_contents (SLAB_SECTION (section), vbox);
return section;
@@ -598,11 +570,7 @@ handle_filter_changed_delayed (gpointer user_data)
app_data->busy_cursor =
gdk_cursor_new_for_display (gtk_widget_get_display (app_data->shell), GDK_WATCH);
gdk_window_set_cursor (gtk_widget_get_window (app_data->shell), app_data->busy_cursor);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (app_data->busy_cursor);
-#else
- gdk_cursor_unref (app_data->busy_cursor);
-#endif
set_state (app_data, NULL);
app_resizer_set_vadjustment_value (app_data->category_layout, 0);
@@ -760,11 +728,7 @@ create_application_category_sections (AppShellData * app_data)
g_object_ref (data->section);
g_free (markup);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
table = gtk_table_new (0, 0, TRUE);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
@@ -790,11 +754,7 @@ show_no_results_message (AppShellData * app_data, GtkWidget * containing_vbox)
app_data->filtered_out_everything_widget = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
g_object_ref (app_data->filtered_out_everything_widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
image = themed_icon_new ("face-surprise", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
@@ -1404,9 +1364,7 @@ tile_activated_cb (Tile * tile, TileEvent * event, gpointer user_data)
static void
handle_launcher_single_clicked (Tile * launcher, gpointer data)
{
-#if GTK_CHECK_VERSION(3,0,0)
GApplication *app;
-#endif
AppShellData *app_data = (AppShellData *) data;
tile_trigger_action (launcher, launcher->actions[APPLICATION_TILE_ACTION_START]);
@@ -1414,14 +1372,10 @@ handle_launcher_single_clicked (Tile * launcher, gpointer data)
if (g_settings_get_boolean (app_data->settings, EXIT_SHELL_ON_ACTION_START))
{
if (app_data->exit_on_close)
-#if GTK_CHECK_VERSION(3,0,0)
{
app=g_application_get_default();
g_application_quit(app);
}
-#else
- gtk_main_quit();
-#endif
else
hide_shell (app_data);
}
@@ -1431,9 +1385,7 @@ static void
handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * action,
gpointer data)
{
-#if GTK_CHECK_VERSION(3,0,0)
GApplication *app;
-#endif
AppShellData *app_data = (AppShellData *) data;
gchar *temp;
@@ -1465,14 +1417,10 @@ handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * a
if (g_settings_get_boolean (app_data->settings, temp))
{
if (app_data->exit_on_close)
-#if GTK_CHECK_VERSION(3,0,0)
{
app=g_application_get_default();
g_application_quit(app);
}
-#else
- gtk_main_quit();
-#endif
else
hide_shell (app_data);
}
diff --git a/libslab/mate-slab.pc.in b/libslab/mate-slab.pc.in
index c6f26ec3..074fa8f2 100644
--- a/libslab/mate-slab.pc.in
+++ b/libslab/mate-slab.pc.in
@@ -5,8 +5,8 @@ includedir=@includedir@
Name: mate-slab
Description: Beautiful App Slab
-Requires: glib-2.0 gobject-2.0 gio-2.0 gtk+-@GTK_API_VERSION@ mate-desktop-2.0 libmate-menu
-Requires.private: gdk-@GTK_API_VERSION@ librsvg-2.0
+Requires: glib-2.0 gobject-2.0 gio-2.0 gtk+-3.0 mate-desktop-2.0 libmate-menu
+Requires.private: gdk-3.0 librsvg-2.0
Version: @VERSION@
Libs: -L${libdir} -lmate-slab
Cflags: -I${includedir}/libmate-slab
diff --git a/libslab/nameplate-tile.c b/libslab/nameplate-tile.c
index b9118130..fd703b34 100644
--- a/libslab/nameplate-tile.c
+++ b/libslab/nameplate-tile.c
@@ -218,13 +218,8 @@ nameplate_tile_setup (NameplateTile *this)
priv->header_ctnr = GTK_CONTAINER (gtk_alignment_new (0.0, 0.5, 1.0, 1.0));
priv->subheader_ctnr = GTK_CONTAINER (gtk_alignment_new (0.0, 0.5, 1.0, 1.0));
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 6);
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0);
@@ -253,9 +248,7 @@ nameplate_tile_drag_begin (GtkWidget * widget, GdkDragContext * context)
{
NameplateTile *this = NAMEPLATE_TILE (widget);
GtkImage *image;
-#if GTK_CHECK_VERSION (3, 0, 0)
const gchar *name;
-#endif
(*GTK_WIDGET_CLASS (nameplate_tile_parent_class)->drag_begin) (widget, context);
@@ -264,7 +257,6 @@ nameplate_tile_drag_begin (GtkWidget * widget, GdkDragContext * context)
image = GTK_IMAGE (this->image);
-#if GTK_CHECK_VERSION (3, 0, 0)
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PIXBUF:
@@ -283,23 +275,4 @@ nameplate_tile_drag_begin (GtkWidget * widget, GdkDragContext * context)
default:
break;
}
-#else
- switch (image->storage_type)
- {
- case GTK_IMAGE_PIXBUF:
- if (image->data.pixbuf.pixbuf)
- gtk_drag_set_icon_pixbuf (context, image->data.pixbuf.pixbuf, 0, 0);
-
- break;
-
- case GTK_IMAGE_ICON_NAME:
- if (image->data.name.pixbuf)
- gtk_drag_set_icon_pixbuf (context, image->data.name.pixbuf, 0, 0);
-
- break;
-
- default:
- break;
- }
-#endif
}
diff --git a/libslab/search-bar.c b/libslab/search-bar.c
index ec689311..f355fb01 100644
--- a/libslab/search-bar.c
+++ b/libslab/search-bar.c
@@ -90,11 +90,7 @@ nld_search_bar_init (NldSearchBar * search_bar)
gtk_widget_set_can_focus (GTK_WIDGET (search_bar), TRUE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (search_bar), GTK_ORIENTATION_VERTICAL);
-#if GTK_CHECK_VERSION (3, 0, 0)
priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
-#else
- priv->hbox = gtk_hbox_new (FALSE, 3);
-#endif
gtk_box_pack_start (GTK_BOX (search_bar), priv->hbox, TRUE, FALSE, 0);
alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0);
diff --git a/libslab/search-context-picker.c b/libslab/search-context-picker.c
index 44902ee6..104955ee 100644
--- a/libslab/search-context-picker.c
+++ b/libslab/search-context-picker.c
@@ -22,10 +22,6 @@
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
typedef struct
{
GtkImage *cur_icon;
@@ -74,25 +70,15 @@ nld_search_context_picker_init (NldSearchContextPicker * picker)
GtkWidget *hbox;
GtkWidget *separator;
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
-#else
- hbox = gtk_hbox_new (FALSE, 10);
-#endif
gtk_container_add (GTK_CONTAINER (picker), hbox);
priv->cur_icon = GTK_IMAGE (gtk_image_new ());
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (priv->cur_icon), FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_MENU), FALSE, FALSE, 0);
-#else
- separator = gtk_vseparator_new ();
- gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE), FALSE, FALSE, 0);
-#endif
gtk_widget_show_all (hbox);
diff --git a/libslab/search-entry.c b/libslab/search-entry.c
index 2953bda0..26a54665 100644
--- a/libslab/search-entry.c
+++ b/libslab/search-entry.c
@@ -37,11 +37,7 @@ static void nld_search_entry_init (NldSearchEntry *);
static void nld_search_entry_finalize (GObject *);
static void nld_search_entry_realize (GtkWidget * widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean nld_search_entry_draw (GtkWidget * widget, cairo_t * cr);
-#else
-static gboolean nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event);
-#endif
G_DEFINE_TYPE (NldSearchEntry, nld_search_entry, GTK_TYPE_ENTRY)
@@ -53,11 +49,7 @@ static void nld_search_entry_class_init (NldSearchEntryClass * nld_search_entry_
g_type_class_add_private (nld_search_entry_class, sizeof (NldSearchEntryPrivate));
widget_class->realize = nld_search_entry_realize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = nld_search_entry_draw;
-#else
- widget_class->expose_event = nld_search_entry_expose_event;
-#endif
g_obj_class->finalize = nld_search_entry_finalize;
}
@@ -95,18 +87,12 @@ nld_search_entry_realize (GtkWidget * widget)
GdkColor *gdkcolor;
char *svg, color[7];
RsvgHandle *rsvg;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRectangle text_area;
-#endif
GTK_WIDGET_CLASS (nld_search_entry_parent_class)->realize (widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area);
height = text_area.height;
-#else
- gdk_window_get_geometry (GTK_ENTRY (widget)->text_area, NULL, NULL, NULL, &height, NULL);
-#endif
if (height - 2 == priv->height)
return;
@@ -129,7 +115,6 @@ nld_search_entry_realize (GtkWidget * widget)
rsvg_handle_free (rsvg);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
nld_search_entry_draw (GtkWidget * widget, cairo_t * cr)
{
@@ -155,34 +140,6 @@ nld_search_entry_draw (GtkWidget * widget, cairo_t * cr)
return FALSE;
}
-#else
-static gboolean
-nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event)
-{
- NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
-
- GTK_WIDGET_CLASS (nld_search_entry_parent_class)->expose_event (widget, event);
-
- if (event->window == GTK_ENTRY (widget)->text_area)
- {
- int width, height, x;
-
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
- {
- gdk_drawable_get_size(event->window, &width, &height);
- x = width - priv->width - 1;
- }
- else
- x = 1;
-
- gdk_draw_pixbuf (event->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- priv->watermark, 0, 0, x, 1, priv->width, priv->height,
- GDK_RGB_DITHER_NORMAL, 0, 0);
- }
-
- return FALSE;
-}
-#endif
GtkWidget *
nld_search_entry_new (void)
diff --git a/libslab/shell-window.c b/libslab/shell-window.c
index cf4a1498..3e267c9e 100644
--- a/libslab/shell-window.c
+++ b/libslab/shell-window.c
@@ -29,11 +29,7 @@ static void shell_window_init (ShellWindow *);
static void shell_window_handle_size_request (GtkWidget * widget, GtkRequisition * requisition,
AppShellData * data);
-#if GTK_CHECK_VERSION (3, 0, 0)
gboolean shell_window_paint_window (GtkWidget * widget, cairo_t * cr, gpointer data);
-#else
-gboolean shell_window_paint_window (GtkWidget * widget, GdkEventExpose * event, gpointer data);
-#endif
#define SHELL_WINDOW_BORDER_WIDTH 6
@@ -60,22 +56,14 @@ shell_window_new (AppShellData * app_data)
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
gtk_frame_set_shadow_type(GTK_FRAME(window), GTK_SHADOW_NONE);
-#if GTK_CHECK_VERSION (3, 0, 0)
window->_hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
-#else
- window->_hbox = GTK_BOX (gtk_hbox_new (FALSE, 0));
-#endif
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (window->_hbox));
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (window), "draw", G_CALLBACK (shell_window_paint_window),
-#else
- g_signal_connect (G_OBJECT (window), "expose-event", G_CALLBACK (shell_window_paint_window),
-#endif
NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
- /* FIXME */
-#else
+
+/* FIXME add some replacement for GTK+3, or just remove this code? */
+#if 0
window->resize_handler_id =
g_signal_connect (G_OBJECT (window), "size-request",
G_CALLBACK (shell_window_handle_size_request), app_data);
@@ -106,11 +94,7 @@ shell_window_handle_size_request (GtkWidget * widget, GtkRequisition * requisiti
gint height;
GtkRequisition child_requisiton;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (APP_RESIZER (app_data->category_layout)->child), &child_requisiton, NULL);
-#else
- child_requisiton = GTK_WIDGET (APP_RESIZER (app_data->category_layout)->child)->requisition;
-#endif
/*
Fixme - counting on this being called after the real size request is done.
@@ -151,11 +135,7 @@ shell_window_set_contents (ShellWindow * shell, GtkWidget * left_pane, GtkWidget
}
gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
shell_window_paint_window (GtkWidget * widget, cairo_t * cr, gpointer data)
-#else
-shell_window_paint_window (GtkWidget * widget, GdkEventExpose * event, gpointer data)
-#endif
{
GtkWidget *left_pane;
GtkAllocation allocation;
@@ -167,16 +147,9 @@ shell_window_paint_window (GtkWidget * widget, GdkEventExpose * event, gpointer
/* draw left pane background */
gtk_paint_flat_box (
gtk_widget_get_style (widget),
-#if GTK_CHECK_VERSION (3, 0, 0)
cr,
-#else
- gtk_widget_get_window (widget),
-#endif
gtk_widget_get_state (widget),
GTK_SHADOW_NONE,
-#if !GTK_CHECK_VERSION (3, 0, 0)
- NULL,
-#endif
widget,
"",
allocation.x,
diff --git a/libslab/slab-section.c b/libslab/slab-section.c
index f28f5c41..af1443bf 100644
--- a/libslab/slab-section.c
+++ b/libslab/slab-section.c
@@ -146,11 +146,7 @@ slab_section_new_with_markup (const gchar * title_markup, SlabStyle style)
}
gtk_box_pack_start (GTK_BOX (section), align, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
section->childbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 10));
-#else
- section->childbox = GTK_BOX (gtk_vbox_new (FALSE, 10));
-#endif
gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (section->childbox));
section->title = gtk_label_new (title_markup);
diff --git a/libslab/tile.c b/libslab/tile.c
index d91c571d..fd245720 100644
--- a/libslab/tile.c
+++ b/libslab/tile.c
@@ -47,11 +47,7 @@ static void tile_clicked (GtkButton *widget);
static gboolean tile_focus_in (GtkWidget *, GdkEventFocus *);
static gboolean tile_focus_out (GtkWidget *, GdkEventFocus *);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean tile_draw (GtkWidget *, cairo_t *);
-#else
-static gboolean tile_expose (GtkWidget *, GdkEventExpose *);
-#endif
static gboolean tile_button_release (GtkWidget *, GdkEventButton *);
static gboolean tile_key_release (GtkWidget *, GdkEventKey *);
static gboolean tile_popup_menu (GtkWidget *);
@@ -105,11 +101,7 @@ tile_class_init (TileClass * this_class)
widget_class->focus_in_event = tile_focus_in;
widget_class->focus_out_event = tile_focus_out;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = tile_draw;
-#else
- widget_class->expose_event = tile_expose;
-#endif
widget_class->button_release_event = tile_button_release;
widget_class->key_release_event = tile_key_release;
widget_class->drag_begin = tile_drag_begin;
@@ -351,11 +343,7 @@ tile_focus_out (GtkWidget * widget, GdkEventFocus * event)
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
tile_draw (GtkWidget * widget, cairo_t * cr)
-#else
-tile_expose (GtkWidget * widget, GdkEventExpose * event)
-#endif
{
/* FIXME: there ought to be a better way to prevent the focus from being rendered. */
@@ -363,24 +351,12 @@ tile_expose (GtkWidget * widget, GdkEventExpose * event)
gboolean retval;
if ((has_focus = gtk_widget_has_focus (widget)))
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_FOCUSED);
-#else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
retval = (*GTK_WIDGET_CLASS (tile_parent_class)->draw) (widget, cr);
-#else
- retval = (*GTK_WIDGET_CLASS (tile_parent_class)->expose_event) (widget, event);
-#endif
if (has_focus)
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_FOCUSED, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-#endif
return retval;
}
@@ -464,11 +440,7 @@ tile_popup_menu_position (GtkMenu * menu, gint * x, gint * y, gboolean * push_in
if (!gtk_widget_get_realized (GTK_WIDGET (tile)))
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
-#else
- gtk_widget_size_request (GTK_WIDGET (menu), &req);
-#endif
gtk_widget_get_allocation (GTK_WIDGET (menu), &all);
top = gtk_widget_get_toplevel (GTK_WIDGET (tile));
diff --git a/libwindow-settings/mate-window-settings-2.0.pc.in b/libwindow-settings/mate-window-settings-2.0.pc.in
index 71645c23..32c337ed 100644
--- a/libwindow-settings/mate-window-settings-2.0.pc.in
+++ b/libwindow-settings/mate-window-settings-2.0.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: mate-window-settings-2.0
Description: Utility library for getting window manager settings
-Requires: gtk+-2.0 mate-desktop-2.0
+Requires: gtk+-3.0 mate-desktop-2.0
Version: @VERSION@
Libs: -L${libdir} -lmate-window-settings
Cflags: -I${includedir}/mate-window-settings-2.0
diff --git a/shell/control-center.c b/shell/control-center.c
index d0f8f8cb..55c4246d 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -23,9 +23,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#include <unique/unique.h>
-#endif
#include <libslab/slab.h>
void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data);
@@ -94,9 +91,8 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
AppShellData* app_data = (AppShellData*) data;
MateDesktopItem* item = (MateDesktopItem*) g_object_get_data(G_OBJECT(tile), APP_ACTION_KEY);
GSettings *settings;
-#if GTK_CHECK_VERSION(3,0,0)
GApplication *app;
-#endif
+
if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
{
return;
@@ -110,12 +106,8 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
{
if (app_data->exit_on_close)
{
-#if GTK_CHECK_VERSION(3,0,0)
app=g_application_get_default();
g_application_quit(app);
-#else
- gtk_main_quit();
-#endif
}
else
{
@@ -126,7 +118,6 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
g_object_unref(settings);
}
-#if GTK_CHECK_VERSION(3,0,0)
static void
activate (GtkApplication *app)
{
@@ -159,50 +150,13 @@ quit (GApplication *app)
{
g_application_quit(app);
}
-#else
-static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command, UniqueMessageData* message, guint time, gpointer user_data)
-{
- UniqueResponse res;
- AppShellData* app_data = user_data;
-
- switch (command)
- {
- case UNIQUE_ACTIVATE:
- /* move the main window to the screen that sent us the command */
- gtk_window_set_screen(GTK_WINDOW(app_data->main_app), unique_message_data_get_screen(message));
-
- if (!app_data->main_app_window_shown_once)
- {
- show_shell(app_data);
- }
-
- gtk_window_present_with_time(GTK_WINDOW(app_data->main_app), time);
- gtk_widget_grab_focus(SLAB_SECTION(app_data->filter_section)->contents);
-
- res = UNIQUE_RESPONSE_OK;
-
- break;
- default:
- res = UNIQUE_RESPONSE_PASSTHROUGH;
- break;
- }
-
- return res;
-}
-#endif
int main(int argc, char* argv[])
{
gboolean hidden = FALSE;
-#if GTK_CHECK_VERSION(3,0,0)
GtkApplication *app;
gint retval;
app = gtk_application_new ("org.mate.mate-control-center.shell", 0);
-#else
- UniqueApp* unique_app;
- AppShellData* app_data;
- GSList* actions;
-#endif
GError* error;
GOptionEntry options[] = {
{"hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL},
@@ -223,43 +177,9 @@ int main(int argc, char* argv[])
g_error_free(error);
return 1;
}
-#if GTK_CHECK_VERSION(3,0,0)
+
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
g_signal_connect (app, "window-removed", G_CALLBACK (quit), NULL);
retval = g_application_run (G_APPLICATION (app), argc, argv);
return retval;
-#else
- unique_app = unique_app_new("org.mate.mate-control-center.shell", NULL);
-
- if (unique_app_is_running(unique_app))
- {
- int retval = 0;
-
- if (!hidden)
- {
- UniqueResponse response;
- response = unique_app_send_message(unique_app, UNIQUE_ACTIVATE, NULL);
- retval = (response != UNIQUE_RESPONSE_OK);
- }
-
- g_object_unref(unique_app);
- return retval;
- }
-
- app_data = appshelldata_new("matecc.menu", GTK_ICON_SIZE_DND, FALSE, TRUE, 0);
- generate_categories(app_data);
-
- actions = get_actions_list();
- layout_shell(app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions, handle_static_action_clicked);
-
- create_main_window(app_data, "MyControlCenter", _("Control Center"), "preferences-desktop", 975, 600, hidden);
-
- unique_app_watch_window(unique_app, GTK_WINDOW(app_data->main_app));
- g_signal_connect(unique_app, "message-received", G_CALLBACK(message_received_cb), app_data);
-
- gtk_main();
- g_object_unref(unique_app);
-
- return 0;
-#endif
}
diff --git a/typing-break/drw-break-window.c b/typing-break/drw-break-window.c
index 59a502ee..66db00f1 100644
--- a/typing-break/drw-break-window.c
+++ b/typing-break/drw-break-window.c
@@ -73,13 +73,8 @@ static gboolean postpone_sensitize_cb (DrwBreakWindow *window)
static gboolean clock_timeout_cb (DrwBreakWindow *window);
static void postpone_clicked_cb (GtkWidget *button,
GtkWidget *window);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean label_draw_event_cb (GtkLabel *label,
cairo_t *cr,
-#else
-static gboolean label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
-#endif
gpointer user_data);
static void label_size_request_cb (GtkLabel *label,
GtkRequisition *requisition,
@@ -167,11 +162,7 @@ drw_break_window_init (DrwBreakWindow *window)
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_widget_show (align);
-#if GTK_CHECK_VERSION (3, 0, 0)
outer_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- outer_vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_widget_show (outer_vbox);
right_padding = gdk_screen_get_width (screen) - monitor.width - monitor.x;
@@ -191,11 +182,7 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_start (GTK_BOX (outer_vbox), align, TRUE, TRUE, 0);
if (allow_postpone) {
-#if GTK_CHECK_VERSION (3, 0, 0)
button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- button_box = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (button_box);
gtk_container_set_border_width (GTK_CONTAINER (button_box), 12);
@@ -228,30 +215,18 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_end (GTK_BOX (outer_vbox), button_box, FALSE, TRUE, 0);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (align), vbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
priv->image = gtk_image_new_from_icon_name ("process-stop", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (priv->image, GTK_ALIGN_END);
gtk_widget_set_valign (priv->image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (priv->image), 1.0, 0.5);
-#endif
gtk_widget_show (priv->image);
gtk_box_pack_start (GTK_BOX (hbox), priv->image, TRUE, TRUE, 8);
@@ -259,13 +234,8 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_widget_show (priv->break_label);
g_signal_connect (priv->break_label,
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (label_draw_event_cb),
-#else
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
-#endif
NULL);
g_signal_connect_after (priv->break_label,
@@ -286,13 +256,8 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_start (GTK_BOX (vbox), priv->clock_label, TRUE, TRUE, 8);
g_signal_connect (priv->clock_label,
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (label_draw_event_cb),
-#else
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
-#endif
NULL);
g_signal_connect_after (priv->clock_label,
@@ -610,7 +575,6 @@ get_layout_location (GtkLabel *label,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
label_draw_event_cb (GtkLabel *label,
cairo_t *cr,
@@ -636,48 +600,6 @@ label_draw_event_cb (GtkLabel *label,
return TRUE;
}
-#else
-static gboolean
-label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
- gpointer user_data)
-{
- gint x, y;
- GtkWidget *widget;
- GdkWindow *window;
- cairo_t *cr;
-
- get_layout_location (label, &x, &y);
-
- widget = GTK_WIDGET (label);
- window = gtk_widget_get_window (widget);
-
- cr = gdk_cairo_create (window);
-
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- cairo_set_source_rgb (cr, 0, 0, 0);
-
- cairo_move_to (cr, x + 1, y + 1);
- pango_cairo_layout_path (cr, gtk_label_get_layout (label));
- cairo_fill (cr);
-
- cairo_destroy (cr);
-
- gtk_paint_layout (gtk_widget_get_style (widget),
- window,
- gtk_widget_get_state (widget),
- FALSE,
- &event->area,
- widget,
- "label",
- x, y,
- gtk_label_get_layout (label));
-
- return TRUE;
-}
-#endif
static void
label_size_request_cb (GtkLabel *label,
diff --git a/typing-break/drw-utils.c b/typing-break/drw-utils.c
index 5c28db98..974f47ac 100644
--- a/typing-break/drw-utils.c
+++ b/typing-break/drw-utils.c
@@ -90,44 +90,15 @@ create_tile_pixbuf (GdkPixbuf *dest_pixbuf,
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
window_draw_event (GtkWidget *widget,
cairo_t *cr,
-#else
-window_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
-#endif
gpointer data)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *context;
- cairo_t *cr;
- cairo_surface_t *surface;
-#endif
int width;
int height;
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- context = gdk_cairo_create (gtk_widget_get_window (widget));
-
- cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
-
- surface = cairo_surface_create_similar (cairo_get_target (context),
- CAIRO_CONTENT_COLOR_ALPHA,
- width,
- height);
-
- if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
- goto done;
- }
-
- cr = cairo_create (surface);
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- goto done;
- }
-#endif
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_paint (cr);
@@ -137,18 +108,6 @@ window_expose_event (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 0.5);
cairo_fill (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-
- cairo_set_source_surface (context, surface, 0, 0);
- cairo_paint (context);
- done:
- if (surface != NULL) {
- cairo_surface_destroy (surface);
- }
- cairo_destroy (context);
-#endif
-
return FALSE;
}
@@ -168,21 +127,10 @@ set_pixmap_background (GtkWidget *window)
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
-#if GTK_CHECK_VERSION (3, 0, 0)
tmp_pixbuf = gdk_pixbuf_get_from_window (gdk_screen_get_root_window (screen),
0,
0,
width, height);
-#else
- tmp_pixbuf = gdk_pixbuf_get_from_drawable (NULL,
- gdk_screen_get_root_window (screen),
- gdk_screen_get_system_colormap (screen),
- 0,
- 0,
- 0,
- 0,
- width, height);
-#endif
pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/ocean-stripes.png", NULL);
@@ -231,31 +179,13 @@ void
drw_setup_background (GtkWidget *window)
{
GdkScreen *screen;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *colormap;
-#endif
gboolean is_composited;
screen = gtk_widget_get_screen (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
is_composited = gdk_screen_is_composited (screen);
-#else
- colormap = gdk_screen_get_rgba_colormap (screen);
-
- if (colormap != NULL && gdk_screen_is_composited (screen)) {
- gtk_widget_set_colormap (GTK_WIDGET (window), colormap);
- is_composited = TRUE;
- } else {
- is_composited = FALSE;
- }
-#endif
if (is_composited) {
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (window, "draw", G_CALLBACK (window_draw_event), window);
-#else
- g_signal_connect (window, "expose-event", G_CALLBACK (window_expose_event), window);
-#endif
} else {
set_pixmap_background (window);
}