Commit cc4ac1ee authored by Alexander Larsson's avatar Alexander Larsson

GtkListBox: Rename separators to headers

parent 4a0b6e54
This diff is collapsed.
......@@ -126,31 +126,31 @@ typedef gint (*GtkListBoxSortFunc) (GtkListBoxRow *row1,
GtkListBoxRow *row2,
gpointer user_data);
/**
* GtkListBoxUpdateSeparatorFunc:
* GtkListBoxUpdateHeaderFunc:
* @row: The row to update
* @before: The row before @row, or %NULL if it is first.
* @user_data: (closure): user data.
*
* Whenever @row changes or which row is before @row changes this is called, which
* lets you update the separator on @row. You may remove or set a new one
* via gtk_list_box_row_set_separator() or just change the state of the current
* separator widget.
* lets you update the header on @row. You may remove or set a new one
* via gtk_list_box_row_set_header() or just change the state of the current
* header widget.
*
* Since: 3.10
*/
typedef void (*GtkListBoxUpdateSeparatorFunc) (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data);
typedef void (*GtkListBoxUpdateHeaderFunc) (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data);
GDK_AVAILABLE_IN_3_10
GType gtk_list_box_row_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_10
GtkWidget* gtk_list_box_row_new (void);
GDK_AVAILABLE_IN_3_10
GtkWidget* gtk_list_box_row_get_separator (GtkListBoxRow *row);
GtkWidget* gtk_list_box_row_get_header (GtkListBoxRow *row);
GDK_AVAILABLE_IN_3_10
void gtk_list_box_row_set_separator (GtkListBoxRow *row,
GtkWidget *separator);
void gtk_list_box_row_set_header (GtkListBoxRow *row,
GtkWidget *header);
GDK_AVAILABLE_IN_3_10
void gtk_list_box_row_changed (GtkListBoxRow *row);
......@@ -184,8 +184,8 @@ void gtk_list_box_set_filter_func (GtkListBox
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_3_10
void gtk_list_box_set_separator_func (GtkListBox *list_box,
GtkListBoxUpdateSeparatorFunc update_separator,
void gtk_list_box_set_header_func (GtkListBox *list_box,
GtkListBoxUpdateHeaderFunc update_header,
gpointer user_data,
GDestroyNotify destroy);
GDK_AVAILABLE_IN_3_10
......
......@@ -60,7 +60,7 @@ row_new (const gchar* text, gint sort_id) {
static void
update_separator_cb (Row *row, Row *before, gpointer data)
update_header_cb (Row *row, Row *before, gpointer data)
{
GtkWidget *hbox, *l, *b;
GList *children;
......@@ -69,29 +69,29 @@ update_separator_cb (Row *row, Row *before, gpointer data)
(row->label != NULL &&
strcmp (gtk_label_get_text (GTK_LABEL (row->label)), "blah3") == 0))
{
/* Create separator if needed */
if (gtk_list_box_row_get_separator (GTK_LIST_BOX_ROW (row)) == NULL)
/* Create header if needed */
if (gtk_list_box_row_get_header (GTK_LIST_BOX_ROW (row)) == NULL)
{
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
l = gtk_label_new ("Separator");
l = gtk_label_new ("Header");
gtk_container_add (GTK_CONTAINER (hbox), l);
b = gtk_button_new_with_label ("button");
gtk_container_add (GTK_CONTAINER (hbox), b);
gtk_widget_show (l);
gtk_widget_show (b);
gtk_list_box_row_set_separator (GTK_LIST_BOX_ROW (row), hbox);
gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), hbox);
}
hbox = gtk_list_box_row_get_separator(GTK_LIST_BOX_ROW (row));
hbox = gtk_list_box_row_get_header(GTK_LIST_BOX_ROW (row));
children = gtk_container_get_children (GTK_CONTAINER (hbox));
l = children->data;
g_list_free (children);
gtk_label_set_text (GTK_LABEL (l), g_strdup_printf ("Separator %d", row->sort_id));
gtk_label_set_text (GTK_LABEL (l), g_strdup_printf ("Header %d", row->sort_id));
}
else
{
gtk_list_box_row_set_separator(GTK_LIST_BOX_ROW (row), NULL);
gtk_list_box_row_set_header(GTK_LIST_BOX_ROW (row), NULL);
}
}
......@@ -210,7 +210,7 @@ separate_clicked_cb (GtkButton *button,
{
GtkListBox *list = data;
gtk_list_box_set_separator_func (list, (GtkListBoxUpdateSeparatorFunc)update_separator_cb, NULL, NULL);
gtk_list_box_set_header_func (list, (GtkListBoxUpdateHeaderFunc)update_header_cb, NULL, NULL);
}
static void
......@@ -219,7 +219,7 @@ unseparate_clicked_cb (GtkButton *button,
{
GtkListBox *list = data;
gtk_list_box_set_separator_func (list, NULL, NULL, NULL);
gtk_list_box_set_header_func (list, NULL, NULL, NULL);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment