[grisbi-devel] [PATCH 7/8] Rewriting the toolbars of historical tab and forecast tab

pbiava pierre.biava at nerim.net
Sun Feb 17 08:20:40 CET 2013


---
 src/bet_graph.c     | 173 ++++++++++++++++++++--------------------------------
 src/bet_graph.h     |   2 +-
 src/bet_hist.c      |  69 +++++++++------------
 src/bet_tab.c       |  63 +++++++++----------
 src/ui/bet_graph.ui |  90 ++++++---------------------
 5 files changed, 145 insertions(+), 252 deletions(-)

diff --git a/src/bet_graph.c b/src/bet_graph.c
index 751531e..8dd6f51 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -45,6 +45,7 @@
 #include "gsb_file.h"
 #include "navigation.h"
 #include "structures.h"
+#include "utils.h"
 #include "utils_gtkbuilder.h"
 #include "utils_dates.h"
 #include "utils_real.h"
@@ -108,8 +109,8 @@ struct _struct_bet_graph_button
     GCallback callback;                 /* fonction de callback */
     gboolean is_visible;                /* TRUE si le bouton est visible dans la barre d'outils */
     gint origin_tab;                    /* BET_ONGLETS_PREV ou BET_ONGLETS_HIST */
-    GtkWidget *box;
-    GtkWidget *button;
+    GtkWidget *toolbar;
+    GtkToolItem *button;
     GtkWidget *tree_view;
     struct_bet_graph_prefs *prefs;      /* préférences pour le graphique */
 };
