[grisbi-devel] [Branch master][PATCH 2/2]remove global variable: account_page

Pierre Biava pierre.biava at nerim.net
Thu Feb 7 21:41:04 CET 2013


 From 815f4f4fd57cb6cccb1d9ec3186aa5457baa428e Mon Sep 17 00:00:00 2001
From: pbiava <pierre.biava at nerim.net>
Date: Sun, 3 Feb 2013 18:47:39 +0100
Subject: [PATCH] remove global variable: account_page

---
  src/bet_config.c         |   31 ++++++++++++++++++++++---------
  src/bet_data.c           |    5 +++--
  src/bet_finance_ui.c     |   10 ++++++++--
  src/bet_hist.c           |   23 ++++++++++++++++-------
  src/bet_tab.c            |   16 ++++++++++++----
  src/fenetre_principale.c |    8 +++++++-
  src/fenetre_principale.h |    1 +
  src/gsb_account.c        |    4 ++--
  src/navigation.c         |    5 ++---
  src/parametres.c         |    3 +--
  10 files changed, 74 insertions(+), 32 deletions(-)

diff --git a/src/bet_config.c b/src/bet_config.c
index 7176f66..e81a87a 100644
--- a/src/bet_config.c
+++ b/src/bet_config.c
@@ -37,6 +37,7 @@
  #include "bet_hist.h"
  #include "bet_tab.h"
  #include "dialog.h"
+#include "fenetre_principale.h"
  #include "gsb_account.h"
  #include "gsb_automem.h"
  #include "gsb_calendar_entry.h"
@@ -90,7 +91,6 @@ static void 
bet_config_initialise_select_historical_data ( gint account_number,
  /*END_STATIC*/

  /*START_EXTERN*/
-extern GtkWidget *account_page;
  extern GtkTreeModel *bet_fyear_model;
  extern GtkTreeModel *bet_fyear_model_filter;
  /*END_EXTERN*/
@@ -228,7 +228,7 @@ gboolean 
bet_config_general_cash_account_option_clicked ( GtkWidget *checkbutton
  {
      GtkWidget *combo;

-    combo = g_object_get_data ( G_OBJECT ( account_page ), 
"account_combo" );
+    combo = g_object_get_data ( G_OBJECT ( gsb_gui_get_account_page () 
), "account_combo" );
      if ( combo )
      {
          gint account_number;
@@ -256,12 +256,14 @@ gboolean 
bet_config_general_cash_account_option_clicked ( GtkWidget *checkbutton
  GtkWidget *bet_config_account_create_account_page ( void )
  {
      GtkWidget *notebook;
+    GtkWidget *account_page;
      GtkWidget *vbox_pref;
      GtkWidget *vbox;
      GtkWidget *widget;

      vbox_pref = new_vbox_with_title_and_icon ( _("Accounts data"), 
"balance_estimate.png" );
      gtk_container_set_border_width ( GTK_CONTAINER ( vbox_pref ), 12 );
+    account_page = gsb_gui_get_account_page ();

      /* set the choice of account */
      widget = bet_config_account_get_select_account ( "Select an 
account" );
@@ -345,7 +347,7 @@ GtkWidget *bet_config_account_get_select_account ( 
gchar *title )

      combo = gsb_account_create_combo_list ( G_CALLBACK ( 
bet_config_change_account ),
                          NULL, FALSE );
-    g_object_set_data ( G_OBJECT ( account_page ), "account_combo", 
combo );
+    g_object_set_data ( G_OBJECT ( gsb_gui_get_account_page () ), 
"account_combo", combo );
      if ( ( account_number = gsb_gui_navigation_get_current_account ( ) 
) == -1 )
          gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo ), 0 );
      else
@@ -406,6 +408,7 @@ GtkWidget *bet_config_get_duration_widget ( gint 
origin )
      GtkWidget *widget = NULL;
      GtkWidget *hbox;
      GtkWidget *previous = NULL;
+    GtkWidget *account_page;
      gpointer pointeur = NULL;
      gint iduration;

@@ -419,6 +422,7 @@ GtkWidget *bet_config_get_duration_widget ( gint 
origin )
          box = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 );
          pointeur = GINT_TO_POINTER ( 1 );
      }
+    account_page = gsb_gui_get_account_page ();

      /* partie mensuelle */
      label = gtk_label_new ( _("Duration estimation:") );
@@ -499,10 +503,13 @@ void bet_config_initialise_duration_widget ( gint 
account_number,
  {
      GtkWidget *widget = NULL;
      GtkWidget *button = NULL;
+    GtkWidget *account_page;
      gpointer ptr = NULL;
      gint param;
      gint months;

+    account_page = gsb_gui_get_account_page ();
+
      param = gsb_data_account_get_bet_spin_range ( account_number );
      months = gsb_data_account_get_bet_months ( account_number );
      button = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_config_account_spin_button" );
@@ -665,7 +672,7 @@ GtkWidget 
*bet_config_account_get_select_historical_data ( gchar *title )
      vbox = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 0 );

      paddingbox = new_paddingbox_with_title ( vbox, FALSE, _(title) );
-    hbox = bet_config_get_select_historical_data ( paddingbox, 
account_page );
+    hbox = bet_config_get_select_historical_data ( paddingbox, 
gsb_gui_get_account_page () );

      return vbox;
  }
@@ -934,7 +941,7 @@ void bet_config_origin_data_clicked ( GtkWidget 
*togglebutton, GdkEventButton *e
          {
              GtkWidget *button;

-            button = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_hist_button_1" );
+            button = g_object_get_data ( G_OBJECT ( 
gsb_gui_get_account_page () ), "bet_hist_button_1" );
              gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button 
), TRUE );
          }
      }
@@ -947,12 +954,12 @@ void bet_config_origin_data_clicked ( GtkWidget 
*togglebutton, GdkEventButton *e
          {
              GtkWidget *button;

-            button = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_hist_button_2" );
+            button = g_object_get_data ( G_OBJECT ( 
gsb_gui_get_account_page () ), "bet_hist_button_2" );
              gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button 
), TRUE );
          }
      }

