Bug #656174 Migrate Cheque / date from GladeXML to Builder

Patch by Robert Fewell

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21160 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2011-08-11 20:25:27 +00:00
parent 166b3494a1
commit c4ec5ff54b
9 changed files with 876 additions and 1877 deletions

View File

@ -9,7 +9,6 @@ glade_DATA = \
exchange-dialog.glade \
druid-gconf-setup.glade \
druid-gnc-xml-import.glade \
gnc-date-format.glade \
gnc-gui-query.glade \
preferences.glade \
totd.glade

View File

@ -1,27 +1,26 @@
/*
* gnc-date-format.c -- Date formator widget
*
* Copyright (C) 2003 Derek Atkins <derek@ihtfp.com>
* All rights reserved.
*
* Gnucash is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* Gnucash is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*
*/
/********************************************************************
* gnc-date-format.c -- Date formator widget *
* (GnuCash) *
* Copyright (C) 2003 Derek Atkins <derek@ihtfp.com> *
* *
* 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 the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
********************************************************************/
/*
@NOTATION@
*/
@ -40,6 +39,7 @@
#include "gnc-date-format.h"
#include "dialog-utils.h"
#include "gnc-engine.h"
#ifndef HAVE_LOCALTIME_R
# include "localtime_r.h"
@ -48,6 +48,9 @@
/* Perhaps it's better just to use MAX_DATE_LENGTH defined in gnc-date.h */
#define MAX_DATE_LEN 80
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
enum
{
FORMAT_CHANGED,
@ -60,7 +63,7 @@ struct _GNCDateFormatPriv
{
GtkWidget* format_combobox;
GtkWidget* label;
GtkWidget* label;
GtkWidget* months_label;
GtkWidget* months_number;
@ -81,13 +84,11 @@ struct _GNCDateFormatPriv
static guint date_format_signals [LAST_SIGNAL] = { 0 };
static void gnc_date_format_init (GNCDateFormat *gdf);
static void gnc_date_format_class_init (GNCDateFormatClass *class);
static void gnc_date_format_finalize (GObject *object);
static void gnc_date_format_compute_format(GNCDateFormat *gdf);
/* Used by glade_xml_signal_autoconnect_full */
void gnc_ui_date_format_changed_cb(GtkWidget *unused, gpointer user_data);
static GtkHBoxClass *parent_class;
@ -150,54 +151,61 @@ gnc_date_format_class_init (GNCDateFormatClass *klass)
0);
}
static void
gnc_date_format_init (GNCDateFormat *gdf)
{
GNCDateFormatPriv *priv;
GladeXML *xml;
GtkBuilder *builder;
GtkWidget *dialog, *table;
g_return_if_fail(gdf);
g_return_if_fail(GNC_IS_DATE_FORMAT(gdf));
/* Open up the Glade and set the signals */
xml = gnc_glade_xml_new("gnc-date-format.glade", "GNC Date Format");
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, gdf);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder,"gnc-date-format.glade", "format-liststore");
gnc_builder_add_from_file (builder,"gnc-date-format.glade", "GNC Date Format");
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gdf);
/* pull in all the child widgets */
priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
priv->label = glade_xml_get_widget(xml, "widget_label");
priv->format_combobox = glade_xml_get_widget(xml, "format_combobox");
priv->label = GTK_WIDGET(gtk_builder_get_object (builder, "widget_label"));
priv->format_combobox = GTK_WIDGET(gtk_builder_get_object (builder, "format_combobox"));
priv->months_label = glade_xml_get_widget(xml, "months_label");
priv->months_number = glade_xml_get_widget(xml, "month_number_button");
priv->months_abbrev = glade_xml_get_widget(xml, "month_abbrev_button");
priv->months_name = glade_xml_get_widget(xml, "month_name_button");
priv->months_label = GTK_WIDGET(gtk_builder_get_object (builder, "months_label"));
priv->months_number = GTK_WIDGET(gtk_builder_get_object (builder, "month_number_button"));
priv->months_abbrev = GTK_WIDGET(gtk_builder_get_object (builder, "month_abbrev_button"));
priv->months_name = GTK_WIDGET(gtk_builder_get_object (builder, "month_name_button"));
priv->years_label = glade_xml_get_widget(xml, "years_label");
priv->years_button = glade_xml_get_widget(xml, "years_button");
priv->years_label = GTK_WIDGET(gtk_builder_get_object (builder, "years_label"));
priv->years_button = GTK_WIDGET(gtk_builder_get_object (builder, "years_button"));
priv->custom_label = glade_xml_get_widget(xml, "format_label");
priv->custom_entry = glade_xml_get_widget(xml, "format_entry");
priv->custom_label = GTK_WIDGET(gtk_builder_get_object (builder, "format_label"));
priv->custom_entry = GTK_WIDGET(gtk_builder_get_object (builder, "format_entry"));
priv->sample_label = glade_xml_get_widget(xml, "sample_label");
priv->sample_label = GTK_WIDGET(gtk_builder_get_object (builder, "sample_label"));
/* Set initial format to gnucash default */
gnc_date_format_set_format(gdf, qof_date_format_get());
/* pull in the dialog and table widgets and play the reconnect game */
dialog = glade_xml_get_widget(xml, "GNC Date Format");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "GNC Date Format"));
table = glade_xml_get_widget(xml, "date_format_table");
table = GTK_WIDGET(gtk_builder_get_object (builder, "date_format_table"));
g_object_ref(G_OBJECT(table));
gtk_container_remove(GTK_CONTAINER(dialog), table);
gtk_container_add(GTK_CONTAINER(gdf), table);
g_object_unref(G_OBJECT(table));
g_object_unref(G_OBJECT(builder));
/* Destroy the now empty window */
gtk_widget_destroy(dialog);
}
static void
gnc_date_format_finalize (GObject *object)
{
@ -229,6 +237,7 @@ gnc_date_format_new (void)
return gnc_date_format_new_with_label (NULL);
}
GtkWidget *
gnc_date_format_new_without_label (void)
{
@ -242,6 +251,7 @@ gnc_date_format_new_without_label (void)
return widget;
}
/**
* gnc_date_format_new_with_label:
* @label: the label to use to define the widget.
@ -267,6 +277,7 @@ gnc_date_format_new_with_label (const char *label)
return GTK_WIDGET(gdf);
}
void
gnc_date_format_set_format (GNCDateFormat *gdf, QofDateFormat format)
{
@ -280,6 +291,7 @@ gnc_date_format_set_format (GNCDateFormat *gdf, QofDateFormat format)
gnc_date_format_compute_format(gdf);
}
QofDateFormat
gnc_date_format_get_format (GNCDateFormat *gdf)
{
@ -292,6 +304,7 @@ gnc_date_format_get_format (GNCDateFormat *gdf)
return gtk_combo_box_get_active(GTK_COMBO_BOX(priv->format_combobox));
}
void
gnc_date_format_set_months (GNCDateFormat *gdf, GNCDateMonthFormat months)
{
@ -323,6 +336,7 @@ gnc_date_format_set_months (GNCDateFormat *gdf, GNCDateMonthFormat months)
gnc_date_format_compute_format(gdf);
}
GNCDateMonthFormat
gnc_date_format_get_months (GNCDateFormat *gdf)
{
@ -344,6 +358,7 @@ gnc_date_format_get_months (GNCDateFormat *gdf)
return GNCDATE_MONTH_NUMBER;
}
void
gnc_date_format_set_years (GNCDateFormat *gdf, gboolean include_century)
{
@ -358,6 +373,7 @@ gnc_date_format_set_years (GNCDateFormat *gdf, gboolean include_century)
gnc_date_format_compute_format(gdf);
}
gboolean
gnc_date_format_get_years (GNCDateFormat *gdf)
{
@ -370,6 +386,7 @@ gnc_date_format_get_years (GNCDateFormat *gdf)
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->years_button));
}
void
gnc_date_format_set_custom (GNCDateFormat *gdf, const char *format)
{
@ -386,6 +403,7 @@ gnc_date_format_set_custom (GNCDateFormat *gdf, const char *format)
gnc_date_format_compute_format(gdf);
}
const char *
gnc_date_format_get_custom (GNCDateFormat *gdf)
{
@ -398,6 +416,7 @@ gnc_date_format_get_custom (GNCDateFormat *gdf)
return gtk_entry_get_text(GTK_ENTRY(priv->custom_entry));
}
void
gnc_ui_date_format_changed_cb(GtkWidget *unused, gpointer user_data)
{
@ -406,6 +425,7 @@ gnc_ui_date_format_changed_cb(GtkWidget *unused, gpointer user_data)
gnc_date_format_compute_format(gdf);
}
static void
gnc_date_format_enable_month (GNCDateFormat *gdf, gboolean sensitive)
{
@ -418,6 +438,7 @@ gnc_date_format_enable_month (GNCDateFormat *gdf, gboolean sensitive)
gtk_widget_set_sensitive(priv->months_name, sensitive);
}
static void
gnc_date_format_enable_year (GNCDateFormat *gdf, gboolean sensitive)
{
@ -428,6 +449,7 @@ gnc_date_format_enable_year (GNCDateFormat *gdf, gboolean sensitive)
gtk_widget_set_sensitive(priv->years_button, sensitive);
}
static void
gnc_date_format_enable_format (GNCDateFormat *gdf, gboolean sensitive)
{
@ -438,6 +460,7 @@ gnc_date_format_enable_format (GNCDateFormat *gdf, gboolean sensitive)
gtk_widget_set_sensitive(priv->custom_entry, sensitive);
}
void
gnc_date_format_refresh (GNCDateFormat *gdf)
{
@ -531,6 +554,7 @@ gnc_date_format_refresh (GNCDateFormat *gdf)
g_free(format);
}
static void
gnc_date_format_compute_format(GNCDateFormat *gdf)
{

View File

@ -1,6 +1,7 @@
gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
gtkbuilder_DATA = \
commodity.glade \
gnc-date-format.glade \
transfer.glade
EXTRA_DIST = $(gtkbuilder_DATA)

View File

@ -1,22 +1,25 @@
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gtk+ 2.10 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="GNC Date Format">
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="GNC Date Format">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Date Format</property>
<property name="resizable">False</property>
<child>
<widget class="GtkTable" id="date_format_table">
<object class="GtkTable" id="date_format_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">6</property>
<property name="n_columns">3</property>
<child>
<widget class="GtkLabel" id="sample_label">
<object class="GtkLabel" id="sample_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">December 31, 2000</property>
</widget>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@ -27,12 +30,18 @@
</packing>
</child>
<child>
<widget class="GtkEntry" id="format_entry">
<object class="GtkEntry" id="format_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="text" translatable="yes">%Y-%m-%d</property>
<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>
<signal name="changed" handler="gnc_ui_date_format_changed_cb"/>
</widget>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@ -42,16 +51,17 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="years_button">
<object class="GtkCheckButton" id="years_button">
<property name="label" translatable="yes">Include Century</property>
<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="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="gnc_ui_date_format_changed_cb"/>
</widget>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@ -62,18 +72,21 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="months_hbox">
<object class="GtkHBox" id="months_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkRadioButton" id="month_number_button">
<object class="GtkRadioButton" id="month_number_button">
<property name="label" translatable="yes">Number</property>
<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="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="gnc_ui_date_format_changed_cb"/>
</widget>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@ -81,16 +94,17 @@
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="month_abbrev_button">
<object class="GtkRadioButton" id="month_abbrev_button">
<property name="label" translatable="yes">Abbreviation</property>
<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="draw_indicator">True</property>
<property name="group">month_number_button</property>
<signal name="toggled" handler="gnc_ui_date_format_changed_cb"/>
</widget>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@ -98,23 +112,24 @@
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="month_name_button">
<object class="GtkRadioButton" id="month_name_button">
<property name="label" translatable="yes">Name</property>
<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="draw_indicator">True</property>
<property name="group">month_number_button</property>
<signal name="toggled" handler="gnc_ui_date_format_changed_cb"/>
</widget>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</widget>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
@ -125,10 +140,11 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="justify">center</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -139,11 +155,12 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="months_label">
<object class="GtkLabel" id="months_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Months:</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -154,11 +171,12 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="years_label">
<object class="GtkLabel" id="years_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Years:</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -169,11 +187,12 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="format_label">
<object class="GtkLabel" id="format_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Format:</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -184,11 +203,12 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Sample:</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -199,42 +219,45 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="label_box">
<object class="GtkHBox" id="label_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
<widget class="GtkLabel" id="widget_label">
<object class="GtkLabel" id="widget_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Date format:</property>
</widget>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="format_combobox">
<object class="GtkComboBox" id="format_combobox">
<property name="visible">True</property>
<property name="items" translatable="yes">US (12/31/2001)
UK (31/12/2001)
Europe (31.12.2001)
ISO (2001-12-31)
UTC
Locale
Custom
</property>
<property name="can_focus">False</property>
<property name="model">format-liststore</property>
<signal name="changed" handler="gnc_ui_date_format_changed_cb"/>
</widget>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
@ -260,7 +283,36 @@ Custom
<child>
<placeholder/>
</child>
</widget>
</object>
</child>
</widget>
</glade-interface>
</object>
<object class="GtkListStore" id="format-liststore">
<columns>
<!-- column-name item -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">US (12/31/2001)</col>
</row>
<row>
<col id="0" translatable="yes">UK (31/12/2001)</col>
</row>
<row>
<col id="0" translatable="yes">Europe (31.12.2001)</col>
</row>
<row>
<col id="0" translatable="yes">ISO (2001-12-31)</col>
</row>
<row>
<col id="0" translatable="yes">UTC</col>
</row>
<row>
<col id="0" translatable="yes">Locale</col>
</row>
<row>
<col id="0" translatable="yes">Custom</col>
</row>
</data>
</object>
</interface>

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@ gladedir = $(GNC_GLADE_DIR)
glade_DATA = \
budget.glade \
newuser.glade \
print.glade \
progress.glade \
reconcile.glade \
register.glade \

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ gtkbuilder_DATA = \
newuser.glade \
owner.glade \
price.glade \
print.glade \
dialog-print-check.glade \
progress.glade \
reconcile.glade \
register.glade \