Skip to content

Commit

Permalink
Remove label column for gnc_date_format_new_without_label
Browse files Browse the repository at this point in the history
Currently the label is destroyed if not required but the grid column is
still present and as such uses the grid column spacing setting which
causes the date format to be offset, this can be seen in the print
cheque dialogue so instead remove the first column which has the label.
  • Loading branch information
Bob-IT committed Dec 3, 2019
1 parent d122fa3 commit 202a7e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
17 changes: 9 additions & 8 deletions gnucash/gnome-utils/gnc-date-format.c
Expand Up @@ -60,6 +60,7 @@ struct _GNCDateFormatPrivate
GtkWidget* format_combobox;

GtkWidget* label;
GtkWidget* table;

GtkWidget* months_label;
GtkWidget* months_number;
Expand Down Expand Up @@ -118,7 +119,7 @@ gnc_date_format_init (GNCDateFormat *gdf)
{
GNCDateFormatPrivate *priv;
GtkBuilder *builder;
GtkWidget *dialog, *table;
GtkWidget *dialog;

g_return_if_fail(gdf);
g_return_if_fail(GNC_IS_DATE_FORMAT(gdf));
Expand Down Expand Up @@ -159,11 +160,11 @@ gnc_date_format_init (GNCDateFormat *gdf)
/* pull in the dialog and table widgets and play the reconnect game */
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "gnc_date_format_window"));

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));
priv->table = GTK_WIDGET(gtk_builder_get_object (builder, "date_format_table"));
g_object_ref (G_OBJECT(priv->table));
gtk_container_remove (GTK_CONTAINER(dialog), priv->table);
gtk_container_add (GTK_CONTAINER(gdf), priv->table);
g_object_unref (G_OBJECT(priv->table));

g_object_unref(G_OBJECT(builder));

Expand Down Expand Up @@ -205,9 +206,9 @@ gnc_date_format_new_without_label (void)
GNCDateFormat *gdf = GNC_DATE_FORMAT(widget);
GNCDateFormatPrivate *priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);

gtk_widget_destroy(priv->label);
// remove the first column which has the label
gtk_grid_remove_column (GTK_GRID(priv->table), 0);
priv->label = NULL;

return widget;
}

Expand Down
18 changes: 6 additions & 12 deletions gnucash/gtkbuilder/gnc-date-format.glade
Expand Up @@ -45,16 +45,19 @@
<object class="GtkGrid" id="date_format_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">3</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="sample_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">3</property>
<property name="label">December 31, 2000</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -202,12 +205,12 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_right">5</property>
<property name="margin_top">3</property>
<property name="label" translatable="yes">Sample</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -263,15 +266,6 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
Expand Down

0 comments on commit 202a7e4

Please sign in to comment.