-    column = g_object_get_data ( G_OBJECT ( account_page ),
+    column = g_object_get_data ( G_OBJECT ( gsb_gui_get_account_page () ),
                          "historical_column_source" );
      gtk_tree_view_column_set_title ( GTK_TREE_VIEW_COLUMN ( column ), 
title );
      g_free ( title );
@@ -1003,6 +1010,7 @@ gboolean bet_config_change_account ( GtkWidget 
*combo )
      GtkWidget *notebook;
      GtkWidget *widget = NULL;
      GtkWidget *fyear_combo;
+    GtkWidget *account_page;
      gint account_number;
      gint bet_use_budget;
      bet_type_onglets bet_show_onglets;
@@ -1015,6 +1023,7 @@ gboolean bet_config_change_account ( GtkWidget 
*combo )

      account_number = gsb_account_get_combo_account_number ( combo );
      bet_use_budget = gsb_data_account_get_bet_use_budget ( 
account_number );
+    account_page = gsb_gui_get_account_page ();

      /* on bloque l'appel à la fonction bet_config_fyear_clicked */
      fyear_combo = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_config_hist_fyear_combo" );
@@ -1089,7 +1098,7 @@ gint bet_config_get_account_from_combo ( void )
      GtkWidget *combo;
      gint account_number = -1;

-    combo = g_object_get_data ( G_OBJECT ( account_page ), 
"account_combo" );
+    combo = g_object_get_data ( G_OBJECT ( gsb_gui_get_account_page () 
), "account_combo" );
      account_number = gsb_account_get_combo_account_number ( combo );

      return account_number;
@@ -1139,7 +1148,9 @@ gboolean bet_config_select_label_changed ( 
GtkWidget *checkbutton,
  void bet_config_sensitive_account_parameters ( gint account_number, 
gboolean sensitive )
  {
      GtkWidget *widget = NULL;
+    GtkWidget *account_page;

+    account_page = gsb_gui_get_account_page ();
      if ( sensitive )
      {
          bet_type_onglets bet_show_onglets;
@@ -1728,7 +1739,9 @@ static GtkWidget 
*bet_config_account_get_select_bank_card ( void )
      GtkWidget *hbox;
      GtkWidget *button;
      GtkWidget *combo;
+    GtkWidget *account_page;

+    account_page = gsb_gui_get_account_page ();
      /* partie de gestion des comptes cartes avec débit différé */
      hbox = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 );

@@ -1761,7 +1774,7 @@ static void bet_config_initialise_select_bank_card 
( gint account_number )
      GtkWidget *button;
      gint active;

-    button = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_credit_card_button" );
+    button = g_object_get_data ( G_OBJECT ( gsb_gui_get_account_page () 
), "bet_credit_card_button" );
      active = gsb_data_account_get_bet_credit_card ( account_number );

      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), active );
diff --git a/src/bet_data.c b/src/bet_data.c
index 390708a..88c7825 100644
--- a/src/bet_data.c
+++ b/src/bet_data.c
@@ -77,7 +77,6 @@ static SH *struct_initialise_bet_historical ( void );


  /*START_EXTERN*/
-extern GtkWidget *account_page;
  /*END_EXTERN*/


@@ -107,11 +106,13 @@ static gint transfert_number;
  void bet_data_select_bet_pages ( gint account_number )
  {
      GtkWidget *page;
+    GtkWidget *account_page;
      gint current_page;
      bet_type_onglets bet_show_onglets;

      devel_debug_int ( account_number );
      bet_show_onglets = gsb_data_account_get_bet_show_onglets ( 
account_number );
+    account_page = gsb_gui_get_account_page ();
      current_page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( 
account_page ) );

      switch ( bet_show_onglets )
@@ -191,7 +192,7 @@ void bet_data_update_bet_module ( gint 
account_number, guint page )
      kind = gsb_data_account_get_kind ( account_number );

      if ( page == -1 && gsb_gui_navigation_get_current_page ( ) == 
GSB_ACCOUNT_PAGE )
-        page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( 
account_page ) );
+        page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( 
gsb_gui_get_account_page () ) );

      switch ( page )
      {
diff --git a/src/bet_finance_ui.c b/src/bet_finance_ui.c
index 95c4195..75b3398 100644
--- a/src/bet_finance_ui.c
+++ b/src/bet_finance_ui.c
@@ -100,7 +100,6 @@ static void bet_finance_update_simulator_toolbar ( 
void );
  /*END_STATIC*/

  /*START_EXTERN*/
-extern GtkWidget *account_page;
  /*END_EXTERN*/

  /* notebook pour la simulation de crédits */
@@ -1513,17 +1512,21 @@ GtkWidget *bet_finance_create_account_page ( void )
      GtkWidget *label_title;
      GtkWidget *label;
      GtkWidget *tree_view;
+    GtkWidget *account_page;

      devel_debug (NULL);

      page = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 5 );
