/* Hack to make the plugin-provided editor widget fit in better with
 * the control center by changing
 *
 *     Foo:     [__________]
 *     Bar baz: [__________]
 *
 * to
 *
 *          Foo [__________]
 *      Bar baz [__________]
 */
static void
vpn_gnome3ify_editor (GtkWidget *widget)
{
        if (GTK_IS_CONTAINER (widget)) {
                GList *children, *iter;

                children = gtk_container_get_children (GTK_CONTAINER (widget));
                for (iter = children; iter; iter = iter->next)
                        vpn_gnome3ify_editor (iter->data);
                g_list_free (children);
        } else if (GTK_IS_LABEL (widget)) {
                const char *text;
                gfloat xalign;
                char *newtext;
                int len;

                xalign = gtk_label_get_xalign (GTK_LABEL (widget));
                if (xalign != 0.0)
                        return;
                text = gtk_label_get_text (GTK_LABEL (widget));
                len = strlen (text);
                if (len < 2 || text[len - 1] != ':')
                        return;

                newtext = g_strndup (text, len - 1);
                gtk_label_set_text (GTK_LABEL (widget), newtext);
                g_free (newtext);
                gtk_label_set_xalign (GTK_LABEL (widget), 1.0);
        }
}
Example #2
0
Php::Value GtkLabel_::get_xalign()
{
	gfloat ret = gtk_label_get_xalign (GTK_LABEL(instance));

	return ret;
}