Merge pull request #11 from JosephMcc/gtk-cleanup1

gtk: We're targeting gtk3.10 so clean up all the gtk version checks a…
This commit is contained in:
Clement Lefebvre 2016-02-15 09:58:06 +00:00
commit 057e2aa4ea
36 changed files with 50 additions and 747 deletions

View File

@ -114,11 +114,7 @@ xed_file_browser_view_finalize (GObject * object)
XedFileBrowserView *obj = XED_FILE_BROWSER_VIEW(object);
if (obj->priv->hand_cursor)
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (obj->priv->hand_cursor);
#else
gdk_cursor_unref (obj->priv->hand_cursor);
#endif
if (obj->priv->hover_path)
gtk_tree_path_free (obj->priv->hover_path);
@ -129,11 +125,7 @@ xed_file_browser_view_finalize (GObject * object)
obj->priv->expand_state = NULL;
}
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (obj->priv->busy_cursor);
#else
gdk_cursor_unref (obj->priv->busy_cursor);
#endif
G_OBJECT_CLASS (xed_file_browser_view_parent_class)->
finalize (object);
@ -316,12 +308,7 @@ set_click_policy_property (XedFileBrowserView *obj,
if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) {
if (obj->priv->hand_cursor == NULL)
#if GTK_CHECK_VERSION (3, 16, 0)
display = gtk_widget_get_display (GTK_WIDGET (obj));
obj->priv->hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
#else
obj->priv->hand_cursor = gdk_cursor_new(GDK_HAND2);
#endif
} else if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE) {
if (obj->priv->hover_path != NULL) {
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (obj->priv->model),
@ -344,11 +331,7 @@ set_click_policy_property (XedFileBrowserView *obj,
}
if (obj->priv->hand_cursor) {
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (obj->priv->hand_cursor);
#else
gdk_cursor_unref (obj->priv->hand_cursor);
#endif
obj->priv->hand_cursor = NULL;
}
}
@ -962,9 +945,6 @@ cell_data_cb (GtkTreeViewColumn * tree_column, GtkCellRenderer * cell,
static void
xed_file_browser_view_init (XedFileBrowserView * obj)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
#endif
obj->priv = XED_FILE_BROWSER_VIEW_GET_PRIVATE (obj);
obj->priv->column = gtk_tree_view_column_new ();
@ -999,12 +979,7 @@ xed_file_browser_view_init (XedFileBrowserView * obj)
G_N_ELEMENTS (drag_source_targets),
GDK_ACTION_COPY);
#if GTK_CHECK_VERSION (3, 16, 0)
display = gtk_widget_get_display (GTK_WIDGET (obj));
obj->priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
#else
obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
#endif
}
static gboolean

View File

@ -50,10 +50,6 @@
#define XML_UI_FILE "xed-file-browser-widget-ui.xml"
#define LOCATION_DATA_KEY "xed-file-browser-widget-location"
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
#endif
enum
{
BOOKMARKS_ID,
@ -240,13 +236,8 @@ static void on_action_filter_binary (GtkAction * action,
static void on_action_bookmark_open (GtkAction * action,
XedFileBrowserWidget * obj);
#if GTK_CHECK_VERSION (3, 0, 0)
XED_PLUGIN_DEFINE_TYPE (XedFileBrowserWidget, xed_file_browser_widget,
GTK_TYPE_BOX)
#else
XED_PLUGIN_DEFINE_TYPE (XedFileBrowserWidget, xed_file_browser_widget,
GTK_TYPE_VBOX)
#endif
static void
free_name_icon (gpointer data)
@ -369,11 +360,7 @@ xed_file_browser_widget_finalize (GObject * object)
cancel_async_operation (obj);
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (obj->priv->busy_cursor);
#else
gdk_cursor_unref (obj->priv->busy_cursor);
#endif
G_OBJECT_CLASS (xed_file_browser_widget_parent_class)->finalize (object);
}
@ -1237,7 +1224,7 @@ create_filter (XedFileBrowserWidget * obj)
gtk_widget_show (expander);
gtk_box_pack_start (GTK_BOX (obj), expander, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 3);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_show (vbox);
obj->priv->filter_expander = expander;
@ -1261,9 +1248,6 @@ create_filter (XedFileBrowserWidget * obj)
static void
xed_file_browser_widget_init (XedFileBrowserWidget * obj)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
#endif
obj->priv = XED_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
@ -1272,17 +1256,10 @@ xed_file_browser_widget_init (XedFileBrowserWidget * obj)
free_name_icon);
gtk_box_set_spacing (GTK_BOX (obj), 3);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (obj),
GTK_ORIENTATION_VERTICAL);
#endif
#if GTK_CHECK_VERSION (3, 16, 0)
display = gtk_widget_get_display (GTK_WIDGET (obj));
obj->priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
#else
obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
#endif
}
/* Private */
@ -2122,23 +2099,11 @@ set_busy (XedFileBrowserWidget *obj, gboolean busy)
if (busy)
{
#if GTK_CHECK_VERSION (3, 16, 0)
GdkDisplay *display;
GdkCursor *cursor;
display = gtk_widget_get_display (GTK_WIDGET (obj));
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
#else
GdkCursor *cursor;
cursor = gdk_cursor_new (GDK_WATCH);
#endif
gdk_window_set_cursor (window, cursor);
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (obj->priv->busy_cursor);
#else
gdk_cursor_unref (cursor);
#endif
}
else
{

View File

@ -48,22 +48,14 @@ gboolean (*XedFileBrowserWidgetFilterFunc) (XedFileBrowserWidget * obj,
struct _XedFileBrowserWidget
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
#else
GtkVBox parent;
#endif
XedFileBrowserWidgetPrivate *priv;
};
struct _XedFileBrowserWidgetClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
/* Signals */
void (*uri_activated) (XedFileBrowserWidget * widget,

View File

@ -23,9 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include <xed/xed-language-manager.h>
#include <xed/xed-prefs-manager.h>
#include <xed/xed-debug.h>

View File

@ -454,11 +454,7 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
label = gtk_label_new (label_text);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
mi = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER(mi), label);

View File

@ -69,11 +69,7 @@ struct _XedTaglistPluginPanelPrivate
gchar *data_dir;
};
#if GTK_CHECK_VERSION (3, 0, 0)
XED_PLUGIN_DEFINE_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_BOX)
#else
XED_PLUGIN_DEFINE_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_VBOX)
#endif
enum
{
@ -581,13 +577,8 @@ tags_list_query_tooltip_cb (GtkWidget *widget,
}
static gboolean
#if GTK_CHECK_VERSION (3, 0, 0)
draw_event_cb (GtkWidget *panel,
cairo_t *cr,
#else
expose_event_cb (GtkWidget *panel,
GdkEventExpose *event,
#endif
gpointer user_data)
{
XedTaglistPluginPanel *ppanel = XED_TAGLIST_PLUGIN_PANEL (panel);
@ -601,13 +592,8 @@ expose_event_cb (GtkWidget *panel,
/* And populate combo box */
populate_tag_groups_combo (XED_TAGLIST_PLUGIN_PANEL (panel));
#if GTK_CHECK_VERSION (3, 0, 0)
/* We need to manage only the first draw -> disconnect */
g_signal_handlers_disconnect_by_func (panel, draw_event_cb, NULL);
#else
/* We need to manage only the first expose event -> disconnect */
g_signal_handlers_disconnect_by_func (panel, expose_event_cb, NULL);
#endif
return FALSE;
}
@ -685,10 +671,8 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
panel->priv = XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel);
panel->priv->data_dir = NULL;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
GTK_ORIENTATION_VERTICAL);
#endif
/* Build the window content */
panel->priv->tag_groups_combo = gtk_combo_box_text_new ();
@ -781,13 +765,8 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
G_CALLBACK (selected_group_changed),
panel);
g_signal_connect (panel,
#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (draw_event_cb),
#else
"expose-event",
G_CALLBACK (expose_event_cb),
#endif
NULL);
}

