[xchat-gnome] partly removes deprecated code



commit 06f7f6695d560492e77314f5ebf48cf8b04b6e22
Author: Ritesh Khadgaray <khadgaray gmail com>
Date:   Tue Feb 22 19:16:31 2011 +0530

    partly removes deprecated code

 src/fe-gnome/connect-dialog.c          |    3 -
 src/fe-gnome/conversation-panel.c      |    6 ---
 src/fe-gnome/irc-network-editor.c      |    8 ----
 src/fe-gnome/main-window.c             |    6 +--
 src/fe-gnome/preferences-page-colors.c |    8 +---
 src/fe-gnome/text-entry.c              |   13 ------
 src/fe-gnome/topic-label.c             |   17 --------
 src/fe-gnome/userlist-gui.c            |    4 --
 src/fe-gnome/xtext.c                   |   69 +-------------------------------
 9 files changed, 4 insertions(+), 130 deletions(-)
---
diff --git a/src/fe-gnome/connect-dialog.c b/src/fe-gnome/connect-dialog.c
index 1c9c9da..796ed22 100644
--- a/src/fe-gnome/connect-dialog.c
+++ b/src/fe-gnome/connect-dialog.c
@@ -159,9 +159,6 @@ connect_dialog_init (ConnectDialog *dialog)
 	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
 	gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
 	gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->toplevel);
-#if !GTK_CHECK_VERSION (2, 23, 0)
-	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-#endif
 
 	g_signal_connect (G_OBJECT (dialog->server_list), "row-activated", G_CALLBACK (row_activated), dialog);
 
diff --git a/src/fe-gnome/conversation-panel.c b/src/fe-gnome/conversation-panel.c
index 59e1bcd..72b5ae8 100644
--- a/src/fe-gnome/conversation-panel.c
+++ b/src/fe-gnome/conversation-panel.c
@@ -584,23 +584,17 @@ conversation_panel_set_background (ConversationPanel *panel)
 			pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
 			if (pixbuf) {
 				gint width, height;
-#if GTK_CHECK_VERSION (2, 23, 0)
 				cairo_t *context;
-#endif
 				GdkPixmap *image;
 
 				width  = gdk_pixbuf_get_width  (pixbuf);
 				height = gdk_pixbuf_get_height (pixbuf);
 
 				image = gdk_pixmap_new (NULL, width, height, 24);
-#if GTK_CHECK_VERSION (2, 23, 0)
 				context = gdk_cairo_create (GDK_DRAWABLE (image));
 				gdk_cairo_set_source_pixbuf (context, pixbuf, 0, 0);
 				cairo_paint (context);
 				cairo_destroy (context);
-#else
-				gdk_draw_pixbuf (image, NULL, pixbuf, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
-#endif
 
 				gtk_xtext_set_background (GTK_XTEXT (panel->priv->xtext), image, FALSE);
 				g_object_unref (pixbuf);
diff --git a/src/fe-gnome/irc-network-editor.c b/src/fe-gnome/irc-network-editor.c
index 0bf89ba..4f86a5a 100644
--- a/src/fe-gnome/irc-network-editor.c
+++ b/src/fe-gnome/irc-network-editor.c
@@ -322,22 +322,14 @@ irc_network_editor_init (IrcNetworkEditor *dialog)
 	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (dialog->autojoin_channels), 1, _("Key"), dialog->autojoin_key_renderer, "text", 1, NULL);
 	g_object_set (G_OBJECT (dialog->autojoin_key_renderer), "editable", TRUE, NULL);
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	dialog->encoding = gtk_combo_box_text_new ();
-#else
-	dialog->encoding = gtk_combo_box_new_text ();
-#endif
 
 	gtk_widget_show (dialog->encoding);
 	gtk_table_attach_defaults (GTK_TABLE (dialog->network_settings_table), dialog->encoding, 1, 2, 5, 6);
 
 	enc = (gchar **) encodings;
 	do {
-#if GTK_CHECK_VERSION (2, 23, 0)
 		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->encoding), _(*enc));
-#else
-		gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->encoding), _(*enc));
-#endif
 		enc++;
 	} while (*enc);
 
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index 1a4a6fd..80e6cbf 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -188,11 +188,7 @@ initialize_main_window (void)
 
 	close = GTK_WIDGET (gtk_builder_get_object (gui.xml, "close discussion"));
 	action = gtk_action_group_get_action (gui.action_group, "DiscussionClose");
