summary refs log tree commit diff stats
path: root/src/fe-gtk/maingui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk/maingui.c')
-rw-r--r--src/fe-gtk/maingui.c125
1 files changed, 58 insertions, 67 deletions
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index b643485a..b9d402dc 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -298,7 +298,7 @@ fe_set_tab_color (struct session *sess, int col)
 static void
 mg_set_myself_away (session_gui *gui, gboolean away)
 {
-	gtk_label_set_attributes (GTK_LABEL (GTK_BIN (gui->nick_label)->child),
+	gtk_label_set_attributes (GTK_LABEL (gtk_bin_get_child (GTK_BIN (gui->nick_label))),
 									  away ? away_list : NULL);
 }
 
@@ -545,11 +545,7 @@ mg_show_generic_tab (GtkWidget *box)
 	int num;
 	GtkWidget *f = NULL;
 
-#if defined(GTK_WIDGET_HAS_FOCUS)
-	if (current_sess && GTK_WIDGET_HAS_FOCUS (current_sess->gui->input_box))
-#else
 	if (current_sess && gtk_widget_has_focus (current_sess->gui->input_box))
-#endif
 		f = current_sess->gui->input_box;
 
 	num = gtk_notebook_page_num (GTK_NOTEBOOK (mg_gui->note_book), box);
@@ -658,16 +654,16 @@ mg_unpopulate (session *sess)
 	res = sess->res;
 
 	res->input_text = strdup (SPELL_ENTRY_GET_TEXT (gui->input_box));
-	res->topic_text = strdup (GTK_ENTRY (gui->topic_entry)->text);
-	res->limit_text = strdup (GTK_ENTRY (gui->limit_entry)->text);
-	res->key_text = strdup (GTK_ENTRY (gui->key_entry)->text);
+	res->topic_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->topic_entry)));
+	res->limit_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->limit_entry)));
+	res->key_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->key_entry)));
 	if (gui->laginfo)
 		res->lag_text = strdup (gtk_label_get_text (GTK_LABEL (gui->laginfo)));
 	if (gui->throttleinfo)
 		res->queue_text = strdup (gtk_label_get_text (GTK_LABEL (gui->throttleinfo)));
 
 	for (i = 0; i < NUM_FLAG_WIDS - 1; i++)
-		res->flag_wid_state[i] = GTK_TOGGLE_BUTTON (gui->flag_wid[i])->active;
+		res->flag_wid_state[i] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gui->flag_wid[i]));
 
 	res->old_ul_value = userlist_get_value (gui->user_tree);
 	if (gui->lagometer)
@@ -749,9 +745,9 @@ mg_set_topic_tip (session *sess)
 			add_tip (sess->gui->topic_entry, _("No topic is set"));
 		break;
 	default:
-		if (GTK_ENTRY (sess->gui->topic_entry)->text &&
-			 GTK_ENTRY (sess->gui->topic_entry)->text[0])
-			add_tip (sess->gui->topic_entry, GTK_ENTRY (sess->gui->topic_entry)->text);
+		if (gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry)) &&
+			 gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry))[0])
+			add_tip (sess->gui->topic_entry, (char *)gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry)));
 		else
 			add_tip (sess->gui->topic_entry, NULL);
 	}
