[grisbi-cvs] [SCM] grisbi branch, pbiava_graph_tools, updated. upstream_version_0_9_4-44-g08dcfbb

Pierre Biava nobody at users.sourceforge.net
Fri Sep 30 20:14:09 CEST 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, pbiava_graph_tools has been updated
       via  08dcfbba257f85f48904a6201eef529f24c692df (commit)
       via  45efa502610bc6ee85995ab883f09a043695055d (commit)
      from  3d109150f64957f94215c05f67d6703cb688b45d (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 08dcfbba257f85f48904a6201eef529f24c692df
Author: pbiava <pierre.biava at nerim.net>
Date:   Fri Sep 30 20:01:25 2011 +0200

    Add a button Show grid for the graph

commit 45efa502610bc6ee85995ab883f09a043695055d
Author: pbiava <pierre.biava at nerim.net>
Date:   Fri Sep 30 12:55:04 2011 +0200

    main.c: Show the ui path

-----------------------------------------------------------------------

Changes:
diff --git a/src/bet_graph.c b/src/bet_graph.c
index ef1b1fa..f14b289 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -59,6 +59,7 @@ struct _struct_bet_graph_data
 {
     GtkTreeView *tree_view;
     GtkNotebook *notebook;
+    GtkWidget *button_show_grid;
     gint account_number;
     gint currency_number;
 
@@ -70,6 +71,7 @@ struct _struct_bet_graph_data
     gchar *service_id;          /* définit le type de graphique : GogPiePlot, GogLinePlot, GogBarColPlot = défaut */
     gboolean is_legend;
     gboolean valid_data;         /* empêche le recalcul des données pendant la durée de vie du graph */
+    gboolean show_grid;          /* FALSE par défaut */
 
     /* données communes aux axes*/
     gint nbre_elemnts;
@@ -133,6 +135,10 @@ static GtkWidget *bet_graph_get_canvas  ( void );
 static gboolean bet_graph_initialise_builder ( void );
 static void bet_graph_map_type_changed ( GtkComboBox *combo,
                         struct_bet_graph_data *self );
+static gboolean bet_graph_notebook_change_page ( GtkNotebook *notebook,
+                        GtkNotebookPage *npage,
+                        gint page,
+                        struct_bet_graph_data *self );
 static gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self );
 static gboolean bet_graph_populate_sectors_by_hist_data ( struct_bet_graph_data *self );
 static void bet_graph_popup_choix_graph_activate ( GtkMenuItem *menuitem,
@@ -143,6 +149,11 @@ static gboolean bet_graph_popup_choix_graph_menu ( GtkWidget *button,
 static void bet_graph_rotation_changed ( GORotationSel *rotation,
                         int angle,
                         struct_bet_graph_data *self );
+static void bet_graph_show_grid_button_changed ( GtkToggleButton *togglebutton,
+                        struct_bet_graph_data *self );
+static void bet_graph_show_grid_button_configure (  struct_bet_graph_data *self,
+                        gint active,
+                        gint hide );
 static void bet_graph_toggle_button_changed ( GtkToggleButton *togglebutton,
                         struct_bet_graph_data *self );
 static void bet_graph_update_graph ( struct_bet_graph_data *self );
@@ -625,6 +636,15 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
                         GTK_SIGNAL_FUNC ( gtk_widget_destroy ),
                         NULL);
 
+    /* initialise le bouton show_grid avec la préférence "Major_grid" */
+    self->button_show_grid = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "button_show_grid" ) );
+    if ( prefs_lines->major_grid_y )
+        bet_graph_show_grid_button_configure ( self, TRUE, -1 );
+    g_signal_connect ( self->button_show_grid,
+                        "toggled",
+                        G_CALLBACK ( bet_graph_show_grid_button_changed ),
+                        self );
+
     /* set the title */
     label = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( tree_view ), "label_title") );
     title = make_pango_attribut ( "weight=\"bold\" size=\"x-large\"",
@@ -636,6 +656,11 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
 
     /* initialise les pages pour les graphiques ligne et barre */
     self->notebook = GTK_NOTEBOOK ( gtk_builder_get_object ( bet_graph_builder, "notebook" ) );
+    g_signal_connect_after ( self->notebook,
+                        "switch-page",
+                        G_CALLBACK ( bet_graph_notebook_change_page ),
+                        self );
+
 
     /* set the graphique page */
     self->plot = bet_graph_create_graph_page ( self, TRUE );
@@ -875,14 +900,13 @@ gboolean bet_graph_affiche_XY_line ( struct_bet_graph_data *self )
     }
 
     /* on ajoute une grille pour l'axe Y si necessaire */
