Esempio n. 1
0
static void
update_title_header (GtkListBoxRow *row,
                     GtkListBoxRow *before,
                     gpointer       data)
{
  GtkWidget *header;
  gchar *title;

  header = gtk_list_box_row_get_header (row);
  title = (gchar *)g_object_get_data (G_OBJECT (row), "title");
  if (!header && title)
    {
      title = g_strdup_printf ("<b>%s</b>", title);

      header = gtk_label_new (title);
      gtk_label_set_use_markup (GTK_LABEL (header), TRUE);
      gtk_widget_set_halign (header, GTK_ALIGN_START);
      gtk_widget_set_margin_top (header, 12);
      gtk_widget_set_margin_start (header, 6);
      gtk_widget_set_margin_end (header, 6);
      gtk_widget_set_margin_bottom (header, 6);
      gtk_widget_show (header);

      gtk_list_box_row_set_header (row, header);

      g_free (title);
    }
}
static void
key_list_header_func (GtkListBoxRow *row, GtkListBoxRow *prev, gpointer unused)
{
    if (prev == NULL)
        return;

    if (gtk_list_box_row_get_header (row) == NULL) {
        g_autoptr(GtkWidget) separator = NULL;

        separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_list_box_row_set_header (row, g_steal_pointer (&separator));
    }
}
static void
place_header_func (GtkListBoxRow *row,
                   GtkListBoxRow *before,
                   gpointer user_data)
{
  gboolean need_separator;
  GtkWidget *current;
  Place *place, *place_before;
  gchar *text;
  GtkWidget *w;

  need_separator = FALSE;
  place = g_object_get_data (G_OBJECT (row), "place");

  if (before != NULL)
    {
      place_before = g_object_get_data (G_OBJECT (before), "place");
      if (place_before->place_type < place->place_type)
        /* use a separator before the first item of a new type */
        need_separator = TRUE;
    }
  else
    {
      /* always put a separator before the first item */
      need_separator = TRUE;
    }

  current = gtk_list_box_row_get_header (row);
  if (need_separator && current == NULL)
    {
      text = g_strdup_printf ("<b>%s</b>", get_heading_name (place->place_type));
      w = gtk_label_new (NULL);
      g_object_set (w,
                    "margin-top", 6,
                    "margin-end", 10,
                    "margin-bottom", 6,
                    "margin-start", 10,
                    NULL);
      gtk_label_set_markup (GTK_LABEL (w), text);
      gtk_widget_set_halign (w, GTK_ALIGN_START);
      gtk_style_context_add_class (gtk_widget_get_style_context (w), "dim-label");

      gtk_list_box_row_set_header (row, w);

      g_free (text);
    }
  else if (!need_separator && current != NULL)
    {
      gtk_list_box_row_set_header (row, NULL);
    }
}
Esempio n. 4
0
static void
update_header (GtkListBoxRow *row,
               GtkListBoxRow *before,
               gpointer       data)
{
  if (before != NULL &&
      gtk_list_box_row_get_header (row) == NULL)
    {
      GtkWidget *separator;

      separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
      gtk_widget_show (separator);
      gtk_list_box_row_set_header (row, separator);
    }
}
static void
photos_dlna_renderers_separator_cb (GtkListBoxRow *row,
                                    GtkListBoxRow *before,
                                    gpointer user_data)
{
  GtkWidget *separator;

  separator = gtk_list_box_row_get_header (row);
  if (separator == NULL && before != NULL)
    {
      separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
      gtk_list_box_row_set_header (row, separator);
      gtk_widget_show (separator);
    }
}
Esempio n. 6
0
static void
add_action_separators (GtkListBoxRow *row, GtkListBoxRow *before, gpointer user_data)
{
	GtkWidget *current;

	if (before == NULL)
		return;

	current = gtk_list_box_row_get_header (row);
	if (current == NULL)
	{
		current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
		gtk_widget_show (current);
		gtk_list_box_row_set_header (row, current);
	}
}
Esempio n. 7
0
static void
update_header (GtkListBoxRow *row,
    GtkListBoxRow *before,
    gpointer user_data)
{
  if (before == NULL)
    {
      /* No separator before the first row */
      gtk_list_box_row_set_header (row, NULL);
      return;
    }

  if (gtk_list_box_row_get_header (row) != NULL)
    return;

  gtk_list_box_row_set_header (row,
      gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
}
Esempio n. 8
0
void
photos_utils_list_box_header_func (GtkListBoxRow *row, GtkListBoxRow *before, gpointer user_data)
{
  GtkWidget *header;

  if (before == NULL)
    {
      gtk_list_box_row_set_header (row, NULL);
      return;
    }

  header = gtk_list_box_row_get_header (row);
  if (header == NULL)
    {
      header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
      gtk_widget_show (header);
      gtk_list_box_row_set_header (row, header);
    }
}