[devhelp/wip/swilmet/misc] window: simplify code
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/swilmet/misc] window: simplify code
- Date: Wed, 23 Mar 2016 12:27:58 +0000 (UTC)
commit 30fa668668ba574e2d7fe883aec9d0d3684f9934
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Mar 23 11:27:11 2016 +0100
window: simplify code
src/dh-window.c | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index be876c1..a4665e6 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -149,22 +149,20 @@ next_tab_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- gint current_page, n_pages;
- GtkNotebook *notebook;
- DhWindowPrivate *priv;
DhWindow *window = user_data;
+ DhWindowPrivate *priv;
+ gint current_page, n_pages;
priv = dh_window_get_instance_private (window);
- notebook = GTK_NOTEBOOK (priv->notebook);
- current_page = gtk_notebook_get_current_page (notebook);
- n_pages = gtk_notebook_get_n_pages (notebook);
+ current_page = gtk_notebook_get_current_page (priv->notebook);
+ n_pages = gtk_notebook_get_n_pages (priv->notebook);
if (current_page < n_pages - 1)
- gtk_notebook_next_page (notebook);
+ gtk_notebook_next_page (priv->notebook);
else
/* Wrap around to the first tab */
- gtk_notebook_set_current_page (notebook, 0);
+ gtk_notebook_set_current_page (priv->notebook, 0);
}
static void
@@ -172,21 +170,19 @@ prev_tab_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- gint current_page;
- GtkNotebook *notebook;
- DhWindowPrivate *priv;
DhWindow *window = user_data;
+ DhWindowPrivate *priv;
+ gint current_page;
priv = dh_window_get_instance_private (window);
- notebook = GTK_NOTEBOOK (priv->notebook);
- current_page = gtk_notebook_get_current_page (notebook);
+ current_page = gtk_notebook_get_current_page (priv->notebook);
if (current_page > 0)
- gtk_notebook_prev_page (notebook);
+ gtk_notebook_prev_page (priv->notebook);
else
/* Wrap around to the last tab */
- gtk_notebook_set_current_page (notebook, -1);
+ gtk_notebook_set_current_page (priv->notebook, -1);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]