r16474 - gnucash/trunk/src - Bug#468681: configurable positioning for summary bar; patch from Michael Culbertson <michael.culbertson gmail com>.
Josh Sled
jsled at cvs.gnucash.org
Mon Aug 27 19:10:15 EDT 2007
Author: jsled
Date: 2007-08-27 19:10:13 -0400 (Mon, 27 Aug 2007)
New Revision: 16474
Trac: http://svn.gnucash.org/trac/changeset/16474
Modified:
gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
gnucash/trunk/src/gnome-utils/glade/preferences.glade
gnucash/trunk/src/gnome-utils/gnc-plugin-page.h
gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
gnucash/trunk/src/gnome/gnc-plugin-page-register.c
gnucash/trunk/src/gnome/schemas/apps_gnucash_general.schemas.in
Log:
Bug#468681: configurable positioning for summary bar; patch from Michael Culbertson <michael.culbertson gmail com>.
Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c 2007-08-27 23:10:13 UTC (rev 16474)
@@ -53,6 +53,7 @@
static GncPluginPage *gnc_plugin_page_invoice_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
static void gnc_plugin_page_invoice_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
+static void gnc_plugin_page_invoice_summarybar_position_changed(GConfEntry *entry, gpointer user_data);
void gnc_plugin_page_invoice_start_toggle_cb(GtkToggleButton *toggle, gpointer data);
void gnc_plugin_page_invoice_end_toggle_cb(GtkToggleButton *toggle, gpointer data);
@@ -397,7 +398,10 @@
gtk_box_pack_start(GTK_BOX (priv->widget), widget, TRUE, TRUE, 0);
plugin_page->summarybar = gnc_invoice_window_create_summary_bar(priv->iw);
- gtk_box_pack_end(GTK_BOX (priv->widget), plugin_page->summarybar, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar, FALSE, FALSE, 0);
+ gnc_plugin_page_invoice_summarybar_position_changed(NULL, page);
+ gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_invoice_summarybar_position_changed, page);
regWidget = gnc_invoice_get_register(priv->iw);
if (regWidget) {
@@ -424,6 +428,9 @@
page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+ gnc_gconf_general_remove_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_invoice_summarybar_position_changed, page);
+
if (priv->widget == NULL)
{
LEAVE("");
@@ -515,8 +522,38 @@
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
gnc_invoice_window_changed (priv->iw, window);
}
+
+
+static void
+gnc_plugin_page_invoice_summarybar_position_changed(GConfEntry *entry,
+ gpointer user_data)
+{
+ GncPluginPage *plugin_page;
+ GncPluginPageInvoice *page;
+ GncPluginPageInvoicePrivate *priv;
+ GtkPositionType position = GTK_POS_BOTTOM;
+ gchar *conf_string;
+ g_return_if_fail(user_data != NULL);
+
+ plugin_page = GNC_PLUGIN_PAGE(user_data);
+ page = GNC_PLUGIN_PAGE_INVOICE (user_data);
+ priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+
+ conf_string = gnc_gconf_get_string (GCONF_GENERAL,
+ KEY_SUMMARYBAR_POSITION, NULL);
+ if (conf_string) {
+ position = gnc_enum_from_nick (GTK_TYPE_POSITION_TYPE,
+ conf_string, GTK_POS_BOTTOM);
+ g_free (conf_string);
+ }
+ gtk_box_reorder_child(GTK_BOX(priv->widget),
+ plugin_page->summarybar,
+ (position == GTK_POS_TOP ? 0 : -1) );
+}
+
+
/************************************************************/
/* Command callbacks */
/************************************************************/
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c 2007-08-27 23:10:13 UTC (rev 16474)
@@ -49,6 +49,7 @@
#include "gnc-account-sel.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
+#include "gnc-gconf-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-gobject-utils.h"
#include "gnc-html.h"
@@ -105,6 +106,8 @@
static GncPluginPage *gnc_plugin_page_account_tree_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
/* Callbacks */
+static void gnc_plugin_page_account_tree_summarybar_position_changed(GConfEntry *entry,
+ gpointer user_data);
static gboolean gnc_plugin_page_account_tree_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
GncPluginPage *page);
@@ -483,9 +486,13 @@
gnc_get_current_session());
plugin_page->summarybar = gnc_main_window_summary_new();
- gtk_box_pack_end (GTK_BOX (priv->widget), plugin_page->summarybar,
- FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->widget), plugin_page->summarybar,
+ FALSE, FALSE, 0);
gtk_widget_show(plugin_page->summarybar);
+ gnc_plugin_page_account_tree_summarybar_position_changed(NULL, page);
+ gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_account_tree_summarybar_position_changed,
+ page);
LEAVE("widget = %p", priv->widget);
return priv->widget;
@@ -501,6 +508,10 @@
page = GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page);
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
+ gnc_gconf_general_remove_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_account_tree_summarybar_position_changed,
+ page);
+
if (priv->widget) {
g_object_unref(G_OBJECT(priv->widget));
priv->widget = NULL;
@@ -587,6 +598,35 @@
/* Callbacks */
+static void
+gnc_plugin_page_account_tree_summarybar_position_changed(GConfEntry *entry,
+ gpointer user_data)
+{
+ GncPluginPage *plugin_page;
+ GncPluginPageAccountTree *page;
+ GncPluginPageAccountTreePrivate *priv;
+ GtkPositionType position = GTK_POS_BOTTOM;
+ gchar *conf_string;
+
+ g_return_if_fail(user_data != NULL);
+
+ plugin_page = GNC_PLUGIN_PAGE(user_data);
+ page = GNC_PLUGIN_PAGE_ACCOUNT_TREE (user_data);
+ priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
+
+ conf_string = gnc_gconf_get_string (GCONF_GENERAL,
+ KEY_SUMMARYBAR_POSITION, NULL);
+ if (conf_string) {
+ position = gnc_enum_from_nick (GTK_TYPE_POSITION_TYPE,
+ conf_string, GTK_POS_BOTTOM);
+ g_free (conf_string);
+ }
+
+ gtk_box_reorder_child(GTK_BOX(priv->widget),
+ plugin_page->summarybar,
+ (position == GTK_POS_TOP ? 0 : -1) );
+}
+
/** This button press handler calls the common button press handler
* for all pages. The GtkTreeView eats all button presses and
* doesn't pass them up the widget tree, even when doesn't do
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2007-08-27 23:10:13 UTC (rev 16474)
@@ -57,6 +57,7 @@
#include "gnc-date-edit.h"
#include "gnc-engine.h"
#include "gnc-event.h"
+#include "gnc-gconf-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-gobject-utils.h"
#include "gnc-gui-query.h"
@@ -97,6 +98,8 @@
static gchar *gnc_plugin_page_register_get_tab_name (GncPluginPage *plugin_page);
static gchar *gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page);
+static void gnc_plugin_page_register_summarybar_position_changed(GConfEntry *entry, gpointer user_data);
+
/* Callbacks for the "Sort By" dialog */
void gnc_plugin_page_register_sort_button_cb(GtkToggleButton *button, GncPluginPageRegister *page);
void gnc_plugin_page_register_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page);
@@ -743,8 +746,11 @@
plugin_page->summarybar = gsr_create_summary_bar(priv->gsr);
if (plugin_page->summarybar) {
gtk_widget_show_all(plugin_page->summarybar);
- gtk_box_pack_end(GTK_BOX (priv->widget), plugin_page->summarybar,
- FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar,
+ FALSE, FALSE, 0);
+ gnc_plugin_page_register_summarybar_position_changed(NULL, page);
+ gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_register_summarybar_position_changed, page);
}
priv->event_handler_id = qof_event_register_handler
@@ -780,6 +786,9 @@
page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+ gnc_gconf_general_remove_cb(KEY_SUMMARYBAR_POSITION,
+ gnc_plugin_page_register_summarybar_position_changed, page);
+
if (priv->widget == NULL)
return;
@@ -1190,6 +1199,35 @@
return NULL;
}
+static void
+gnc_plugin_page_register_summarybar_position_changed(GConfEntry *entry,
+ gpointer user_data)
+{
+ GncPluginPage *plugin_page;
+ GncPluginPageRegister *page;
+ GncPluginPageRegisterPrivate *priv;
+ GtkPositionType position = GTK_POS_BOTTOM;
+ gchar *conf_string;
+
+ g_return_if_fail(user_data != NULL);
+
+ plugin_page = GNC_PLUGIN_PAGE(user_data);
+ page = GNC_PLUGIN_PAGE_REGISTER (user_data);
+ priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+ conf_string = gnc_gconf_get_string (GCONF_GENERAL,
+ KEY_SUMMARYBAR_POSITION, NULL);
+ if (conf_string) {
+ position = gnc_enum_from_nick (GTK_TYPE_POSITION_TYPE,
+ conf_string, GTK_POS_BOTTOM);
+ g_free (conf_string);
+ }
+
+ gtk_box_reorder_child(GTK_BOX(priv->widget),
+ plugin_page->summarybar,
+ (position == GTK_POS_TOP ? 0 : -1) );
+}
+
/************************************************************/
/* "Sort By" Dialog */
/************************************************************/
Modified: gnucash/trunk/src/gnome/schemas/apps_gnucash_general.schemas.in
===================================================================
--- gnucash/trunk/src/gnome/schemas/apps_gnucash_general.schemas.in 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/gnome/schemas/apps_gnucash_general.schemas.in 2007-08-27 23:10:13 UTC (rev 16474)
@@ -536,6 +536,23 @@
</schema>
<schema>
+ <key>/schemas/apps/gnucash/general/summarybar_position</key>
+ <applyto>/apps/gnucash/general/summarybar_position</applyto>
+ <owner>gnucash</owner>
+ <type>string</type>
+ <default>bottom</default>
+ <locale name="C">
+ <short>Position of the summary bar</short>
+ <long>
+ This setting determines the edge at which the summary bar
+ for various pages is drawn. Possible values are "top"
+ and "bottom".
+ It defaults to "bottom".
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnucash/dev/allow_file_incompatibility</key>
<applyto>/apps/gnucash/dev/allow_file_incompatibility</applyto>
<owner>gnucash</owner>
Modified: gnucash/trunk/src/gnome-utils/glade/preferences.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/preferences.glade 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/gnome-utils/glade/preferences.glade 2007-08-27 23:10:13 UTC (rev 16474)
@@ -3857,7 +3857,7 @@
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">4</property>
+ <property name="right_attach">2</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="x_options">fill</property>
@@ -3880,7 +3880,7 @@
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">4</property>
+ <property name="right_attach">2</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="x_padding">12</property>
@@ -3905,7 +3905,7 @@
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">4</property>
+ <property name="right_attach">2</property>
<property name="top_attach">17</property>
<property name="bottom_attach">18</property>
<property name="x_padding">12</property>
@@ -3930,7 +3930,7 @@
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">4</property>
+ <property name="right_attach">2</property>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
<property name="x_padding">12</property>
@@ -3955,7 +3955,7 @@
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">4</property>
+ <property name="right_attach">2</property>
<property name="top_attach">19</property>
<property name="bottom_attach">20</property>
<property name="x_padding">12</property>
@@ -3965,6 +3965,83 @@
</child>
<child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Summary Bar Position</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">15</property>
+ <property name="bottom_attach">16</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="gconf/general/summarybar_position/top">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Display the summary bar at the top of the page.</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Top</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">16</property>
+ <property name="bottom_attach">17</property>
+ <property name="x_padding">12</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="gconf/general/summarybar_position/bottom">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Display the summary bar at the bottom of the page.</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Bottom</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">gconf/general/summarybar_position/top</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">17</property>
+ <property name="bottom_attach">18</property>
+ <property name="x_padding">12</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkLabel" id="label112">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
@@ -4138,7 +4215,7 @@
</widget>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="x_options">fill</property>
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-page.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-page.h 2007-08-27 22:51:29 UTC (rev 16473)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-page.h 2007-08-27 23:10:13 UTC (rev 16474)
@@ -41,6 +41,8 @@
G_BEGIN_DECLS
+#define KEY_SUMMARYBAR_POSITION "summarybar_position"
+
/* type macros */
#define GNC_TYPE_PLUGIN_PAGE (gnc_plugin_page_get_type ())
#define GNC_PLUGIN_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPage))
More information about the gnucash-changes
mailing list