@@ -760,13 +756,8 @@ mg_set_topic_tip (session *sess)
 static void
 mg_hide_empty_pane (GtkPaned *pane)
 {
-#if defined(GTK_WIDGET_VISIBLE)
-	if ((pane->child1 == NULL || !GTK_WIDGET_VISIBLE (pane->child1)) &&
-		 (pane->child2 == NULL || !GTK_WIDGET_VISIBLE (pane->child2)))
-#else
-	if ((pane->child1 == NULL || !gtk_widget_get_visible (pane->child1)) &&
-		 (pane->child2 == NULL || !gtk_widget_get_visible (pane->child2)))
-#endif
+	if ((gtk_paned_get_child1 (pane) == NULL || !gtk_widget_get_visible (gtk_paned_get_child1 (pane))) &&
+		(gtk_paned_get_child2 (pane) == NULL || !gtk_widget_get_visible (gtk_paned_get_child2 (pane))))
 	{
 		gtk_widget_hide (GTK_WIDGET (pane));
 		return;
@@ -789,6 +780,7 @@ mg_userlist_showhide (session *sess, int show)
 	session_gui *gui = sess->gui;
 	int handle_size;
 	int right_size;
+	GtkAllocation allocation;
 
 	right_size = MAX (prefs.hex_gui_pane_right_size, prefs.hex_gui_pane_right_size_min);
 
@@ -797,8 +789,9 @@ mg_userlist_showhide (session *sess, int show)
 		gtk_widget_show (gui->user_box);
 		gui->ul_hidden = 0;
 
+		gtk_widget_get_allocation (gui->hpane_right, &allocation);
 		gtk_widget_style_get (GTK_WIDGET (gui->hpane_right), "handle-size", &handle_size, NULL);
-		gtk_paned_set_position (GTK_PANED (gui->hpane_right), GTK_WIDGET (gui->hpane_right)->allocation.width - (right_size + handle_size));
+		gtk_paned_set_position (GTK_PANED (gui->hpane_right), allocation.width - (right_size + handle_size));
 	}
 	else
 	{
@@ -895,6 +888,7 @@ mg_populate (session *sess)
 	restore_gui *res = sess->res;
 	int i, render = TRUE;
 	guint16 vis = gui->ul_hidden;
+	GtkAllocation allocation;
 
 	switch (sess->type)
 	{
@@ -935,7 +929,8 @@ mg_populate (session *sess)
 
 	/* xtext size change? Then don't render, wait for the expose caused
       by showing/hidding the userlist */
-	if (vis != gui->ul_hidden && gui->user_box->allocation.width > 1)
+	gtk_widget_get_allocation (gui->user_box, &allocation);
+	if (vis != gui->ul_hidden && allocation.width > 1)
 		render = FALSE;
 
 	gtk_xtext_buffer_show (GTK_XTEXT (gui->xtext), res->buffer, render);
@@ -982,14 +977,14 @@ mg_populate (session *sess)
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (gui->lagometer),
 												 res->lag_value);
 		if (res->lag_tip)
-			add_tip (sess->gui->lagometer->parent, res->lag_tip);
+			add_tip (gtk_widget_get_parent (sess->gui->lagometer), res->lag_tip);
 	}
 	if (gui->throttlemeter)
 	{
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (gui->throttlemeter),
 												 res->queue_value);
 		if (res->queue_tip)
-			add_tip (sess->gui->throttlemeter->parent, res->queue_tip);
+			add_tip (gtk_widget_get_parent (sess->gui->throttlemeter), res->queue_tip);
 	}
 
 	/* did this tab have a connecting graph? restore it.. */
@@ -1000,7 +995,7 @@ mg_populate (session *sess)
 	}
 
 	/* menu items */
-	GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY])->active = sess->server->is_away;
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY]), sess->server->is_away);
 	gtk_widget_set_sensitive (gui->menu_item[MENU_ID_AWAY], sess->server->connected);
 	gtk_widget_set_sensitive (gui->menu_item[MENU_ID_JOIN], sess->server->end_of_motd);
 	gtk_widget_set_sensitive (gui->menu_item[MENU_ID_DISCONNECT],
@@ -1241,7 +1236,7 @@ mg_open_quit_dialog (gboolean minimize_button)
 	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 
-	dialog_vbox1 = GTK_DIALOG (dialog)->vbox;
+	dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 	gtk_widget_show (dialog_vbox1);
 
 	table1 = gtk_table_new (2, 2, FALSE);
@@ -1278,7 +1273,7 @@ mg_open_quit_dialog (gboolean minimize_button)
 	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
 	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
 
-	dialog_action_area1 = GTK_DIALOG (dialog)->action_area;
+	dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
 	gtk_widget_show (dialog_action_area1);
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
 										GTK_BUTTONBOX_END);
@@ -1305,12 +1300,12 @@ mg_open_quit_dialog (gboolean minimize_button)
 	switch (gtk_dialog_run (GTK_DIALOG (dialog)))
 	{
 	case 0:
-		if (GTK_TOGGLE_BUTTON (checkbutton1)->active)
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton1)))
 			prefs.hex_gui_quit_dialog = 0;
 		hexchat_exit ();
 		break;
 	case 1: /* minimize to tray */
-		if (GTK_TOGGLE_BUTTON (checkbutton1)->active)
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton1)))
 		{
 			prefs.hex_gui_tray_close = 1;
 			/*prefs.hex_gui_quit_dialog = 0;*/
@@ -1474,7 +1469,7 @@ mg_markup_item (GtkWidget *menu, char *text, int arg)
 	GtkWidget *item;
 
 	item = gtk_menu_item_new_with_label ("");
-	gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), text);
+	gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), text);
 	g_signal_connect (G_OBJECT (item), "activate",
 							G_CALLBACK (mg_color_insert), GINT_TO_POINTER (arg));
 	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -1540,7 +1535,7 @@ mg_set_guint8 (GtkCheckMenuItem *item, guint8 *setting)
 	guint8 logging = sess->text_logging;
 
 	*setting = SET_OFF;
-	if (item->active)
+	if (gtk_check_menu_item_get_active (item))
 		*setting = SET_ON;
 
 	/* has the logging setting changed? */