+    account_page = gsb_gui_get_account_page ();

      /* titre de la page */
      align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
      gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5);

      label_title = gtk_label_new ( _("Amortization Table") );
-    g_object_set_data ( G_OBJECT ( account_page ), 
"bet_finance_amortization_title", label_title );
+    g_object_set_data ( G_OBJECT ( gsb_gui_get_account_page () ),
+                        "bet_finance_amortization_title",
+                        label_title );
      gtk_container_add ( GTK_CONTAINER ( align ), label_title );

      /* Choix des données sources */
@@ -1602,6 +1605,7 @@ void bet_finance_ui_update_amortization_tab ( gint 
account_number )
  {
      GtkWidget *label;
      GtkWidget *tree_view;
+    GtkWidget *account_page;
      GtkTreeModel *store;
      GtkTreePath *path;
      gchar *tmp_str;
@@ -1621,6 +1625,8 @@ void bet_finance_ui_update_amortization_tab ( gint 
account_number )
      if ( gsb_gui_navigation_get_current_account ( ) != account_number )
          return;

+    account_page = gsb_gui_get_account_page ();
+
      s_amortissement = g_malloc0 ( sizeof ( struct_amortissement ) );
      s_amortissement -> origin = SPP_ORIGIN_FINANCE;

diff --git a/src/bet_hist.c b/src/bet_hist.c
index e8d8084..65f68ca 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -116,7 +116,6 @@ static gboolean bet_historical_set_full_sub_div ( 
GtkTreeModel *model, GtkTreeIt
  /*END_STATIC*/

  /*START_EXTERN*/
-extern GtkWidget *account_page;
  /*END_EXTERN*/

  /* blocage des signaux pour le tree_view pour les comptes de type 
GSB_TYPE_CASH */
@@ -156,19 +155,21 @@ GtkWidget *bet_historical_create_page ( void )
      GtkWidget *label_title;
      GtkWidget *button_1, *button_2;
      GtkWidget *tree_view;
+    GtkWidget *account_page;
      gpointer pointeur;

      devel_debug (NULL);
      page = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 5 );
      gtk_widget_set_name ( page, "historical_page" );

+    account_page = gsb_gui_get_account_page ();
      /* titre de la page */
      align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
      gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;

      label_title = gtk_label_new ( "bet_hist_title" );
      gtk_container_add ( GTK_CONTAINER ( align ), label_title );
-    g_object_set_data ( G_OBJECT ( account_page ), "bet_hist_title", 
label_title);
+    g_object_set_data ( G_OBJECT ( gsb_gui_get_account_page () ), 
"bet_hist_title", label_title);

      /* Choix des données sources */
      align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
@@ -497,6 +498,7 @@ GtkWidget *bet_historical_get_data_tree_view ( 
GtkWidget *container )
  {
      GtkWidget *scrolled_window;
      GtkWidget *tree_view;
+    GtkWidget *account_page;
      GtkTreeStore *tree_model;
      GtkTreeSelection *tree_selection;
      GtkCellRenderer *cell;
@@ -504,6 +506,7 @@ GtkWidget *bet_historical_get_data_tree_view ( 
GtkWidget *container )
      gchar *title;

      /* devel_debug (NULL); */
+    account_page = gsb_gui_get_account_page ();
      tree_view = gtk_tree_view_new ( );
      gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW (tree_view), FALSE );
      g_object_set_data ( G_OBJECT ( account_page ), "hist_tree_view", 
tree_view );
@@ -703,7 +706,7 @@ void bet_historical_populate_data ( gint 
account_number )
      TransactionCurrentFyear *tcf = NULL;

      devel_debug_int ( account_number );
-    tree_view = g_object_get_data (G_OBJECT ( account_page ), 
"bet_historical_treeview" );
+    tree_view = g_object_get_data (G_OBJECT ( gsb_gui_get_account_page 
() ), "bet_historical_treeview" );
      if ( GTK_IS_TREE_VIEW ( tree_view ) == FALSE )
          return;

@@ -1139,7 +1142,7 @@ void bet_historical_refresh_data ( GtkTreeModel 
*tab_model,
      GtkTreeIter fils_iter;

      devel_debug (NULL);
-    tree_view = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_historical_treeview" );
+    tree_view = g_object_get_data ( G_OBJECT (gsb_gui_get_account_page 
() ), "bet_historical_treeview" );
      model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );

      if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), 
