summaryrefslogtreecommitdiff
path: root/libslab
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 /libslab
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
Diffstat (limited to 'libslab')
-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
10 files changed, 8 insertions, 257 deletions
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));