@@ -1608,78 +1609,61 @@ static gboolean bet_graph_notebook_change_page ( GtkNotebook *notebook,
 static void bet_graph_popup_choix_graph_activate ( GtkMenuItem *menuitem,
                         struct_bet_graph_button *self )
 {
-    GtkWidget *parent;
-    GList *tmp_list;
-    gint origin_tab = 0;
+    GtkToolItem *item;
+    gchar *tmp_str;
+    gint nbre_elemnts;
+    struct_bet_graph_prefs *prefs;
 
-    parent = gtk_widget_get_parent ( self->box );
-    tmp_list = g_object_get_data ( G_OBJECT ( parent ), "button_list" );
+    prefs = self->prefs;
 
-    while ( tmp_list )
+    /* on définit l'origine du bouton */
+    if ( self->origin_tab == BET_ONGLETS_PREV )
     {
-        struct_bet_graph_button *self;
-        struct_bet_graph_prefs *prefs;
-
-        self = tmp_list -> data;
-
-        prefs = self->prefs;
-        origin_tab = self->origin_tab;
-        if ( self->is_visible == TRUE )
-        {
-            self->is_visible = FALSE;
-            if ( strcmp ( self->service_id, "GogLinePlot" ) == 0 )
-                prefs->type_graph = 1;
-            else
-                prefs->type_graph = 0;
-            origin_tab = self->origin_tab;
-
-            break;
-        }
-
-        tmp_list = tmp_list -> next;
+        tmp_str = g_strdup ( "forecast_graph" );
+        nbre_elemnts = gtk_toolbar_get_n_items ( GTK_TOOLBAR ( self->toolbar ) ) -1;
+    }
+    else
+    {
+        tmp_str = g_strdup ( "historical_graph" );
+        nbre_elemnts = gtk_toolbar_get_n_items ( GTK_TOOLBAR ( self->toolbar ) ) -1;
     }
 
-    gtk_container_foreach ( GTK_CONTAINER ( self->box ), ( GtkCallback ) gtk_widget_destroy, NULL );
+    /* on change le type de graphique */
+    prefs->type_graph = !prefs->type_graph;
 
-    self->is_visible = TRUE;
-    self->button = gsb_automem_imagefile_button_new ( conf.display_toolbar,
-                        self->name,
-                        self->filename,
-                        NULL,
-                        NULL );
+    item = gtk_toolbar_get_nth_item ( GTK_TOOLBAR ( self->toolbar ), nbre_elemnts );
+    if ( item )
+        gtk_container_remove ( GTK_CONTAINER ( self->toolbar ), GTK_WIDGET ( item ) );
 
-    g_object_set_data ( G_OBJECT ( self->button ), "service_id", self->service_id );
-    g_object_set_data ( G_OBJECT ( self->button ), "origin_tab", GINT_TO_POINTER ( origin_tab ) );
-    g_signal_connect ( G_OBJECT ( self->button ),
-                        "clicked",
-                        self->callback,
+    item = bet_graph_button_menu_new ( self->toolbar,
+                        tmp_str,
+                        G_CALLBACK ( self->callback ),
                         self->tree_view );
 
-    gtk_box_pack_start ( GTK_BOX ( self->box ), self->button, TRUE, TRUE, 0 );
+    g_free ( tmp_str );
 
-    gsb_file_set_modified ( TRUE );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( self->toolbar ), item, -1 );
+
+    gtk_widget_show_all ( self->toolbar );
 
     /* on lance le graphique */
-    gtk_button_clicked ( GTK_BUTTON ( self->button ) );
+    g_signal_emit_by_name( item, "clicked", self->tree_view, NULL );
 }
 
 
 /**
+ * construit le menu popup du bouton
  *
- *
- * \param
- * \param
+ * \param button
  * \param
  *
  * \return FALSE
  * */
-static gboolean bet_graph_popup_choix_graph_menu ( GtkWidget *button,
-                        GdkEventButton *event,
+static void bet_graph_popup_choix_graph_menu ( GtkWidget *button,
                         GList *liste )
 {
     GtkWidget *menu;
     GtkWidget *menu_item;
-    GtkWidget *icon;
     GList *tmp_list;
 
     menu = gtk_menu_new ();
@@ -1692,9 +1676,8 @@ static gboolean bet_graph_popup_choix_graph_menu ( GtkWidget *button,
 
         self = tmp_list -> data;
 
-        icon = gtk_image_new_from_file ( g_build_filename ( gsb_dirs_get_pixmaps_dir ( ), self->filename, NULL ) );
-        menu_item = gtk_image_menu_item_new_with_label  ( self->name );
-        gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ), icon );
+        menu_item = utils_menu_new_item_from_image_label ( self->filename, self->name );
+
         g_signal_connect ( G_OBJECT ( menu_item ),
                         "activate",
                         G_CALLBACK ( bet_graph_popup_choix_graph_activate ),
@@ -1707,15 +1690,8 @@ static gboolean bet_graph_popup_choix_graph_menu ( GtkWidget *button,
         tmp_list = tmp_list -> next;
     }
 
+    gtk_menu_tool_button_set_menu ( GTK_MENU_TOOL_BUTTON ( button ), menu );
     gtk_widget_show_all ( menu );
-    gtk_menu_popup ( GTK_MENU ( menu ),
-                        NULL, button,
-                        set_popup_position,
-                        button,
-                        1,
-                        gtk_get_current_event_time ( ) );
-
-    return FALSE;
 }
 
 
@@ -1923,22 +1899,20 @@ static GDate *bet_graph_get_date_debut_periode ( void )
 /**
  * retourne un bouton pour choisir entre un graph ligne ou colonne
  *
- * \param
- * \param
- * \param
- * \param
+ * \param type_graph    forecast_graph or historical_graph
+ * \param callback
+ * \paramtree_view
  *
- * \return button
+ * \return item
  * */
-GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
+GtkToolItem *bet_graph_button_menu_new ( GtkWidget *toolbar,
                         const gchar *type_graph,
                         GCallback callback,
                         GtkWidget *tree_view )
 {
-    GtkWidget *arrow_button = NULL;
-    GtkWidget *box;
-    GtkWidget *box_button;
+    GtkToolItem *item = NULL;
     GList *liste = NULL;
+    gchar *tooltip = NULL;
     gint origin_tab = 0;
     struct_bet_graph_button *self;
     struct_bet_graph_prefs *prefs = NULL;
@@ -1947,12 +1921,6 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
     if ( !bet_graph_initialise_builder ( ) )
         return NULL;
 
-    /* boite qui contiendra les deux boutons */
-    box = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "button_menu_box" ) );
-
-    /* boite qui contiendra le bouton actif */
-    box_button = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "box_button" ) );
-
     /* initialisation des préférences */
     if ( strcmp ( type_graph, "forecast_graph" ) == 0 )
     {
@@ -1960,7 +1928,7 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
             prefs_prev = struct_initialise_bet_graph_prefs ();
         prefs = prefs_prev;
         origin_tab = BET_ONGLETS_PREV;
-        gtk_widget_set_tooltip_text ( GTK_WIDGET ( box_button ), _("Display the graph of forecast") );
+        tooltip = g_strdup ( _("Display the graph of forecast") );
     }
     else if ( strcmp ( type_graph, "historical_graph" ) == 0 )
     {
@@ -1968,7 +1936,7 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
             prefs_hist = struct_initialise_bet_graph_prefs ();
         prefs = prefs_hist;
         origin_tab = BET_ONGLETS_HIST;
-        gtk_widget_set_tooltip_text ( GTK_WIDGET ( box_button ), _("Display the monthly graph") );
+        tooltip = g_strdup ( _("Display the monthly graph") );
     }
 
     /* initialisation des données du premier bouton */
