summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-05 22:21:04 -0400
committerTingPing <tingping@tingping.se>2013-10-05 22:21:04 -0400
commitc463236521186307d6195f9161c0b82d057f5ba3 (patch)
tree5542c46d719d2cc20b7ab5e7dc160315d8f45b39 /src
parent435e8881ed7a21014d70069752d64267e92b7735 (diff)
Round two of gtk accessor functions: chanview-tabs
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/chanview-tabs.c102
-rw-r--r--src/fe-gtk/chanview-tree.c2
2 files changed, 54 insertions, 50 deletions
diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c
index 9db6b21a..9262323b 100644
--- a/src/fe-gtk/chanview-tabs.c
+++ b/src/fe-gtk/chanview-tabs.c
@@ -70,15 +70,15 @@ cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
 
 	if (cv->vertical)
 	{
-		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, 0, &viewport_size, 0);
+		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner)));
+		gdk_window_get_geometry (gtk_widget_get_parent_window (inner), 0, 0, 0, &viewport_size, 0);
 	} else
 	{
-		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, &viewport_size, 0, 0);
+		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner)));
+		gdk_window_get_geometry (gtk_widget_get_parent_window (inner), 0, 0, &viewport_size, 0, 0);
 	}
 
-	if (adj->upper <= viewport_size)
+	if (gtk_adjustment_get_upper (adj) <= viewport_size)
 	{
 		gtk_widget_hide (((tabview *)cv)->b1);
 		gtk_widget_hide (((tabview *)cv)->b2);
@@ -99,22 +99,22 @@ tab_search_offset (GtkWidget *inner, gint start_offset,
 	GtkWidget *button;
 	gint found;
 
-	boxes = GTK_BOX (inner)->children;
+	boxes = gtk_container_get_children (GTK_CONTAINER (inner));
 	if (!forward && boxes)
 		boxes = g_list_last (boxes);
 
 	while (boxes)
 	{
-		box = ((GtkBoxChild *)boxes->data)->widget;
+		box = (GtkWidget *)boxes->data;
 		boxes = (forward ? boxes->next : boxes->prev);
 
-		tabs = GTK_BOX (box)->children;
+		tabs = gtk_container_get_children (GTK_CONTAINER (box));
 		if (!forward && tabs)
 			tabs = g_list_last (tabs);
 
 		while (tabs)
 		{
-			button = ((GtkBoxChild *)tabs->data)->widget;
+			button = (GtkWidget *)tabs->data;
 			tabs = (forward ? tabs->next : tabs->prev);
 
 			if (!GTK_IS_TOGGLE_BUTTON (button))
@@ -137,18 +137,20 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
 	gint viewport_size;
 	gfloat new_value;
 	GtkWidget *inner;
+	GdkWindow *parent_win;
 	gfloat i;
 
 	inner = ((tabview *)cv)->inner;
+	parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
 
 	if (cv->vertical)
 	{
-		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, 0, &viewport_size, 0);
+		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
+		gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0);
 	} else
 	{
-		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, &viewport_size, 0, 0);
+		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
+		gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0);
 	}
 
 	new_value = tab_search_offset (inner, adj->value, 0, cv->vertical);
@@ -184,18 +186,20 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
 	gint viewport_size;
 	gfloat new_value;
 	GtkWidget *inner;
+	GdkWindow *parent_win;
 	gfloat i;
 
 	inner = ((tabview *)cv)->inner;
+	parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
 
 	if (cv->vertical)
 	{
-		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, 0, &viewport_size, 0);
+		adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
+		gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0);
 	} else
 	{
-		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (inner->parent));
-		gdk_window_get_geometry (inner->parent->window, 0, 0, &viewport_size, 0, 0);
+		adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
+		gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0);
 	}
 
 	new_value = tab_search_offset (inner, adj->value, 1, cv->vertical);
@@ -329,7 +333,7 @@ cv_tabs_init (chanview *cv)
 	button = gtkutil_button (outer, GTK_STOCK_CLOSE, NULL, cv_tabs_xclick_cb,
 									 cv, 0);
 	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-	GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (button, FALSE);
 
 	gtk_container_add (GTK_CONTAINER (cv->box), outer);
 }
