summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJussi Kukkonen <jku@goto.fi>2014-07-28 15:13:41 +0300
committerJussi Kukkonen <jku@goto.fi>2014-07-31 18:26:00 +0300
commit4679e71ef0844f5873cd75f04f0096d236eff3a6 (patch)
treec9f11c73c1f5b802410f03093a444e3678855760 /src
parent80798bd591001aa2b935d731fb5af7b217f06010 (diff)
downloadgupnp-tools-4679e71ef0844f5873cd75f04f0096d236eff3a6.tar.gz
universal-cp: Workaround for Label alignment issues
It seems Labels in a size group won't correctly align to start with GTK+ 3.13. Work around this by adding an extra container around each label, and adding the containers in the size group instead. https://bugzilla.gnome.org/show_bug.cgi?id=733594
Diffstat (limited to 'src')
-rw-r--r--src/universal-cp/action-dialog.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/universal-cp/action-dialog.c b/src/universal-cp/action-dialog.c
index cfef832..406bfad 100644
--- a/src/universal-cp/action-dialog.c
+++ b/src/universal-cp/action-dialog.c
@@ -42,7 +42,7 @@ static GtkWidget *service_label;
static GtkWidget *action_label;
static GtkWidget *in_args_expander;
static GtkWidget *out_args_expander;
-static GtkSizeGroup *label_group;
+static GtkSizeGroup *label_container_group;
static void
on_expander_clicked (GObject *expander,
@@ -225,7 +225,7 @@ populate_action_arguments_grid (GtkWidget *grid,
GUPnPServiceIntrospection *introspection)
{
GList *arg_node;
- GtkWidget *last_label = NULL;
+ GtkWidget *last_aligner_grid = NULL;
g_assert (introspection != NULL);
@@ -239,23 +239,32 @@ populate_action_arguments_grid (GtkWidget *grid,
arg_node;
arg_node = arg_node->next) {
GUPnPServiceActionArgInfo *arg_info;
+ GtkWidget *aligner_grid;
GtkWidget *label;
GtkWidget *input_widget;
arg_info = (GUPnPServiceActionArgInfo *) arg_node->data;
/* First add the name */
- label = gtk_label_new (arg_info->name);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+ /* GTK_ALIGN_START seems to have a bug in a size group:
+ * use a container for alignment */
+ aligner_grid = gtk_grid_new ();
gtk_grid_attach_next_to (GTK_GRID (grid),
- label,
- last_label,
+ aligner_grid,
+ last_aligner_grid,
GTK_POS_BOTTOM,
1, 1);
- gtk_size_group_add_widget (label_group, label);
- gtk_widget_show (label);
- last_label = label;
+ last_aligner_grid = aligner_grid;
+
+ label = gtk_label_new (arg_info->name);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+ gtk_widget_set_vexpand (label, TRUE);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_grid_attach (GTK_GRID (aligner_grid), label,
+ 0, 0, 1, 1);
+ gtk_size_group_add_widget (label_container_group,
+ aligner_grid);
+ gtk_widget_show_all (aligner_grid);
/* Then the input widget */
input_widget = create_widget_for_argument (arg_info,
@@ -263,7 +272,7 @@ populate_action_arguments_grid (GtkWidget *grid,
gtk_widget_set_hexpand (input_widget, TRUE);
gtk_grid_attach_next_to (GTK_GRID (grid),
input_widget,
- label,
+ aligner_grid,
GTK_POS_RIGHT,
1,1);
gtk_widget_show_all (input_widget);
@@ -722,7 +731,7 @@ init_action_dialog (GtkBuilder *builder)
{
GtkWidget *image;
- label_group =
+ label_container_group =
gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Dialog box and grids */
@@ -788,7 +797,7 @@ init_action_dialog (GtkBuilder *builder)
void
deinit_action_dialog (void)
{
- g_object_unref (label_group);
+ g_object_unref (label_container_group);
gtk_widget_destroy (dialog);
}