ocarina/ocarina/body/page.cpp
Bryan Schumaker 882f917c8f ocarina: Add a reference to the footer before moving
Calling the remove() function will destroy the footer if it has no other
references.  To prevent this, I need to call g_object_ref() add a
reference to the widget.
2011-10-21 14:51:22 -04:00

41 lines
697 B
C++

#include <ocarina/page.h>
#include <ocarina/gtk.h>
#include <ocarina/footer.h>
#include <libsaria/print.h>
GtkAttachOptions GROW = GTK_FILL;
GtkAttachOptions SHRINK;
Page::Page(GtkWidget *content)
{
table = gtk_table_new(3, 1, FALSE);
add_content(content);
gtk_widget_show(table);
}
Page::~Page()
{
}
void Page::add_content(GtkWidget *content)
{
gtk_table_attach_defaults(GTK_TABLE(table), content, 0, 1, 0, 1);
}
void Page::remove_footer(GtkWidget *footer)
{
gtk_container_remove(GTK_CONTAINER(table), footer);
}
void Page::add_footer(GtkWidget *footer)
{
gtk_table_attach(GTK_TABLE(table), footer, 0, 1, 2, 3, GROW, SHRINK, 0, 0);
}
GtkWidget *Page::get_page()
{
return table;
}