Remove label column for gnc_date_format_new_without_label

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.
This commit is contained in:
Robert Fewell 2019-11-29 16:33:55 +00:00
parent d122fa397f
commit 202a7e40d8
2 changed files with 15 additions and 20 deletions

View File

@ -60,6 +60,7 @@ struct _GNCDateFormatPrivate
GtkWidget* format_combobox;
GtkWidget* label;
GtkWidget* table;
GtkWidget* months_label;
GtkWidget* months_number;
@ -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));
@ -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));
@ -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;
}

View File

@ -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>
@ -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>
@ -263,15 +266,6 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>