summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 17:19:44 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 17:19:44 -0400
commit7b104667ab49b62e19f115fd33274936e087d892 (patch)
tree091520bf34fc8bc55c4f4d1e43eb9efc2882d62b
parentec070204a55be1c3f046cdc1896225a6cddf1b2f (diff)
More TODO resolution.
-rw-r--r--new/container_unix.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/new/container_unix.c b/new/container_unix.c
index 047b40a..e3f8da3 100644
--- a/new/container_unix.c
+++ b/new/container_unix.c
@@ -29,8 +29,6 @@ static void uiContainer_dispose(GObject *obj)
G_OBJECT_CLASS(uiContainer_parent_class)->dispose(obj);
}
-// TODO switch from using uiContainer() directly below
-
static void uiContainer_finalize(GObject *obj)
{
G_OBJECT_CLASS(uiContainer_parent_class)->finalize(obj);
@@ -41,27 +39,30 @@ static void uiContainer_finalize(GObject *obj)
static void uiContainer_add(GtkContainer *container, GtkWidget *widget)
{
- gtk_widget_set_parent(widget, GTK_WIDGET(container));
- if (uiContainer(container)->children != NULL)
- g_ptr_array_add(uiContainer(container)->children, widget);
+ uiContainer *c = uiContainer(container);
+
+ gtk_widget_set_parent(widget, GTK_WIDGET(c));
+ if (c->children != NULL)
+ g_ptr_array_add(c->children, widget);
}
static void uiContainer_remove(GtkContainer *container, GtkWidget *widget)
{
+ uiContainer *c = uiContainer(container);
+
gtk_widget_unparent(widget);
- if (uiContainer(container)->children != NULL)
- g_ptr_array_remove(uiContainer(container)->children, widget);
+ if (c->children != NULL)
+ g_ptr_array_remove(c->children, widget);
}
static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
- uiControl *c;
+ uiContainer *c = uiContainer(widget);
uiSizing d;
- gtk_widget_set_allocation(widget, allocation);
- c = uiContainer(widget)->child;
- if (c != NULL)
- (*(c->resize))(c, allocation->x, allocation->y, allocation->width, allocation->height, &d);
+ gtk_widget_set_allocation(GTK_WIDGET(c), allocation);
+ if (c->child != NULL)
+ (*(c->child->resize))(c->child, allocation->x, allocation->y, allocation->width, allocation->height, &d);
}
struct forall {
@@ -78,12 +79,13 @@ static void doforall(gpointer obj, gpointer data)
static void uiContainer_forall(GtkContainer *container, gboolean includeInternals, GtkCallback callback, gpointer data)
{
+ uiContainer *c = uiContainer(container);
struct forall s;
s.callback = callback;
s.data = data;
- if (uiContainer(container)->children != NULL)
- g_ptr_array_foreach(uiContainer(container)->children, doforall, &s);
+ if (c->children != NULL)
+ g_ptr_array_foreach(c->children, doforall, &s);
}
static void uiContainer_class_init(uiContainerClass *class)
@@ -98,8 +100,5 @@ static void uiContainer_class_init(uiContainerClass *class)
GtkWidget *newContainer(void)
{
- uiContainer *c;
-
- c = uiContainer(g_object_new(uiContainerType, NULL));
- return GTK_WIDGET(c);
+ return GTK_WIDGET(g_object_new(uiContainerType, NULL));
}