[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. upstream_version_0_9_4-144-gd6e2807
Pierre Biava
nobody at users.sourceforge.net
Mon Dec 26 23:15:33 CET 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, grisbi-gtk3 has been updated
via d6e280725c9ce311eb9efbf0f4ce489037e31229 (commit)
via 8561c7e599b5ca08ddf2e79a99e7d402f5ed7b16 (commit)
via 3259797cc2f5f39111655a209343ba331c7deba4 (commit)
via 79c66f5885c50e5f77cbfda9efea5f8272a07344 (commit)
via b5cdff0fb394e97c209ca6c95ac4aab5e905e4a6 (commit)
via 8dae7248325480b2391aba6a0bad12554cf43c1b (commit)
via a54ec6617b7539ca590f4597d3a7a92195d01413 (commit)
via ad617ba4830bd38a5cfe965c9ea795f1ddcf95b6 (commit)
via 842aea64e77ea3fd3a020658220a6d07707e642d (commit)
via 6755287646e3ad1f3522319359c30d496f8e700f (commit)
via 28f8494a6e85d9ff2d6a31f6917bb208628d7fa4 (commit)
via 77a4b566fb7e07a08bbc58bd498c261cfe98bdfa (commit)
via 14d4f263890b5d84c44b6803d70c57b5ddfe3e7e (commit)
via 7848b14e089fdd467f101bf0c9508251b0170a51 (commit)
via 1a81d0ece471f1e54453096ad4b54b3af16c3347 (commit)
via 03f6d20ecc69ebac4db271e9302107d44159dc5d (commit)
via e16c86f62414bb57fe916a195106e87d9225bd4f (commit)
via cebf80e7b173df9ab63ec6e23dce0bfaf767de68 (commit)
via 84c18ec971629cb62fb996f88e03fd1602825914 (commit)
from 386090a135f6383380e41daa494d71dabf6e9ff6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d6e280725c9ce311eb9efbf0f4ce489037e31229
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 23:11:13 2011 +0100
help.c: deleted deleted gtk_about_dialog_set_url_hook () and gtk_about_dialog_set_email_hook ()
commit 8561c7e599b5ca08ddf2e79a99e7d402f5ed7b16
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 23:09:50 2011 +0100
gbs_transaction_list.c: replaced gdk_drawable_get_size () by gdk_window_get_height ()
commit 3259797cc2f5f39111655a209343ba331c7deba4
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 23:08:44 2011 +0100
minor changes
commit 79c66f5885c50e5f77cbfda9efea5f8272a07344
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 23:08:24 2011 +0100
parametres.c: replaced gtk_combo_box_entry_new_text () by gtk_combo_box_text_new_with_entry ()
commit b5cdff0fb394e97c209ca6c95ac4aab5e905e4a6
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 22:11:25 2011 +0100
import_csv.c: replaced gtk_combo_box_new_text () by gtk_combo_box_text_new ()
commit 8dae7248325480b2391aba6a0bad12554cf43c1b
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 22:01:23 2011 +0100
init _locale struct
commit a54ec6617b7539ca590f4597d3a7a92195d01413
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 22:00:53 2011 +0100
fixes a segmentation fault when closing Grisbi
commit ad617ba4830bd38a5cfe965c9ea795f1ddcf95b6
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 21:45:30 2011 +0100
fixes a crash when the parent window does not exist
commit 842aea64e77ea3fd3a020658220a6d07707e642d
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 21:43:20 2011 +0100
replaced gtk_combo_box_new_text () by gtk_combo_box_text_new ()
commit 6755287646e3ad1f3522319359c30d496f8e700f
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 21:42:36 2011 +0100
replaced gtk_combo_box_get_active_text () by gsb_combo_box_get_active_text ()
commit 28f8494a6e85d9ff2d6a31f6917bb208628d7fa4
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 15:04:11 2011 +0100
gsb_combo_box.c: rewriting functions and adding new features
commit 77a4b566fb7e07a08bbc58bd498c261cfe98bdfa
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 14:08:47 2011 +0100
affichage_liste.c: replaced gtk_combo_box_new_text () by gtk_combo_box_text_new ()
commit 14d4f263890b5d84c44b6803d70c57b5ddfe3e7e
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Dec 26 11:33:05 2011 +0100
replaced GTK_OPTION_MENU by gsb_combo_box_new_with_index () and fixed bug of display of new payment method
commit 7848b14e089fdd467f101bf0c9508251b0170a51
Author: pbiava <pierre.biava at nerim.net>
Date: Sun Dec 25 22:51:43 2011 +0100
replaced GTK_WIDGET_REALIZED () by gtk_widget_get_realized ()
commit 1a81d0ece471f1e54453096ad4b54b3af16c3347
Author: pbiava <pierre.biava at nerim.net>
Date: Sun Dec 25 22:05:57 2011 +0100
gsb_select_icon.c : replaced gtk_combo_box_entry_new_with_model () by gtk_combo_box_new_with_model_and_entry
commit 03f6d20ecc69ebac4db271e9302107d44159dc5d
Author: pbiava <pierre.biava at nerim.net>
Date: Sun Dec 25 07:40:56 2011 +0100
add folder.png and grisbi.ui
commit e16c86f62414bb57fe916a195106e87d9225bd4f
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Dec 24 16:32:26 2011 +0100
Formatting the code
commit cebf80e7b173df9ab63ec6e23dce0bfaf767de68
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Dec 24 09:38:43 2011 +0100
replace gtk_signal_connect () by g_signal_connect ()
commit 84c18ec971629cb62fb996f88e03fd1602825914
Author: pbiava <pierre.biava at nerim.net>
Date: Wed Dec 21 22:07:02 2011 +0100
Changing the parameters of the function gsb_string_remplace_string ()
-----------------------------------------------------------------------
Changes:
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
index c7db64d..0295308 100644
--- a/pixmaps/Makefile.am
+++ b/pixmaps/Makefile.am
@@ -26,6 +26,7 @@ grisbi_pixmaps_DATA = \
exec.png \
files.png \
financial-years.png \
+ folder.png \
fonts.png \
form.png \
generalities.png \
diff --git a/pixmaps/folder.png b/pixmaps/folder.png
new file mode 100644
index 0000000..2a1e0e1
Binary files /dev/null and b/pixmaps/folder.png differ
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3830ee2..43fb910 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -144,4 +144,5 @@ src/utils_operations.c
src/utils_str.c
[type: gettext/glade]src/ui/bet_graph.ui
[type: gettext/glade]src/ui/etats_config.ui
+[type: gettext/glade]src/ui/grisbi.ui
share/grisbi.desktop.in
diff --git a/src/affichage_liste.c b/src/affichage_liste.c
index da3360d..050031d 100644
--- a/src/affichage_liste.c
+++ b/src/affichage_liste.c
@@ -189,19 +189,20 @@ GtkWidget *onglet_affichage_operations ( void )
break;
}
- button = gtk_combo_box_new_text ();
- g_signal_connect ( G_OBJECT (button), "changed",
- G_CALLBACK (display_mode_button_changed),
- GINT_TO_POINTER (i));
+ button = gtk_combo_box_text_new ( );
+ g_signal_connect ( G_OBJECT ( button ),
+ "changed",
+ G_CALLBACK ( display_mode_button_changed ),
+ GINT_TO_POINTER ( i ) );
gtk_box_pack_start ( GTK_BOX (vbox_buttons), button, FALSE, FALSE, 0);
j=0;
while (text_line[j])
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (button), text_line[j]);
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( button ), text_line[j] );
j++;
}
- gtk_combo_box_set_active ( GTK_COMBO_BOX (button), position);
+ gtk_combo_box_set_active ( GTK_COMBO_BOX ( button ), position );
}
/* pack vboxes in hbox */
@@ -231,7 +232,7 @@ GtkWidget *onglet_affichage_operations ( void )
hbox = gtk_hbox_new ( FALSE, 5);
gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0 );
- button = gtk_combo_box_new_text ();
+ button = gtk_combo_box_text_new ( );
g_signal_connect ( G_OBJECT ( button ),
"changed",
G_CALLBACK ( gsb_transactions_list_display_sort_changed ),
@@ -239,7 +240,7 @@ GtkWidget *onglet_affichage_operations ( void )
for ( i = 0 ; i < 2 ; i++ )
{
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( button ), options_tri_primaire[i] );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( button ), options_tri_primaire[i] );
}
gtk_combo_box_set_active ( GTK_COMBO_BOX ( button ), conf.transactions_list_primary_sorting );
gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
@@ -251,7 +252,7 @@ GtkWidget *onglet_affichage_operations ( void )
hbox = gtk_hbox_new ( FALSE, 5);
gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0 );
- button = gtk_combo_box_new_text ();
+ button = gtk_combo_box_text_new ( );
g_signal_connect ( G_OBJECT ( button ),
"changed",
G_CALLBACK ( gsb_transactions_list_display_sort_changed ),
@@ -259,7 +260,7 @@ GtkWidget *onglet_affichage_operations ( void )
for ( i = 0 ; i < 4 ; i++ )
{
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( button ), options_tri_secondaire[i] );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( button ), options_tri_secondaire[i] );
}
gtk_combo_box_set_active ( GTK_COMBO_BOX ( button ), conf.transactions_list_secondary_sorting );
gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
diff --git a/src/bet_future.c b/src/bet_future.c
index ccc03b6..b59e7ba 100644
--- a/src/bet_future.c
+++ b/src/bet_future.c
@@ -851,8 +851,8 @@ gboolean bet_form_scheduler_frequency_button_changed ( GtkWidget *combo_box,
{
gchar *selected_item;
- selected_item = gtk_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) );
-
+ selected_item = gsb_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) );
+
if ( !strcmp ( selected_item, _("Once") ) )
{
gtk_widget_hide ( bet_form_scheduler_get_element_widget (
diff --git a/src/bet_graph.c b/src/bet_graph.c
index bad97d1..44e2fc0 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -396,9 +396,9 @@ void bet_graph_sectors_graph_new ( GtkWidget *button,
dialog = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "bet_graph_dialog" ) );
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ), GTK_WINDOW ( run.window ) );
gtk_widget_set_size_request ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
- gtk_signal_connect ( GTK_OBJECT ( dialog ),
+ g_signal_connect ( G_OBJECT ( dialog ),
"destroy",
- GTK_SIGNAL_FUNC ( gtk_widget_destroy ),
+ G_CALLBACK ( gtk_widget_destroy ),
NULL);
/* set the title */
@@ -638,9 +638,9 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
dialog = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "bet_graph_dialog" ) );
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ), GTK_WINDOW ( run.window ) );
gtk_widget_set_size_request ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
- gtk_signal_connect ( GTK_OBJECT ( dialog ),
+ g_signal_connect ( G_OBJECT ( dialog ),
"destroy",
- GTK_SIGNAL_FUNC ( gtk_widget_destroy ),
+ G_CALLBACK ( gtk_widget_destroy ),
NULL);
/* initialise le bouton show_grid avec la préférence "Major_grid" */
diff --git a/src/dialog.c b/src/dialog.c
index 7d6c563..5c791d6 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -229,13 +229,22 @@ GtkWidget *dialogue_special_no_run ( GtkMessageType param,
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new ( GTK_WINDOW ( run.window ),
- GTK_DIALOG_DESTROY_WITH_PARENT,
+ if ( GTK_IS_WINDOW ( run.window ) )
+ {
+ dialog = gtk_message_dialog_new ( GTK_WINDOW ( run.window ),
+ GTK_DIALOG_DESTROY_WITH_PARENT || GTK_DIALOG_MODAL,
param, buttons,
"%s", text );
- gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), text );
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new ( NULL,
+ 0,
+ param, buttons,
+ "%s", text );
+ }
- gtk_window_set_modal ( GTK_WINDOW ( dialog ), TRUE );
+ gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), text );
return dialog;
}
diff --git a/src/etats_onglet.c b/src/etats_onglet.c
index b5e40d5..78aae2d 100644
--- a/src/etats_onglet.c
+++ b/src/etats_onglet.c
@@ -269,7 +269,7 @@ gboolean ajout_etat ( void )
_("Report type"));
/* combobox for predefined reports */
- combobox = gtk_combo_box_new_text ();
+ combobox = gtk_combo_box_text_new ( );
gtk_box_pack_start ( GTK_BOX(frame), combobox, FALSE, FALSE, 0 );
/* on ajoute maintenant la frame */
@@ -293,13 +293,13 @@ gboolean ajout_etat ( void )
GTK_SHADOW_NONE );
/* fill combobox */
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Last month incomes and outgoings") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Current month incomes and outgoings") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Annual budget") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Blank report") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Cheques deposit") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Monthly outgoings by payee") );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), _("Search") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Last month incomes and outgoings") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Current month incomes and outgoings") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Annual budget") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Blank report") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Cheques deposit") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Monthly outgoings by payee") );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), _("Search") );
/* set first entry and description */
@@ -1137,11 +1137,11 @@ void exporter_etat ( void )
gtk_box_pack_start ( GTK_BOX(hbox), gtk_label_new ( _("File format: ") ),
FALSE, FALSE, 0 );
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new ( );
gtk_box_pack_start ( GTK_BOX(hbox), combo, TRUE, TRUE, 0 );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(combo), _("Grisbi report file (egsb file)" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(combo), _("HTML file" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(combo), _("CSV file" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combo ), _("Grisbi report file (egsb file)" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combo ), _("HTML file" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combo ), _("CSV file" ) );
/* Set initial format. */
gtk_combo_box_set_active ( GTK_COMBO_BOX(combo), REPORT_HTML );
diff --git a/src/export.c b/src/export.c
index 5dd1e61..6b2f69b 100644
--- a/src/export.c
+++ b/src/export.c
@@ -458,9 +458,9 @@ GtkWidget * create_export_account_resume_page ( struct exported_account * accoun
FALSE, FALSE, 0 );
/* Combo box */
- combo = gtk_combo_box_new_text();
- gtk_combo_box_append_text ( GTK_COMBO_BOX(combo), _("QIF format" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(combo), _("CSV format" ) );
+ combo = gtk_combo_box_text_new ( );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combo ), _("QIF format" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combo ), _("CSV format" ) );
gtk_box_pack_start ( GTK_BOX ( hbox ), combo, TRUE, TRUE, 0 );
g_signal_connect ( G_OBJECT(combo), "changed",
G_CALLBACK ( export_account_change_format ),
diff --git a/src/gsb_assistant_archive_export.c b/src/gsb_assistant_archive_export.c
index 81996e4..cf5535f 100644
--- a/src/gsb_assistant_archive_export.c
+++ b/src/gsb_assistant_archive_export.c
@@ -301,10 +301,10 @@ static GtkWidget *gsb_assistant_archive_export_page_name ( GtkWidget *assistant
FALSE, FALSE, 0 );
/* Combo box */
- archive_export_combobox = gtk_combo_box_new_text();
- gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("Grisbi (GSB) format" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("QIF format" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("CSV format" ) );
+ archive_export_combobox = gtk_combo_box_text_new ( );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( archive_export_combobox ), _("Grisbi (GSB) format" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( archive_export_combobox ), _("QIF format" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( archive_export_combobox ), _("CSV format" ) );
gtk_box_pack_start ( GTK_BOX ( hbox ), archive_export_combobox, TRUE, TRUE, 0 );
archive_export_filechooser = gtk_file_chooser_widget_new ( GTK_FILE_CHOOSER_ACTION_SAVE );
diff --git a/src/gsb_autofunc.c b/src/gsb_autofunc.c
index 8fc0e46..69de8bb 100644
--- a/src/gsb_autofunc.c
+++ b/src/gsb_autofunc.c
@@ -1173,10 +1173,10 @@ static gboolean gsb_autofunc_real_changed ( GtkWidget *entry,
* gint index )
* ex : gsb_data_account_set_kind ( account_number, account_kind )
*
- * basically, that combobox is created with gsb_combo_box_new_with_index_by_list, so can use that functions to get the index
+ * basically, that combobox is created with gsb_combo_box_new_with_index_from_list, so can use that functions to get the index
* if necessary
*
- * \param list a g_slist to create the combobox (succession of text and number, see gsb_combo_box_new_with_index_by_list)
+ * \param list a g_slist to create the combobox (succession of text and number, see gsb_combo_box_new_with_index_from_list)
* \param index the index to place the combobox
* \param hook an optional function to execute as a handler if the
* combobox changed.
@@ -1201,7 +1201,7 @@ GtkWidget *gsb_autofunc_combobox_new ( GSList *list,
GtkWidget *combobox;
/* create and fill the combobox */
- combobox = gsb_combo_box_new_with_index_by_list ( list, NULL, NULL );
+ combobox = gsb_combo_box_new_with_index_from_list ( list, NULL, NULL );
gsb_combo_box_set_index (combobox, index);
diff --git a/src/gsb_combo_box.c b/src/gsb_combo_box.c
index f382c3b..8cdb0f7 100644
--- a/src/gsb_combo_box.c
+++ b/src/gsb_combo_box.c
@@ -2,9 +2,10 @@
/* */
/* gsb_combo_box */
/* */
-/* Copyright (C) 2000-2006 Cédric Auger (cedric at grisbi.org) */
-/* 2003-2006 Benjamin Drieu (bdrieu at april.org) */
-/* http://www.grisbi.org */
+/* Copyright (C) 2000-2006 Cédric Auger (cedric at grisbi.org) */
+/* 2003-2006 Benjamin Drieu (bdrieu at april.org) */
+/* 2008-2011 Pierre Biava (grisbi at pierre.biava.name) */
+/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
@@ -33,12 +34,15 @@
#endif
#include "include.h"
+#include <glib/gi18n.h>
/*START_INCLUDE*/
#include "gsb_combo_box.h"
+#include "utils.h"
/*END_INCLUDE*/
/*START_STATIC*/
+static GtkListStore *gsb_combo_box_list_store_new_from_list ( GSList *list );
/*END_STATIC*/
/*START_EXTERN*/
@@ -48,9 +52,9 @@
* create a text only combo_box with an index
* column 0 will contain the text
* column 1 will have the index, in the order of the strings
- *
+ *
* this function takes an array of string and attribute a number beginning by the first element of the array
- * to link some text with a special number, use gsb_combo_box_new_with_index_by_list
+ * to link some text with a special number, use gsb_combo_box_new_with_index_from_list
*
* \param string a pointer to an array of strings terminated by NULL, string will be appended in that order
* \param func an optional function to call when change the current item (gboolean func (GtkWidget *combox, gpointer data)
@@ -59,50 +63,27 @@
* \return a combo box widget
* */
GtkWidget *gsb_combo_box_new_with_index ( gchar **string,
- GCallback func,
- gpointer data )
+ GCallback func,
+ gpointer data )
{
- GtkWidget *combo_box;
- GtkListStore *store;
- GtkCellRenderer *renderer;
- gint i = 0;
+ GtkWidget *combo;
+ GtkTreeModel *model;
- combo_box = gtk_combo_box_new ();
+ combo = gtk_combo_box_new ( );
+
+ model = GTK_TREE_MODEL ( gsb_combo_box_list_store_new_from_array ( string ) );
+ gtk_combo_box_set_model ( GTK_COMBO_BOX ( combo ), model );
+
+ gsb_combo_box_set_text_renderer ( GTK_COMBO_BOX ( combo ), 0 );
+ gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo ), 0 );
- store = gtk_list_store_new ( 2,
- G_TYPE_STRING,
- G_TYPE_INT );
- if (string)
- {
- while (string[i])
- {
- GtkTreeIter iter;
-
- gtk_list_store_append ( GTK_LIST_STORE (store),
- &iter );
- gtk_list_store_set ( store,
- &iter,
- 0, string[i],
- 1, i,
- -1 );
- i++;
- }
- }
- gtk_combo_box_set_model ( GTK_COMBO_BOX (combo_box),
- GTK_TREE_MODEL (store));
if ( func )
- g_signal_connect ( G_OBJECT (combo_box),
- "changed",
- G_CALLBACK(func),
- data );
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "text", 0,
- NULL);
-
- return combo_box;
+ g_signal_connect ( G_OBJECT ( combo ),
+ "changed",
+ G_CALLBACK ( func ),
+ data );
+
+ return combo;
}
@@ -113,67 +94,35 @@ GtkWidget *gsb_combo_box_new_with_index ( gchar **string,
*
* the function takes a g_slist of text and number to attribute
* this list must be as : text_1 -> number_1 -> text_2 -> number_2 -> ...
- *
+ *
* \param list a g_slist containing succession of text and number to associate to the text
* \param func an optional function to call when change the current item (gboolean func (GtkWidget *combox, gpointer data)
* \param data the data to send to the func
*
* \return a combo box widget
* */
-GtkWidget *gsb_combo_box_new_with_index_by_list ( GSList *list,
- GCallback func,
- gpointer data )
+GtkWidget *gsb_combo_box_new_with_index_from_list ( GSList *list,
+ GCallback func,
+ gpointer data )
{
- GSList *tmp_list;
- GtkWidget *combo_box;
- GtkListStore *store;
- GtkCellRenderer *renderer;
+ GtkWidget *combo;
+ GtkTreeModel *model;
- combo_box = gtk_combo_box_new ();
+ combo = gtk_combo_box_new ();
+
+ model = GTK_TREE_MODEL ( gsb_combo_box_list_store_new_from_list ( list ) );
+ gtk_combo_box_set_model ( GTK_COMBO_BOX ( combo ), model );
+
+ gsb_combo_box_set_text_renderer ( GTK_COMBO_BOX ( combo ), 0 );
+ gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo ), 0 );
- store = gtk_list_store_new ( 2,
- G_TYPE_STRING,
- G_TYPE_INT );
- tmp_list = list;
- if (tmp_list)
- {
- while (tmp_list)
- {
- GtkTreeIter iter;
- gchar *string;
-
- string = tmp_list -> data;
- tmp_list = tmp_list -> next;
-
- /* should not append */
- if (!tmp_list)
- break;
-
- gtk_list_store_append ( GTK_LIST_STORE (store),
- &iter );
- gtk_list_store_set ( store,
- &iter,
- 0, string,
- 1, GPOINTER_TO_INT (tmp_list -> data),
- -1 );
- tmp_list = tmp_list -> next;
- }
- }
- gtk_combo_box_set_model ( GTK_COMBO_BOX (combo_box),
- GTK_TREE_MODEL (store));
if ( func )
- g_signal_connect ( G_OBJECT (combo_box),
- "changed",
- G_CALLBACK(func),
- data );
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "text", 0,
- NULL);
-
- return combo_box;
+ g_signal_connect ( G_OBJECT ( combo ),
+ "changed",
+ G_CALLBACK ( func ),
+ data );
+
+ return combo;
}
/**
@@ -186,20 +135,19 @@ GtkWidget *gsb_combo_box_new_with_index_by_list ( GSList *list,
* */
gint gsb_combo_box_get_index ( GtkWidget *combo_box )
{
- gint index;
+ GtkTreeModel *model;
GtkTreeIter iter;
+ gint index;
if (!combo_box)
- return -1;
+ return -1;
- if ( !gtk_combo_box_get_active_iter ( GTK_COMBO_BOX (combo_box),
- &iter ))
- return -1;
+ if ( !gtk_combo_box_get_active_iter ( GTK_COMBO_BOX ( combo_box ), &iter ) )
+ return -1;
+
+ model = gtk_combo_box_get_model ( GTK_COMBO_BOX ( combo_box ) );
+ gtk_tree_model_get ( model, &iter, 1, &index, -1 );
- gtk_tree_model_get ( GTK_TREE_MODEL (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box))),
- &iter,
- 1, &index,
- -1 );
return index;
}
@@ -215,7 +163,7 @@ gint gsb_combo_box_get_index ( GtkWidget *combo_box )
* \return TRUE ok, FALSE problem
* */
gint gsb_combo_box_set_index ( GtkWidget *combo_box,
- gint index )
+ gint index )
{
GtkTreeIter iter;
GtkTreeModel *model;
@@ -247,3 +195,130 @@ gint gsb_combo_box_set_index ( GtkWidget *combo_box,
return FALSE;
}
+
+/**
+ * get the text of the current item in the combo_box given in param
+ * the combo_box must have been created with gsb_combo_box_new_with_index
+ *
+ * \param combo_box
+ *
+ * \return a newly allocated string or NULL if nothing selected
+ * */
+gchar *gsb_combo_box_get_active_text ( GtkComboBox *combo_box )
+{
+ GtkTreeIter iter;
+ gchar *string;
+
+ if ( !combo_box )
+ return NULL;
+
+ if ( !gtk_combo_box_get_active_iter ( GTK_COMBO_BOX ( combo_box ), &iter ) )
+ return NULL;
+
+ gtk_tree_model_get ( GTK_TREE_MODEL ( gtk_combo_box_get_model ( GTK_COMBO_BOX ( combo_box ) ) ),
+ &iter,
+ 0, &string,
+ -1 );
+
+ return string;
+}
+
+
+/**
+ * Cette fonction retourne un GtkListStore à partir d'un tableau de chaine
+ *
+ * \param le tableau de chaines à mettre dans le modèle
+ *
+ * \return un GtkListStore.
+ */
+GtkListStore *gsb_combo_box_list_store_new_from_array ( gchar **array )
+{
+ GtkListStore *store = NULL;
+ gint i = 0;
+
+ store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT );
+
+ while ( array[i] )
+ {
+ GtkTreeIter iter;
+ gchar *string;
+
+ string = gettext ( array[i] );
+ gtk_list_store_append ( store, &iter );
+ gtk_list_store_set ( store, &iter, 0, string, 1, i, -1 );
+
+ i++;
+ }
+
+ /* return */
+ return store;
+}
+
+
+/**
+ * Cette fonction retourne un GtkListStore à partir d'une liste
+ * TODO modifier le fonctionnement de cette liste
+ *
+ * \param le tableau de chaines à mettre dans le modèle
+ *
+ * \return un GtkListStore.
+ */
+GtkListStore *gsb_combo_box_list_store_new_from_list ( GSList *list )
+{
+ GtkListStore *store = NULL;
+ GSList *tmp_list;
+
+ store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT );
+
+ tmp_list = list;
+ while (tmp_list)
+ {
+ GtkTreeIter iter;
+ gchar *string;
+
+ string = tmp_list -> data;
+ tmp_list = tmp_list -> next;
+
+ /* should not append */
+ if ( !tmp_list )
+ break;
+
+ gtk_list_store_append ( GTK_LIST_STORE ( store ), &iter );
+ gtk_list_store_set ( store,
+ &iter,
+ 0, string,
+ 1, GPOINTER_TO_INT ( tmp_list -> data ),
+ -1 );
+
+ tmp_list = tmp_list -> next;
+ }
+
+ /* return */
+ return store;
+}
+
+
+/**
+ * Cette fonction crée la colonne visible d'un GtkComboBox
+ *
+ * \param le combo à initialiser
+ * \param le numéro de la colonne texte
+ *
+ * \return
+ */
+void gsb_combo_box_set_text_renderer ( GtkComboBox *combo,
+ gint num_col )
+{
+ GtkCellRenderer *renderer;
+
+ renderer = gtk_cell_renderer_text_new ( );
+ gtk_cell_layout_pack_start ( GTK_CELL_LAYOUT ( combo ), renderer, TRUE );
+ gtk_cell_layout_set_attributes ( GTK_CELL_LAYOUT ( combo ), renderer,
+ "text", num_col,
+ NULL );
+}
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
diff --git a/src/gsb_combo_box.h b/src/gsb_combo_box.h
index 6ce5eb3..de71a40 100644
--- a/src/gsb_combo_box.h
+++ b/src/gsb_combo_box.h
@@ -7,14 +7,19 @@
/* END_INCLUDE_H */
/* START_DECLARATION */
+gchar *gsb_combo_box_get_active_text ( GtkComboBox *combo_box );
gint gsb_combo_box_get_index ( GtkWidget *combo_box );
+GtkListStore *gsb_combo_box_list_store_new_from_array ( gchar **array );
+
GtkWidget *gsb_combo_box_new_with_index ( gchar **string,
- GCallback func,
- gpointer data );
-GtkWidget *gsb_combo_box_new_with_index_by_list ( GSList *list,
- GCallback func,
- gpointer data );
+ GCallback func,
+ gpointer data );
+GtkWidget *gsb_combo_box_new_with_index_from_list ( GSList *list,
+ GCallback func,
+ gpointer data );
gint gsb_combo_box_set_index ( GtkWidget *combo_box,
- gint index );
+ gint index );
+void gsb_combo_box_set_text_renderer ( GtkComboBox *combo,
+ gint num_col );
/* END_DECLARATION */
#endif
diff --git a/src/gsb_form_config.c b/src/gsb_form_config.c
index aa5bf03..3c1c1c5 100644
--- a/src/gsb_form_config.c
+++ b/src/gsb_form_config.c
@@ -828,8 +828,8 @@ gboolean gsb_form_config_change_column_size ( GtkWidget *tree_view,
gint account_number;
gint i;
- if ( !GTK_WIDGET_REALIZED (tree_view))
- return FALSE;
+ if ( !gtk_widget_get_realized ( tree_view ) )
+ return FALSE;
account_number = gsb_account_get_combo_account_number ( accounts_combobox );
diff --git a/src/gsb_form_scheduler.c b/src/gsb_form_scheduler.c
index 8d34a97..b24d66b 100644
--- a/src/gsb_form_scheduler.c
+++ b/src/gsb_form_scheduler.c
@@ -871,8 +871,8 @@ gboolean gsb_form_scheduler_frequency_button_changed ( GtkWidget *combo_box,
{
gchar *selected_item;
- selected_item = gtk_combo_box_get_active_text ( GTK_COMBO_BOX (combo_box));
-
+ selected_item = gsb_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) );
+
if ( !strcmp ( selected_item,
_("Once")))
{
diff --git a/src/gsb_locale.c b/src/gsb_locale.c
index 6f2b121..3b1d6b9 100644
--- a/src/gsb_locale.c
+++ b/src/gsb_locale.c
@@ -36,7 +36,7 @@ void gsb_locale_init ( void )
locale = localeconv ( );
- _locale = g_malloc ( sizeof (*_locale) );
+ _locale = g_malloc0 ( sizeof (*_locale) );
_locale -> decimal_point = g_strdup ( locale -> decimal_point );
_locale -> thousands_sep = g_strdup ( locale -> thousands_sep );
_locale -> grouping = g_strdup ( locale -> grouping );
diff --git a/src/gsb_payment_method_config.c b/src/gsb_payment_method_config.c
index 5bd55ac..6e7fcda 100644
--- a/src/gsb_payment_method_config.c
+++ b/src/gsb_payment_method_config.c
@@ -1,8 +1,9 @@
/* ************************************************************************** */
/* */
-/* copyright (c) 2000-2007 Cédric Auger (cedric at grisbi.org) */
-/* 2004-2007 Benjamin Drieu (bdrieu at april.org) */
-/* http://www.grisbi.org */
+/* copyright (c) 2000-2007 Cédric Auger (cedric at grisbi.org) */
+/* 2004-2007 Benjamin Drieu (bdrieu at april.org) */
+/* 2008-2011 Pierre Biava (grisbi at pierre.biava.name) */
+/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
@@ -35,6 +36,7 @@
#include "gsb_payment_method_config.h"
#include "dialog.h"
#include "gsb_autofunc.h"
+#include "gsb_combo_box.h"
#include "gsb_data_account.h"
#include "gsb_data_form.h"
#include "gsb_data_payment.h"
@@ -50,6 +52,7 @@
#include "traitement_variables.h"
#include "transaction_list.h"
#include "utils.h"
+#include "erreur.h"
/*END_INCLUDE*/
/*START_STATIC*/
@@ -73,8 +76,8 @@ static gboolean gsb_payment_method_config_select ( GtkTreeSelection *selection,
GtkWidget *tree_view );
static gboolean gsb_payment_method_config_show_entry_changed ( GtkWidget *button,
GtkWidget *tree_view );
-static gboolean gsb_payment_method_config_sign_changed ( GtkWidget *menu_item,
- gint *sign );
+static gboolean gsb_payment_method_config_sign_changed ( GtkWidget *combo,
+ gpointer data );
static gboolean gsb_payment_method_config_switch_payment ( gint payment_number );
static gboolean gsb_payment_method_config_toggled ( GtkCellRendererToggle *cell,
gchar *path_str,
@@ -98,6 +101,15 @@ static GtkWidget *button_show_entry;
/** Global to handle sensitiveness */
static GtkWidget *details_paddingbox;
+/* liste des signes des moyens de payement */
+static gchar *payment_sign_list[] =
+{
+ N_("Neutral"),
+ N_("Debit"),
+ N_("Credit"),
+ NULL
+};
+
/**
* Creates the "Payment methods" tab. It uses a nice GtkTreeView.
@@ -109,7 +121,7 @@ static GtkWidget *details_paddingbox;
GtkWidget *gsb_payment_method_config_create ( void )
{
GtkWidget *vbox_pref, *hbox, *scrolled_window, *paddingbox;
- GtkWidget *vbox, *table, *menu, *item, *label;
+ GtkWidget *vbox, *table, *label;
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
GtkWidget *bouton_ajouter_type;
@@ -305,41 +317,20 @@ GtkWidget *gsb_payment_method_config_create ( void )
GTK_SHRINK | GTK_FILL, 0,
0, 0 );
- /* Create menu */
- payment_sign_button = gtk_option_menu_new ();
- menu = gtk_menu_new();
- /* Neutral method_ptr */
- item = gtk_menu_item_new_with_label ( _("Neutral") );
- g_signal_connect ( G_OBJECT ( item ),
- "activate",
- G_CALLBACK ( gsb_payment_method_config_sign_changed ),
- GINT_TO_POINTER (GSB_PAYMENT_NEUTRAL));
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
- /* Debit method_ptr */
- item = gtk_menu_item_new_with_label ( _("Debit") );
- g_signal_connect ( G_OBJECT ( item ),
- "activate",
- G_CALLBACK ( gsb_payment_method_config_sign_changed ),
- GINT_TO_POINTER (GSB_PAYMENT_DEBIT));
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
- /* Credit method_ptr */
- item = gtk_menu_item_new_with_label ( _("Credit") );
- g_signal_connect ( G_OBJECT ( item ),
- "activate",
- G_CALLBACK ( gsb_payment_method_config_sign_changed ),
- GINT_TO_POINTER (GSB_PAYMENT_CREDIT));
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
- /* Set menu */
- gtk_option_menu_set_menu ( GTK_OPTION_MENU ( payment_sign_button ), menu );
+ /* Create list of sign for payment method */
+ payment_sign_button = gsb_combo_box_new_with_index ( payment_sign_list,
+ G_CALLBACK ( gsb_payment_method_config_sign_changed ),
+ NULL );
+
gtk_table_attach ( GTK_TABLE ( table ),
- payment_sign_button, 1, 3, 2, 3,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0 );
+ payment_sign_button, 1, 3, 2, 3,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0 );
- /** Do not set this tab sensitive is no account file is opened. */
+ /* Do not set this tab sensitive is no account file is opened. */
if ( !gsb_data_account_get_accounts_amount () )
{
- gtk_widget_set_sensitive ( vbox_pref, FALSE );
+ gtk_widget_set_sensitive ( vbox_pref, FALSE );
}
return ( vbox_pref );
@@ -523,8 +514,8 @@ gboolean gsb_payment_method_config_select ( GtkTreeSelection *selection,
gsb_autofunc_checkbutton_set_value ( button_auto_numbering,
gsb_data_payment_get_automatic_numbering (payment_number),
payment_number );
- gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ),
- gsb_data_payment_get_sign (payment_number));
+ gsb_combo_box_set_index ( payment_sign_button,
+ gsb_data_payment_get_sign ( payment_number ) );
/* Activating widgets */
gtk_widget_set_sensitive ( button_auto_numbering,
gsb_data_payment_get_show_entry (payment_number));
@@ -544,7 +535,7 @@ gboolean gsb_payment_method_config_select ( GtkTreeSelection *selection,
gtk_widget_set_sensitive ( button_auto_numbering, FALSE );
gtk_widget_set_sensitive ( payment_last_number_entry, FALSE );
/* We set menu to "Neutral" as a default*/
- gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ), 0);
+ gsb_combo_box_set_index ( payment_sign_button, 0);
/* Nothing to remove */
gtk_widget_set_sensitive ( payment_remove_button, TRUE );
@@ -562,7 +553,7 @@ gboolean gsb_payment_method_config_select ( GtkTreeSelection *selection,
gtk_widget_set_sensitive ( button_auto_numbering, FALSE );
gtk_widget_set_sensitive ( payment_last_number_entry, FALSE );
/* We set menu to "Neutral" as a default*/
- gtk_option_menu_set_history ( GTK_OPTION_MENU ( payment_sign_button ), 0);
+ gsb_combo_box_set_index ( payment_sign_button, 0);
/* Nothing to remove */
gtk_widget_set_sensitive ( payment_remove_button, TRUE );
@@ -946,82 +937,94 @@ gint gsb_payment_method_config_get_transaction_by_sign ( gint account_number,
*
* \return FALSE
*/
-gboolean gsb_payment_method_config_sign_changed ( GtkWidget *menu_item,
- gint *sign )
+gboolean gsb_payment_method_config_sign_changed ( GtkWidget *combo,
+ gpointer data )
{
+ GtkTreeModel *model;
GtkTreeSelection *selection;
GtkTreeIter iter;
gboolean good;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (payment_method_treeview));
- good = gtk_tree_selection_get_selected (selection, NULL, &iter);
+ selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( payment_method_treeview ) );
+ good = gtk_tree_selection_get_selected ( selection, &model, &iter );
- if (good)
+ if ( good )
{
- GtkTreeModel *model;
- gint payment_number;
-
- model = gtk_tree_view_get_model ( GTK_TREE_VIEW (payment_method_treeview));
- gtk_tree_model_get ( GTK_TREE_MODEL(model), &iter,
- PAYMENT_METHODS_NUMBER_COLUMN, &payment_number,
- -1 );
-
- if (payment_number)
- {
- gint account_number;
-
- /* Call this callback so that we "unselect" things */
- gsb_payment_method_config_select ( selection, payment_method_treeview);
-
- account_number = gsb_data_payment_get_account_number (payment_number);
-
- /* as we have changed the sign of the method of payment, check if it was the default
- * for the account, and if yes, change the default for that account */
- switch (gsb_data_payment_get_sign (payment_number))
- {
- case GSB_PAYMENT_DEBIT:
- if ( gsb_data_account_get_default_debit (account_number) == payment_number)
- {
- /* the current method of payment was a debit and was the default debit for its account,
- * so change the default to another debit */
- gsb_data_account_set_default_debit ( account_number,
- gsb_payment_method_config_get_transaction_by_sign (account_number,
- GSB_PAYMENT_DEBIT,
- payment_number));
- }
- break;
-
- case GSB_PAYMENT_CREDIT:
- if ( gsb_data_account_get_default_credit (account_number) == payment_number)
- {
- /* the current method of payment was a credit and was the default credit for its account,
- * so change the default to another credit */
- gsb_data_account_set_default_credit ( account_number,
- gsb_payment_method_config_get_transaction_by_sign (account_number,
- GSB_PAYMENT_CREDIT,
- payment_number));
- }
- break;
- }
- gsb_data_payment_set_sign ( payment_number,
- GPOINTER_TO_INT (sign));
-
- /* Update tree */
- g_signal_handlers_block_by_func ( selection,
- G_CALLBACK (gsb_payment_method_config_select),
- model );
- gsb_payment_method_config_fill_list (model);
- gtk_tree_view_expand_all ( GTK_TREE_VIEW(payment_method_treeview) );
- g_signal_handlers_unblock_by_func ( selection,
- G_CALLBACK (gsb_payment_method_config_select),
- model );
- gtk_tree_model_foreach ( GTK_TREE_MODEL (model),
- (GtkTreeModelForeachFunc) gsb_payment_method_config_foreach_select,
- GINT_TO_POINTER (payment_number));
- /* need to clear and fill the reconciliation tree becaus if it was a neutral changing to credit/debit
- * and neutral was split... */
- gsb_reconcile_sort_config_fill ();
- }
+ gint payment_number;
+ gint index;
+
+ /* on bloque l'appel à la fonction gsb_payment_method_config_sign_changed */
+ g_signal_handlers_block_by_func ( payment_sign_button,
+ G_CALLBACK ( gsb_payment_method_config_sign_changed ),
+ NULL );
+
+ index = gtk_combo_box_get_active ( GTK_COMBO_BOX ( combo ) );
+/* model = gtk_tree_view_get_model ( GTK_TREE_VIEW (payment_method_treeview)); */
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+ &iter,
+ PAYMENT_METHODS_NUMBER_COLUMN, &payment_number,
+ -1 );
+
+ if ( payment_number )
+ {
+ gint account_number;
+
+ /* Call this callback so that we "unselect" things */
+ gsb_payment_method_config_select ( selection, payment_method_treeview );
+
+ account_number = gsb_data_payment_get_account_number ( payment_number );
+
+ /* as we have changed the sign of the method of payment, check if it was the default
+ * for the account, and if yes, change the default for that account */
+ switch (gsb_data_payment_get_sign ( payment_number ) )
+ {
+ case GSB_PAYMENT_DEBIT:
+ if ( gsb_data_account_get_default_debit ( account_number ) == payment_number)
+ {
+ /* the current method of payment was a debit and was the default debit for its account,
+ * so change the default to another debit */
+ gsb_data_account_set_default_debit ( account_number,
+ gsb_payment_method_config_get_transaction_by_sign ( account_number,
+ GSB_PAYMENT_DEBIT,
+ payment_number ) );
+ }
+ break;
+
+ case GSB_PAYMENT_CREDIT:
+ if ( gsb_data_account_get_default_credit ( account_number ) == payment_number)
+ {
+ /* the current method of payment was a credit and was the default credit for its account,
+ * so change the default to another credit */
+ gsb_data_account_set_default_credit ( account_number,
+ gsb_payment_method_config_get_transaction_by_sign ( account_number,
+ GSB_PAYMENT_CREDIT,
+ payment_number ) );
+ }
+ break;
+ }
+ gsb_data_payment_set_sign ( payment_number, index );
+
+ /* Update tree */
+ g_signal_handlers_block_by_func ( selection,
+ G_CALLBACK ( gsb_payment_method_config_select ),
+ model );
+ gsb_payment_method_config_fill_list (model);
+ gtk_tree_view_expand_all ( GTK_TREE_VIEW(payment_method_treeview ) );
+ g_signal_handlers_unblock_by_func ( selection,
+ G_CALLBACK ( gsb_payment_method_config_select ),
+ model );
+ gtk_tree_model_foreach ( GTK_TREE_MODEL (model),
+ (GtkTreeModelForeachFunc) gsb_payment_method_config_foreach_select,
+ GINT_TO_POINTER (payment_number));
+
+ /* need to clear and fill the reconciliation tree becaus if it was a neutral changing to credit/debit
+ * and neutral was split... */
+ gsb_reconcile_sort_config_fill ();
+ }
+ /* on débloque l'appel à la fonction gsb_payment_method_config_sign_changed */
+ g_signal_handlers_unblock_by_func ( payment_sign_button,
+ G_CALLBACK ( gsb_payment_method_config_sign_changed ),
+ NULL );
}
return FALSE;
}
@@ -1036,119 +1039,126 @@ gboolean gsb_payment_method_config_sign_changed ( GtkWidget *menu_item,
* \return FALSE
* */
gboolean gsb_payment_method_config_add ( GtkWidget *button,
- GtkWidget *tree_view )
+ GtkWidget *tree_view )
{
- GtkTreeSelection * selection;
+ GtkTreeSelection *selection;
GtkTreeIter iter, parent, root, child, *final;
- GtkTreePath * treepath;
+ GtkTreePath *tree_path;
+ GtkTreePath *final_path;
gint account_number, type_final;
gboolean good;
gint payment_number;
GtkTreeModel *model;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
- good = gtk_tree_selection_get_selected (selection, NULL, &iter);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
+ selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+ good = gtk_tree_selection_get_selected ( selection, &model, &iter );
if ( good )
{
- /* there is a selection, get corrent iters */
- gtk_tree_model_get ( GTK_TREE_MODEL(model), &iter,
- PAYMENT_METHODS_NUMBER_COLUMN, &payment_number,
- -1 );
- if (payment_number)
- {
- /* Select parent */
- gtk_tree_model_iter_parent ( GTK_TREE_MODEL(model),
- &parent, &iter );
- final = &parent;
- type_final = gsb_data_payment_get_sign (payment_number);
- gtk_tree_model_iter_parent (GTK_TREE_MODEL(model), &root, &parent);
- }
- else
- {
- gchar *name;
-
- gtk_tree_model_get ( GTK_TREE_MODEL(model), &iter,
- PAYMENT_METHODS_NAME_COLUMN, &name,
- -1 );
-
- if (gtk_tree_model_iter_parent (GTK_TREE_MODEL(model), &root, &iter))
- {
- /* We are on "Credit" or "Debit" or "Neutral" */
- final = &iter;
- if ( !strcmp(name, _("Credit")) )
- {
- type_final = GSB_PAYMENT_CREDIT;
- }
- else if ( !strcmp(name, _("Debit")) )
- {
- type_final = GSB_PAYMENT_DEBIT;
- }
- else /* Neutral */
- {
- type_final = GSB_PAYMENT_NEUTRAL;
- }
- }
- else
- {
- /* We are on an account, method_ptr will be the same as the
- first node */
- if (!gtk_tree_model_iter_children( GTK_TREE_MODEL(model),
- &child, &iter ))
- /* Should not happen! */
- dialogue_error_brain_damage ();
-
- final = &child;
- type_final = GSB_PAYMENT_DEBIT;
- }
- }
+ /* there is a selection, get current iters */
+ gtk_tree_model_get ( GTK_TREE_MODEL( model ),
+ &iter,
+ PAYMENT_METHODS_NUMBER_COLUMN, &payment_number,
+ -1 );
+ if ( payment_number )
+ {
+ /* Select parent */
+ gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( model ), &parent, &iter );
+ final = &parent;
+ type_final = gsb_data_payment_get_sign ( payment_number );
+ gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( model ), &root, &parent );
+ /* ici root = compte, parent = type, iter = moyen de payement sélectionné */
+ }
+ else
+ {
+ gchar *name;
+
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+ &iter,
+ PAYMENT_METHODS_NAME_COLUMN, &name,
+ -1 );
+
+ if ( gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( model ), &root, &iter ) )
+ {
+ /* We are on "Credit" or "Debit" or "Neutral" */
+ final = &iter;
+ if ( !strcmp ( name, _("Credit") ) )
+ {
+ type_final = GSB_PAYMENT_CREDIT;
+ }
+ else if ( !strcmp ( name, _("Debit") ) )
+ {
+ type_final = GSB_PAYMENT_DEBIT;
+ }
+ else /* Neutral */
+ {
+ type_final = GSB_PAYMENT_NEUTRAL;
+ }
+ }
+ else
+ {
+ /* We are on an account, method_ptr will be the same as the
+ first node */
+ if ( !gtk_tree_model_iter_children ( GTK_TREE_MODEL ( model ), &child, &iter ) )
+ /* Should not happen! */
+ dialogue_error_brain_damage ();
+
+ final = &child;
+ type_final = GSB_PAYMENT_DEBIT;
+ }
+ }
}
else
{
- /* No selection, we use first account, first method*/
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL(model), &iter);
- gtk_tree_model_iter_children( GTK_TREE_MODEL(model),
- &child, &iter );
- final = &child;
- type_final = GSB_PAYMENT_DEBIT;
+ /* No selection, we use first account, first method*/
+ gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter );
+ gtk_tree_model_iter_children ( GTK_TREE_MODEL ( model ), &child, &iter );
+
+ final = &child;
+ type_final = GSB_PAYMENT_DEBIT;
}
/* final is now set on debit or credit line where we want to set the method of payment */
- gtk_tree_model_get ( GTK_TREE_MODEL(model), final,
- PAYMENT_METHODS_ACCOUNT_COLUMN, &account_number,
- -1);
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+ final,
+ PAYMENT_METHODS_ACCOUNT_COLUMN, &account_number,
+ -1 );
/* create the new method of payment */
payment_number = gsb_data_payment_new ( _("New payment method") );
- gsb_data_payment_set_sign ( payment_number,
- type_final );
- gsb_data_payment_set_account_number ( payment_number,
- account_number );
+ gsb_data_payment_set_sign ( payment_number, type_final );
+ gsb_data_payment_set_account_number ( payment_number, account_number );
/* append it to the store */
- gtk_tree_store_append (GTK_TREE_STORE (model), &iter, final);
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
- PAYMENT_METHODS_NAME_COLUMN, gsb_data_payment_get_name (payment_number),
- PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
- PAYMENT_METHODS_TYPE_COLUMN, type_final,
- PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,
- PAYMENT_METHODS_ACTIVABLE_COLUMN, type_final != 0,
- PAYMENT_METHODS_VISIBLE_COLUMN, type_final != 0,
- PAYMENT_METHODS_NUMBER_COLUMN, payment_number,
- -1 );
+ gtk_tree_store_append ( GTK_TREE_STORE ( model ), &iter, final );
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &iter,
+ PAYMENT_METHODS_NAME_COLUMN, gsb_data_payment_get_name ( payment_number ),
+ PAYMENT_METHODS_NUMBERING_COLUMN, NULL,
+ PAYMENT_METHODS_TYPE_COLUMN, type_final,
+ PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,
+ PAYMENT_METHODS_ACTIVABLE_COLUMN, type_final != 0,
+ PAYMENT_METHODS_VISIBLE_COLUMN, type_final != 0,
+ PAYMENT_METHODS_NUMBER_COLUMN, payment_number,
+ -1 );
+
+ tree_path = gtk_tree_model_get_path ( GTK_TREE_MODEL ( model ), &iter );
+ gtk_tree_model_row_inserted ( GTK_TREE_MODEL ( model ), tree_path, &iter );
/* Select and view new position */
+ final_path = gtk_tree_model_get_path ( GTK_TREE_MODEL ( model ), final );
+ if ( !gtk_tree_view_row_expanded ( GTK_TREE_VIEW ( tree_view ), final_path ) )
+ gtk_tree_view_expand_to_path ( GTK_TREE_VIEW ( tree_view ), final_path );
+ gtk_tree_path_free ( final_path );
+
gtk_tree_selection_select_iter ( selection, &iter );
- treepath = gtk_tree_model_get_path ( GTK_TREE_MODEL(model), &iter );
- gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW(tree_view), treepath, NULL,
- TRUE, 0.5, 0);
- gtk_tree_path_free ( treepath );
+
+ gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW ( tree_view ), tree_path, NULL, TRUE, 0.5, 0);
+ gtk_tree_path_free ( tree_path );
/* add to the sorted list */
- gsb_data_account_sort_list_add ( account_number,
- payment_number );
+ gsb_data_account_sort_list_add ( account_number, payment_number );
gsb_reconcile_sort_config_fill ();
/* Mark file as modified */
diff --git a/src/gsb_scheduler_list.c b/src/gsb_scheduler_list.c
index f4f083b..d662a14 100644
--- a/src/gsb_scheduler_list.c
+++ b/src/gsb_scheduler_list.c
@@ -2180,12 +2180,12 @@ gboolean gsb_scheduler_list_popup_custom_periodicity_dialog (void)
gtk_box_pack_start ( GTK_BOX(hbox2), entry, FALSE, FALSE, 6 );
/* combobox for userdefined frequency */
- combobox = gtk_combo_box_new_text ();
+ combobox = gtk_combo_box_text_new ( );
gtk_box_pack_start ( GTK_BOX(hbox2), combobox, FALSE, FALSE, 0 );
for ( i = 0; names[i]; i++ )
{
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), names[i] );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), names[i] );
}
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combobox ), affichage_echeances_perso_j_m_a );
diff --git a/src/gsb_select_icon.c b/src/gsb_select_icon.c
index d362de8..ef50611 100644
--- a/src/gsb_select_icon.c
+++ b/src/gsb_select_icon.c
@@ -41,32 +41,36 @@
/*START_STATIC*/
static gboolean gsb_select_icon_add_path ( void );
-static GtkWidget * gsb_select_icon_create_entry_text ( gchar * name_icon );
-static void gsb_select_icon_create_file_chooser ( GtkWidget * button,
- gpointer user_data );
-static GtkWidget * gsb_select_icon_create_icon_view ( gchar * name_icon );
-static void gsb_select_icon_entry_text_changed ( GtkComboBoxEntry *entry,
- gpointer user_data );
-static GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon );
+static gboolean gsb_select_icon_button_press ( GtkWidget *icon_view,
+ GdkEventButton *ev,
+ gpointer null );
+static GtkWidget *gsb_select_icon_create_entry_text ( gchar *name_icon );
+static void gsb_select_icon_create_file_chooser ( GtkWidget *button,
+ gpointer user_data );
+static GtkWidget *gsb_select_icon_create_icon_view ( gchar *name_icon );
+static void gsb_select_icon_entry_text_changed ( GtkComboBox *entry,
+ gpointer user_data );
+static GtkTreePath *gsb_select_icon_fill_icon_view ( const gchar *name_icon );
static GdkPixbuf *gsb_select_icon_resize_logo_pixbuf ( GdkPixbuf *pixbuf );
static void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
- gpointer user_data );
-static gchar * gsb_select_icon_troncate_name_icon ( gchar *name_icon, gint trunc );
+ gpointer user_data );
+static gchar *gsb_select_icon_troncate_name_icon ( gchar *name_icon,
+ gint trunc );
/*END_STATIC*/
/*START_EXTERN*/
/*END_EXTERN*/
-static GtkWidget * dialog;
-static GtkWidget * bouton_OK;
-static GtkWidget * entry_text;
-static GtkWidget * icon_view;
-static GdkPixbuf * pixbuf_logo = NULL;
+static GtkWidget *dialog;
+static GtkWidget *bouton_OK;
+static GtkWidget *entry_text;
+static GtkWidget *icon_view;
+static GdkPixbuf *pixbuf_logo = NULL;
static GtkListStore *store = NULL;
-static gchar * path_icon;
-static gchar * new_icon;
+static gchar *path_icon;
+static gchar *new_icon;
/* variables for account_icon */
static GSList *list_accounts_icon = NULL;
@@ -142,14 +146,14 @@ gboolean gsb_select_icon_init_logo_variables ( void )
*
* \return le nouveau nom de l'icône ou NULL
* */
-gchar * gsb_select_icon_create_window ( gchar *name_icon )
+gchar *gsb_select_icon_create_window ( gchar *name_icon )
{
GtkWidget *content_area;
GtkWidget *hbox;
GtkWidget *chooser_button;
GtkWidget *scroll;
GtkWidget *icon_view;
- gint result;
+ gint result;
devel_debug ( name_icon );
@@ -177,10 +181,10 @@ gchar * gsb_select_icon_create_window ( gchar *name_icon )
/* création hbox pour GtkEntry répertoire et bouton sélection des répertoires */
hbox = gtk_hbox_new ( FALSE, 5);
- gtk_container_set_border_width ( GTK_CONTAINER( hbox ), 6 );
+ gtk_container_set_border_width ( GTK_CONTAINER( hbox ), 6 );
gtk_box_pack_start ( GTK_BOX ( content_area ), hbox, FALSE, FALSE, 5 );
- /* création du GtkComboBoxEntry pour la saisie du répertoire */
+ /* création du GtkComboBox pour la saisie du répertoire */
entry_text = gsb_select_icon_create_entry_text ( name_icon );
gtk_box_pack_start ( GTK_BOX ( hbox ), entry_text, TRUE, TRUE, 0 );
@@ -198,37 +202,46 @@ gchar * gsb_select_icon_create_window ( gchar *name_icon )
gtk_container_add ( GTK_CONTAINER ( scroll ), icon_view );
/* gestion des signaux */
- g_signal_connect ( G_OBJECT ( icon_view ),
- "selection-changed",
- G_CALLBACK( gsb_select_icon_selection_changed ),
+ g_signal_connect ( G_OBJECT ( icon_view ),
+ "selection-changed",
+ G_CALLBACK ( gsb_select_icon_selection_changed ),
NULL );
- g_signal_connect ( G_OBJECT ( chooser_button ),
- "clicked",
- G_CALLBACK(gsb_select_icon_create_file_chooser),
+ g_signal_connect ( G_OBJECT ( icon_view ),
+ "button-press-event",
+ G_CALLBACK ( gsb_select_icon_button_press ),
NULL );
- g_signal_connect ( G_OBJECT( entry_text ),
- "changed",
- G_CALLBACK( gsb_select_icon_entry_text_changed ),
+ g_signal_connect ( G_OBJECT ( chooser_button ),
+ "clicked",
+ G_CALLBACK ( gsb_select_icon_create_file_chooser ),
+ NULL );
+
+ g_signal_connect ( G_OBJECT( entry_text ),
+ "changed",
+ G_CALLBACK ( gsb_select_icon_entry_text_changed ),
NULL );
gtk_widget_show_all ( dialog );
- result = gtk_dialog_run (GTK_DIALOG (dialog));
- switch (result)
+ result = gtk_dialog_run ( GTK_DIALOG ( dialog ) );
+ switch ( result )
{
- case GTK_RESPONSE_ACCEPT:
- devel_debug ( "réponse OK" );
- break;
- default:
- devel_debug ( "réponse Non OK" );
- if ( new_icon && strlen ( new_icon ) > 0 )
- g_free ( new_icon );
- new_icon = NULL;
+ case GTK_RESPONSE_ACCEPT:
+ devel_debug ( "réponse OK" );
+ break;
+ case GTK_RESPONSE_NONE:
+ devel_debug ( "réponse NONE" );
+ break;
+ default:
+ devel_debug ( "réponse Non OK" );
+ if ( new_icon && strlen ( new_icon ) > 0 )
+ g_free ( new_icon );
+ new_icon = NULL;
break;
}
- gtk_widget_destroy (dialog);
+ if ( GTK_IS_WIDGET ( dialog ) )
+ gtk_widget_destroy ( dialog );
return new_icon;
}
@@ -242,18 +255,13 @@ gchar * gsb_select_icon_create_window ( gchar *name_icon )
*
* \return le GtkComboBox
* */
-GtkWidget * gsb_select_icon_create_entry_text ( gchar * name_icon )
+GtkWidget *gsb_select_icon_create_entry_text ( gchar *name_icon )
{
GtkWidget *combo;
GtkTreeIter iter;
- if ( store )
- {
- devel_debug ( "combo existe" );
- }
- else
+ if ( !store )
{
- devel_debug ( "combo n'existe pas" );
store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT );
gtk_list_store_append (store, &iter);
if ( g_strcmp0 ( gsb_dirs_get_pixmaps_dir ( ), path_icon ) != 0 )
@@ -264,8 +272,10 @@ GtkWidget * gsb_select_icon_create_entry_text ( gchar * name_icon )
gtk_list_store_set (store, &iter, 0, path_icon, -1);
}
- combo = gtk_combo_box_entry_new_with_model ( GTK_TREE_MODEL ( store ), 0 );
- gtk_entry_set_text ( GTK_ENTRY (GTK_BIN (combo)->child), name_icon );
+ combo = gtk_combo_box_new_with_model_and_entry ( GTK_TREE_MODEL ( store ) );
+ gtk_combo_box_set_entry_text_column ( GTK_COMBO_BOX ( combo ), 0 );
+
+ gtk_entry_set_text ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( combo ) ) ), name_icon );
return combo;
}
@@ -277,9 +287,9 @@ GtkWidget * gsb_select_icon_create_entry_text ( gchar * name_icon )
* \param nom de l'icône
*
* \return le GtkIconView rempli avec l'icône sélectionnée au premier plan
- *
+ *
* */
-GtkWidget * gsb_select_icon_create_icon_view ( gchar * name_icon )
+GtkWidget *gsb_select_icon_create_icon_view ( gchar *name_icon )
{
GtkTreePath * tree_path;
@@ -314,16 +324,15 @@ GtkWidget * gsb_select_icon_create_icon_view ( gchar * name_icon )
* \return un GtkTreePath qui donne la position de l'icône passée
* en paramètre
* */
-GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon )
+GtkTreePath *gsb_select_icon_fill_icon_view ( const gchar *name_icon )
{
GDir *dir;
GError *error = NULL;
GtkTreePath *tree_path = NULL;
-
devel_debug ( path_icon );
-
+
dir = g_dir_open ( path_icon, 0, &error );
if ( dir )
{
@@ -333,41 +342,53 @@ GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon )
GSList *liste = NULL;
gint i = 0;
const gchar *name = NULL;
-
- while ( (name = g_dir_read_name ( dir ) ) )
+
+ while ( ( name = g_dir_read_name ( dir ) ) )
{
liste = g_slist_append ( liste, g_strdup ( name ) );
}
liste = g_slist_sort ( liste, (GCompareFunc) my_strcasecmp );
+
store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
+
while ( liste )
{
- gchar *tmpstr = g_strconcat ( path_icon, G_DIR_SEPARATOR_S,
- liste -> data, NULL );
- if ( g_strcmp0 ( tmpstr, name_icon ) == 0 )
+ gchar *tmp_str = NULL;
+
+ tmp_str = g_build_filename ( path_icon, liste -> data, NULL );
+ if ( g_file_test ( tmp_str, G_FILE_TEST_IS_DIR ) )
{
- gchar *tmpstr = utils_str_itoa ( i );
- tree_path = gtk_tree_path_new_from_string ( tmpstr );
- g_free ( tmpstr );
+ g_free ( tmp_str );
+ tmp_str = g_build_filename ( gsb_dirs_get_pixmaps_dir ( ), "folder.png", NULL );
}
- pixbuf = gdk_pixbuf_new_from_file_at_size ( tmpstr, 32, 32, NULL);
+ if ( g_strcmp0 ( tmp_str, name_icon ) == 0 )
+ {
+ gchar *index_str;
+
+ index_str = utils_str_itoa ( i );
+ tree_path = gtk_tree_path_new_from_string ( index_str );
+ g_free ( index_str );
+ }
+ pixbuf = gdk_pixbuf_new_from_file_at_size ( tmp_str, 32, 32, NULL );
if ( pixbuf )
{
- gchar *tmpstr;
+ gchar *icon_str;
gtk_list_store_append ( store, &iter );
- tmpstr = gsb_select_icon_troncate_name_icon ( liste -> data, 10 );
- gtk_list_store_set (store, &iter, PIXBUF_COLUMN, pixbuf,
- TEXT_COLUMN, tmpstr, -1);
- g_free ( tmpstr );
- g_object_unref (pixbuf);
+ icon_str = gsb_select_icon_troncate_name_icon ( liste -> data, 10 );
+ gtk_list_store_set (store, &iter,
+ PIXBUF_COLUMN, pixbuf,
+ TEXT_COLUMN, icon_str,
+ -1);
+ g_free ( icon_str );
+ g_object_unref ( pixbuf );
}
- g_free ( tmpstr );
+ g_free ( tmp_str );
liste = liste -> next;
i++;
}
- gtk_icon_view_set_model (GTK_ICON_VIEW ( icon_view ), GTK_TREE_MODEL (store));
+ gtk_icon_view_set_model (GTK_ICON_VIEW ( icon_view ), GTK_TREE_MODEL ( store ) );
g_dir_close ( dir );
}
else
@@ -378,6 +399,8 @@ GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon )
if ( tree_path == NULL )
tree_path = gtk_tree_path_new_from_string ( "0" );
+
+ /* return */
return tree_path;
}
@@ -389,10 +412,10 @@ GtkTreePath * gsb_select_icon_fill_icon_view ( gchar * name_icon )
* \param bouton appelant
*
* \return void
- *
+ *
* */
-void gsb_select_icon_create_file_chooser ( GtkWidget * button,
- gpointer user_data )
+void gsb_select_icon_create_file_chooser ( GtkWidget *button,
+ gpointer user_data )
{
GtkWidget *chooser;
GtkFileFilter *filter;
@@ -404,12 +427,12 @@ void gsb_select_icon_create_file_chooser ( GtkWidget * button,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- gtk_window_set_position ( GTK_WINDOW (chooser), GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_position ( GTK_WINDOW (chooser), GTK_WIN_POS_CENTER_ON_PARENT );
gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (dialog));
- gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
gtk_widget_set_size_request ( chooser, 600, 750 );
filter = gtk_file_filter_new ();
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter);
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter);
gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER ( chooser ), path_icon );
if (gtk_dialog_run (GTK_DIALOG ( chooser ) ) == GTK_RESPONSE_ACCEPT )
{
@@ -437,27 +460,28 @@ void gsb_select_icon_create_file_chooser ( GtkWidget * button,
* \param le GtkComboBoxEntry appellant
*
* \return void
- *
+ *
* */
-void gsb_select_icon_entry_text_changed ( GtkComboBoxEntry *entry,
- gpointer user_data )
+void gsb_select_icon_entry_text_changed ( GtkComboBox *entry,
+ gpointer user_data )
{
GtkTreePath *path;
- const gchar *tmpstr;
+ const gchar *tmp_str;
gchar *ptr;
- tmpstr = gtk_entry_get_text ( GTK_ENTRY (GTK_BIN (entry_text)->child ) );
- devel_debug ( tmpstr );
- ptr = g_strstr_len ( tmpstr, -1, path_icon );
+ tmp_str = gtk_entry_get_text ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( entry ) ) ) );
+ devel_debug ( tmp_str );
+
+ ptr = g_strstr_len ( tmp_str, -1, path_icon );
if ( ptr == NULL )
{
- if ( g_file_test ( tmpstr, G_FILE_TEST_IS_DIR ) )
+ if ( g_file_test ( tmp_str, G_FILE_TEST_IS_DIR ) )
{
- path_icon = g_strdup ( tmpstr );
+ path_icon = g_strdup ( tmp_str );
path = gsb_select_icon_fill_icon_view ( NULL );
- gtk_icon_view_scroll_to_path (GTK_ICON_VIEW ( icon_view ),
- path, TRUE, 0.5, 0 );
- gtk_widget_set_sensitive (bouton_OK, FALSE );
+ gtk_icon_view_scroll_to_path (GTK_ICON_VIEW ( icon_view ), path, TRUE, 0.5, 0 );
+
+ gtk_widget_set_sensitive ( bouton_OK, FALSE );
}
}
}
@@ -468,13 +492,13 @@ void gsb_select_icon_entry_text_changed ( GtkComboBoxEntry *entry,
*
* \param le GtkIconView appellant
*
- * \return
- *
+ * \return void
+ *
* */
void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
gpointer user_data )
{
- GList * liste;
+ GList *liste;
GtkTreePath *path;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -483,8 +507,8 @@ void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
liste = gtk_icon_view_get_selected_items ( GTK_ICON_VIEW ( icon_view ) );
/* Could happen if selection is unset, exiting then. */
- if ( ! liste )
- return;
+ if ( !liste )
+ return;
path = liste -> data;
@@ -495,11 +519,12 @@ void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
devel_debug ( name_icon );
if ( name_icon && strlen ( name_icon ) > 0 )
{
- new_icon = g_strconcat ( path_icon, G_DIR_SEPARATOR_S,
- name_icon, NULL );
- gtk_entry_set_text ( GTK_ENTRY (GTK_BIN (entry_text)->child ),
- new_icon );
+ new_icon = g_build_filename ( path_icon, name_icon, NULL );
+ gtk_entry_set_text ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( entry_text ) ) ), new_icon );
+
gtk_widget_set_sensitive (bouton_OK, TRUE );
+
+ g_free ( name_icon );
}
}
@@ -512,7 +537,8 @@ void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
*
* \return le nom de l'icône sur une ou plusieurs lignes
* */
-gchar * gsb_select_icon_troncate_name_icon ( gchar *name_icon, gint trunc )
+gchar *gsb_select_icon_troncate_name_icon ( gchar *name_icon,
+ gint trunc )
{
glong size = g_utf8_strlen (name_icon, -1);
@@ -597,7 +623,7 @@ gboolean gsb_select_icon_add_path ( void )
* \param pixbuf
*
* */
-gchar * gsb_select_icon_create_chaine_base64_from_pixbuf ( GdkPixbuf *pixbuf )
+gchar *gsb_select_icon_create_chaine_base64_from_pixbuf ( GdkPixbuf *pixbuf )
{
GdkPixdata pixdata;
guint8 *str;
@@ -1006,6 +1032,66 @@ gboolean gsb_select_icon_remove_account_pixbuf ( gint account_number )
return FALSE;
}
+
+/**
+ * called when we press a button on the list
+ *
+ * \param tree_view
+ * \param ev
+ *
+ * \return FALSE
+ * */
+gboolean gsb_select_icon_button_press ( GtkWidget *icon_view,
+ GdkEventButton *ev,
+ gpointer null )
+{
+ if ( ev -> type == GDK_2BUTTON_PRESS )
+ {
+ GtkTreePath *path = NULL;
+
+ if ( ( path = gtk_icon_view_get_path_at_pos ( GTK_ICON_VIEW ( icon_view ), ev -> x, ev -> y ) ) )
+ {
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *name_icon = NULL;
+ gchar *tmp_str;
+
+ model = gtk_icon_view_get_model ( GTK_ICON_VIEW ( icon_view ) );
+ if (gtk_tree_model_get_iter ( GTK_TREE_MODEL (model), &iter, path ))
+ gtk_tree_model_get (model, &iter, TEXT_COLUMN, &name_icon, -1);
+ printf ("name_icon = %s\n", name_icon);
+ tmp_str = my_strdelimit ( name_icon, "\n", "" );
+ devel_debug ( tmp_str );
+ gtk_tree_path_free ( path );
+
+ name_icon = g_build_filename ( path_icon, tmp_str, NULL );
+ g_free ( tmp_str );
+ g_free ( path_icon );
+ path_icon = name_icon;
+
+ if ( g_file_test ( path_icon, G_FILE_TEST_IS_DIR ) )
+ {
+ path = gsb_select_icon_fill_icon_view ( NULL );
+ gtk_icon_view_scroll_to_path (GTK_ICON_VIEW ( icon_view ), path, TRUE, 0.5, 0 );
+ gsb_select_icon_add_path ( );
+ gtk_entry_set_text ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( entry_text ) ) ), path_icon );
+ gtk_widget_set_sensitive (bouton_OK, FALSE );
+ gtk_tree_path_free ( path );
+ }
+ else
+ {
+ new_icon = g_strdup ( path_icon );
+ gtk_widget_destroy ( dialog );
+ }
+
+ return FALSE;
+ }
+ }
+
+ return FALSE;
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
diff --git a/src/gsb_select_icon.h b/src/gsb_select_icon.h
index 7d18c6e..88d607b 100644
--- a/src/gsb_select_icon.h
+++ b/src/gsb_select_icon.h
@@ -12,7 +12,7 @@
/* START_DECLARATION */
GdkPixbuf *gsb_select_icon_change_account_pixbuf ( gint account_number,
gchar *filename );
-gchar * gsb_select_icon_create_chaine_base64_from_pixbuf ( GdkPixbuf *pixbuf );
+gchar *gsb_select_icon_create_chaine_base64_from_pixbuf ( GdkPixbuf *pixbuf );
GdkPixbuf *gsb_select_icon_create_pixbuf_from_chaine_base64 ( gchar *str_base64 );
gchar * gsb_select_icon_create_window ( gchar *name_icon );
GdkPixbuf *gsb_select_icon_get_account_pixbuf ( gint account_number );
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 94eaa82..bb7879f 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -1174,6 +1174,7 @@ gfloat gsb_transactions_list_get_row_align ( void )
GtkTreePath *path;
GtkTreeView *tree_view;
GdkRectangle back_rect;
+ GdkWindow *window;
gint height_win;
gfloat row_align;
gfloat height, rect_y;
@@ -1184,13 +1185,14 @@ gfloat gsb_transactions_list_get_row_align ( void )
path = transaction_list_select_get_path (0);
if (!path)
- return 0;
+ return 0;
- if ( !GDK_IS_DRAWABLE ( gtk_tree_view_get_bin_window ( tree_view ) ) )
+ window = gtk_tree_view_get_bin_window ( t_bin_window ( tree_view ) ) ) e64 ); _text ) ) ), path_icon ); it r data) x pÿ ¸pÿ uJwG9+ jxG9+ eG9+ XH9+ ¸pÿ p¶H9+ ð¬pÿ À«pÿ k`wG9+ 6 è è! è! ·pÿ ¸pÿ xH9+ ðpÿ BwG9+ `wG9+ ·pÿ `BwG9+ Ï·pÿ ÀøH9+ uJwG9+ øH9+ ØøH9+ ¨ øH9+ jxG9+ xH9+ ðpÿ À¬pÿ k`wG9+ à! à! ·pÿ ¸pÿ HÞsH9+ Юpÿ BwG9+ `wG9+ ·pÿ `BwG9+ Ï·pÿ À·pÿ ¸·pÿ 8kG9+ p ¸pÿ uJwG9+ jxG9+ Юpÿ pÿ k`wG9+ G H I J K M N O P ·pÿ ¸pÿ HJH9+ p°pÿ BwG9+ `wG9+ ·pÿ 0øH9+ uJwG9+ H9+ É'H9+ øH9+ ØøH9+ ¨ øH9+ jxG9+ HJH9+ p°pÿ
°®pÿ k`wG9+ 8JH9+ p°pÿ à®pÿ k`wG9+ (JH9+ p°pÿ ¯pÿ k`wG9+ JH9+ p°pÿ @¯pÿ k`wG9+ ¨øH9+ uJwG9+ ¨ øH9+ À©pÿ (H9+ eIwG9+ ØøH9+ à¯pÿ y(H9+ eIwG9+ øH9+ °pÿ Z(H9+ eIwG9+ ØÄ'H9+ H9+ É'H9+ øH9+ Ø$H9+ ØøH9+ ¨ øH9+ jxG9+ 8kG9+ óG9+ ¸pÿ p['H9+ À±pÿ °pÿ k`wG9+ 5 6 7 8 : < = > ? @ B D ·pÿ ¸pÿ àðG9+ ¸pÿ uJwG9+ eG9+ @°pÿ óG9+ eIwG9+ eG9+ Õ_ at fÆS Qöl±íÁ£¿G9+ ¸pÿ àðG9+ вpÿ ±pÿ k`wG9+ u]ÞÓ 4Q ÷U^Qʧ ¶uª¹ñìò*Äv·pÿ ¸pÿ HÞ¼G9+ $ùG9+ @¹pÿ ¦0[I9+ ¦0[I9+ vöG9+ Ï·pÿ ¹pÿ ¸·pÿ ´pÿ /H9+ uJwG9+ Ø$H9+ ºpÿ ¢0[I9+ P¹pÿ à´p
ÿ ÿÿÿÿÿÿÿÿ¢0[I9+ ¸pÿ tree_view );
+ if ( !GDK_IS_DRAWABLE ( window ) )
return 0;
- gdk_drawable_get_size ( GDK_DRAWABLE (gtk_tree_view_get_bin_window (tree_view)),
- NULL, &height_win);
+ height_win = gdk_window_get_height ( window );
+
gtk_tree_view_get_background_area (tree_view, path, NULL, &back_rect);
gtk_tree_path_free (path);
diff --git a/src/gtk_combofix.c b/src/gtk_combofix.c
index b06016e..6f3eb2d 100644
--- a/src/gtk_combofix.c
+++ b/src/gtk_combofix.c
@@ -1303,7 +1303,7 @@ static gboolean gtk_combofix_set_popup_position ( GtkComboFix *combofix )
"horizontal-separator", &horizontal_separator,
NULL );
- if ( GTK_WIDGET_REALIZED ( priv -> tree_view ) )
+ if ( gtk_widget_get_realized ( priv -> tree_view ) )
{
gtk_tree_view_get_cell_area ( GTK_TREE_VIEW ( priv -> tree_view),
gtk_tree_path_new_first ( ),
diff --git a/src/help.c b/src/help.c
index 313dbd3..3da1db9 100644
--- a/src/help.c
+++ b/src/help.c
@@ -40,6 +40,10 @@
/*END_INCLUDE*/
/*START_STATIC*/
+static gboolean url_clicked ( GtkAboutDialog *label,
+ gchar *uri,
+ gpointer user_data );
+
static void launch_url (GtkAboutDialog *about, const gchar * link, gpointer data);
/*END_STATIC*/
@@ -47,32 +51,30 @@ static void launch_url (GtkAboutDialog *about, const gchar * link, gpointer data
/*START_EXTERN*/
/*END_EXTERN*/
-
/**
- * Handler used to pop up a web browser when user clicked on a link in
+ * Handler used to lauch a mailer or browser when user clicked on a link in
* the GtkAboutDialog.
*
- * \param about Dialog that triggered the event.
- * \param link URL to display.
- * \param data Not used.
+ * \param label link that triggered the event.
+ * \param uri URL to display.
+ * \param data Not used.
*/
-void launch_url (GtkAboutDialog *about, const gchar * link, gpointer data)
+gboolean url_clicked ( GtkAboutDialog *label,
+ gchar *uri,
+ gpointer user_data )
{
- lance_navigateur_web ( link );
-}
+ if ( g_str_has_prefix ( uri, "mailto:" ) )
+ {
+ gchar *str;
+ str = gsb_string_remplace_string ( uri, "%40", "@" );
+ lance_mailer ( str );
+ g_free ( str );
+ }
+ else
+ lance_navigateur_web ( uri );
-/**
- * Handler used to pop up a mailer when user clicked on a link in
- * the GtkAboutDialog.
- *
- * \param about Dialog that triggered the event.
- * \param link URL to display.
- * \param data Not used.
- */
-void launch_mailto (GtkAboutDialog *about, const gchar * link, gpointer data)
-{
- lance_mailer ( link );
+ return TRUE;
}
@@ -203,8 +205,6 @@ NULL};
}
about = gtk_about_dialog_new ( );
- gtk_about_dialog_set_url_hook (launch_url, NULL, NULL);
- gtk_about_dialog_set_email_hook (launch_mailto, NULL, NULL);
gtk_about_dialog_set_program_name ( GTK_ABOUT_DIALOG (about), "Grisbi" );
gtk_about_dialog_set_logo ( GTK_ABOUT_DIALOG (about), logo );
gtk_about_dialog_set_comments ( GTK_ABOUT_DIALOG (about), comments );
@@ -226,6 +226,11 @@ NULL};
g_free ( version_to_string );
g_free ( comments );
+ g_signal_connect ( G_OBJECT ( about ),
+ "activate-link",
+ G_CALLBACK ( url_clicked ),
+ NULL );
+
gtk_dialog_run ( GTK_DIALOG (about)) ;
gtk_widget_destroy (about);
diff --git a/src/import.c b/src/import.c
index 510303b..6b59100 100644
--- a/src/import.c
+++ b/src/import.c
@@ -1241,7 +1241,7 @@ GtkWidget *cree_ligne_recapitulatif ( struct struct_compte_importation * compte
gtk_container_add ( GTK_CONTAINER ( alignement ), label );
gtk_box_pack_start ( GTK_BOX ( compte -> hbox1 ), alignement, FALSE, FALSE, 0 );
- compte -> bouton_type_compte = gsb_combo_box_new_with_index_by_list (
+ compte -> bouton_type_compte = gsb_combo_box_new_with_index_from_list (
gsb_account_property_create_combobox_list (),
NULL, NULL );
gtk_box_pack_start ( GTK_BOX ( compte -> hbox1 ), compte -> bouton_type_compte,
diff --git a/src/import_csv.c b/src/import_csv.c
index 1ce3663..3906a01 100644
--- a/src/import_csv.c
+++ b/src/import_csv.c
@@ -133,16 +133,15 @@ GtkWidget * import_create_csv_preview_page ( GtkWidget * assistant )
hbox = gtk_hbox_new ( FALSE, 12 );
gtk_box_pack_start ( GTK_BOX(paddingbox), hbox, FALSE, FALSE, 0 );
- combobox = gtk_combo_box_new_text ();
+ combobox = gtk_combo_box_text_new ();
do
{
- gchar * complete_name = g_strdup_printf ( "%s : \"%s\"",
- _(csv_separators [ i ] . name),
- ( csv_separators [ i ] . value ?
- csv_separators [ i ] . value : "" ) );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( combobox ), complete_name );
- g_free ( complete_name );
-
+ gchar * complete_name = g_strdup_printf ( "%s : \"%s\"",
+ _(csv_separators [ i ] . name),
+ ( csv_separators [ i ] . value ?
+ csv_separators [ i ] . value : "" ) );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( combobox ), complete_name );
+ g_free ( complete_name );
}
while ( csv_separators [ i ++ ] . value );
diff --git a/src/main.c b/src/main.c
index 8662653..6967d82 100644
--- a/src/main.c
+++ b/src/main.c
@@ -135,8 +135,6 @@ int main ( int argc, char **argv )
g_mem_set_vtable(glib_mem_profiler_table);
#endif
- gsb_dirs_init ( );
-
#ifdef _WIN32
main_win_32 ( argc, argv );
#else
@@ -146,15 +144,6 @@ int main ( int argc, char **argv )
main_linux ( argc, argv );
#endif /* GTKOSXAPPLICATION || linux */
#endif /* _WIN32 */
- gsb_locale_shutdown ( );
- gsb_dirs_shutdown ( );
-
- /* liberation libgoffice */
- libgoffice_shutdown ( );
-
-#if GSB_GMEMPROFILE
- g_mem_profile();
-#endif
exit ( 0 );
}
@@ -179,7 +168,6 @@ void main_linux ( int argc, char **argv )
/* Setup locale/gettext */
setlocale (LC_ALL, "");
-
gsb_locale_init ( );
#if IS_DEVELOPMENT_VERSION == 1
@@ -193,6 +181,9 @@ void main_linux ( int argc, char **argv )
/* Initialize plugins manager */
go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
+ /* initialisation des différents répertoires */
+ gsb_dirs_init ( );
+
/* on commence par détourner le signal SIGSEGV */
gsb_grisbi_trappe_signal_sigsegv ( );
@@ -225,6 +216,19 @@ void main_linux ( int argc, char **argv )
/* sauvegarde les raccourcis claviers */
gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
+
+ /* libération de mémoire */
+ gsb_locale_shutdown ( );
+ gsb_dirs_shutdown ( );
+
+ /* liberation libgoffice */
+ libgoffice_shutdown ( );
+
+#if GSB_GMEMPROFILE
+ g_mem_profile();
+#endif
+
+ exit ( 0 );
}
@@ -267,9 +271,11 @@ void main_mac_osx ( int argc, char **argv )
/* Setup locale/gettext */
setlocale (LC_ALL, "");
-
gsb_locale_init ( );
+ /* initialisation des différents répertoires */
+ gsb_dirs_init ( );
+
/* on commence par détourner le signal SIGSEGV */
gsb_grisbi_trappe_signal_sigsegv ( );
@@ -338,6 +344,18 @@ void main_mac_osx ( int argc, char **argv )
g_object_unref ( theApp );
+ gsb_locale_shutdown ( );
+ gsb_dirs_shutdown ( );
+
+ /* liberation libgoffice */
+ libgoffice_shutdown ( );
+
+#if GSB_GMEMPROFILE
+ g_mem_profile();
+#endif
+
+ exit ( 0 );
+
#endif /* GTKOSXAPPLICATION */
}
@@ -384,6 +402,9 @@ void main_win_32 ( int argc, char **argv )
win32_parse_gtkrc ( "gtkrc" );
+ /* initialisation des différents répertoires */
+ gsb_dirs_init ( );
+
/* parse command line parameter, exit with correct error code when needed */
if ( !parse_options (argc, argv, &opt, &status ) )
exit ( status );
@@ -414,6 +435,18 @@ void main_win_32 ( int argc, char **argv )
/* sauvegarde les raccourcis claviers */
gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
+ gsb_locale_shutdown ( );
+ gsb_dirs_shutdown ( );
+
+ /* liberation libgoffice */
+ libgoffice_shutdown ( );
+
+#if GSB_GMEMPROFILE
+ g_mem_profile();
+#endif
+
+ exit ( 0 );
+
#endif /* WIN_32 */
}
diff --git a/src/parametres.c b/src/parametres.c
index 7bbfee2..09fa31e 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -86,11 +86,13 @@ static gboolean gsb_gui_delete_msg_toggled ( GtkCellRendererToggle *cell, gchar
GtkTreeModel * model );
static gboolean gsb_gui_messages_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
GtkTreeModel * model );
-static void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user_data );
+static void gsb_localisation_decimal_point_changed ( GtkComboBoxText *widget,
+ gpointer user_data );
static gboolean gsb_localisation_format_date_toggle ( GtkToggleButton *togglebutton,
GdkEventButton *event,
gpointer user_data);
-static void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user_data );
+static void gsb_localisation_thousands_sep_changed ( GtkComboBoxText *widget,
+ gpointer user_data );
static void gsb_localisation_update_affichage ( gint type_maj );
static GtkWidget *onglet_delete_messages ( void );
static GtkWidget *onglet_fichier ( void );
@@ -1381,11 +1383,11 @@ GtkWidget *gsb_config_number_format_chosen ( GtkWidget *parent, gint sens )
gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), label );
gtk_box_pack_start ( GTK_BOX ( dec_hbox ), label, FALSE, FALSE, 0 );
- dec_sep = gtk_combo_box_entry_new_text ( );
- gtk_editable_set_editable ( GTK_EDITABLE ( GTK_BIN ( dec_sep ) -> child ), FALSE );
- gtk_entry_set_width_chars ( GTK_ENTRY ( GTK_BIN ( dec_sep ) -> child ), 5 );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( dec_sep ), "." );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( dec_sep ), "," );
+ dec_sep = gtk_combo_box_text_new_with_entry ( );
+ gtk_editable_set_editable ( GTK_EDITABLE ( gtk_bin_get_child ( GTK_BIN ( dec_sep ) ) ), FALSE );
+ gtk_entry_set_width_chars ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( dec_sep ) ) ), 5 );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( dec_sep ), "." );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( dec_sep ), "," );
gtk_box_pack_start ( GTK_BOX ( dec_hbox ), dec_sep, FALSE, FALSE, 0 );
thou_hbox = gtk_hbox_new ( FALSE, 0 );
@@ -1394,13 +1396,13 @@ GtkWidget *gsb_config_number_format_chosen ( GtkWidget *parent, gint sens )
gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), label );
gtk_box_pack_start ( GTK_BOX ( thou_hbox ), label, FALSE, FALSE, 0 );
- thou_sep = gtk_combo_box_entry_new_text ( );
- gtk_editable_set_editable ( GTK_EDITABLE ( GTK_BIN ( thou_sep ) -> child ), FALSE );
- gtk_entry_set_width_chars ( GTK_ENTRY ( GTK_BIN ( thou_sep ) -> child ), 5 );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( thou_sep ), "' '" );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( thou_sep ), "." );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( thou_sep ), "," );
- gtk_combo_box_append_text ( GTK_COMBO_BOX ( thou_sep ), "''" );
+ thou_sep = gtk_combo_box_text_new_with_entry ( );
+ gtk_editable_set_editable ( GTK_EDITABLE ( gtk_bin_get_child ( GTK_BIN ( thou_sep ) ) ), FALSE );
+ gtk_entry_set_width_chars ( GTK_ENTRY ( gtk_bin_get_child ( GTK_BIN ( thou_sep ) ) ), 5 );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( thou_sep ), "' '" );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( thou_sep ), "." );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( thou_sep ), "," );
+ gtk_combo_box_text_append_text ( GTK_COMBO_BOX_TEXT ( thou_sep ), "''" );
gtk_box_pack_start ( GTK_BOX ( thou_hbox ), thou_sep, FALSE, FALSE, 0 );
@@ -1461,21 +1463,21 @@ GtkWidget *gsb_config_number_format_chosen ( GtkWidget *parent, gint sens )
*
*
* */
-void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user_data )
+void gsb_localisation_decimal_point_changed ( GtkComboBoxText *widget, gpointer user_data )
{
GtkWidget *combo_box;
GtkWidget *entry;
gchar *str_capital;
const gchar *text;
- text = gtk_combo_box_get_active_text ( widget );
+ text = gtk_combo_box_text_get_active_text ( widget );
combo_box = g_object_get_data ( G_OBJECT ( widget ), "separator" );
if ( g_strcmp0 ( text, "," ) == 0 )
{
gsb_locale_set_mon_decimal_point ( "," );
- if ( g_strcmp0 ( gtk_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) ), "," ) == 0 )
+ if ( g_strcmp0 ( gtk_combo_box_text_get_active_text ( GTK_COMBO_BOX_TEXT ( combo_box ) ), "," ) == 0 )
{
gsb_locale_set_mon_thousands_sep ( " " );
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo_box ), 0 );
@@ -1484,7 +1486,7 @@ void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user
else
{
gsb_locale_set_mon_decimal_point ( "." );
- if ( g_strcmp0 ( gtk_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) ), "." ) == 0 )
+ if ( g_strcmp0 ( gtk_combo_box_text_get_active_text ( GTK_COMBO_BOX_TEXT ( combo_box ) ), "." ) == 0 )
{
gsb_locale_set_mon_thousands_sep ( "," );
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo_box ), 2 );
@@ -1514,14 +1516,14 @@ void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user
*
*
* */
-void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user_data )
+void gsb_localisation_thousands_sep_changed ( GtkComboBoxText *widget, gpointer user_data )
{
GtkWidget *combo_box;
GtkWidget *entry;
gchar *str_capital;
const gchar *text;
- text = gtk_combo_box_get_active_text ( widget );
+ text = gtk_combo_box_text_get_active_text ( widget );
combo_box = g_object_get_data ( G_OBJECT ( widget ), "separator" );
if ( g_strcmp0 ( text, "' '" ) == 0 )
@@ -1532,7 +1534,7 @@ void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user
{
gsb_locale_set_mon_thousands_sep ( "." );
- if ( g_strcmp0 ( gtk_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) ), "." ) == 0 )
+ if ( g_strcmp0 ( gtk_combo_box_text_get_active_text ( GTK_COMBO_BOX_TEXT ( combo_box ) ), "." ) == 0 )
{
gsb_locale_set_mon_decimal_point ( "," );
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo_box ), 1 );
@@ -1542,7 +1544,7 @@ void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user
{
gsb_locale_set_mon_thousands_sep ( "," );
- if ( g_strcmp0 ( gtk_combo_box_get_active_text ( GTK_COMBO_BOX ( combo_box ) ), "," ) == 0 )
+ if ( g_strcmp0 ( gtk_combo_box_text_get_active_text ( GTK_COMBO_BOX_TEXT ( combo_box ) ), "," ) == 0 )
{
gsb_locale_set_mon_decimal_point ( "." );
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo_box ), 0 );
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index d0ba6ae..81360ea 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -128,7 +128,7 @@ extern gint valeur_echelle_recherche_date_import;
/* the total of % of scheduled columns can be > 100 because all the columns are not showed at the same time */
static const gchar *scheduler_col_width_init = "10-12-36-12-12-12-12";
-static const gchar *transaction_col_width_init = "10-12-30-12-12-12-12";
+static const gchar *transaction_col_width_init = "10-12-36-6-12-12-12";
/**
* initialisation of all the variables of grisbi
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 3700fd7..f3539e8 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -1,6 +1,7 @@
uidir = $(pkgdatadir)/ui
-ui_DATA = etats_config.ui\
- bet_graph.ui
+ui_DATA = etats_config.ui \
+ bet_graph.ui \
+ grisbi.ui
EXTRA_DIST = $(ui_DATA)
diff --git a/src/ui/grisbi.ui b/src/ui/grisbi.ui
new file mode 100644
index 0000000..80ea59c
--- /dev/null
+++ b/src/ui/grisbi.ui
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.24"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="window">
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
diff --git a/src/utils_str.c b/src/utils_str.c
index 0678241..896d6ab 100644
--- a/src/utils_str.c
+++ b/src/utils_str.c
@@ -680,7 +680,9 @@ gchar * gsb_string_truncate_n ( gchar * string, int n, gboolean hard_trunc )
* remplace la chaine old_str par new_str dans str
*
*/
-gchar * gsb_string_remplace_string ( gchar *str, gchar *old_str, gchar *new_str )
+gchar *gsb_string_remplace_string ( const gchar *str,
+ gchar *old_str,
+ gchar *new_str )
{
gchar *ptr_debut;
gint long_old, str_len;
diff --git a/src/utils_str.h b/src/utils_str.h
index 9042027..150b6ae 100644
--- a/src/utils_str.h
+++ b/src/utils_str.h
@@ -19,9 +19,11 @@ GSList *gsb_string_get_int_list_from_string ( const gchar *string,
GSList *gsb_string_get_string_list_from_string ( const gchar *string,
gchar *delimiter );
gboolean gsb_string_is_trouve ( const gchar *payee_name, const gchar *needle );
-gchar * gsb_string_remplace_joker ( const gchar *chaine, gchar *new_str );
-gchar * gsb_string_remplace_string ( gchar *str, gchar *old_str, gchar *new_str );
-gchar * gsb_string_truncate ( gchar * string );
+gchar *gsb_string_remplace_joker ( const gchar *chaine, gchar *new_str );
+gchar *gsb_string_remplace_string ( const gchar *str,
+ gchar *old_str,
+ gchar *new_str );
+gchar *gsb_string_truncate ( gchar * string );
gchar *gsb_string_uniform_new_line ( const gchar *chaine, gint nbre_char );
G_MODULE_EXPORT gchar * latin2utf8 ( const gchar * inchar);
gchar *limit_string ( gchar *string,
hooks/post-receive
--
grisbi
More information about the cvs
mailing list