@@ -343,7 +347,7 @@ static void
 tab_add_sorted (chanview *cv, GtkWidget *box, GtkWidget *tab, chan *ch)
 {
 	GList *list;
-	GtkBoxChild *child;
+	GtkWidget *child;
 	int i = 0;
 	void *b;
 
@@ -360,13 +364,13 @@ tab_add_sorted (chanview *cv, GtkWidget *box, GtkWidget *tab, chan *ch)
 	/* userdata, passed to mg_tabs_compare() */
 	b = ch->userdata;
 
-	list = GTK_BOX (box)->children;
+	list = gtk_container_get_children (GTK_CONTAINER (box));
 	while (list)
 	{
 		child = list->data;
-		if (!GTK_IS_SEPARATOR (child->widget))
+		if (!GTK_IS_SEPARATOR (child))
 		{
-			void *a = g_object_get_data (G_OBJECT (child->widget), "u");
+			void *a = g_object_get_data (G_OBJECT (child), "u");
 
 			if (ch->tag == 0 && cv->cb_compare (a, b) > 0)
 			{
@@ -393,23 +397,23 @@ cv_tabs_prune (chanview *cv)
 {
 	GList *boxes, *children;
 	GtkWidget *box, *inner;
-	GtkBoxChild *child;
+	GtkWidget *child;
 	int empty;
 
 	inner = ((tabview *)cv)->inner;
-	boxes = GTK_BOX (inner)->children;
+	boxes = gtk_container_get_children (GTK_CONTAINER (inner));
 	while (boxes)
 	{
 		child = boxes->data;
-		box = child->widget;
+		box = child;
 		boxes = boxes->next;
 
 		/* check if the box is empty (except a vseperator) */
 		empty = TRUE;
-		children = GTK_BOX (box)->children;
+		children = gtk_container_get_children (GTK_CONTAINER (box));
 		while (children)
 		{
-			if (!GTK_IS_SEPARATOR (((GtkBoxChild *)children->data)->widget))
+			if (!GTK_IS_SEPARATOR ((GtkWidget *)children->data))
 			{
 				empty = FALSE;
 				break;
@@ -427,21 +431,21 @@ tab_add_real (chanview *cv, GtkWidget *tab, chan *ch)
 {
 	GList *boxes, *children;
 	GtkWidget *sep, *box, *inner;
-	GtkBoxChild *child;
+	GtkWidget *child;
 	int empty;
 
 	inner = ((tabview *)cv)->inner;
 	/* see if a family for this tab already exists */
-	boxes = GTK_BOX (inner)->children;
+	boxes = gtk_container_get_children (GTK_CONTAINER (inner));
 	while (boxes)
 	{
 		child = boxes->data;
-		box = child->widget;
+		box = child;
 
 		if (g_object_get_data (G_OBJECT (box), "f") == ch->family)
 		{
 			tab_add_sorted (cv, box, tab, ch);
-			gtk_widget_queue_resize (inner->parent);
+			gtk_widget_queue_resize (gtk_widget_get_parent(inner));
 			return;
 		}
 
@@ -449,10 +453,10 @@ tab_add_real (chanview *cv, GtkWidget *tab, chan *ch)
 
 		/* check if the box is empty (except a vseperator) */
 		empty = TRUE;
-		children = GTK_BOX (box)->children;
+		children = gtk_container_get_children (GTK_CONTAINER (box));
 		while (children)
 		{
-			if (!GTK_IS_SEPARATOR (((GtkBoxChild *)children->data)->widget))
+			if (!GTK_IS_SEPARATOR ((GtkWidget *)children->data))
 			{
 				empty = FALSE;
 				break;
@@ -484,7 +488,7 @@ tab_add_real (chanview *cv, GtkWidget *tab, chan *ch)
 	gtk_box_pack_start (GTK_BOX (box), tab, 0, 0, 0);
 	gtk_widget_show (tab);
 	gtk_widget_show (box);
-	gtk_widget_queue_resize (inner->parent);
+	gtk_widget_queue_resize (gtk_widget_get_parent(inner));
 }
 
 static gboolean
@@ -590,25 +594,25 @@ tab_group_for_each_tab (chanview *cv,
 {
 	GList *tabs;
 	GList *boxes;
-	GtkBoxChild *child;
+	GtkWidget *child;
 	GtkBox *innerbox;
 	int i;
 
 	innerbox = (GtkBox *) ((tabview *)cv)->inner;
-	boxes = innerbox->children;
+	boxes = gtk_container_get_children (GTK_CONTAINER (innerbox));
 	i = 0;
 	while (boxes)
 	{
 		child = boxes->data;
-		tabs = GTK_BOX (child->widget)->children;
+		tabs = gtk_container_get_children (GTK_CONTAINER (child));
 
 		while (tabs)
 		{
 			child = tabs->data;
 
-			if (!GTK_IS_SEPARATOR (child->widget))
+			if (!GTK_IS_SEPARATOR (child))
 			{
-				if (callback (child->widget, i, usernum) != -1)
+				if (callback (child, i, usernum) != -1)
 					return i;
 				i++;
 			}
@@ -707,15 +711,15 @@ cv_tabs_move (chan *ch, int delta)
 {
 	int i, pos = 0;
 	GList *list;
-	GtkWidget *parent = ((GtkWidget *)ch->impl)->parent;
+	GtkWidget *parent = gtk_widget_get_parent(GTK_WIDGET (ch->impl));
 
 	i = 0;
-	for (list = GTK_BOX (parent)->children; list; list = list->next)
+	for (list = gtk_container_get_children (GTK_CONTAINER (parent)); list; list = list->next)
 	{
-		GtkBoxChild *child_entry;
+		GtkWidget *child_entry;
 
 		child_entry = list->data;
-		if (child_entry->widget == ch->impl)
+		if (child_entry == ch->impl)
 			pos = i;
 		i++;
 	}
@@ -733,23 +737,23 @@ cv_tabs_move_family (chan *ch, int delta)
 
 	/* find position of tab's family */
 	i = 0;
-	for (list = GTK_BOX (((tabview *)ch->cv)->inner)->children; list; list = list->next)
+	for (list = gtk_container_get_children (GTK_CONTAINER (((tabview *)ch->cv)->inner)); list; list = list->next)
 	{
-		GtkBoxChild *child_entry;
+		GtkWidget *child_entry;
 		void *fam;
 
 		child_entry = list->data;
-		fam = g_object_get_data (G_OBJECT (child_entry->widget), "f");
+		fam = g_object_get_data (G_OBJECT (child_entry), "f");
 		if (fam == ch->family)
 		{
-			box = child_entry->widget;
+			box = child_entry;
 			pos = i;
 		}
 		i++;
 	}
 
 	pos = (pos - delta) % i;
-	gtk_box_reorder_child (GTK_BOX (box->parent), box, pos);
+	gtk_box_reorder_child (GTK_BOX (gtk_widget_get_parent(box)), box, pos);
 }
 
 static void
@@ -776,7 +780,7 @@ cv_tabs_rename (chan *ch, char *name)
 		pango_attr_list_ref (attr);
 
 	gtk_button_set_label (GTK_BUTTON (tab), name);
-	gtk_widget_queue_resize (tab->parent->parent->parent);
+	gtk_widget_queue_resize (gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(tab))));
 
 	if (attr)
 	{
diff --git a/src/fe-gtk/chanview-tree.c b/src/fe-gtk/chanview-tree.c
index 4e9dd8a8..e1e53dcf 100644
--- a/src/fe-gtk/chanview-tree.c
+++ b/src/fe-gtk/chanview-tree.c
@@ -265,7 +265,7 @@ cv_tree_focus (chan *ch)
 		gtk_tree_view_get_visible_rect (tree, &vis_rect);
 
 		/* The cordinates aren't offset correctly */
-		gtk_tree_view_widget_to_tree_coords( tree, cell_rect.x, cell_rect.y, NULL, &cell_rect.y );
+		gtk_tree_view_convert_widget_to_bin_window_coords ( tree, cell_rect.x, cell_rect.y, NULL, &cell_rect.y );
 
 		/* only need to scroll if out of bounds */
 		if (cell_rect.y < vis_rect.y ||