@@ -1978,7 +1946,7 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
     self->filename = g_strdup ( "graph-histo.png" );
     self->service_id = g_strdup ( "GogBarColPlot" );
     self->callback = callback;
-    self->box = box_button;
+    self->toolbar = toolbar;
     self->tree_view = tree_view;
     self->origin_tab = origin_tab;
     self->prefs = prefs;
@@ -1987,19 +1955,14 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
     if ( prefs->type_graph == 0 )
     {
         self->is_visible = TRUE;
-        self->button = gsb_automem_imagefile_button_new ( style,
-                    self->name,
-                    self->filename,
-                    NULL,
-                    NULL );
-
+        item = utils_buttons_menu_new_from_image_label ( self->filename, self->name );
+        self->button = item;
         g_object_set_data ( G_OBJECT ( self->button ), "service_id", self->service_id );
         g_object_set_data ( G_OBJECT ( self->button ), "origin_tab", GINT_TO_POINTER ( origin_tab ) );
         g_signal_connect ( G_OBJECT ( self->button ),
-                    "clicked",
-                    self->callback,
-                    self->tree_view );
-        gtk_box_pack_start ( GTK_BOX ( self->box ), self->button, TRUE, TRUE, 0 );
+                        "clicked",
+                        self->callback,
+                        self->tree_view );
     }
     liste = g_list_append ( liste, self );
 
@@ -2010,7 +1973,7 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
     self->filename = g_strdup ( "graph-line.png" );
     self->service_id = g_strdup ( "GogLinePlot" );
     self->callback = callback;
-    self->box = box_button;
+    self->toolbar = toolbar;
     self->tree_view = tree_view;
     self->origin_tab = origin_tab;
     self->prefs = prefs;
@@ -2019,33 +1982,31 @@ GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
     if ( prefs->type_graph == 1 )
     {
         self->is_visible = TRUE;
-        self->button = gsb_automem_imagefile_button_new ( style,
-                    self->name,
-                    self->filename,
-                    NULL,
-                    NULL );
-
+        item = utils_buttons_menu_new_from_image_label ( self->filename, self->name );
+        self->button = item;
         g_object_set_data ( G_OBJECT ( self->button ), "service_id", self->service_id );
         g_object_set_data ( G_OBJECT ( self->button ), "origin_tab", GINT_TO_POINTER ( origin_tab ) );
         g_signal_connect ( G_OBJECT ( self->button ),
-                    "clicked",
-                    self->callback,
-                    self->tree_view );
-        gtk_box_pack_start ( GTK_BOX ( self->box ), self->button, TRUE, TRUE, 0 );
+                        "clicked",
+                        self->callback,
+                        self->tree_view );
     }
     liste = g_list_append ( liste, self );
 