-    if ( prefs_lines->major_grid_y || prefs_lines->minor_grid_y )
+    if ( self->show_grid )
     {
-        axis = gog_object_get_child_by_name ( GOG_OBJECT ( self->chart ), "Y-Axis" );
-
-        if ( prefs_lines->major_grid_y )
+        if ( prefs_lines->major_grid_y || self->show_grid )
         {
-            grid_line = gog_object_add_by_name ( GOG_OBJECT ( axis ), "MajorGrid", NULL );
+            axis = gog_object_get_child_by_name ( GOG_OBJECT ( self->chart ), "Y-Axis" );
 
+            grid_line = gog_object_add_by_name ( GOG_OBJECT ( axis ), "MajorGrid", NULL );
             if ( prefs_lines->minor_grid_y )
                 grid_line = gog_object_add_by_name ( GOG_OBJECT ( axis ), "MinorGrid", NULL );
         }
@@ -1255,21 +1279,12 @@ GtkWidget *bet_graph_create_line_preferences ( struct_bet_graph_data *self )
     /* onfiguration de la grille */
     button_1 = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "major_grid_y" ) );
     g_object_set_data ( G_OBJECT ( button_1 ), "rang", GINT_TO_POINTER ( 8 ) );
-    g_signal_connect ( button_1,
-                        "toggled",
-                        G_CALLBACK ( bet_graph_toggle_button_changed ),
-                        self );
 
     button_2 = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "minor_grid_y" ) );
     if ( prefs_lines->minor_grid_y )
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (button_2 ), TRUE );
 
     g_object_set_data ( G_OBJECT ( button_2 ), "rang", GINT_TO_POINTER ( 9 ) );
-    g_signal_connect ( button_2,
-                        "toggled",
-                        G_CALLBACK ( bet_graph_toggle_button_changed ),
-                        self );
-
     /* on lie les deux boutons pour les retrouver plus tard */
     g_object_set_data ( G_OBJECT ( button_1 ), "grid_y", button_2 );
 
@@ -1278,6 +1293,15 @@ GtkWidget *bet_graph_create_line_preferences ( struct_bet_graph_data *self )
     else
         gtk_widget_set_sensitive ( button_2, FALSE );
 
+    /* set the signal */
+    g_signal_connect ( button_1,
+                        "toggled",
+                        G_CALLBACK ( bet_graph_toggle_button_changed ),
+                        self );
+    g_signal_connect ( button_2,
+                        "toggled",
+                        G_CALLBACK ( bet_graph_toggle_button_changed ),
+                        self );
 
     return box_prefs_line;
 }
@@ -1332,11 +1356,31 @@ void bet_graph_toggle_button_changed ( GtkToggleButton *togglebutton,
         break;
     case 8:
         prefs_lines->major_grid_y = active;
+
+        /* on sensibilise ou désensibilise le bouton minor_grid_y */
         button = g_object_get_data ( G_OBJECT ( togglebutton ), "grid_y" );
         gtk_widget_set_sensitive ( button, active );
+
+        /* si le graphe est dans la bonne configuration on sort */
+        if ( prefs_lines->major_grid_y == self->show_grid )
+        {
+            gsb_file_set_modified ( TRUE );
+            return;
+        }
+        /* on positionne le bouton self->button_show_grid */
+        if ( active )
+            bet_graph_show_grid_button_configure ( self, TRUE, TRUE );
+        else
+            bet_graph_show_grid_button_configure ( self, FALSE, TRUE );
         break;
     case 9:
         prefs_lines->minor_grid_y = active;
+
+        /* on positionne le bouton self->button_show_grid */
+        if ( active )
+            bet_graph_show_grid_button_configure ( self, TRUE, TRUE );
+        else
+            bet_graph_show_grid_button_configure ( self, FALSE, TRUE );
         break;
     }
 
