[devhelp/wip/swilmet/misc: 3/4] window: simplify close_button_clicked_cb()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/swilmet/misc: 3/4] window: simplify close_button_clicked_cb()
- Date: Sun, 15 Nov 2015 17:24:05 +0000 (UTC)
commit d72d0b5d2bfd88356e972ccbef41dbdf457bff2f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Nov 15 17:20:07 2015 +0100
window: simplify close_button_clicked_cb()
src/dh-window.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 51625d1..ff83745 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -1309,19 +1309,13 @@ close_button_clicked_cb (GtkButton *button,
{
DhWindowPrivate *priv;
GtkWidget *parent_tab;
- gint pages;
- gint i;
+ gint page_num;
priv = dh_window_get_instance_private (window);
parent_tab = g_object_get_data (G_OBJECT (button), "parent_tab");
- pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook));
- for (i=0; i<pages; i++) {
- if (gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook), i) == parent_tab) {
- window_close_tab (window, i);
- break;
- }
- }
+ page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), parent_tab);
+ window_close_tab (window, page_num);
}
static GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]