Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove obsolete checks for older versions of gtk and glib since gtk 2…
….10 and

glib 2.12 are the minimum requirements.

git-svn-id: https://xchat.svn.sourceforge.net/svnroot/xchat@1516 893a96be-7f27-4fdf-9d1e-6aeec9d3cce1
  • Loading branch information
lsitu committed Jul 14, 2012
1 parent d4761e4 commit eefac2c
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 63 deletions.
5 changes: 0 additions & 5 deletions src/common/xchat.h
Expand Up @@ -562,12 +562,7 @@ struct popup
/* CL: get a random int in the range [0..n-1]. DON'T use rand() % n, it gives terrible results. */
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))

#if defined(WIN32) && GLIB_CHECK_VERSION(2,4,0)
#define xchat_filename_from_utf8 g_locale_from_utf8
#define xchat_filename_to_utf8 g_locale_to_utf8
#else
#define xchat_filename_from_utf8 g_filename_from_utf8
#define xchat_filename_to_utf8 g_filename_to_utf8
#endif

#endif
4 changes: 2 additions & 2 deletions src/fe-gtk/chanview-tree.c
Expand Up @@ -100,10 +100,10 @@ cv_tree_init (chanview *cv)
/*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/
GTK_WIDGET_UNSET_FLAGS (view, GTK_CAN_FOCUS);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
#if GTK_CHECK_VERSION(2,10,0)

if (!(prefs.gui_tweaks & 8))
gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE);
#endif

gtk_container_add (GTK_CONTAINER (win), view);

/* icon column */
Expand Down
7 changes: 1 addition & 6 deletions src/fe-gtk/fe-gtk.c
Expand Up @@ -823,13 +823,8 @@ fe_gui_info (session *sess, int info_type)
if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (sess->gui->window)))
#endif
return 2; /* hidden (iconified or systray) */
#if GTK_CHECK_VERSION(2,4,0)

if (gtk_window_is_active (GTK_WINDOW (sess->gui->window)))
#else
#if GTK_CHECK_VERSION(2,2,0)
if (GTK_WINDOW (sess->gui->window)->is_active)
#endif
#endif
return 1; /* active/focused */

return 0; /* normal (no keyboard focus or behind a window) */
Expand Down
4 changes: 0 additions & 4 deletions src/fe-gtk/fkeys.c
Expand Up @@ -1541,11 +1541,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
comp = 0;
}

#if GLIB_CHECK_VERSION(2,4,0)
list = g_completion_complete_utf8 (gcomp, comp ? old_gcomp.data : ent, &result);
#else
list = g_completion_complete (gcomp, comp ? old_gcomp.data : ent, &result);
#endif

if (result == NULL) /* No matches found */
{
Expand Down
3 changes: 1 addition & 2 deletions src/fe-gtk/gtkutil.c
Expand Up @@ -186,10 +186,9 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
}
#if GTK_CHECK_VERSION(2,8,0)

if (!(flags & FRF_NOASKOVERWRITE))
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
#endif
}
else
dialog = gtk_file_chooser_dialog_new (title, NULL,
Expand Down
4 changes: 0 additions & 4 deletions src/fe-gtk/ignoregui.c
Expand Up @@ -228,17 +228,13 @@ ignore_delete_entry_clicked (GtkWidget * wid, struct session *sess)
if (gtkutil_treeview_get_selected (view, &iter, 0, &mask, -1))
{
/* delete this row, select next one */
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gtk_list_store_remove (store, &iter);
#else
if (gtk_list_store_remove (store, &iter))
{
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 1.0, 0.0);
gtk_tree_view_set_cursor (view, path, NULL, FALSE);
gtk_tree_path_free (path);
}
#endif

ignore_del (mask, NULL);
g_free (mask);
Expand Down
9 changes: 0 additions & 9 deletions src/fe-gtk/menu.c
Expand Up @@ -564,10 +564,8 @@ menu_destroy (GtkWidget *menu, gpointer objtounref)
static void
menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
{
#if (GTK_MAJOR_VERSION != 2) || (GTK_MINOR_VERSION != 0)
if (event && event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
#endif

g_object_ref (menu);
g_object_ref_sink (menu);
Expand Down Expand Up @@ -1676,8 +1674,6 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
return item;
}

#if GTK_CHECK_VERSION(2,4,0)

/* Override the default GTK2.4 handler, which would make menu
bindings not work when the menu-bar is hidden. */
static gboolean
Expand All @@ -1691,9 +1687,6 @@ menu_canacaccel (GtkWidget *widget, guint signal_id, gpointer user_data)
#endif
}

#endif


/* === STUFF FOR /MENU === */

static GtkMenuItem *
Expand Down Expand Up @@ -2069,10 +2062,8 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
/* /MENU needs to know this later */
g_object_set_data (G_OBJECT (menu_bar), "accel", accel_group);

#if GTK_CHECK_VERSION(2,4,0)
g_signal_connect (G_OBJECT (menu_bar), "can-activate-accel",
G_CALLBACK (menu_canacaccel), 0);
#endif

/* set the initial state of toggles */
mymenu[MENUBAR_OFFSET].state = !prefs.hidemenu;
Expand Down
31 changes: 0 additions & 31 deletions src/fe-gtk/xtext.c
Expand Up @@ -1056,13 +1056,8 @@ gtk_xtext_realize (GtkWidget * widget)
gdk_gc_set_fill (xtext->bgc, GDK_TILED);
}

