summaryrefslogtreecommitdiff
path: root/mate-dictionary/src
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-22 15:49:16 +0300
committermonsta <[email protected]>2016-11-22 15:49:16 +0300
commitea481767c4e3ec19136a5b61ad46f244a9a5ffa7 (patch)
treebbcceb1d2a0be587e7127109f57e41e9e9b43f98 /mate-dictionary/src
parent8f9a34f003061d7c5e6cfe8a8cb64ec6e98d7c4a (diff)
downloadmate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.bz2
mate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require mate-panel >= 1.17
Diffstat (limited to 'mate-dictionary/src')
-rw-r--r--mate-dictionary/src/gdict-aligned-window.c8
-rw-r--r--mate-dictionary/src/gdict-applet.c31
-rw-r--r--mate-dictionary/src/gdict-sidebar.c16
-rw-r--r--mate-dictionary/src/gdict-source-dialog.c8
-rw-r--r--mate-dictionary/src/gdict-window.c114
5 files changed, 5 insertions, 172 deletions
diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c
index c1cb9d53..37c03ca5 100644
--- a/mate-dictionary/src/gdict-aligned-window.c
+++ b/mate-dictionary/src/gdict-aligned-window.c
@@ -173,11 +173,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
gdk_flush ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (window)), NULL, NULL, &our_width, &our_height);
-#else
- gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (window)), NULL, NULL, &our_width, &our_height, NULL);
-#endif
/* stick, skip taskbar and pager */
gtk_window_stick (GTK_WINDOW (window));
@@ -191,11 +187,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
gdk_window_get_origin (gdk_window,
&entry_x,
&entry_y);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height);
-#else
- gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height, NULL);
-#endif
if (entry_x + our_width < gdk_screen_width ())
x = entry_x + 1;
diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c
index 424a4c75..cd6133ef 100644
--- a/mate-dictionary/src/gdict-applet.c
+++ b/mate-dictionary/src/gdict-applet.c
@@ -38,10 +38,6 @@
#include "gdict-common.h"
#include "gdict-aligned-window.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 GDICT_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_APPLET, GdictAppletClass))
#define GDICT_APPLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_APPLET, GdictAppletClass))
@@ -338,11 +334,7 @@ gdict_applet_build_window (GdictApplet *applet)
gtk_widget_show (frame);
priv->frame = frame;
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- vbox = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
@@ -356,11 +348,7 @@ gdict_applet_build_window (GdictApplet *applet)
gtk_widget_set_can_focus (priv->defbox, TRUE);
gtk_widget_set_can_default (priv->defbox, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- bbox = gtk_hbutton_box_new ();
-#endif
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
gtk_box_set_spacing (GTK_BOX (bbox), 6);
gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
@@ -520,22 +508,7 @@ gdict_applet_draw (GdictApplet *applet)
if (priv->box)
gtk_widget_destroy (priv->box);
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (priv->orient, 0);
-#else
- switch (priv->orient)
- {
- case GTK_ORIENTATION_VERTICAL:
- box = gtk_vbox_new (FALSE, 0);
- break;
- case GTK_ORIENTATION_HORIZONTAL:
- box = gtk_hbox_new (FALSE, 0);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-#endif
gtk_container_add (GTK_CONTAINER (applet), box);
gtk_widget_show (box);
@@ -558,11 +531,7 @@ gdict_applet_draw (GdictApplet *applet)
gtk_box_pack_start (GTK_BOX (box), priv->toggle, FALSE, FALSE, 0);
gtk_widget_show (priv->toggle);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
gtk_container_add (GTK_CONTAINER (priv->toggle), hbox);
gtk_widget_show (hbox);
diff --git a/mate-dictionary/src/gdict-sidebar.c b/mate-dictionary/src/gdict-sidebar.c
index 7ca99fab..1a6e6d4b 100644
--- a/mate-dictionary/src/gdict-sidebar.c
+++ b/mate-dictionary/src/gdict-sidebar.c
@@ -36,10 +36,6 @@
#include "gdict-sidebar.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
{
guint index;
@@ -332,11 +328,7 @@ gdict_sidebar_init (GdictSidebar *sidebar)
priv->pages_by_id = g_hash_table_new (g_str_hash, g_str_equal);
/* top option menu */
-#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 (sidebar), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
priv->hbox = hbox;
@@ -351,11 +343,7 @@ gdict_sidebar_init (GdictSidebar *sidebar)
sidebar);
priv->select_button = select_button;
-#if GTK_CHECK_VERSION (3, 0, 0)
select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- select_hbox = gtk_hbox_new (FALSE, 0);
-#endif
priv->label = gtk_label_new (NULL);
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -367,11 +355,7 @@ gdict_sidebar_init (GdictSidebar *sidebar)
gtk_box_pack_start (GTK_BOX (select_hbox), priv->label, FALSE, FALSE, 0);
gtk_widget_show (priv->label);
-#if GTK_CHECK_VERSION (3, 0, 0)
arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_BUTTON);
-#else
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
-#endif
gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0);
gtk_widget_show (arrow);
diff --git a/mate-dictionary/src/gdict-source-dialog.c b/mate-dictionary/src/gdict-source-dialog.c
index 223f54a1..502f1578 100644
--- a/mate-dictionary/src/gdict-source-dialog.c
+++ b/mate-dictionary/src/gdict-source-dialog.c
@@ -582,10 +582,6 @@ gdict_source_dialog_constructor (GType type,
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
/* get the UI from the GtkBuilder file */
dialog->builder = gtk_builder_new ();
gtk_builder_add_from_file (dialog->builder, GDICT_SOURCE_UI, &error);
@@ -673,10 +669,6 @@ gdict_source_dialog_constructor (GType type,
*/
update_dialog_ui (dialog);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
-
return object;
}
diff --git a/mate-dictionary/src/gdict-window.c b/mate-dictionary/src/gdict-window.c
index 3c716080..026cb9e9 100644
--- a/mate-dictionary/src/gdict-window.c
+++ b/mate-dictionary/src/gdict-window.c
@@ -56,15 +56,6 @@
#define GDICT_SIDEBAR_STRATEGIES_PAGE "strat-chooser"
#define GDICT_SIDEBAR_SOURCES_PAGE "source-chooser"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
-#if !GTK_CHECK_VERSION(3,0,0)
-#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
-#endif
-
enum
{
COMPLETION_TEXT_COLUMN,
@@ -197,11 +188,7 @@ gdict_window_dispose (GObject *gobject)
if (window->busy_cursor)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (window->busy_cursor);
-#else
- gdk_cursor_unref (window->busy_cursor);
-#endif
window->busy_cursor = NULL;
}
@@ -1618,82 +1605,6 @@ gdict_window_size_allocate (GtkWidget *widget,
allocation);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void
-set_window_default_size (GdictWindow *window)
-{
- GtkWidget *widget;
- gboolean is_maximized;
- gint width, height;
- gint font_size;
- GdkScreen *screen;
- gint monitor_num;
- GtkRequisition req;
- GdkRectangle monitor;
-
- g_assert (GDICT_IS_WINDOW (window));
-
- widget = GTK_WIDGET (window);
-
- /* make sure that the widget is realized */
- /*Do this implicitly in GTK3.21 or segfault results */
- gtk_widget_realize (widget);
- /* XXX - the user wants mate-dictionary to resize itself, so
- * we compute the minimum safe geometry needed for displaying
- * the text returned by a dictionary server, which is based
- * on the font size and the ANSI terminal. this is dumb,
- * I know, but dictionary servers return pre-formatted text
- * and we can't reformat it ourselves.
- */
- if (window->default_width == -1 || window->default_height == -1)
- {
- /* Size based on the font size */
- GtkWidget *defbox = window->defbox;
- gint width, height;
-
- font_size = pango_font_description_get_size (gtk_widget_get_style (defbox)->font_desc);
- font_size = PANGO_PIXELS (font_size);
-
- width = font_size * GDICT_WINDOW_COLUMNS;
- height = font_size * GDICT_WINDOW_ROWS;
-
- /* Use at least the requisition size of the window... */
- gtk_widget_get_preferred_size (widget, NULL, &req);
- width = MAX (width, req.width);
- height = MAX (height, req.height);
-
- /* ... but make it no larger than the monitor */
- screen = gtk_widget_get_screen (widget);
- monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
-
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
- width = MIN (width, monitor.width * 3 / 4);
- height = MIN (height, monitor.height * 3 / 4);
-
- window->default_width = width;
- window->default_height = height;
- }
-
- /* Set default size */
- gtk_window_set_default_size (GTK_WINDOW (widget),
- window->default_width,
- window->default_height);
-
- if (window->is_maximized)
- gtk_window_maximize (GTK_WINDOW (widget));
-}
-
-static void
-gdict_window_style_set (GtkWidget *widget,
- GtkStyle *old_style)
-{
-
- if (GTK_WIDGET_CLASS (gdict_window_parent_class)->style_set)
- GTK_WIDGET_CLASS (gdict_window_parent_class)->style_set (widget, old_style);
-
- set_window_default_size (GDICT_WINDOW (widget));
-}
-#endif
static void
gdict_window_handle_notify_position_cb (GtkWidget *widget,
GParamSpec *pspec,
@@ -1740,11 +1651,7 @@ gdict_window_constructor (GType type,
/* recover the state */
gdict_window_load_state (window);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_push_composite_child ();
-#endif
-
- window->main_box = gtk_vbox_new (FALSE, 0);
+ window->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), window->main_box);
gtk_widget_show (window->main_box);
@@ -1783,12 +1690,12 @@ gdict_window_constructor (GType type,
gdict_window_ensure_menu_state (window);
}
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (window->main_box), vbox);
gtk_widget_show (vbox);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -1822,16 +1729,12 @@ gdict_window_constructor (GType type,
gtk_box_pack_start (GTK_BOX (hbox), window->entry, TRUE, TRUE, 0);
gtk_widget_show (window->entry);
-#if GTK_CHECK_VERSION (3, 0, 0)
handle = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- handle = gtk_hpaned_new ();
-#endif
gtk_box_pack_start (GTK_BOX (vbox), handle, TRUE, TRUE, 0);
gtk_widget_show (handle);
- frame1 = gtk_vbox_new (FALSE, 0);
- frame2 = gtk_vbox_new (FALSE, 0);
+ frame1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ frame2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
window->defbox = gdict_defbox_new ();
if (window->context)
@@ -2016,10 +1919,6 @@ gdict_window_constructor (GType type,
gtk_widget_grab_focus (window->entry);
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_pop_composite_child ();
-#endif
-
window->in_construction = FALSE;
return object;
@@ -2120,9 +2019,6 @@ gdict_window_class_init (GdictWindowClass *klass)
LAST_PROP,
gdict_window_properties);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- widget_class->style_set = gdict_window_style_set;
-#endif
widget_class->size_allocate = gdict_window_size_allocate;
}