@@ -1384,6 +1428,95 @@ void bet_graph_gap_spinner_changed ( GtkSpinButton *spinbutton,
  *
  *
  * */
+void bet_graph_show_grid_button_changed ( GtkToggleButton *togglebutton,
+                        struct_bet_graph_data *self )
+{
+    gboolean active;
+
+    active = gtk_toggle_button_get_active ( togglebutton );
+
+    self->show_grid = active;
+    if ( active )
+        gtk_button_set_label ( GTK_BUTTON ( self->button_show_grid ), _("Hide grid") );
+    else
+        gtk_button_set_label ( GTK_BUTTON ( self->button_show_grid ), _("Show grid") );
+
+    /* on met à jour le graph */
+    bet_graph_update_graph ( self );
+
+    gtk_notebook_set_current_page ( self->notebook, 0 );
+}
+
+
+/**
+ * on positionne les caractéristiques du bouton
+ *
+ *\param active : 1 = on veut montrer la grille 0 = on veut cacher la grille -1 = sans effet
+ *\param hide : 1 = on cache le bouton 0 = on montre le bouton -1 = sans effet
+ *
+ *\return
+ * */
+void bet_graph_show_grid_button_configure (  struct_bet_graph_data *self,
+                        gint active,
+                        gint hide )
+{
+    if ( active != -1 )
+    {
+        /* on bloque le signal */
+        g_signal_handlers_block_by_func ( G_OBJECT ( self->button_show_grid ),
+                        bet_graph_show_grid_button_changed,
+                        self );
+
+        self->show_grid = active;
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( self->button_show_grid ), active );
+
+        if ( active ) /* la grille est visible */
+            gtk_button_set_label ( GTK_BUTTON ( self->button_show_grid ), _("Hide grid") );
+        else
+            gtk_button_set_label ( GTK_BUTTON ( self->button_show_grid ), _("Show grid") );
+
+        /* on débloque le signal */
+        g_signal_handlers_unblock_by_func ( G_OBJECT ( self->button_show_grid ),
+                        bet_graph_show_grid_button_changed,
+                        self );
+    }
+
+    if ( active != -1 )
+    {
+        if ( hide )
+            gtk_widget_hide ( GTK_WIDGET ( self->button_show_grid ) );
+        else
+            gtk_widget_show ( GTK_WIDGET ( self->button_show_grid ) );
+    }
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_graph_notebook_change_page ( GtkNotebook *notebook,
+                        GtkNotebookPage *npage,
+                        gint page,
+                        struct_bet_graph_data *self )
+{
+    if ( page == 0 )
+        gtk_widget_show ( self->button_show_grid );
+    else
+        gtk_widget_hide ( self->button_show_grid );
+
+    return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
 void bet_graph_update_graph ( struct_bet_graph_data *self )
 {
     devel_debug (NULL);
diff --git a/src/main.c b/src/main.c
index 9539c8d..43cb7f2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -829,12 +829,12 @@ gchar *gsb_main_get_print_locale_var ( void )
 
     locale_str = g_strdup_printf ( "LANG = %s\n\n"
                         "Currency\n"
-                        "\tcurrency_symbol = %s\n"
+                        "\tcurrency_symbol   = %s\n"
                         "\tmon_thousands_sep = \"%s\"\n"
                         "\tmon_decimal_point = %s\n"
-                        "\tpositive_sign = \"%s\"\n"
-                        "\tnegative_sign = \"%s\"\n"
-                        "\tfrac_digits = \"%d\"\n\n",
+                        "\tpositive_sign     = \"%s\"\n"
+                        "\tnegative_sign     = \"%s\"\n"
+                        "\tfrac_digits       = \"%d\"\n\n",
                         g_getenv ( "LANG"),
                         conv->currency_symbol,
                         mon_thousands_sep,
@@ -862,16 +862,17 @@ gchar *gsb_main_get_print_dir_var ( void )
     gchar *path_str = NULL;
 
     path_str = g_strdup_printf ( "Paths\n"
-                        "\tXDG_DATA_HOME = %s\n"
-                        "\tXDG_CONFIG_HOME = %s\n\n"
-                        "\tC_GRISBIRC = %s\n"
-                        "\tC_PATH_CONFIG = %s\n"
-                        "\tC_PATH_CONFIG_ACCELS = %s\n"
-                        "\tC_PATH_DATA_FILES = %s\n\n"
-                        "\tDATA_PATH = %s\n\n"
-                        "\tgsb_dirs_get_locale_dir ( ) = %s\n"
+                        "\tXDG_DATA_HOME                = %s\n"
+                        "\tXDG_CONFIG_HOME              = %s\n\n"
+                        "\tC_GRISBIRC                   = %s\n"
+                        "\tC_PATH_CONFIG                = %s\n"
+                        "\tC_PATH_CONFIG_ACCELS         = %s\n"
+                        "\tC_PATH_DATA_FILES            = %s\n\n"
+                        "\tDATA_PATH                    = %s\n\n"
+                        "\tgsb_dirs_get_locale_dir ( )  = %s\n"
                         "\tgsb_dirs_get_plugins_dir ( ) = %s\n"
-                        "\tgsb_dirs_get_pixmaps_dir ( ) = %s\n\n",
+                        "\tgsb_dirs_get_pixmaps_dir ( ) = %s\n"
+                        "\tgsb_dirs_get_ui_dir ( )      = %s\n\n",
                         g_get_user_data_dir ( ),
                         g_get_user_config_dir ( ),
                         C_GRISBIRC ( ),
@@ -881,7 +882,8 @@ gchar *gsb_main_get_print_dir_var ( void )
                         DATA_PATH,
                         gsb_dirs_get_locale_dir ( ),
                         gsb_dirs_get_plugins_dir ( ),
-                        gsb_dirs_get_pixmaps_dir ( ) );
+                        gsb_dirs_get_pixmaps_dir ( ),
+                        gsb_dirs_get_ui_dir ( ) );
 
     return path_str;
 }
diff --git a/src/ui/bet_graph.ui b/src/ui/bet_graph.ui
index 15c63c8..ba5a5e6 100644
--- a/src/ui/bet_graph.ui
+++ b/src/ui/bet_graph.ui
@@ -26,9 +26,28 @@
           <object class="GtkHButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="homogeneous">True</property>
             <property name="layout_style">end</property>
             <child>
-              <placeholder/>
+              <object class="GtkAlignment" id="alignment4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <child>
+                  <object class="GtkToggleButton" id="button_show_grid">
+                    <property name="label" translatable="yes">Show grid</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_action_appearance">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
             </child>
             <child>
               <object class="GtkButton" id="button1">


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list