#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
xtext->hand_cursor = gdk_cursor_new (GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new (GDK_LEFT_SIDE);
#else
xtext->hand_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_LEFT_SIDE);
#endif

gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
widget->style = gtk_style_attach (widget->style, widget->window);
Expand Down Expand Up @@ -1342,11 +1337,7 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)

gdk_draw_line (xtext->draw_buf, xtext->marker_gc, x, render_y, x + width, render_y);

#if GTK_CHECK_VERSION(2,4,0)
if (gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))))
#else
if (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))->has_focus)
#endif
{
xtext->buffer->marker_seen = TRUE;
}
Expand Down Expand Up @@ -2096,13 +2087,8 @@ gtk_xtext_set_clip_owner (GtkWidget * xtext, GdkEventButton * event)
str = gtk_xtext_selection_get_text (GTK_XTEXT (xtext), &len);
if (str)
{
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
str, len);
#else
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD),
str, len);
#endif
free (str);
}

Expand Down Expand Up @@ -2429,12 +2415,8 @@ gtk_xtext_selection_get (GtkWidget * widget,
gint format;
gint new_length;

#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gdk_string_to_compound_text (
#else
gdk_string_to_compound_text_for_display (
gdk_drawable_get_display (widget->window),
#endif
stripped, &encoding, &format, &new_text,
&new_length);
gtk_selection_data_set (selection_data_ptr, encoding, format,
Expand Down Expand Up @@ -3645,14 +3627,9 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
#ifdef USE_SHM
if (xtext->shm && shm_pixmaps)
{
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
shaded_pix = gdk_pixmap_foreign_new (
XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth));
#else
shaded_pix = gdk_pixmap_foreign_new_for_display (
gdk_drawable_get_display (xtext->draw_buf),
XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth));
#endif
} else
#endif
{
Expand Down Expand Up @@ -3873,11 +3850,7 @@ gtk_xtext_load_trans (GtkXText * xtext)
} else
{
noshade:
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
xtext->pixmap = gdk_pixmap_foreign_new (rootpix);
#else
xtext->pixmap = gdk_pixmap_foreign_new_for_display (gdk_drawable_get_display (GTK_WIDGET (xtext)->window), rootpix);
#endif
gdk_gc_set_tile (xtext->bgc, xtext->pixmap);
gdk_gc_set_ts_origin (xtext->bgc, -x, -y);
xtext->ts_x = -x;
Expand Down Expand Up @@ -5096,11 +5069,7 @@ gtk_xtext_append_entry (xtext_buffer *buf, textentry * ent, time_t stamp)

if (buf->reset_marker_pos ||
((buf->marker_pos == NULL || buf->marker_seen) && (buf->xtext->buffer != buf ||
#if GTK_CHECK_VERSION(2,4,0)
!gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (buf->xtext)))))))
#else
!(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (buf->xtext))))->has_focus)))
#endif
{
buf->marker_pos = ent;
dontscroll (buf); /* force scrolling off */
Expand Down

0 comments on commit eefac2c

Please sign in to comment.