[grisbi-devel] [PATCH 8/8] optimization of the function of update of the toolbars
pbiava
pierre.biava at nerim.net
Sun Feb 17 08:20:41 CET 2013
---
src/bet_finance_ui.c | 20 +-------------------
src/bet_finance_ui.h | 2 +-
src/bet_hist.c | 20 ++------------------
src/bet_hist.h | 2 +-
src/bet_tab.c | 20 ++------------------
src/bet_tab.h | 2 +-
src/fenetre_principale.c | 25 ++++++++++++++++++++++---
7 files changed, 30 insertions(+), 61 deletions(-)
diff --git a/src/bet_finance_ui.c b/src/bet_finance_ui.c
index e6c0ce5..68a531c 100644
--- a/src/bet_finance_ui.c
+++ b/src/bet_finance_ui.c
@@ -2155,26 +2155,8 @@ GtkWidget *bet_finance_get_capital_entry ( void )
*
*
*/
-void bet_finance_update_all_finance_toolbars ( void )
+void bet_finance_update_all_finance_toolbars ( gint toolbar_style )
{
- gint toolbar_style = 0;
-
- switch ( conf.display_toolbar )
- {
- case GSB_BUTTON_TEXT:
- toolbar_style = GTK_TOOLBAR_TEXT;
- break;
- case GSB_BUTTON_ICON:
- toolbar_style = GTK_TOOLBAR_ICONS;
- break;
- case GSB_BUTTON_BOTH:
- toolbar_style = GTK_TOOLBAR_BOTH;
- break;
- case GSB_BUTTON_BOTH_HORIZ:
- toolbar_style = GTK_TOOLBAR_BOTH_HORIZ;
- break;
- }
-
gtk_toolbar_set_style ( GTK_TOOLBAR ( account_toolbar ), toolbar_style );
gtk_toolbar_set_style ( GTK_TOOLBAR ( amortization_toolbar ), toolbar_style );
gtk_toolbar_set_style ( GTK_TOOLBAR ( simulator_toolbar ), toolbar_style );
diff --git a/src/bet_finance_ui.h b/src/bet_finance_ui.h
index ae73c5a..f4c6433 100644
--- a/src/bet_finance_ui.h
+++ b/src/bet_finance_ui.h
@@ -14,7 +14,7 @@ GtkWidget *bet_finance_create_page ( void );
GtkWidget *bet_finance_get_capital_entry ( void );
gdouble bet_finance_get_number_from_string ( GtkWidget *parent, const gchar *name );
void bet_finance_switch_simulator_page ( void );
-void bet_finance_update_all_finance_toolbars ( void );
+void bet_finance_update_all_finance_toolbars ( gint toolbar_style );
void bet_finance_ui_update_amortization_tab ( gint account_number );
/* END_DECLARATION */
diff --git a/src/bet_hist.c b/src/bet_hist.c
index acc60ed..2084efe 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -1994,25 +1994,9 @@ GtkWidget *bet_historical_create_toolbar ( GtkWidget *parent,
*
*
* */
-void bet_historical_update_toolbar ( void )
+void bet_historical_update_toolbar ( gint toolbar_style )
{
- GtkWidget *page;
- GtkWidget *tree_view;
- GList *list = NULL;
-
- page = g_object_get_data ( G_OBJECT ( bet_historical_toolbar ), "page" );
- tree_view = g_object_get_data ( G_OBJECT ( bet_historical_toolbar ), "tree_view" );
-
- list = gtk_container_get_children ( GTK_CONTAINER ( bet_historical_toolbar ) );
-
- if ( list )
- {
- gtk_container_remove ( GTK_CONTAINER ( bet_historical_toolbar ),
- GTK_WIDGET ( list -> data ) );
- g_list_free ( list );
- }
- gtk_container_add ( GTK_CONTAINER ( bet_historical_toolbar ),
- bet_historical_create_toolbar ( page, tree_view ) );
+ gtk_toolbar_set_style ( GTK_TOOLBAR ( bet_historical_toolbar ), toolbar_style );
}
diff --git a/src/bet_hist.h b/src/bet_hist.h
index 00f9d36..9a13eda 100644
--- a/src/bet_hist.h
+++ b/src/bet_hist.h
@@ -20,7 +20,7 @@ void bet_historical_refresh_data ( GtkTreeModel *tab_model,
GDate *date_max );
void bet_historical_set_fyear_from_combobox ( GtkWidget *combo_box, gint fyear );
void bet_historical_set_page_title ( gint account_number );
-void bet_historical_update_toolbar ( void );
+void bet_historical_update_toolbar ( gint toolbar_style );
/* END_DECLARATION */
#endif /*_BALANCE_ESTIMATE_HIST_H*/
diff --git a/src/bet_tab.c b/src/bet_tab.c
index e296ae6..1f1cdaf 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -3111,25 +3111,9 @@ void bet_array_export_tab ( GtkWidget *menu_item, GtkTreeView *tree_view )
*
*
* */
-void bet_array_update_toolbar ( void )
+void bet_array_update_toolbar ( gint toolbar_style )
{
- GtkWidget *page;
- GtkWidget *tree_view;
- GList *list = NULL;
-
- page = g_object_get_data ( G_OBJECT ( bet_array_toolbar ), "page" );
- tree_view = g_object_get_data ( G_OBJECT ( bet_array_toolbar ), "tree_view" );
-
- list = gtk_container_get_children ( GTK_CONTAINER ( bet_array_toolbar ) );
-
- if ( list )
- {
- gtk_container_remove ( GTK_CONTAINER ( bet_array_toolbar ),
- GTK_WIDGET ( list -> data ) );
- g_list_free ( list );
- }
- gtk_container_add ( GTK_CONTAINER ( bet_array_toolbar ),
- bet_array_list_create_toolbar ( page, tree_view ) );
+ gtk_toolbar_set_style ( GTK_TOOLBAR ( bet_array_toolbar ), toolbar_style );
}
/**
* crée une transacction du montant et à la date du transfert en exécutant
diff --git a/src/bet_tab.h b/src/bet_tab.h
index 2a680de..4999ed5 100644
--- a/src/bet_tab.h
+++ b/src/bet_tab.h
@@ -37,7 +37,7 @@ void bet_array_list_add_new_hist_line ( GtkTreeModel *tab_model,
GDate *date_max );
gboolean bet_array_list_select_path ( GtkWidget *tree_view, GtkTreePath *path );
void bet_array_update_estimate_tab ( gint account_number, gint type_maj );
-void bet_array_update_toolbar ( void );
+void bet_array_update_toolbar ( gint toolbar_style );
/* END_DECLARATION */
#endif /*_BALANCE_ESTIMATE_TAB_H*/
diff --git a/src/fenetre_principale.c b/src/fenetre_principale.c
index 52c4ec7..7d7c77a 100644
--- a/src/fenetre_principale.c
+++ b/src/fenetre_principale.c
@@ -50,6 +50,7 @@
#include "structures.h"
#include "tiers_onglet.h"
#include "traitement_variables.h"
+#include "utils_buttons.h"
#include "erreur.h"
/*END_INCLUDE*/
@@ -551,15 +552,33 @@ gboolean gsb_gui_is_hpaned_general ( void )
*/
void gsb_gui_update_all_toolbars ( void )
{
+ gint toolbar_style = 0;
+
+ switch ( conf.display_toolbar )
+ {
+ case GSB_BUTTON_TEXT:
+ toolbar_style = GTK_TOOLBAR_TEXT;
+ break;
+ case GSB_BUTTON_ICON:
+ toolbar_style = GTK_TOOLBAR_ICONS;
+ break;
+ case GSB_BUTTON_BOTH:
+ toolbar_style = GTK_TOOLBAR_BOTH;
+ break;
+ case GSB_BUTTON_BOTH_HORIZ:
+ toolbar_style = GTK_TOOLBAR_BOTH_HORIZ;
+ break;
+ }
+
gsb_gui_update_transaction_toolbar ( );
gsb_gui_update_scheduler_toolbar ( );
payees_update_toolbar_list ( );
categories_update_toolbar_list ( );
budgetary_lines_update_toolbar_list ( );
gsb_gui_update_reports_toolbar ( );
- bet_array_update_toolbar ( );
- bet_historical_update_toolbar ( );
- bet_finance_update_all_finance_toolbars ( );
+ bet_array_update_toolbar ( toolbar_style );
+ bet_historical_update_toolbar ( toolbar_style );
+ bet_finance_update_all_finance_toolbars ( toolbar_style );
}
--
1.8.1.3
More information about the devel
mailing list