&iter ) )
@@ -1272,7 +1275,7 @@ gboolean bet_historical_set_full_sub_div ( 
GtkTreeModel *model, GtkTreeIter *par

      if ( edited )
      {
-        tree_view = g_object_get_data ( G_OBJECT ( account_page ),
+        tree_view = g_object_get_data ( G_OBJECT ( 
gsb_gui_get_account_page () ),
                          "bet_historical_treeview" );
          gtk_tree_view_collapse_row ( tree_view,
                          gtk_tree_model_get_path ( model, parent ) );
@@ -1430,7 +1433,7 @@ void bet_historical_row_collapse_all ( GtkTreeView 
*tree_view,
                          GtkTreeModel *model )
  {
      if ( tree_view == NULL )
-        tree_view = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_historical_treeview" );
+        tree_view = g_object_get_data ( G_OBJECT ( 
gsb_gui_get_account_page () ), "bet_historical_treeview" );
      gtk_tree_view_collapse_row ( tree_view,
                  gtk_tree_model_get_path ( model, iter ) );
      gtk_tree_selection_select_iter ( gtk_tree_view_get_selection (
@@ -1623,12 +1626,14 @@ gboolean 
bet_historical_initializes_account_settings ( gint account_number )
  {
      GtkWidget *button = NULL;
      GtkWidget *combo = NULL;
+    GtkWidget *account_page;
      GtkTreeViewColumn *column;
      gchar *title;
      gint fyear_number;
      gint origin;
      gpointer pointeur;

+    account_page = gsb_gui_get_account_page ();
      /* set data origin */
      origin = gsb_data_account_get_bet_hist_data ( account_number );
      if ( origin )
@@ -1736,10 +1741,12 @@ gboolean bet_historical_set_background_color ( 
GtkWidget *tree_view )
   * */
  void bet_historical_g_signal_block_tree_view ( void )
  {
+    GtkWidget *account_page;
      GtkTreeView *tree_view;
      gpointer cell;
      GtkTreeModel *tree_model;

+    account_page = gsb_gui_get_account_page ();
      hist_block_signal = TRUE;
      tree_view = g_object_get_data ( G_OBJECT ( account_page ), 
"hist_tree_view" );
      tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
@@ -1760,12 +1767,14 @@ void bet_historical_g_signal_block_tree_view ( 
void )
   * */
  void bet_historical_g_signal_unblock_tree_view ( void )
  {
+    GtkWidget *account_page;
      GtkTreeView *tree_view;
      gpointer cell;
      GtkTreeModel *tree_model;

      if ( hist_block_signal == FALSE )
          return;
+    account_page = gsb_gui_get_account_page ();

      hist_block_signal = FALSE;
      tree_view = g_object_get_data ( G_OBJECT ( account_page ), 
"hist_tree_view" );
@@ -1806,7 +1815,7 @@ void bet_historical_set_page_title ( gint 
account_number )
                      gsb_data_fyear_get_name ( result ),
                      gsb_data_account_get_name ( account_number ) );

-    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( account_page 
), "bet_hist_title") );
+    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( 
gsb_gui_get_account_page () ), "bet_hist_title") );
      gtk_label_set_label ( GTK_LABEL ( widget ), title );

      g_free ( hist_srce_name );
diff --git a/src/bet_tab.c b/src/bet_tab.c
index ecebeb4..1e2f88d 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -148,7 +148,6 @@ static gboolean bet_array_update_average_column ( 
GtkTreeModel *model,
  /*END_STATIC*/

  /*START_EXTERN*/
-extern GtkWidget *account_page;
  extern const gdouble prev_month_max;
  extern gint valeur_echelle_recherche_date_import;
  /*END_EXTERN*/
@@ -547,6 +546,7 @@ static gboolean bet_array_update_average_column ( 
GtkTreeModel *model,
  void bet_array_refresh_estimate_tab ( gint account_number )
  {
      GtkWidget *widget;
+    GtkWidget *account_page;
      GtkWidget *tree_view;
      GtkTreeIter iter;
      GtkTreeModel *tree_model;
@@ -567,6 +567,7 @@ void bet_array_refresh_estimate_tab ( gint 
account_number )
      gint currency_number;

      devel_debug (NULL);
+    account_page = gsb_gui_get_account_page ();

      tmp_range = struct_initialise_bet_range ( );

@@ -708,18 +709,23 @@ GtkWidget *bet_array_create_page ( void )
      GtkWidget *label_title;
      GtkWidget *label;
      GtkWidget *tree_view;
+    GtkWidget *account_page;

      devel_debug (NULL);
      page = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 5 );
      gtk_widget_set_name ( page, "forecast_page" );

+    account_page = gsb_gui_get_account_page ();
+
      /* create the title */
      align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
      gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;

      label_title = gtk_label_new ("Estimate array");
      gtk_container_add ( GTK_CONTAINER ( align ), label_title );
-    g_object_set_data ( G_OBJECT ( account_page ), "bet_array_title", 
label_title );
+    g_object_set_data ( G_OBJECT ( account_page ),
+                        "bet_array_title",
+                        label_title );

      align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
      gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;
@@ -792,7 +798,7 @@ GtkWidget *bet_array_create_tree_view ( GtkWidget 
*container )
      /* create the estimate treeview */
      tree_view = gtk_tree_view_new ( );
      gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW ( tree_view ), FALSE );
-    g_object_set_data ( G_OBJECT ( account_page ), 
"bet_estimate_treeview", tree_view );
+    g_object_set_data ( G_OBJECT ( gsb_gui_get_account_page () ), 
"bet_estimate_treeview", tree_view );
      g_object_set_data ( G_OBJECT ( tree_view ), "origin_data_model",
                          GINT_TO_POINTER ( 
SPP_ESTIMATE_TREE_ORIGIN_DATA ) );
      g_object_set_data ( G_OBJECT ( tree_view ), "color_data_model",
@@ -1791,7 +1797,7 @@ void bet_array_list_change_menu ( GtkWidget 
*menu_item,

      if ( origine == SPP_ORIGIN_TRANSACTION )
      {
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), 0 );
+        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( 
gsb_gui_get_account_page () ), 0 );
          transaction_list_select ( number );
          gsb_transactions_list_edit_transaction ( number );
      }
@@ -2347,11 +2353,13 @@ gboolean bet_array_initializes_account_settings 
( gint account_number )
      GtkWidget *widget = NULL;
      GtkWidget *button = NULL;
      GtkWidget *toggled = NULL;
+    GtkWidget *account_page;
      gpointer pointeur;
      gint param;
      gint months;

      /* devel_debug_int ( account_number ); */
+    account_page = gsb_gui_get_account_page ();
      button = g_object_get_data ( G_OBJECT ( account_page ), 
"bet_account_spin_button" );

      param = gsb_data_account_get_bet_spin_range ( account_number );
diff --git a/src/fenetre_principale.c b/src/fenetre_principale.c
index f25dcda..52c4ec7 100644
--- a/src/fenetre_principale.c
+++ b/src/fenetre_principale.c
@@ -76,7 +76,7 @@ static GtkWidget *hpaned_general = NULL;
  static GtkWidget *notebook_general = NULL;

  /** Notebook of the account pane. */
-GtkWidget *account_page = NULL;
+static GtkWidget *account_page = NULL;

  static GtkWidget * headings_eb = NULL;

@@ -563,6 +563,12 @@ void gsb_gui_update_all_toolbars ( void )
  }


+GtkWidget *gsb_gui_get_account_page ( void )
+{
+    return account_page;
+}
+
+
  /* Local Variables: */
  /* c-basic-offset: 4 */
  /* End: */
diff --git a/src/fenetre_principale.h b/src/fenetre_principale.h
index a2a530e..8442f2d 100644
--- a/src/fenetre_principale.h
+++ b/src/fenetre_principale.h
@@ -30,6 +30,7 @@ typedef enum GSB_ACCOUNT_NOTEBOOK_PAGES {

  /* START_DECLARATION */
  GtkWidget *gsb_gui_create_general_widgets ( void );
+GtkWidget *gsb_gui_get_account_page ( void );
  GtkWidget *gsb_gui_get_general_notebook (void );
  void gsb_gui_headings_update_suffix ( gchar * suffix );
  void gsb_gui_headings_update_title ( gchar * title );
diff --git a/src/gsb_account.c b/src/gsb_account.c
index cb62154..fb0ecfb 100644
--- a/src/gsb_account.c
+++ b/src/gsb_account.c
@@ -60,7 +60,6 @@


  /*START_EXTERN*/
-extern GtkWidget *account_page;
  /*END_EXTERN*/


@@ -134,7 +133,8 @@ gboolean gsb_account_new ( kind_account account_type,

          /* Go to accounts properties */
          gtk_notebook_set_current_page ( GTK_NOTEBOOK ( 
notebook_general ), GSB_ACCOUNT_PAGE );
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), 
GSB_PROPERTIES_PAGE );
+        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( 
gsb_gui_get_account_page () ),
+                        GSB_PROPERTIES_PAGE );

          gsb_account_property_fill_page ();
      }
diff --git a/src/navigation.c b/src/navigation.c
index df1cbf0..97cf834 100644
--- a/src/navigation.c
+++ b/src/navigation.c
@@ -137,7 +137,6 @@ static gboolean navigation_tree_drag_data_get ( 
GtkTreeDragSource *drag_source,


  /*START_EXTERN*/
-extern GtkWidget *account_page;
  extern GtkWidget *label_last_statement;
  extern GtkWidget *menu_import_rules;
  /*END_EXTERN*/
@@ -1168,9 +1167,9 @@ gboolean gsb_gui_navigation_select_line ( 
GtkTreeSelection *selection,
  	    gsb_menu_update_view_menu ( account_number );

  	    /* set the form */
-        gsb_gui_on_account_switch_page ( GTK_NOTEBOOK ( account_page ),
+        gsb_gui_on_account_switch_page ( GTK_NOTEBOOK ( 
gsb_gui_get_account_page () ),
                          NULL,
-                        gtk_notebook_get_current_page ( GTK_NOTEBOOK ( 
account_page ) ),
+                        gtk_notebook_get_current_page ( GTK_NOTEBOOK ( 
gsb_gui_get_account_page () ) ),
                          NULL );
  	    /* gsb_form_show ( FALSE ); */

diff --git a/src/parametres.c b/src/parametres.c
index d93768d..9766a72 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -125,7 +125,6 @@ static gint width_spin_button = 50;


  /*START_EXTERN*/
-extern GtkWidget *account_page;
  extern struct conditional_message delete_msg[];
  extern struct conditional_message messages[];
  extern gchar *nom_fichier_comptes;
@@ -1941,7 +1940,7 @@ void gsb_localisation_update_affichage ( gint 
type_maj )
          kind_account kind;

          account_number = gsb_gui_navigation_get_current_account ( );
-        account_current_page = gtk_notebook_get_current_page ( 
GTK_NOTEBOOK ( account_page ) );
+        account_current_page = gtk_notebook_get_current_page ( 
GTK_NOTEBOOK ( gsb_gui_get_account_page () ) );

          kind = gsb_data_account_get_kind ( account_number );
          switch ( kind )
-- 
1.7.4.4



More information about the devel mailing list