-    /* on attache la liste des boutons servira  plus tard */
-    g_object_set_data ( G_OBJECT ( box ), "button_list", liste );
+    if ( tooltip )
+    {
+        gtk_tool_item_set_tooltip_text ( GTK_TOOL_ITEM ( item ), tooltip );
+        g_free ( tooltip );
+    }
+
+    gtk_menu_tool_button_set_menu ( GTK_MENU_TOOL_BUTTON ( item ), gtk_menu_new () );
 
-    /* bouton qui ouvre le menu de choix du bouton actif */
-    arrow_button = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "arrow_button" ) );
-    g_signal_connect ( G_OBJECT ( arrow_button ),
-                        "button-press-event",
+    g_signal_connect ( G_OBJECT ( item ),
+                        "show-menu",
                         G_CALLBACK ( bet_graph_popup_choix_graph_menu ),
                         liste );
 
-    return box;
+    return item;
 }
 
 
diff --git a/src/bet_graph.h b/src/bet_graph.h
index bac0cb1..963dd86 100644
--- a/src/bet_graph.h
+++ b/src/bet_graph.h
@@ -21,7 +21,7 @@
 
 
 /* START_DECLARATION */
-GtkWidget *bet_graph_button_menu_new ( GsbButtonStyle style,
+GtkToolItem *bet_graph_button_menu_new ( GtkWidget *toolbar,
                         const gchar *type_graph,
                         GCallback callback,
                         GtkWidget *tree_view );
diff --git a/src/bet_hist.c b/src/bet_hist.c
index 65f68ca..acc60ed 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -150,6 +150,7 @@ GtkWidget *bet_historical_create_page ( void )
 {
     GtkWidget *widget;
     GtkWidget *page;
+    GtkWidget *frame;
     GtkWidget *hbox;
     GtkWidget *align;
     GtkWidget *label_title;
@@ -163,6 +164,11 @@ GtkWidget *bet_historical_create_page ( void )
     gtk_widget_set_name ( page, "historical_page" );
 
     account_page = gsb_gui_get_account_page ();
+
+    /* frame pour la barre d'outils */
+    frame = gtk_frame_new ( NULL );
+    gtk_box_pack_start ( GTK_BOX ( page ), frame, FALSE, FALSE, 0 );
+
     /* titre de la page */
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
     gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;
@@ -236,13 +242,8 @@ GtkWidget *bet_historical_create_page ( void )
     utils_set_tree_view_selection_and_text_color ( tree_view );
 
     /* on y ajoute la barre d'outils */
-    bet_historical_toolbar = gtk_handle_box_new ( );
-    g_object_set_data ( G_OBJECT ( bet_historical_toolbar ), "tree_view", tree_view );
-    g_object_set_data ( G_OBJECT ( bet_historical_toolbar ), "page", page );
-    gtk_widget_show ( bet_historical_toolbar );
-
-    gtk_box_pack_start ( GTK_BOX ( page ), bet_historical_toolbar, FALSE, FALSE, 0 );
-    gtk_box_reorder_child ( GTK_BOX ( page ), bet_historical_toolbar, 0 );
+    bet_historical_toolbar = bet_historical_create_toolbar ( page, tree_view );
+    gtk_container_add ( GTK_CONTAINER ( frame ), bet_historical_toolbar );
 
     gtk_widget_show_all ( page );
 
@@ -1938,63 +1939,51 @@ void bet_historical_fyear_hide_present_futures_fyears ( void )
 GtkWidget *bet_historical_create_toolbar ( GtkWidget *parent,
                         GtkWidget *tree_view )
 {
-    GtkWidget *hbox;
-    GtkWidget *button;
+    GtkWidget *toolbar;
+    GtkToolItem *item;
 
-    /* Hbox */
-    hbox = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 );
+    toolbar = gtk_toolbar_new ( );
+    g_object_set_data ( G_OBJECT ( toolbar ), "tree_view", tree_view );
+    g_object_set_data ( G_OBJECT ( toolbar ), "page", parent );
 
     /* print button */
-    button = gsb_automem_stock_button_new ( conf.display_toolbar,
-                        GTK_STOCK_PRINT,
-                        _("Print"),
-                        NULL,
-                        NULL );
-    gtk_widget_set_tooltip_text ( GTK_WIDGET ( button ), _("Print the array") );
-    g_signal_connect ( G_OBJECT ( button ),
+    item = gtk_tool_button_new_from_stock ( GTK_STOCK_PRINT );
+    gtk_widget_set_tooltip_text ( GTK_WIDGET ( item ), _("Print the array") );
+    g_signal_connect ( G_OBJECT ( item ),
                         "clicked",
                         G_CALLBACK ( bet_historical_print_tab ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 
     /* Export button */
-    button = gsb_automem_stock_button_new ( conf.display_toolbar,
-					   GTK_STOCK_SAVE,
-					   _("Export"),
-					   NULL,
-					   NULL );
-    gtk_widget_set_tooltip_text ( GTK_WIDGET ( button ), _("Export the array") );
-    g_signal_connect ( G_OBJECT ( button ),
+    item = gtk_tool_button_new_from_stock ( GTK_STOCK_SAVE );
+    gtk_tool_button_set_label ( GTK_TOOL_BUTTON ( item ), _("Export") );
+    gtk_widget_set_tooltip_text ( GTK_WIDGET ( item ), _("Export the array") );
+    g_signal_connect ( G_OBJECT ( item ),
                         "clicked",
                         G_CALLBACK ( bet_historical_export_tab ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 
 #ifdef HAVE_GOFFICE
     /* sectors button */
-    button = gsb_automem_imagefile_button_new ( conf.display_toolbar,
-                        _("Data graph"),
-                        "graph-sectors.png",
-                        NULL,
-                        NULL );
-    gtk_widget_set_tooltip_text ( GTK_WIDGET ( button ), _("Display the pie graph") );
-    g_signal_connect ( G_OBJECT ( button ),
+    item = utils_buttons_new_from_image_label ( "graph-sectors.png", _("Data graph") );
+    gtk_widget_set_tooltip_text ( GTK_WIDGET ( item ), _("Display the pie graph") );
+    g_signal_connect ( G_OBJECT ( item ),
                         "clicked",
                         G_CALLBACK ( bet_graph_sectors_graph_new ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 
     /* monthly button */
-    button = bet_graph_button_menu_new ( conf.display_toolbar,
+    item = bet_graph_button_menu_new ( toolbar,
                         "historical_graph",
                         G_CALLBACK ( bet_graph_montly_graph_new ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 #endif /* HAVE_GOFFICE */
 
-    gtk_widget_show_all ( hbox );
-
-    return ( hbox );
+    return ( toolbar );
 
 }
 
diff --git a/src/bet_tab.c b/src/bet_tab.c
index 1e2f88d..e296ae6 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -92,7 +92,8 @@ static gboolean bet_array_list_button_press ( GtkWidget *tree_view,
                         GdkEventButton *ev );
 static void bet_array_list_change_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
-static GtkWidget *bet_array_list_create_toolbar ( GtkWidget *parent, GtkWidget *tree_view );
+static GtkWidget *bet_array_list_create_toolbar ( GtkWidget *parent,
+                        GtkWidget *tree_view );
 static void bet_array_list_context_menu ( GtkWidget *tree_view,
                         GtkTreePath *path );
 static void bet_array_list_delete_all_menu ( GtkWidget *menu_item,
@@ -702,6 +703,7 @@ void bet_array_refresh_estimate_tab ( gint account_number )
 GtkWidget *bet_array_create_page ( void )
 {
     GtkWidget *page;
+    GtkWidget *frame;
     GtkWidget *widget = NULL;
     GtkWidget *initial_date = NULL;
     GtkWidget *hbox;
@@ -717,6 +719,10 @@ GtkWidget *bet_array_create_page ( void )
 
     account_page = gsb_gui_get_account_page ();
 
+    /* frame pour la barre d'outils */
+    frame = gtk_frame_new ( NULL );
+    gtk_box_pack_start ( GTK_BOX ( page ), frame, FALSE, FALSE, 0 );
+
     /* create the title */
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
     gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;
@@ -766,13 +772,8 @@ GtkWidget *bet_array_create_page ( void )
     g_object_set_data ( G_OBJECT ( tree_view ), "label_title", label_title );
 
     /* on y ajoute la barre d'outils */
-    bet_array_toolbar = gtk_handle_box_new ( );
-    g_object_set_data ( G_OBJECT ( bet_array_toolbar ), "tree_view", tree_view );
-    g_object_set_data ( G_OBJECT ( bet_array_toolbar ), "page", page );
-    gtk_widget_show ( bet_array_toolbar );
-
-    gtk_box_pack_start ( GTK_BOX ( page ), bet_array_toolbar, FALSE, FALSE, 0 );
-    gtk_box_reorder_child ( GTK_BOX ( page ), bet_array_toolbar, 0 );
+    bet_array_toolbar = bet_array_list_create_toolbar ( page, tree_view );
+    gtk_container_add ( GTK_CONTAINER ( frame ), bet_array_toolbar );
 
     gtk_widget_show_all ( page );
 
@@ -2953,53 +2954,45 @@ gboolean bet_array_list_size_allocate ( GtkWidget *tree_view,
  *
  *
  * */
-GtkWidget *bet_array_list_create_toolbar ( GtkWidget *parent, GtkWidget *tree_view )
+GtkWidget *bet_array_list_create_toolbar ( GtkWidget *parent,
+                        GtkWidget *tree_view )
 {
-    GtkWidget *hbox;
-    GtkWidget *button;
+    GtkWidget *toolbar;
+    GtkToolItem *item;
 
-    /* Hbox */
-    hbox = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 );
+    toolbar = gtk_toolbar_new ( );
+    g_object_set_data ( G_OBJECT ( toolbar ), "tree_view", tree_view );
+    g_object_set_data ( G_OBJECT ( toolbar ), "page", parent );
 
     /* print button */
-    button = gsb_automem_stock_button_new ( conf.display_toolbar,
-                        GTK_STOCK_PRINT,
-                        _("Print"),
-                        NULL,
-                        NULL );
-    gtk_widget_set_tooltip_text ( GTK_WIDGET ( button ), _("Print the array") );
-    g_signal_connect ( G_OBJECT ( button ),
+    item = gtk_tool_button_new_from_stock ( GTK_STOCK_PRINT );
+    gtk_widget_set_tooltip_text ( GTK_WIDGET ( item ), _("Print the array") );
+    g_signal_connect ( G_OBJECT ( item ),
                         "clicked",
                         G_CALLBACK ( print_tree_view_list ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 
     /* Export button */
-    button = gsb_automem_stock_button_new ( conf.display_toolbar,
-					   GTK_STOCK_SAVE,
-					   _("Export"),
-					   NULL,
-					   NULL );
-    gtk_widget_set_tooltip_text ( GTK_WIDGET ( button ), _("Export the array of forecast") );
-    g_signal_connect ( G_OBJECT ( button ),
+    item = gtk_tool_button_new_from_stock ( GTK_STOCK_SAVE );
+    gtk_tool_button_set_label ( GTK_TOOL_BUTTON ( item ), _("Export") );
+    gtk_widget_set_tooltip_text ( GTK_WIDGET ( item ), _("Export the array of forecast") );
+    g_signal_connect ( G_OBJECT ( item ),
                         "clicked",
                         G_CALLBACK ( bet_array_export_tab ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 
 #ifdef HAVE_GOFFICE
     /* graph button */
-    button = bet_graph_button_menu_new ( conf.display_toolbar,
+    item = bet_graph_button_menu_new ( toolbar,
                         "forecast_graph",
                         G_CALLBACK ( bet_graph_line_graph_new ),
                         tree_view );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 5 );
+    gtk_toolbar_insert ( GTK_TOOLBAR ( toolbar ), item, -1 );
 #endif /* HAVE_GOFFICE */
 
-    gtk_widget_show_all ( hbox );
-
-    return ( hbox );
-
+    return ( toolbar );
 }
 
 
diff --git a/src/ui/bet_graph.ui b/src/ui/bet_graph.ui
index 6cca050..dd3ed22 100644
--- a/src/ui/bet_graph.ui
+++ b/src/ui/bet_graph.ui
@@ -1,30 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.18"/>
-  <!-- interface-naming-policy project-wide -->
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">500</property>
     <property name="step_increment">10</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkArrow" id="arrow">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="arrow_type">down</property>
-    <property name="shadow_type">etched-out</property>
-  </object>
   <object class="GtkDialog" id="bet_graph_dialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Diagram</property>
     <property name="type_hint">normal</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox1">
+      <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
+          <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
@@ -39,7 +32,6 @@
                     <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>
@@ -55,7 +47,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -131,12 +122,12 @@
     <property name="modal">True</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox2">
+      <object class="GtkBox" id="dialog-vbox2">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area2">
+          <object class="GtkButtonBox" id="dialog-action_area2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
@@ -149,7 +140,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -340,8 +330,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="active">True</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
@@ -357,8 +347,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
                                       <packing>
@@ -373,8 +363,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="active">True</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
@@ -447,8 +437,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="active">True</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
@@ -464,8 +454,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="draw_indicator">True</property>
                                         <property name="group">axis_low</property>
                                       </object>
@@ -492,8 +482,8 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
-                                                <property name="use_action_appearance">False</property>
                                                 <property name="use_underline">True</property>
+                                                <property name="xalign">0.5</property>
                                                 <property name="draw_indicator">True</property>
                                                 <property name="group">axis_low</property>
                                               </object>
@@ -565,7 +555,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0.5</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                             </child>
@@ -723,8 +713,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
                                       <packing>
@@ -739,8 +729,8 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="use_underline">True</property>
+                                        <property name="xalign">0.5</property>
                                         <property name="draw_indicator">True</property>
                                       </object>
                                       <packing>
@@ -870,7 +860,7 @@
                   </object>
                   <packing>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options"/>
                   </packing>
                 </child>
                 <child>
@@ -884,7 +874,7 @@
                     <property name="left_attach">2</property>
                     <property name="right_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options"/>
                   </packing>
                 </child>
                 <child>
@@ -896,8 +886,6 @@
                     <property name="invisible_char_set">True</property>
                     <property name="primary_icon_activatable">False</property>
                     <property name="secondary_icon_activatable">False</property>
-                    <property name="primary_icon_sensitive">True</property>
-                    <property name="secondary_icon_sensitive">True</property>
                     <property name="adjustment">adjustment1</property>
                     <property name="climb_rate">10</property>
                     <property name="snap_to_ticks">True</property>
@@ -909,7 +897,7 @@
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options"/>
                   </packing>
                 </child>
                 <child>
@@ -918,8 +906,8 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0.5</property>
                     <property name="yalign">0.46000000834465027</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -927,8 +915,8 @@
                     <property name="right_attach">3</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
-                    <property name="x_options"></property>
-                    <property name="y_options"></property>
+                    <property name="x_options"/>
+                    <property name="y_options"/>
                   </packing>
                 </child>
               </object>
@@ -948,42 +936,4 @@
       </packing>
     </child>
   </object>
-  <object class="GtkHBox" id="button_menu_box">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="has_tooltip">True</property>
-    <child>
-      <object class="GtkVBox" id="box_button">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="has_tooltip">True</property>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="arrow_button">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="has_tooltip">True</property>
-        <property name="tooltip_text" translatable="yes">Select the chart type</property>
-        <property name="use_action_appearance">False</property>
-        <property name="image">arrow</property>
-        <property name="relief">none</property>
-        <property name="draw_indicator">False</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
 </interface>
-- 
1.8.1.3



More information about the devel mailing list