View File

@ -58,11 +58,7 @@ typedef struct _XedTaglistPluginPanel XedTaglistPluginPanel;
struct _XedTaglistPluginPanel
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox vbox;
#else
GtkVBox vbox;
#endif
/*< private > */
XedTaglistPluginPanelPrivate *priv;
@ -75,11 +71,7 @@ typedef struct _XedTaglistPluginPanelClass XedTaglistPluginPanelClass;
struct _XedTaglistPluginPanelClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
};
/*

View File

@ -84,11 +84,6 @@ struct _XedCloseConfirmationDialogPrivate
(priv->unsaved_documents->next == NULL)) ? \
SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE)
#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
G_DEFINE_TYPE(XedCloseConfirmationDialog, xed_close_confirmation_dialog, GTK_TYPE_DIALOG)
static void set_unsaved_document (XedCloseConfirmationDialog *dlg,
@ -490,29 +485,16 @@ build_single_doc_dialog (XedCloseConfirmationDialog *dlg)
doc = XED_DOCUMENT (dlg->priv->unsaved_documents->data);
/* Image */
#if GTK_CHECK_VERSION (3, 10, 0)
image = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG);
#else
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DIALOG);
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_START);
gtk_widget_set_valign (image, GTK_ALIGN_END);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
/* Primary label */
primary_label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
gtk_widget_set_can_focus (GTK_WIDGET (primary_label), FALSE);
@ -533,20 +515,16 @@ build_single_doc_dialog (XedCloseConfirmationDialog *dlg)
secondary_label = gtk_label_new (str);
g_free (str);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
gtk_widget_set_can_focus (GTK_WIDGET (secondary_label), FALSE);
hbox = gtk_hbox_new (FALSE, 12);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 12);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
@ -673,39 +651,26 @@ build_multiple_docs_dialog (XedCloseConfirmationDialog *dlg)
priv = dlg->priv;
hbox = gtk_hbox_new (FALSE, 12);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
hbox, TRUE, TRUE, 0);
/* Image */
#if GTK_CHECK_VERSION (3, 10, 0)
image = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_DIALOG);
#else
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DIALOG);
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 12);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* Primary label */
primary_label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
str = g_strdup_printf (
@ -723,18 +688,14 @@ build_multiple_docs_dialog (XedCloseConfirmationDialog *dlg)
g_free (markup_str);
gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0);
vbox2 = gtk_vbox_new (FALSE, 8);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
select_label = gtk_label_new_with_mnemonic (_("S_elect the documents you want to save:"));
gtk_box_pack_start (GTK_BOX (vbox2), select_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (select_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (select_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (select_label), 0.0, 0.5);
#endif
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0);
@ -753,11 +714,7 @@ build_multiple_docs_dialog (XedCloseConfirmationDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox2), secondary_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (select_label), treeview);

View File

@ -38,9 +38,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include <xed/xed-prefs-manager.h>

View File

@ -21,9 +21,6 @@
#define __EGG_SM_CLIENT_PRIVATE_H__
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION (3, 0, 0)
#include <gdkconfig.h>
#endif
#include "eggsmclient.h"
G_BEGIN_DECLS

View File

