[Gnucash-changes] r12952 - gnucash/trunk - More HIG changes.
David Hampton
hampton at cvs.gnucash.org
Mon Jan 23 00:53:12 EST 2006
Author: hampton
Date: 2006-01-23 00:53:11 -0500 (Mon, 23 Jan 2006)
New Revision: 12952
Trac: http://svn.gnucash.org/trac/changeset/12952
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome/dialog-chart-export.c
gnucash/trunk/src/gnome/glade/chart-export.glade
Log:
More HIG changes.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-01-23 05:42:27 UTC (rev 12951)
+++ gnucash/trunk/ChangeLog 2006-01-23 05:53:11 UTC (rev 12952)
@@ -1,5 +1,8 @@
2006-01-22 David Hampton <hampton at employees.org>
+ * src/gnome/dialog-chart-export.c:
+ * src/gnome/glade/chart-export.glade: More HIG changes.
+
* src/gnome-utils/gnc-file.c: Add an icon to the export button in
the generic filename dialog.
Modified: gnucash/trunk/src/gnome/dialog-chart-export.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-chart-export.c 2006-01-23 05:42:27 UTC (rev 12951)
+++ gnucash/trunk/src/gnome/dialog-chart-export.c 2006-01-23 05:53:11 UTC (rev 12952)
@@ -4,6 +4,7 @@
* Sun Feb 27 14:19:12 2005
* Copyright 2005 Neil Williams
* linux at codehelp.co.uk
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
****************************************************************************/
/*
@@ -35,15 +36,18 @@
#include "dialog-utils.h"
#include "gnc-engine.h"
#include "gnc-file.h"
+#include "gnc-ui.h"
#define EQUITY_ACCOUNT_NAME _("Opening Balances")
#define OPENING_BALANCE_DESC _("Opening Balance")
-static GtkWidget *chart_export;
-void on_dateok_clicked (GtkButton *button, gpointer user_data);
+void chart_export_response_cb (GtkDialog *dialog, gint response, gpointer user_data);
typedef struct chart_data_s
{
+ GladeXML *xml;
+ GtkWidget *dialog;
+ GtkWidget *calendar;
time_t chart_time_t;
QofSession *chart_session;
Account *equity_account;
@@ -175,51 +179,41 @@
g_list_free(ref);
}
-static GtkWidget *
-create_chart_export ( void )
+void
+gnc_main_window_chart_export(void)
{
- GtkWidget *dialog;
- GladeXML *xml;
+ GladeXML *xml;
chart_data *data;
xml = gnc_glade_xml_new ("chart-export.glade", "chart-export");
data = g_new0(chart_data, 1);
- glade_xml_signal_connect_data(xml, "on_dateok_clicked",
- G_CALLBACK (on_dateok_clicked), data);
- dialog = glade_xml_get_widget (xml, "chart-export");
- return dialog;
+ data->xml = xml;
+ data->dialog = glade_xml_get_widget(xml, "chart-export");
+ data->calendar = glade_xml_get_widget(xml, "chart-calendar");
+ glade_xml_signal_autoconnect_full(xml,
+ gnc_glade_autoconnect_full_func,
+ data);
+ gtk_widget_show(data->dialog);
}
-void
-gnc_main_window_chart_export(void)
+static void
+on_dateok_clicked (chart_data *data)
{
- chart_export = create_chart_export ();
- gtk_widget_show (chart_export);
-}
-
-void
-on_dateok_clicked (GtkButton *button, gpointer user_data)
-{
guint year, month, day;
- chart_data *data;
- GtkCalendar *calendar;
struct tm *chart_tm;
- GtkWindow *parent;
gchar *filename;
QofSession *current_session, *chart_session;
QofBook *book;
QofCollection *coll;
- calendar = (GtkCalendar*)gnc_glade_lookup_widget(chart_export, "chart-calendar");
- parent = (GtkWindow*)gtk_widget_get_parent ((GtkWidget*)chart_export);
- data = (chart_data*)user_data;
data->chart_time_t = time(NULL);
chart_tm = gmtime(&data->chart_time_t);
/* set today - calendar will omit any zero/NULL values */
year = chart_tm->tm_year + 1900;
month = chart_tm->tm_mon + 1;
day = chart_tm->tm_mday;
- gtk_calendar_get_date(calendar, &year, &month, &day);
+ gtk_calendar_get_date(GTK_CALENDAR(data->calendar),
+ &year, &month, &day);
if((year + 1900) != chart_tm->tm_year) {
chart_tm->tm_year = year - 1900;
}
@@ -230,7 +224,6 @@
chart_tm->tm_mday = day;
}
data->chart_time_t = mktime(chart_tm);
- gtk_widget_destroy(chart_export);
current_session = qof_session_get_current_session();
book = qof_session_get_book(current_session);
filename = g_strdup("/tmp/qsf-chartofaccounts.xml");
@@ -239,21 +232,22 @@
NULL, NULL, GNC_FILE_DIALOG_EXPORT);
if (filename)
{
+ gnc_set_busy_cursor(NULL, TRUE);
gnc_engine_suspend_events();
- qof_session_begin(chart_session, filename, TRUE, TRUE);
+ qof_session_begin(chart_session, filename, TRUE, TRUE);
data->chart_session = chart_session;
data->equity_account = NULL;
- coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
+ coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
qof_collection_foreach(coll, chart_collection_cb, data);
if(data->equity_account == NULL)
- {
+ {
data->equity_account = xaccMallocAccount (qof_session_get_book(chart_session));
xaccAccountBeginEdit (data->equity_account);
xaccAccountSetName (data->equity_account, EQUITY_ACCOUNT_NAME);
xaccAccountSetDescription(data->equity_account, EQUITY_ACCOUNT_NAME);
xaccAccountSetType (data->equity_account, EQUITY);
xaccAccountSetCommodity (data->equity_account, gnc_default_currency());
- }
+ }
qof_object_foreach(GNC_ID_ACCOUNT, book, chart_entity_cb, data);
data->param_ref_list = qof_class_get_referenceList(GNC_ID_TRANS);
qof_object_foreach(GNC_ID_TRANS, book, chart_reference_cb, data);
@@ -261,11 +255,32 @@
data->param_ref_list = qof_class_get_referenceList(GNC_ID_SPLIT);
qof_object_foreach(GNC_ID_SPLIT, book, chart_reference_cb, data);
g_list_free(data->param_ref_list);
- qof_session_save(chart_session, NULL);
+ qof_session_save(chart_session, NULL);
show_session_error(qof_session_get_error(chart_session), filename);
gnc_engine_resume_events();
+ gnc_unset_busy_cursor(NULL);
}
qof_session_end(chart_session);
- g_free(data);
qof_session_set_current_session(current_session);
}
+
+void
+chart_export_response_cb (GtkDialog *dialog, gint response, gpointer user_data)
+{
+ chart_data *data;
+ data = (chart_data*)user_data;
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ gtk_widget_hide(data->dialog);
+ on_dateok_clicked(data);
+ break;
+
+ default:
+ /* do nothing */
+ break;
+ }
+
+ gtk_widget_destroy(data->dialog);
+ g_object_unref(data->xml);
+ g_free(data);
+}
Modified: gnucash/trunk/src/gnome/glade/chart-export.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/chart-export.glade 2006-01-23 05:42:27 UTC (rev 12951)
+++ gnucash/trunk/src/gnome/glade/chart-export.glade 2006-01-23 05:53:11 UTC (rev 12952)
@@ -4,6 +4,7 @@
<glade-interface>
<widget class="GtkDialog" id="chart-export">
+ <property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Export Chart of Accounts</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -16,18 +17,20 @@
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="has_separator">True</property>
+ <property name="focus_on_map">True</property>
+ <property name="has_separator">False</property>
+ <signal name="response" handler="chart_export_response_cb" last_modification_time="Mon, 23 Jan 2006 04:43:46 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
@@ -49,12 +52,73 @@
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
- <signal name="clicked" handler="on_dateok_clicked" last_modification_time="Mon, 28 Feb 2005 10:40:01 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-convert</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label">_Export</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -67,25 +131,12 @@
</child>
<child>
- <widget class="GtkFixed" id="fixed1">
+ <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkCalendar" id="chart-calendar">
- <property name="width_request">215</property>
- <property name="height_request">180</property>
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Future dates are not supported</property>
- <property name="can_focus">True</property>
- <property name="display_options">GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES</property>
- </widget>
- <packing>
- <property name="x">40</property>
- <property name="y">184</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="chartlabel">
<property name="width_request">304</property>
<property name="height_request">56</property>
@@ -97,25 +148,27 @@
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
- <property name="yalign">0.52</property>
+ <property name="yalign">0.519999980927</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">You can export the Chart of Accounts to a QSF XML file that can be imported into another GnuCash file or used in other programs.</atkproperty>
- </accessibility>
+ <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="x">8</property>
- <property name="y">8</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="processlabel">
- <property name="width_request">296</property>
- <property name="height_request">48</property>
+ <widget class="GtkLabel" id="chartnote">
+ <property name="width_request">304</property>
+ <property name="height_request">56</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">Select the date to use and click Next to choose the filename and location.</property>
+ <property name="label" translatable="yes">The Chart of Accounts includes the balance for each account, on the date specified. Note that future dates are not supported.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_FILL</property>
@@ -125,19 +178,24 @@
<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="x">8</property>
- <property name="y">128</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="chartnote">
- <property name="width_request">304</property>
- <property name="height_request">56</property>
+ <widget class="GtkLabel" id="processlabel">
+ <property name="width_request">296</property>
+ <property name="height_request">48</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">The Chart of Accounts includes the balance for each account, on the date specified. Note that future dates are not supported.</property>
+ <property name="label" translatable="yes">Select the date to use and click Export to choose the filename and location.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_FILL</property>
@@ -147,146 +205,38 @@
<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="x">8</property>
- <property name="y">64</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-<widget class="GtkFileChooserDialog" id="chartfilechooserdialog">
- <property name="visible">True</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_SAVE</property>
- <property name="local_only">True</property>
- <property name="select_multiple">False</property>
- <property name="show_hidden">False</property>
- <property name="title" translatable="yes">Filename for exported XML</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">24</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
<child>
- <widget class="GtkButton" id="button1">
+ <widget class="GtkCalendar" id="chart-calendar">
+ <property name="width_request">215</property>
+ <property name="height_request">180</property>
<property name="visible">True</property>
- <property name="can_default">True</property>
+ <property name="tooltip" translatable="yes">Future dates are not supported</property>
<property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
+ <property name="display_options">GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES</property>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
-
- <child>
- <widget class="GtkButton" id="exportok">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-5</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">Export</atkproperty>
- </accessibility>
- <signal name="clicked" handler="on_exportok_clicked" last_modification_time="Mon, 28 Feb 2005 11:26:59 GMT"/>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-convert</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Export</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
More information about the gnucash-changes
mailing list