-#if GTK_CHECK_VERSION (2, 16, 0)
-    gtk_activatable_set_related_action (GTK_ACTIVATABLE (close), action);
-#else
-    gtk_action_connect_proxy (action, close);
-#endif
+	gtk_activatable_set_related_action (GTK_ACTIVATABLE (close), action);
 
 #define GW(name) ((gui.name) = GTK_WIDGET (gtk_builder_get_object (gui.xml, #name)))
 	GW(conversation_panel);
diff --git a/src/fe-gnome/preferences-page-colors.c b/src/fe-gnome/preferences-page-colors.c
index 33186c9..5e8d4d8 100644
--- a/src/fe-gnome/preferences-page-colors.c
+++ b/src/fe-gnome/preferences-page-colors.c
@@ -255,18 +255,12 @@ preferences_page_colors_new (gpointer prefs_dialog, GtkBuilder *xml)
 	gtk_list_store_set (p->page_store, &iter, 0, PREFERENCES_PAGE (page)->icon, 1, _("Colors"), 2, 1, -1);
 
 	page->combo = gtk_combo_box_new_text ();
-#if GTK_CHECK_VERSION (2, 23, 0)
 	page->combo = gtk_combo_box_text_new ();
 	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (page->combo), _("Black on White"));
 	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (page->combo), _("White on Black"));
 	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (page->combo), _("Custom"));
 	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (page->combo), _("System Theme Colors"));
-#else
-	gtk_combo_box_append_text (GTK_COMBO_BOX (page->combo), _("Black on White"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (page->combo), _("White on Black"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (page->combo), _("Custom"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (page->combo), _("System Theme Colors"));
-#endif
+
 	gtk_widget_show (page->combo);
 	gtk_label_set_mnemonic_widget (GTK_LABEL (page->color_label_1), page->combo);
 	gtk_box_pack_start (GTK_BOX (page->foreground_background_hbox), page->combo, FALSE, TRUE, 0);
diff --git a/src/fe-gnome/text-entry.c b/src/fe-gnome/text-entry.c
index ad24c6c..2329d37 100644
--- a/src/fe-gnome/text-entry.c
+++ b/src/fe-gnome/text-entry.c
@@ -624,15 +624,10 @@ get_color_icon (int c, GtkStyle *style)
 {
 	GtkWidget *image;
 	GdkPixmap *pixmap;
-#if GTK_CHECK_VERSION (2, 23, 0)
 	cairo_t *context;
-#else
-	GdkGC *color;
-#endif
 
 	pixmap = gdk_pixmap_new (NULL, 16, 16, 24);
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	context = gdk_cairo_create (GDK_DRAWABLE (pixmap));
 	gdk_cairo_set_source_color (context, &style->dark[GTK_STATE_NORMAL]);
 	cairo_rectangle (context, 0, 0, 16, 16);
@@ -641,14 +636,6 @@ get_color_icon (int c, GtkStyle *style)
 	cairo_rectangle (context, 1, 1, 14, 14);
 	cairo_fill (context);
 	cairo_destroy (context);
-#else
-	color = gdk_gc_new (GDK_DRAWABLE (pixmap));
-	gdk_gc_set_foreground (color, &style->dark[GTK_STATE_NORMAL]);
-	gdk_draw_rectangle (GDK_DRAWABLE (pixmap), color, TRUE, 0, 0, 16, 16);
-	gdk_gc_set_foreground (color, &colors[c]);
-	gdk_draw_rectangle (GDK_DRAWABLE (pixmap), color, TRUE, 1, 1, 14, 14);
-	g_object_unref (color);
-#endif
 
 	image = gtk_image_new_from_pixmap (pixmap, NULL);
 	g_object_unref (pixmap);
diff --git a/src/fe-gnome/topic-label.c b/src/fe-gnome/topic-label.c
index 4d6e448..983a80b 100644
--- a/src/fe-gnome/topic-label.c
+++ b/src/fe-gnome/topic-label.c
@@ -21,9 +21,6 @@
 #include <config.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(2,17,1)
-#include <libsexy/sexy-url-label.h>
-#endif
 #include "gui.h"
 #include "util.h"
 #include "text-entry.h"
@@ -85,13 +82,8 @@ topic_label_init (TopicLabel *label)
 
 	priv = label->priv = TOPIC_LABEL_GET_PRIVATE (label);
 	priv->expander = gtk_expander_new (NULL);
-#if GTK_CHECK_VERSION(2,17,1)
 	priv->label = gtk_label_new (NULL);
 	priv->sizing_label = gtk_label_new (NULL);
-#else
-	priv->label = sexy_url_label_new ();
-	priv->sizing_label = sexy_url_label_new ();
-#endif
 	gtk_expander_set_expanded (GTK_EXPANDER (priv->expander), FALSE);
 	gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_END);
 	gtk_label_set_selectable (GTK_LABEL (priv->label), TRUE);
@@ -106,11 +98,7 @@ topic_label_init (TopicLabel *label)
 	gtk_box_set_spacing (GTK_BOX (label), 6);
 
 	g_signal_connect (G_OBJECT (priv->expander), "activate", G_CALLBACK (topic_label_expand_activate), (gpointer) label);
-#if GTK_CHECK_VERSION(2,17,1)
 	g_signal_connect (G_OBJECT (priv->label), "activate-link", G_CALLBACK (topic_label_url_activated), (gpointer) label);
-#else
-	g_signal_connect (G_OBJECT (priv->label), "url-activated", G_CALLBACK (topic_label_url_activated), (gpointer) label);
-#endif
 	priv->topics = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
 }
 
@@ -197,13 +185,8 @@ topic_label_set_current (TopicLabel *label, struct session *sess)
 
 
 	if (topic) {
-#if GTK_CHECK_VERSION(2,17,1)
 		gtk_label_set_markup (GTK_LABEL (priv->label), topic);
 		gtk_label_set_markup (GTK_LABEL (priv->sizing_label), topic);
-#else
-		sexy_url_label_set_markup (SEXY_URL_LABEL (priv->label), topic);
-		sexy_url_label_set_markup (SEXY_URL_LABEL (priv->sizing_label), topic);
-#endif
 	} else {
 		gtk_label_set_text (GTK_LABEL (priv->label), "");
 		gtk_label_set_text (GTK_LABEL (priv->sizing_label), "");
diff --git a/src/fe-gnome/userlist-gui.c b/src/fe-gnome/userlist-gui.c
index f062e6b..e34186d 100644
--- a/src/fe-gnome/userlist-gui.c
+++ b/src/fe-gnome/userlist-gui.c
@@ -402,12 +402,8 @@ userlist_button_release (GtkWidget *widget, GdkEventButton *button, gpointer dat
 	gint x, y, width, height;
 
 	gdk_window_get_root_origin (gui.userlist_window->window, &x, &y);
-#if GTK_CHECK_VERSION (2, 23, 0)
 	width = gdk_window_get_width  (gui.userlist_window->window);
 	height = gdk_window_get_height  (gui.userlist_window->window);
-#else
-	gdk_drawable_get_size      (gui.userlist_window->window, &width, &height);
-#endif
 
 	/* If the event happened on top of the userlist window, we don't want to
 	 * close it */
diff --git a/src/fe-gnome/xtext.c b/src/fe-gnome/xtext.c
index 06b00c5..e2746a9 100644
--- a/src/fe-gnome/xtext.c
+++ b/src/fe-gnome/xtext.c
@@ -1041,13 +1041,8 @@ gtk_xtext_realize (GtkWidget * widget)
 		gdk_gc_set_fill (xtext->bgc, GDK_TILED);
 	}
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	xtext->hand_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_HAND1);
 	xtext->resize_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), 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);