@ -367,13 +367,7 @@ sm_client_xsmp_startup (EggSMClient *client,
xsmp->client_id = g_strdup (ret_client_id);
free (ret_client_id);
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_enter ();
#endif
gdk_x11_set_sm_client_id (xsmp->client_id);
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_leave ();
#endif
g_debug ("Got client ID \"%s\"", xsmp->client_id);
}
@ -541,10 +535,6 @@ idle_do_pending_events (gpointer data)
EggSMClientXSMP *xsmp = data;
EggSMClient *client = data;
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_enter ();
#endif
xsmp->idle = 0;
if (xsmp->waiting_to_emit_quit)
@ -568,9 +558,6 @@ idle_do_pending_events (gpointer data)
}
out:
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_leave ();
#endif
return FALSE;
}
@ -1292,13 +1279,7 @@ process_ice_messages (IceConn ice_conn)
{
IceProcessMessagesStatus status;
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_enter ();
#endif
status = IceProcessMessages (ice_conn, NULL, NULL);
#if !GTK_CHECK_VERSION (3, 0, 0)
gdk_threads_leave ();
#endif
switch (status)
{

View File

@ -30,13 +30,7 @@ xed_close_button_style_set (GtkWidget *button,
{
gint h, w;
#if GTK_CHECK_VERSION (3, 10, 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
#else
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
GTK_ICON_SIZE_MENU, &w, &h);
#endif
gtk_widget_set_size_request (button, w + 2, h + 2);
GTK_WIDGET_CLASS (xed_close_button_parent_class)->style_set (button, previous_style);

View File

@ -38,9 +38,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#define GTK_OBJECT G_OBJECT
#endif
#include "xed-commands.h"
#include "xed-debug.h"
@ -763,7 +760,7 @@ _xed_cmd_search_goto_line (GtkAction *action,
/* goto line is builtin in XedView, just activate
* the corrisponding binding.
*/
gtk_bindings_activate (GTK_OBJECT (active_view),
gtk_bindings_activate (G_OBJECT (active_view),
GDK_KEY_i,
GDK_CONTROL_MASK);
}
@ -787,7 +784,7 @@ _xed_cmd_search_incremental_search (GtkAction *action,
/* incremental search is builtin in XedView, just activate
* the corrisponding binding.
*/
gtk_bindings_activate (GTK_OBJECT (active_view),
gtk_bindings_activate (G_OBJECT (active_view),
GDK_KEY_k,
GDK_CONTROL_MASK);
}

View File

@ -39,11 +39,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#else
#include <gtksourceview/gtksourceiter.h>
#endif
#include "xed-prefs-manager-app.h"
#include "xed-document.h"
@ -178,11 +174,7 @@ enum {
static guint document_signals[LAST_SIGNAL] = { 0 };
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedDocument, xed_document, GTK_SOURCE_TYPE_BUFFER)
#else
G_DEFINE_TYPE(XedDocument, xed_document, GTK_TYPE_SOURCE_BUFFER)
#endif
GQuark
xed_document_error_quark (void)
@ -1895,11 +1887,7 @@ xed_document_search_forward (XedDocument *doc,
GtkTextIter *match_end)
{
GtkTextIter iter;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags;
#else
GtkSourceSearchFlags search_flags;
#endif
gboolean found = FALSE;
GtkTextIter m_start;
GtkTextIter m_end;
@ -1923,28 +1911,16 @@ xed_document_search_forward (XedDocument *doc,
else
iter = *start;
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!XED_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
}
while (!found)
{
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter,
#endif
doc->priv->search_text,
search_flags,
&m_start,
@ -1988,11 +1964,7 @@ xed_document_search_backward (XedDocument *doc,
GtkTextIter *match_end)
{
GtkTextIter iter;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags;
#else
GtkSourceSearchFlags search_flags;
#endif
gboolean found = FALSE;
GtkTextIter m_start;
GtkTextIter m_end;
@ -2016,28 +1988,16 @@ xed_document_search_backward (XedDocument *doc,
else
iter = *end;
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!XED_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
}
while (!found)
{
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_backward_search (&iter,
#else
found = gtk_source_iter_backward_search (&iter,
#endif
doc->priv->search_text,
search_flags,
&m_start,
@ -2075,11 +2035,7 @@ xed_document_replace_all (XedDocument *doc,
GtkTextIter iter;
GtkTextIter m_start;
GtkTextIter m_end;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags = 0;
#else
GtkSourceSearchFlags search_flags = 0;
#endif
gboolean found = TRUE;
gint cont = 0;
gchar *search_text;
@ -2104,19 +2060,11 @@ xed_document_replace_all (XedDocument *doc,
gtk_text_buffer_get_start_iter (buffer, &iter);
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!XED_SEARCH_IS_CASE_SENSITIVE (flags))
{
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
}
replace_text_len = strlen (replace_text);
@ -2139,11 +2087,7 @@ xed_document_replace_all (XedDocument *doc,
do
{
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter,
#endif
search_text,
search_flags,
&m_start,
@ -2246,15 +2190,9 @@ _xed_document_get_seconds_since_last_save_or_load (XedDocument *doc)
static void
get_search_match_colors (XedDocument *doc,
gboolean *foreground_set,
#if GTK_CHECK_VERSION (3, 14, 0)
GdkRGBA *foreground,
gboolean *background_set,
GdkRGBA *background)
#else
GdkColor *foreground,
gboolean *background_set,
GdkColor *background)
#endif
{
GtkSourceStyleScheme *style_scheme;
GtkSourceStyle *style;
@ -2279,21 +2217,6 @@ get_search_match_colors (XedDocument *doc,
if (*foreground_set)
{
#if GTK_CHECK_VERSION (3, 14, 0)
if (fg == NULL ||
!gdk_rgba_parse (foreground, fg))
{
*foreground_set = FALSE;
}
}
if (*background_set)
{
if (bg == NULL ||
!gdk_rgba_parse (background, bg))
{
*background_set = FALSE;
#else
if (fg == NULL ||
!gdk_color_parse (fg, foreground))
{
@ -2307,7 +2230,6 @@ get_search_match_colors (XedDocument *doc,
!gdk_color_parse (bg, background))
{
*background_set = FALSE;
#endif
}
}
@ -2321,11 +2243,7 @@ get_search_match_colors (XedDocument *doc,
"Falling back to hard-coded colors "
"for the \"found\" text tag.");
#if GTK_CHECK_VERSION (3, 14, 0)
gdk_rgba_parse (background, "#FFFF78");
#else
gdk_color_parse ("#FFFF78", background);
#endif
*background_set = TRUE;
*foreground_set = FALSE;
@ -2337,13 +2255,8 @@ sync_found_tag (XedDocument *doc,
GParamSpec *pspec,
gpointer data)
{
#if GTK_CHECK_VERSION (3, 14, 0)
GdkRGBA fg;
GdkRGBA bg;
#else
GdkColor fg;
GdkColor bg;
#endif
gboolean fg_set;
gboolean bg_set;
@ -2356,17 +2269,10 @@ sync_found_tag (XedDocument *doc,
&bg_set, &bg);
g_object_set (doc->priv->found_tag,
#if GTK_CHECK_VERSION (3, 14, 0)
"foreground-rgba", fg_set ? &fg : NULL,
NULL);
g_object_set (doc->priv->found_tag,
"background-rgba", bg_set ? &bg : NULL,
#else
"foreground-gdk", fg_set ? &fg : NULL,
NULL);
g_object_set (doc->priv->found_tag,
"background-gdk", bg_set ? &bg : NULL,
#endif
NULL);
}
@ -2390,11 +2296,7 @@ search_region (XedDocument *doc,
GtkTextIter iter;
GtkTextIter m_start;
GtkTextIter m_end;
#if GTK_CHECK_VERSION (3, 0, 0)
GtkTextSearchFlags search_flags = 0;
#else
GtkSourceSearchFlags search_flags = 0;
#endif
gboolean found = TRUE;
GtkTextBuffer *buffer;
@ -2454,19 +2356,11 @@ search_region (XedDocument *doc,
iter = *start;
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
#else
search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
#endif
if (!XED_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
{
#if GTK_CHECK_VERSION (3, 0, 0)
search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
#else
search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
#endif
}
do
@ -2474,11 +2368,7 @@ search_region (XedDocument *doc,
if ((end != NULL) && gtk_text_iter_is_end (end))
end = NULL;
#if GTK_CHECK_VERSION (3, 0, 0)
found = gtk_text_iter_forward_search (&iter,
#else
found = gtk_source_iter_forward_search (&iter,
#endif
doc->priv->search_text,
search_flags,
&m_start,

View File

@ -53,11 +53,7 @@ struct _XedDocumentsPanelPrivate
guint is_reodering : 1;
};
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedDocumentsPanel, xed_documents_panel, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE(XedDocumentsPanel, xed_documents_panel, GTK_TYPE_VBOX)
#endif
enum
{
@ -540,11 +536,7 @@ menu_position (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
#else
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{
@ -758,10 +750,8 @@ xed_documents_panel_init (XedDocumentsPanel *panel)
panel->priv->adding_tab = FALSE;
panel->priv->is_reodering = FALSE;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
GTK_ORIENTATION_VERTICAL);
#endif
/* Create the scrolled window */
sw = gtk_scrolled_window_new (NULL, NULL);

View File

@ -57,11 +57,7 @@ typedef struct _XedDocumentsPanel XedDocumentsPanel;
struct _XedDocumentsPanel
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox vbox;
#else
GtkVBox vbox;
#endif
/*< private > */
XedDocumentsPanelPrivate *priv;
@ -74,11 +70,7 @@ typedef struct _XedDocumentsPanelClass XedDocumentsPanelClass;
struct _XedDocumentsPanelClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
};
/*

View File

@ -39,9 +39,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include "xed-file-chooser-dialog.h"
#include "xed-encodings-combo-box.h"
@ -55,10 +53,6 @@
#define ALL_FILES _("All Files")
#define ALL_TEXT_FILES _("All Text Files")
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
#endif
struct _XedFileChooserDialogPrivate
{
GtkWidget *option_menu;
@ -86,11 +80,7 @@ create_option_menu (XedFileChooserDialog *dialog)
GtkWidget *menu;
label = gtk_label_new_with_mnemonic (_("C_haracter Encoding:"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
#endif
menu = xed_encodings_combo_box_new (
gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE);
@ -155,11 +145,7 @@ create_newline_combo (XedFileChooserDialog *dialog)
GtkTreeIter iter;
label = gtk_label_new_with_mnemonic (_("L_ine Ending:"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
#endif
store = gtk_list_store_new (2, G_TYPE_STRING, XED_TYPE_DOCUMENT_NEWLINE_TYPE);
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
@ -216,7 +202,7 @@ create_newline_combo (XedFileChooserDialog *dialog)
static void
create_extra_widget (XedFileChooserDialog *dialog)
{
dialog->priv->extra_widget = gtk_hbox_new (FALSE, 6);
dialog->priv->extra_widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (dialog->priv->extra_widget);
@ -309,11 +295,7 @@ all_text_files_filter (const GtkFileFilterInfo *filter_info,
GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *languages);
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (lang), FALSE);
#else
g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), FALSE);
#endif
++languages;
mime_types = gtk_source_language_get_mime_types (lang);
@ -392,9 +374,6 @@ xed_file_chooser_dialog_new_valist (const gchar *title,
result = g_object_new (XED_TYPE_FILE_CHOOSER_DIALOG,
"title", title,
#if !GTK_CHECK_VERSION (3, 0, 0)
"file-system-backend", NULL,
#endif
"local-only", FALSE,
"action", action,
"select-multiple", action == GTK_FILE_CHOOSER_ACTION_OPEN,
@ -421,9 +400,7 @@ xed_file_chooser_dialog_new_valist (const gchar *title,
gtk_file_filter_set_name (filter, ALL_FILES);
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (result), filter);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (result), action);
#endif
if (active_filter != 1)
{

View File

@ -50,11 +50,6 @@
#define MAX_URI_IN_DIALOG_LENGTH 50
#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
static gboolean
is_recoverable_error (const GError *error)
{
@ -122,18 +117,14 @@ set_message_area_text_and_icon (GtkWidget *message_area,
GtkWidget *primary_label;
GtkWidget *secondary_label;
hbox_content = gtk_hbox_new (FALSE, 8);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
primary_markup = g_strdup_printf ("<b>%s</b>", primary_text);
@ -142,11 +133,7 @@ set_message_area_text_and_icon (GtkWidget *message_area,
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
@ -161,11 +148,7 @@ set_message_area_text_and_icon (GtkWidget *message_area,
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
}
gtk_widget_show_all (hbox_content);
@ -449,7 +432,7 @@ create_combo_box (GtkWidget *message_area, GtkWidget *vbox)
GtkWidget *menu;
gchar *label_markup;
hbox = gtk_hbox_new (FALSE, 6);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
label_markup = g_strdup_printf ("<small>%s</small>",
_("Ch_aracter Encoding:"));
@ -523,18 +506,14 @@ create_conversion_error_message_area (const gchar *primary_text,
GTK_MESSAGE_ERROR);
}
hbox_content = gtk_hbox_new (FALSE, 8);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
image = gtk_image_new_from_stock ("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
primary_markup = g_strdup_printf ("<b>%s</b>", primary_text);
@ -543,11 +522,7 @@ create_conversion_error_message_area (const gchar *primary_text,
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
@ -562,11 +537,7 @@ create_conversion_error_message_area (const gchar *primary_text,
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
}
create_combo_box (message_area, vbox);
@ -801,18 +772,14 @@ xed_file_already_open_warning_message_area_new (const gchar *uri)
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area),
GTK_MESSAGE_WARNING);
hbox_content = gtk_hbox_new (FALSE, 8);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
primary_text = g_strdup_printf (_("This file (%s) is already open in another xed window."), uri_for_display);
@ -825,11 +792,7 @@ xed_file_already_open_warning_message_area_new (const gchar *uri)
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
@ -844,11 +807,7 @@ xed_file_already_open_warning_message_area_new (const gchar *uri)
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
@ -905,18 +864,14 @@ xed_externally_modified_saving_error_message_area_new (
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area),
GTK_MESSAGE_WARNING);
hbox_content = gtk_hbox_new (FALSE, 8);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
// FIXME: review this message, it's not clear since for the user the "modification"
@ -933,11 +888,7 @@ xed_externally_modified_saving_error_message_area_new (
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
@ -951,11 +902,7 @@ xed_externally_modified_saving_error_message_area_new (
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);
@ -1013,18 +960,14 @@ xed_no_backup_saving_error_message_area_new (const gchar *uri,
gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area),
GTK_MESSAGE_WARNING);
hbox_content = gtk_hbox_new (FALSE, 8);
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
#endif
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0);
// FIXME: review this messages
@ -1045,11 +988,7 @@ xed_no_backup_saving_error_message_area_new (const gchar *uri,
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (primary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
#endif
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
@ -1065,11 +1004,7 @@ xed_no_backup_saving_error_message_area_new (const gchar *uri,
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (secondary_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
#endif
gtk_widget_show_all (hbox_content);
set_contents (message_area, hbox_content);

View File

@ -31,9 +31,7 @@
#include <string.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include "xed-language-manager.h"
#include "xed-prefs-manager.h"
#include "xed-utils.h"
@ -79,11 +77,7 @@ xed_language_manager_list_languages_sorted (GtkSourceLanguageManager *lm,
GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, *ids);
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (lang), NULL);
#else
g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (lang), NULL);
#endif
++ids;
if (include_hidden || !gtk_source_language_get_hidden (lang))

View File

@ -43,11 +43,6 @@
#define XED_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PANEL, XedPanelPrivate))
#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
struct _XedPanelPrivate
{
GtkOrientation orientation;
@ -90,11 +85,7 @@ static GObject *xed_panel_constructor (GType type,
GObjectConstructParam *construct_properties);
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedPanel, xed_panel, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE(XedPanel, xed_panel, GTK_TYPE_VBOX)
#endif
static void
xed_panel_finalize (GObject *obj)
@ -195,13 +186,8 @@ xed_panel_class_init (XedPanelClass *klass)
g_object_class_install_property (object_class,
PROP_ORIENTATION,
#if GTK_CHECK_VERSION (3, 0, 0)
g_param_spec_enum ("panel-orientation",
"Panel Orientation",
#else
g_param_spec_enum ("orientation",
"Orientation",
#endif
"The panel's orientation",
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_VERTICAL,
@ -281,26 +267,6 @@ set_gtk_image_from_gtk_image (GtkImage *image,
case GTK_IMAGE_EMPTY:
gtk_image_clear (image);
break;
#if !GTK_CHECK_VERSION (3, 0, 0)
case GTK_IMAGE_PIXMAP:
{
GdkPixmap *pm;
GdkBitmap *bm;
gtk_image_get_pixmap (source, &pm, &bm);
gtk_image_set_from_pixmap (image, pm, bm);
}
break;
case GTK_IMAGE_IMAGE:
{
GdkImage *i;
GdkBitmap *bm;
gtk_image_get_image (source, &i, &bm);
gtk_image_set_from_image (image, i, bm);
}
break;
#endif
case GTK_IMAGE_PIXBUF:
{
GdkPixbuf *pb;
@ -416,10 +382,8 @@ xed_panel_init (XedPanel *panel)
{
panel->priv = XED_PANEL_GET_PRIVATE (panel);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
GTK_ORIENTATION_VERTICAL);
#endif
}
static void
@ -473,7 +437,7 @@ build_horizontal_panel (XedPanel *panel)
GtkWidget *sidebar;
GtkWidget *close_button;
box = gtk_hbox_new(FALSE, 0);
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (box),
panel->priv->notebook,
@ -482,7 +446,7 @@ build_horizontal_panel (XedPanel *panel)
0);
/* Toolbar, close button and first separator */
sidebar = gtk_vbox_new(FALSE, 6);
sidebar = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (sidebar), 4);
gtk_box_pack_start (GTK_BOX (box),
@ -517,12 +481,12 @@ build_vertical_panel (XedPanel *panel)
GtkWidget *dummy_label;
/* Create title hbox */
title_hbox = gtk_hbox_new (FALSE, 6);
title_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (title_hbox), 5);
gtk_box_pack_start (GTK_BOX (panel), title_hbox, FALSE, FALSE, 0);
icon_name_hbox = gtk_hbox_new (FALSE, 0);
icon_name_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (title_hbox),
icon_name_hbox,
TRUE,
@ -547,11 +511,8 @@ build_vertical_panel (XedPanel *panel)
0);
panel->priv->title_label = gtk_label_new (_("Empty"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (panel->priv->title_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (panel->priv->title_label), 0, 0.5);
#endif
gtk_label_set_ellipsize(GTK_LABEL (panel->priv->title_label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (icon_name_hbox),
@ -635,33 +596,27 @@ build_tab_label (XedPanel *panel,
/* set hbox spacing and label padding (see below) so that there's an
* equal amount of space around the label */
hbox = gtk_hbox_new (FALSE, 4);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
label_ebox = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
label_hbox = gtk_hbox_new (FALSE, 4);
label_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
/* setup icon */
gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
/* setup label */
label = gtk_label_new (name);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
label = gtk_label_new (name);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_margin_left (label, 0);
gtk_widget_set_margin_right (label, 0);
gtk_widget_set_margin_top (label, 0);
gtk_widget_set_margin_bottom (label, 0);
#else
gtk_misc_set_padding (GTK_MISC (label), 0, 0);
#endif
gtk_box_pack_start (GTK_BOX (label_hbox), label, TRUE, TRUE, 0);
gtk_widget_set_tooltip_text (label_ebox, name);
@ -727,11 +682,8 @@ xed_panel_add_item (XedPanel *panel,
tab_label = build_tab_label (panel, item, data->name, data->icon);
menu_label = gtk_label_new (name);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (menu_label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5);
#endif
if (!gtk_widget_get_visible (item))
gtk_widget_show (item);

View File

@ -55,11 +55,7 @@ typedef struct _XedPanel XedPanel;
struct _XedPanel
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox vbox;
#else
GtkVBox vbox;
#endif
/*< private > */
XedPanelPrivate *priv;
@ -72,11 +68,7 @@ typedef struct _XedPanelClass XedPanelClass;
struct _XedPanelClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
void (* item_added) (XedPanel *panel,
GtkWidget *item);

View File

@ -70,11 +70,7 @@ struct _XedPluginManagerPrivate
GtkWidget *popup_menu;
};
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedPluginManager, xed_plugin_manager, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE(XedPluginManager, xed_plugin_manager, GTK_TYPE_VBOX)
#endif
static XedPluginInfo *plugin_manager_get_selected_plugin (XedPluginManager *pm);
static void plugin_manager_toggle_active (XedPluginManager *pm, GtkTreeIter *iter, GtkTreeModel *model);
@ -794,10 +790,8 @@ xed_plugin_manager_init (XedPluginManager *pm)
pm->priv = XED_PLUGIN_MANAGER_GET_PRIVATE (pm);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (pm),
GTK_ORIENTATION_VERTICAL);
#endif
/*
* Always we create the manager, firstly we rescan the plugins directory
@ -808,11 +802,7 @@ xed_plugin_manager_init (XedPluginManager *pm)
label = gtk_label_new_with_mnemonic (_("Active _Plugins:"));
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
gtk_box_pack_start (GTK_BOX (pm), label, FALSE, TRUE, 0);
@ -830,11 +820,8 @@ xed_plugin_manager_init (XedPluginManager *pm)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), pm->priv->tree);
#if GTK_CHECK_VERSION (3, 0, 0)
hbuttonbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
#else
hbuttonbox = gtk_hbutton_box_new ();
#endif
gtk_box_pack_start (GTK_BOX (pm), hbuttonbox, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);
gtk_box_set_spacing (GTK_BOX (hbuttonbox), 8);

View File

@ -55,11 +55,7 @@ typedef struct _XedPluginManager XedPluginManager;
struct _XedPluginManager
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox vbox;
#else
GtkVBox vbox;
#endif
/*< private > */
XedPluginManagerPrivate *priv;
@ -72,11 +68,7 @@ typedef struct _XedPluginManagerClass XedPluginManagerClass;
struct _XedPluginManagerClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
};
/*

View File

@ -1198,11 +1198,7 @@ xed_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
while (l != NULL)
{
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
#else
g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
#endif
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
enable);
@ -1308,11 +1304,7 @@ xed_prefs_manager_source_style_scheme_changed (GSettings *settings,
docs = xed_app_get_documents (xed_app_get_default ());
for (l = docs; l != NULL; l = l->next)
{
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
#else
g_return_if_fail (GTK_IS_SOURCE_BUFFER (l->data));
#endif
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data),
style);

View File

@ -517,11 +517,7 @@ create_compositor (XedPrintJob *job)
print_font_numbers = xed_prefs_manager_get_print_font_numbers ();
job->priv->compositor = GTK_SOURCE_PRINT_COMPOSITOR (
#if GTK_CHECK_VERSION (3, 0, 0)
g_object_new (GTK_SOURCE_TYPE_PRINT_COMPOSITOR,
#else
g_object_new (GTK_TYPE_SOURCE_PRINT_COMPOSITOR,
#endif
"buffer", GTK_SOURCE_BUFFER (job->priv->doc),
"tab-width", gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (job->priv->view)),
"highlight-syntax", gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (job->priv->doc)) &&

View File

@ -42,10 +42,6 @@
#define PRINTER_DPI (72.)
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
#endif
struct _XedPrintPreviewPrivate
{
GtkPrintOperation *operation;
@ -87,11 +83,7 @@ struct _XedPrintPreviewPrivate
guint cur_page;
};
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (XedPrintPreview, xed_print_preview, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE (XedPrintPreview, xed_print_preview, GTK_TYPE_VBOX)
#endif
static void
xed_print_preview_get_property (GObject *object,
@ -593,7 +585,7 @@ create_bar (XedPrintPreview *preview)
gtk_widget_show (GTK_WIDGET (i));
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), i, -1);
status = gtk_hbox_new (FALSE, 4);
status = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
priv->page_entry = gtk_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (priv->page_entry), 3);
gtk_entry_set_max_length (GTK_ENTRY (priv->page_entry), 6);
@ -1005,10 +997,8 @@ xed_print_preview_init (XedPrintPreview *preview)
priv->context = NULL;
priv->gtk_preview = NULL;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (preview),
GTK_ORIENTATION_VERTICAL);
#endif
create_bar (preview);
create_preview_layout (preview);
@ -1116,13 +1106,8 @@ draw_page (cairo_t *cr,
}
static gboolean
#if GTK_CHECK_VERSION (3, 0, 0)
preview_draw (GtkWidget *widget,
cairo_t *cr,
#else
preview_expose (GtkWidget *widget,
GdkEventExpose *event,
#endif
XedPrintPreview *preview)
{
XedPrintPreviewPrivate *priv;
@ -1134,22 +1119,12 @@ preview_expose (GtkWidget *widget,
bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (priv->layout));
#if GTK_CHECK_VERSION (3, 0, 0)
if (!gtk_cairo_should_draw_window (cr, bin_window))
return TRUE;
cairo_save (cr);
gtk_cairo_transform_to_window (cr, widget, bin_window);
#else
if (event->window != bin_window)
return FALSE;
cairo_t *cr = gdk_cairo_create (bin_window);
gdk_cairo_rectangle (cr, &event->area);
cairo_clip (cr);
#endif
/* get the first page to display */
pg = get_first_page_displayed (preview);
@ -1177,11 +1152,7 @@ preview_expose (GtkWidget *widget,
}
}
#if GTK_CHECK_VERSION (3, 0, 0)
cairo_restore (cr);
#else
cairo_destroy (cr);
#endif
return TRUE;
}
@ -1237,13 +1208,8 @@ preview_ready (GtkPrintOperationPreview *gtk_preview,
/* let the default gtklayout handler clear the background */
g_signal_connect_after (preview->priv->layout,
#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (preview_draw),
#else
"expose-event",
G_CALLBACK (preview_expose),
#endif
preview);
gtk_widget_queue_draw (preview->priv->layout);

View File

@ -48,21 +48,14 @@ typedef struct _XedPrintPreviewClass XedPrintPreviewClass;
struct _XedPrintPreview
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
#else
GtkVBox parent;
#endif
XedPrintPreviewPrivate *priv;
};
struct _XedPrintPreviewClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
void (* close) (XedPrintPreview *preview);
};

View File

@ -48,11 +48,6 @@ enum {
#define XED_PROGRESS_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PROGRESS_MESSAGE_AREA, XedProgressMessageAreaPrivate))
#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
struct _XedProgressMessageAreaPrivate
{
GtkWidget *image;
@ -139,33 +134,25 @@ xed_progress_message_area_init (XedProgressMessageArea *area)
area->priv = XED_PROGRESS_MESSAGE_AREA_GET_PRIVATE (area);
vbox = gtk_vbox_new (FALSE, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
hbox = gtk_hbox_new (FALSE, 4);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
area->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (area->priv->image);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER);
#else
gtk_misc_set_alignment (GTK_MISC (area->priv->image), 0.5, 0.5);
#endif
gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 4);
area->priv->label = gtk_label_new ("");
gtk_widget_show (area->priv->label);
gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (area->priv->label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (area->priv->label), 0.0, 0.5);
#endif
gtk_label_set_ellipsize (GTK_LABEL (area->priv->label),
PANGO_ELLIPSIZE_END);

View File

@ -39,9 +39,7 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include "xed-style-scheme-manager.h"
#include "xed-prefs-manager.h"
@ -112,11 +110,7 @@ xed_style_scheme_manager_list_schemes_sorted (GtkSourceStyleSchemeManager *manag
const gchar * const * scheme_ids;
GSList *schemes = NULL;
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), NULL);
#endif
scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);
@ -267,11 +261,7 @@ _xed_style_scheme_manager_install_scheme (GtkSourceStyleSchemeManager *manager,
const gchar* const *ids;
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), NULL);
#endif
g_return_val_if_fail (fname != NULL, NULL);
dirname = g_path_get_dirname (fname);
@ -362,11 +352,7 @@ _xed_style_scheme_manager_uninstall_scheme (GtkSourceStyleSchemeManager *manager
GtkSourceStyleScheme *scheme;
const gchar *filename;
#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), FALSE);
#else
g_return_val_if_fail (GTK_IS_SOURCE_STYLE_SCHEME_MANAGER (manager), FALSE);
#endif
g_return_val_if_fail (id != NULL, FALSE);
scheme = gtk_source_style_scheme_manager_get_scheme (manager, id);

View File

@ -31,10 +31,6 @@
#define XED_TAB_LABEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_TAB_LABEL, XedTabLabelPrivate))
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
#endif
/* Signals */
enum
{
@ -63,11 +59,7 @@ struct _XedTabLabelPrivate
static guint signals[LAST_SIGNAL] = { 0 };
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE (XedTabLabel, xed_tab_label, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE (XedTabLabel, xed_tab_label, GTK_TYPE_HBOX)
#endif
static void
xed_tab_label_finalize (GObject *object)
@ -269,16 +261,14 @@ xed_tab_label_init (XedTabLabel *tab_label)
tab_label->priv->close_button_sensitive = TRUE;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (tab_label),
GTK_ORIENTATION_HORIZONTAL);
#endif
ebox = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
tab_label->priv->ebox = ebox;
hbox = gtk_hbox_new (FALSE, 4);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_container_add (GTK_CONTAINER (ebox), hbox);
close_button = xed_close_button_new ();
@ -301,19 +291,13 @@ xed_tab_label_init (XedTabLabel *tab_label)
tab_label->priv->icon = icon;
label = gtk_label_new ("");
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_margin_left (label, 0);
gtk_widget_set_margin_right (label, 0);
gtk_widget_set_margin_top (label, 0);
gtk_widget_set_margin_bottom (label, 0);
#else
gtk_misc_set_padding (GTK_MISC (label), 0, 0);
#endif
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
tab_label->priv->label = label;

View File

@ -41,21 +41,13 @@ typedef struct _XedTabLabelClass XedTabLabelClass;
typedef struct _XedTabLabelPrivate XedTabLabelPrivate;
struct _XedTabLabel {
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox parent;
#else
GtkHBox parent;
#endif
XedTabLabelPrivate *priv;
};
struct _XedTabLabelClass {
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkHBoxClass parent_class;
#endif
void (* close_clicked) (XedTabLabel *tab_label);
};

View File

@ -49,10 +49,6 @@
#define XED_TAB_KEY "XED_TAB_KEY"
#if GTK_CHECK_VERSION (3, 0, 0)
#define gdk_cursor_unref(cursor) g_object_unref (cursor)
#endif
struct _XedTabPrivate
{
XedTabState state;
@ -86,11 +82,7 @@ struct _XedTabPrivate
gint ask_if_externally_modified : 1;
};
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedTab, xed_tab, GTK_TYPE_BOX)
#else
G_DEFINE_TYPE(XedTab, xed_tab, GTK_TYPE_VBOX)
#endif
enum
{
@ -338,7 +330,7 @@ set_cursor_according_to_state (GtkTextView *view,
if (left_window != NULL)
gdk_window_set_cursor (left_window, cursor);
gdk_cursor_unref (cursor);
g_object_unref (cursor);
}
else
{
@ -351,7 +343,7 @@ set_cursor_according_to_state (GtkTextView *view,
if (left_window != NULL)
gdk_window_set_cursor (left_window, NULL);
gdk_cursor_unref (cursor);
g_object_unref (cursor);
}
}
@ -1489,10 +1481,8 @@ xed_tab_init (XedTab *tab)
tab->priv->ask_if_externally_modified = TRUE;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_orientable_set_orientation (GTK_ORIENTABLE (tab),
GTK_ORIENTATION_VERTICAL);
#endif
/* Create the scrolled window */
sw = gtk_scrolled_window_new (NULL, NULL);
@ -1869,14 +1859,7 @@ _xed_tab_get_icon (XedTab *tab)
theme = gtk_icon_theme_get_for_screen (screen);
g_return_val_if_fail (theme != NULL, NULL);
#if GTK_CHECK_VERSION (3, 10, 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &icon_size);
#else
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (tab)),
GTK_ICON_SIZE_MENU,
NULL,
&icon_size);
#endif
switch (tab->priv->state)
{

View File

@ -77,11 +77,7 @@ typedef struct _XedTab XedTab;
struct _XedTab
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBox vbox;
#else
GtkVBox vbox;
#endif
/*< private > */
XedTabPrivate *priv;
@ -94,11 +90,8 @@ typedef struct _XedTabClass XedTabClass;
struct _XedTabClass
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkBoxClass parent_class;
#else
GtkVBoxClass parent_class;
#endif
};
/*

View File

@ -134,11 +134,7 @@ xed_utils_menu_position_under_widget (GtkMenu *menu,
widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
#else
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
gtk_widget_get_allocation (widget, &allocation);
@ -193,11 +189,8 @@ xed_utils_menu_position_under_tree_view (GtkMenu *menu,
if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL)
{
GtkRequisition requisition;
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition);
#else
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
*x += rect.width - requisition.width;
}
}

View File

@ -56,10 +56,6 @@
#define XED_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_VIEW, XedViewPrivate))
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
#endif
typedef enum
{
GOTO_LINE,
@ -135,13 +131,9 @@ static gboolean reset_searched_text (XedView *view);
static void hide_search_window (XedView *view,
gboolean cancel);
#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean xed_view_draw (GtkWidget *widget,
cairo_t *cr);
#else
static gint xed_view_expose (GtkWidget *widget,
GdkEventExpose *event);
#endif
static void search_highlight_updated_cb (XedDocument *doc,
GtkTextIter *start,
GtkTextIter *end,
@ -151,11 +143,7 @@ static void xed_view_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,
gint count);
#if GTK_CHECK_VERSION (3, 0, 0)
G_DEFINE_TYPE(XedView, xed_view, GTK_SOURCE_TYPE_VIEW)
#else
G_DEFINE_TYPE(XedView, xed_view, GTK_TYPE_SOURCE_VIEW)
#endif
/* Signals */
enum
@ -199,11 +187,7 @@ xed_view_class_init (XedViewClass *klass)
object_class->finalize = xed_view_finalize;
widget_class->focus_out_event = xed_view_focus_out;
#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = xed_view_draw;
#else
widget_class->expose_event = xed_view_expose;
#endif
/*
* Override the gtk_text_view_drag_motion and drag_drop
@ -763,43 +747,15 @@ static void
set_entry_state (GtkWidget *entry,
XedSearchEntryState state)
{
#if GTK_CHECK_VERSION (3, 0 ,0)
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (entry));
#endif
if (state == XED_SEARCH_ENTRY_NOT_FOUND)
{
#if GTK_CHECK_VERSION (3, 0 ,0)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
#else
GdkColor red;
GdkColor white;
/* FIXME: a11y and theme */
gdk_color_parse ("#FF6666", &red);
gdk_color_parse ("white", &white);
gtk_widget_modify_base (entry,
GTK_STATE_NORMAL,
&red);
gtk_widget_modify_text (entry,
GTK_STATE_NORMAL,
&white);
#endif
}
else /* reset */
{
#if GTK_CHECK_VERSION (3, 0 ,0)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
#else
gtk_widget_modify_base (entry,
GTK_STATE_NORMAL,
NULL);
gtk_widget_modify_text (entry,
GTK_STATE_NORMAL,
NULL);
#endif
}
}
@ -982,17 +938,9 @@ hide_search_window (XedView *view, gboolean cancel)
static gboolean
search_entry_flush_timeout (XedView *view)
{
#if !GTK_CHECK_VERSION (3, 0, 0)
GDK_THREADS_ENTER ();
#endif
view->priv->typeselect_flush_timeout = 0;
hide_search_window (view, FALSE);
#if !GTK_CHECK_VERSION (3, 0, 0)
GDK_THREADS_LEAVE ();
#endif
return FALSE;
}
@ -1205,16 +1153,8 @@ real_search_enable_popdown (gpointer data)
{
XedView *view = (XedView *)data;
#if !GTK_CHECK_VERSION (3, 0, 0)
GDK_THREADS_ENTER ();
#endif
view->priv->disable_popdown = FALSE;
#if !GTK_CHECK_VERSION (3, 0, 0)
GDK_THREADS_LEAVE ();
#endif
return FALSE;
}
@ -1525,7 +1465,7 @@ ensure_search_window (XedView *view)
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (view->priv->search_window), frame);
vbox = gtk_vbox_new (FALSE, 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
@ -1864,31 +1804,19 @@ start_interactive_goto_line (XedView *view)
return start_interactive_search_real (view);
}
#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
xed_view_draw (GtkWidget *widget,
cairo_t *cr)
#else
static gint
xed_view_expose (GtkWidget *widget,
GdkEventExpose *event)
#endif
{
GtkTextView *text_view;
XedDocument *doc;
#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *window;
#endif
text_view = GTK_TEXT_VIEW (widget);
doc = XED_DOCUMENT (gtk_text_view_get_buffer (text_view));
#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT);
if (gtk_cairo_should_draw_window (cr, window) &&
#else
if ((event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT)) &&
#endif
xed_document_get_enable_search_highlighting (doc))
{
GdkRectangle visible_rect;
@ -1907,11 +1835,7 @@ xed_view_expose (GtkWidget *widget,
&iter2);
}
#if GTK_CHECK_VERSION (3, 0, 0)
return GTK_WIDGET_CLASS (xed_view_parent_class)->draw (widget, cr);
#else
return (* GTK_WIDGET_CLASS (xed_view_parent_class)->expose_event)(widget, event);
#endif
}
static GdkAtom

View File

@ -39,9 +39,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtksourceview/gtksource.h>
#endif
#include "xed-ui.h"
#include "xed-window.h"
@ -71,10 +69,6 @@
XED_TYPE_WINDOW, \
XedWindowPrivate))
#if GTK_CHECK_VERSION (3, 0, 0)
#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
#endif
/* Signals */
enum
{
@ -1550,10 +1544,8 @@ create_menu_bar_and_toolbar (XedWindow *window,
0);
window->priv->toolbar = gtk_ui_manager_get_widget (manager, "/ToolBar");
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->toolbar),
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
#endif
gtk_box_pack_start (GTK_BOX (main_box),
window->priv->toolbar,
FALSE,
@ -3805,7 +3797,7 @@ xed_window_init (XedWindow *window)
window->priv->window_group = gtk_window_group_new ();
gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (window));
main_box = gtk_vbox_new (FALSE, 0);
main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), main_box);
gtk_widget_show (main_box);