@@ -1608,7 +1603,7 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch)
 		g_free (name);
 
 		item = gtk_menu_item_new_with_label ("");
-		gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), buf);
+		gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), buf);
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 		gtk_widget_show (item);
 
@@ -1713,7 +1708,7 @@ mg_dialog_dnd_drop (GtkWidget * widget, GdkDragContext * context, gint x,
 {
 	if (current_sess->type == SESS_DIALOG)
 		/* sess->channel is really the nickname of dialogs */
-		mg_dnd_drop_file (current_sess, current_sess->channel, selection_data->data);
+		mg_dnd_drop_file (current_sess, current_sess->channel, (char *)gtk_selection_data_get_data (selection_data));
 }
 
 /* add a tabbed channel */
@@ -1804,7 +1799,7 @@ mg_topic_cb (GtkWidget *entry, gpointer userdata)
 
 	if (sess->channel[0] && sess->server->connected && sess->type == SESS_CHANNEL)
 	{
-		text = GTK_ENTRY (entry)->text;
+		text = (char *)gtk_entry_get_text (GTK_ENTRY (entry));
 		if (text[0] == 0)
 			text = NULL;
 		sess->server->p_topic (sess->server, sess->channel, text);
@@ -1946,7 +1941,7 @@ mg_change_flag (GtkWidget * wid, session *sess, char flag)
 	mode[2] = '\0';
 	if (serv->connected && sess->channel[0])
 	{
-		if (GTK_TOGGLE_BUTTON (wid)->active)
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)))
 			mode[0] = '+';
 		else
 			mode[0] = '-';
@@ -1964,7 +1959,7 @@ flagl_hit (GtkWidget * wid, struct session *sess)
 	const char *limit_str;
 	server *serv = sess->server;
 
-	if (GTK_TOGGLE_BUTTON (wid)->active)
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)))
 	{
 		if (serv->connected && sess->channel[0])
 		{
@@ -1995,7 +1990,7 @@ flagk_hit (GtkWidget * wid, struct session *sess)
 		snprintf (modes, sizeof (modes), "-k %s", 
 			  gtk_entry_get_text (GTK_ENTRY (sess->gui->key_entry)));
 
-		if (GTK_TOGGLE_BUTTON (wid)->active)
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)))
 			modes[0] = '+';
 
 		serv->p_mode (serv, sess->channel, modes);
@@ -2154,7 +2149,7 @@ mg_dialog_button_cb (GtkWidget *wid, char *cmd)
 	if (!current_sess)
 		return;
 
-	topic = (char *)(GTK_ENTRY (current_sess->gui->topic_entry)->text);
+	topic = (char *)(gtk_entry_get_text (GTK_ENTRY (current_sess->gui->topic_entry)));
 	topic = strrchr (topic, '@');
 	if (topic)
 		host = topic + 1;
@@ -2558,15 +2553,12 @@ static void
 mg_rightpane_cb (GtkPaned *pane, GParamSpec *param, session_gui *gui)
 {
 	int handle_size;
-
-/*	if (pane->child1 == NULL || (!GTK_WIDGET_VISIBLE (pane->child1)))
-		return;
-	if (pane->child2 == NULL || (!GTK_WIDGET_VISIBLE (pane->child2)))
-		return;*/
+	GtkAllocation allocation;
 
 	gtk_widget_style_get (GTK_WIDGET (pane), "handle-size", &handle_size, NULL);
 	/* record the position from the RIGHT side */
-	prefs.hex_gui_pane_right_size = GTK_WIDGET (pane)->allocation.width - gtk_paned_get_position (pane) - handle_size;
+	gtk_widget_get_allocation (GTK_WIDGET(pane), &allocation);
+	prefs.hex_gui_pane_right_size = allocation.width - gtk_paned_get_position (pane) - handle_size;
 }
 
 static gboolean
@@ -2697,17 +2689,17 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW
 	int unref_chanview = FALSE;
 
 	/* first, remove userlist/treeview from their containers */
-	if (userlist && userlist->parent)
+	if (userlist && gtk_widget_get_parent (userlist))
 	{
 		g_object_ref (userlist);
-		gtk_container_remove (GTK_CONTAINER (userlist->parent), userlist);
+		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (userlist)), userlist);
 		unref_userlist = TRUE;
 	}
 
-	if (chanview && chanview->parent)
+	if (chanview && gtk_widget_get_parent (chanview))
 	{
 		g_object_ref (chanview);
-		gtk_container_remove (GTK_CONTAINER (chanview->parent), chanview);
+		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (chanview)), chanview);
 		unref_chanview = TRUE;
 	}
 