@@ -1718,11 +1713,7 @@ gtk_xtext_scrolldown_timeout (GtkXText * xtext)
 	int p_y, win_height;
 
 	gdk_window_get_pointer (GTK_WIDGET (xtext)->window, 0, &p_y, 0);
-#if GTK_CHECK_VERSION (2, 23, 0)
 	win_height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, 0, &win_height);
-#endif
 
 	if (p_y > win_height &&
 		 xtext->adj->value < (xtext->adj->upper - xtext->adj->page_size))
@@ -1762,11 +1753,7 @@ gtk_xtext_selection_update (GtkXText * xtext, GdkEventMotion * event, int p_y, g
 	int win_height;
 	int moved;
 
-#if GTK_CHECK_VERSION (2, 16, 0)
 	win_height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, 0, &win_height);
-#endif
 
 	/* selecting past top of window, scroll up! */
 	if (p_y < 0 && xtext->adj->value >= 0)
@@ -2080,13 +2067,7 @@ 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
+		gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), str, len);
 		free (str);
 	}
 
@@ -2407,11 +2388,7 @@ gtk_xtext_selection_get (GtkWidget * widget,
 			gint new_length;
 
  			gdk_string_to_compound_text_for_display (
-#if GTK_CHECK_VERSION (2, 23, 0)
 							gdk_window_get_display (widget->window),
-#else
-							gdk_drawable_get_display (widget->window),
-#endif
 							stripped, &encoding, &format, &new_text,
 							&new_length);
 			gtk_selection_data_set (selection_data_ptr, encoding, format,
@@ -3543,14 +3520,9 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
 #ifdef USE_SHM
 		if (xtext->shm)
 		{
-#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
 		{
@@ -3758,12 +3730,8 @@ gtk_xtext_load_trans (GtkXText * xtext)
 	if (xtext->shaded)
 	{
 		int width, height;
-#if GTK_CHECK_VERSION (2, 23, 0)
 		width = gdk_window_get_width (GTK_WIDGET (xtext)->window);
 		height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-		gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
-#endif
 
 		xtext->pixmap = shade_pixmap (xtext, rootpix, x, y, width+105, height);
 		if (xtext->pixmap == NULL)
@@ -3777,11 +3745,7 @@ gtk_xtext_load_trans (GtkXText * xtext)
 	} else
 	{
 noshade:
-#if GTK_CHECK_VERSION (2, 23, 0)
 		xtext->pixmap = gdk_pixmap_foreign_new_for_display (gdk_window_get_display (GTK_WIDGET (xtext)->window), 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;
@@ -3924,11 +3888,7 @@ gtk_xtext_find_subline (GtkXText *xtext, textentry *ent, int line)
 	if (line <= RECORD_WRAPS)
 		return ent->wrap_offset[line - 1];
 
-#if GTK_CHECK_VERSION (2, 16, 0)
 	win_width = gdk_window_get_width (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &win_width, 0);
-#endif
 	win_width -= MARGIN;
 
 /*	indent = ent->indent;
@@ -4347,12 +4307,8 @@ gtk_xtext_calc_lines (xtext_buffer *buf, int fire_signal)
 	int height;
 	int lines;
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	width = gdk_window_get_width (GTK_WIDGET (buf->xtext)->window);
 	height = gdk_window_get_height (GTK_WIDGET (buf->xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (buf->xtext)->window, &width, &height);
-#endif
 	width -= MARGIN;
 
 	if (width < 30 || height < buf->xtext->fontsize || width < buf->indent + 30)
@@ -4447,12 +4403,8 @@ gtk_xtext_render_ents (GtkXText * xtext, textentry * enta, textentry * entb)
 	if (xtext->buffer->indent < MARGIN)
 		xtext->buffer->indent = MARGIN;	  /* 2 pixels is our left margin */
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	width = gdk_window_get_width (GTK_WIDGET (xtext)->window);
 	height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
-#endif
 	width -= MARGIN;
 
 	if (width < 32 || height < xtext->fontsize || width < xtext->buffer->indent + 30)
@@ -4539,12 +4491,8 @@ gtk_xtext_render_page (GtkXText * xtext)
 	if (xtext->buffer->indent < MARGIN)
 		xtext->buffer->indent = MARGIN;	  /* 2 pixels is our left margin */
 
-#if GTK_CHECK_VERSION (2, 23, 0)
 	width = gdk_window_get_width (GTK_WIDGET (xtext)->window);
 	height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
-#endif
 
 	if (width < 34 || height < xtext->fontsize || width < xtext->buffer->indent + 32)
 		return;
@@ -4597,10 +4545,7 @@ gtk_xtext_render_page (GtkXText * xtext)
 #endif
 	{
 
-#if !GTK_CHECK_VERSION (2, 13, 0)
-		/* so the obscured regions are exposed */
-		gdk_gc_set_exposures (xtext->fgc, TRUE);
-#endif
+
 		if (overlap < 1)	/* DOWN */
 		{
 			int remainder;
@@ -4752,15 +4697,9 @@ gtk_xtext_check_ent_visibility (GtkXText * xtext, textentry *find_ent, int add)
 	textentry *ent;
 	int lines_max;
 	int line = 0;
-	int width;
 	int height;
 
-#if GTK_CHECK_VERSION (2, 16, 0)
-	width = gdk_window_get_width (GTK_WIDGET (xtext)->window);
 	height = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
-#endif
 
 	lines_max = ((height + xtext->pixel_offset) / xtext->fontsize) + add;
 	ent = xtext->buffer->pagetop_ent;
@@ -5232,12 +5171,8 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
 
 	if (!gtk_widget_get_realized (GTK_WIDGET (xtext)))
 		gtk_widget_realize (GTK_WIDGET (xtext));
-#if GTK_CHECK_VERSION (2, 23, 0)
 	w = gdk_window_get_width (GTK_WIDGET (xtext)->window);
 	h = gdk_window_get_height (GTK_WIDGET (xtext)->window);
-#else
-	gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &w, &h);
-#endif
 
 	/* after a font change */
 	if (buf->needs_recalc)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]