@@ -3036,7 +3028,7 @@ mg_create_entry (session *sess, GtkWidget *box)
 
 	gui->nick_label = but = gtk_button_new_with_label (sess->server->nick);
 	gtk_button_set_relief (GTK_BUTTON (but), GTK_RELIEF_NONE);
-	GTK_WIDGET_UNSET_FLAGS (but, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (but, FALSE);
 	gtk_box_pack_end (GTK_BOX (gui->nick_box), but, 0, 0, 0);
 	g_signal_connect (G_OBJECT (but), "clicked",
 							G_CALLBACK (mg_nickclick_cb), NULL);
@@ -3517,7 +3509,7 @@ fe_update_mode_buttons (session *sess, char mode, char sign)
 			if (!sess->gui->is_tab || sess == current_tab)
 			{
 				ignore_chanmode = TRUE;
-				if (GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i])->active != state)
+				if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i])) != state)
 					gtk_toggle_button_set_active (
 							GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i]), state);
 				ignore_chanmode = FALSE;
@@ -3561,7 +3553,7 @@ fe_set_away (server *serv)
 		{
 			if (!sess->gui->is_tab || sess == current_tab)
 			{
-				GTK_CHECK_MENU_ITEM (sess->gui->menu_item[MENU_ID_AWAY])->active = serv->is_away;
+				gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (sess->gui->menu_item[MENU_ID_AWAY]), serv->is_away);
 				/* gray out my nickname */
 				mg_set_myself_away (sess->gui, serv->is_away);
 			}
@@ -3774,9 +3766,9 @@ is_child_of (GtkWidget *widget, GtkWidget *parent)
 {
 	while (widget)
 	{
-		if (widget->parent == parent)
+		if (gtk_widget_get_parent (widget) == parent)
 			return TRUE;
-		widget = widget->parent;
+		widget = gtk_widget_get_parent (widget);
 	}
 	return FALSE;
 }
@@ -3787,7 +3779,7 @@ mg_handle_drop (GtkWidget *widget, int y, int *pos, int *other_pos)
 	int height;
 	session_gui *gui = current_sess->gui;
 
-	gdk_drawable_get_size (widget->window, NULL, &height);
+	gdk_drawable_get_size (gtk_widget_get_window (widget), NULL, &height);
 
 	if (y < height / 2)
 	{
@@ -3832,10 +3824,10 @@ mg_is_gui_target (GdkDragContext *context)
 {
 	char *target_name;
 
-	if (!context || !context->targets || !context->targets->data)
+	if (!context || !gdk_drag_context_list_targets (context) || !gdk_drag_context_list_targets (context)->data)
 		return FALSE;
 
-	target_name = gdk_atom_name (context->targets->data);
+	target_name = gdk_atom_name (gdk_drag_context_list_targets (context)->data);
 	if (target_name)
 	{
 		/* if it's not HEXCHAT_CHANVIEW or HEXCHAT_USERLIST */
@@ -3900,7 +3892,7 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
 	if (!mg_is_gui_target (context))
 		return FALSE;
 
-	switch (context->action)
+	switch (gdk_drag_context_get_selected_action (context))
 	{
 	case GDK_ACTION_MOVE:
 		/* from userlist */
@@ -3927,10 +3919,8 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
 	GdkGCValues val;
 	int half, width, height;
 	int ox, oy;
-#if 0
-	GtkPaned *paned;
-#endif
 	GdkDrawable *draw;
+	GtkAllocation allocation;
 
 	/* ignore file drops */
 	if (!mg_is_gui_target (context))
@@ -3938,24 +3928,25 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
 
 	if (scbar)	/* scrollbar */
 	{
-		ox = widget->allocation.x;
-		oy = widget->allocation.y;
-		width = widget->allocation.width;
-		height = widget->allocation.height;
-		draw = widget->window;
+		gtk_widget_get_allocation (widget, &allocation);
+		ox = allocation.x;
+		oy = allocation.y;
+		width = allocation.width;
+		height = allocation.height;
+		draw = gtk_widget_get_window (widget);
 	}
 	else
 	{
 		ox = oy = 0;
-		gdk_drawable_get_size (widget->window, &width, &height);
-		draw = widget->window;
+		gdk_drawable_get_size (gtk_widget_get_window (widget), &width, &height);
+		draw = gtk_widget_get_window (widget);
 	}
 
 	val.subwindow_mode = GDK_INCLUDE_INFERIORS;
 	val.graphics_exposures = 0;
 	val.function = GDK_XOR;
 
-	gc = gdk_gc_new_with_values (widget->window, &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION);
+	gc = gdk_gc_new_with_values (gtk_widget_get_window (widget), &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION);
 	col.red = rand() % 0xffff;
 	col.green = rand() % 0xffff;
 	col.blue = rand() % 0xffff;