hdy-demo-window.c 18.3 KB
Newer Older
1
#include "hdy-demo-window.h"
2 3

#include <glib/gi18n.h>
4
#define HANDY_USE_UNSTABLE_API
5
#include <handy.h>
6
#include "hdy-view-switcher-demo-window.h"
7

8
struct _HdyDemoWindow
9 10 11
{
  GtkApplicationWindow parent_instance;

Adrien Plazas's avatar
Adrien Plazas committed
12
  HdyLeaflet *header_box;
Adrien Plazas's avatar
Adrien Plazas committed
13 14
  HdyLeaflet *content_box;
  GtkButton *back;
15
  GtkToggleButton *search_button;
Adrien Plazas's avatar
Adrien Plazas committed
16 17
  GtkStackSidebar *sidebar;
  GtkStack *stack;
Adrien Plazas's avatar
Adrien Plazas committed
18
  HdyComboRow *leaflet_transition_row;
19
  GtkWidget *box_dialer;
20
  HdyDialer *dialer;
21 22 23
  GtkWidget *box_keypad;
  GtkListBox *keypad_listbox;
  HdyKeypad *keypad;
Guido Gunther's avatar
Guido Gunther committed
24
  GtkLabel *display;
25 26
  HdySearchBar *search_bar;
  GtkEntry *search_entry;
27
  GtkListBox *column_listbox;
Adrien Plazas's avatar
Adrien Plazas committed
28 29 30
  GtkListBox *lists_listbox;
  HdyComboRow *combo_row;
  HdyComboRow *enum_combo_row;
Adrien Plazas's avatar
Adrien Plazas committed
31
  HdyHeaderGroup *header_group;
32 33 34 35
  HdyPaginator *paginator;
  GtkListBox *paginator_listbox;
  HdyComboRow *paginator_orientation_row;
  HdyComboRow *paginator_indicator_style_row;
36 37
};

38
G_DEFINE_TYPE (HdyDemoWindow, hdy_demo_window, GTK_TYPE_APPLICATION_WINDOW)
39 40

static gboolean
41
hdy_demo_window_key_pressed_cb (GtkWidget     *sender,
42
                                GdkEvent      *event,
43
                                HdyDemoWindow *self)
44 45
{
  GdkModifierType default_modifiers = gtk_accelerator_get_default_mod_mask ();
46 47
  guint keyval;
  GdkModifierType state;
48

49 50
  gdk_event_get_keyval (event, &keyval);
  gdk_event_get_state (event, &state);
51 52 53

  if ((keyval == GDK_KEY_q || keyval == GDK_KEY_Q) &&
      (state & default_modifiers) == GDK_CONTROL_MASK) {
54 55 56 57 58 59 60 61
    gtk_widget_destroy (GTK_WIDGET (self));

    return TRUE;
  }

  return FALSE;
}

Adrien Plazas's avatar
Adrien Plazas committed
62
static void
63
update (HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
64 65 66 67 68 69
{
  GtkWidget *header_child = hdy_leaflet_get_visible_child (self->header_box);
  HdyFold fold = hdy_leaflet_get_fold (self->header_box);

  g_assert (header_child == NULL || GTK_IS_HEADER_BAR (header_child));

70
  hdy_header_group_set_focus (self->header_group, fold == HDY_FOLD_FOLDED ? GTK_HEADER_BAR (header_child) : NULL);
Adrien Plazas's avatar
Adrien Plazas committed
71 72
}

73
static void
74
update_header_bar (HdyDemoWindow *self)
75 76 77 78 79 80 81 82
{
  const gchar *visible_child_name;

  visible_child_name = gtk_stack_get_visible_child_name (GTK_STACK (self->stack));
  gtk_widget_set_visible (GTK_WIDGET (self->search_button),
                          g_str_equal (visible_child_name, "search-bar"));
}

Adrien Plazas's avatar
Adrien Plazas committed
83
static void
84 85 86
hdy_demo_window_notify_header_visible_child_cb (GObject       *sender,
                                                GParamSpec    *pspec,
                                                HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
87 88 89 90 91
{
  update (self);
}

static void
92 93 94
hdy_demo_window_notify_fold_cb (GObject       *sender,
                                GParamSpec    *pspec,
                                HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
95 96 97 98
{
  update (self);
}

99 100 101 102 103 104 105 106 107 108 109
static void
update_leaflet_swipe (HdyDemoWindow *self)
{
  gboolean first_page = (hdy_paginator_get_position (self->paginator) <= 0);
  gboolean paginator_visible =
    (gtk_stack_get_visible_child (self->stack) == GTK_WIDGET (self->paginator));

  hdy_leaflet_set_can_swipe_back (self->content_box,
                                  !paginator_visible || first_page);
}

Adrien Plazas's avatar
Adrien Plazas committed
110
static void
111 112 113
hdy_demo_window_notify_visible_child_cb (GObject       *sender,
                                         GParamSpec    *pspec,
                                         HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
114
{
115
  hdy_leaflet_set_visible_child_name (self->content_box, "content");
116
  update_header_bar (self);
117
  update_leaflet_swipe (self);
Adrien Plazas's avatar
Adrien Plazas committed
118 119 120
}

static void
121 122
hdy_demo_window_back_clicked_cb (GtkWidget     *sender,
                                 HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
123
{
124
  hdy_leaflet_set_visible_child_name (self->content_box, "sidebar");
Adrien Plazas's avatar
Adrien Plazas committed
125 126
}

Adrien Plazas's avatar
Adrien Plazas committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
static gchar *
leaflet_transition_name (HdyEnumValueObject *value,
                         gpointer            user_data)
{
  g_return_val_if_fail (HDY_IS_ENUM_VALUE_OBJECT (value), NULL);

  switch (hdy_enum_value_object_get_value (value)) {
  case HDY_LEAFLET_TRANSITION_TYPE_NONE:
    return g_strdup (_("None"));
  case HDY_LEAFLET_TRANSITION_TYPE_SLIDE:
    return g_strdup (_("Slide"));
  case HDY_LEAFLET_TRANSITION_TYPE_OVER:
    return g_strdup (_("Over"));
  case HDY_LEAFLET_TRANSITION_TYPE_UNDER:
    return g_strdup (_("Under"));
  default:
    return NULL;
  }
}

static void
notify_leaflet_transition_cb (GObject       *sender,
                              GParamSpec    *pspec,
                              HdyDemoWindow *self)
{
  HdyComboRow *row = HDY_COMBO_ROW (sender);

  g_assert (HDY_IS_COMBO_ROW (row));
  g_assert (HDY_IS_DEMO_WINDOW (self));

  hdy_leaflet_set_transition_type (HDY_LEAFLET (self->content_box), hdy_combo_row_get_selected_index (row));
}

160
static void
161 162
hdy_demo_window_submitted_cb (GtkWidget *widget,
                              gchar     *number)
163
{
Guido Gunther's avatar
Guido Gunther committed
164
  g_print ("Submit %s\n", number);
165 166 167
}


168
static void
169 170
deleted_cb (HdyDialer     *dialer,
            HdyDemoWindow *self)
171 172
{
  g_assert (HDY_IS_DIALER (dialer));
173
  g_assert (HDY_IS_DEMO_WINDOW (self));
174 175 176 177
  g_print ("Delete btn\n");
}


178
static void
179 180
number_notify_cb (HdyDemoWindow *self,
                  gpointer       unused)
181
{
Guido Gunther's avatar
Guido Gunther committed
182 183
  gtk_label_set_label (self->display, hdy_dialer_get_number (self->dialer));
  g_print ("wuff: %s\n", hdy_dialer_get_number (self->dialer));
184 185
}

Guido Gunther's avatar
Guido Gunther committed
186

187
static void
188 189 190
symbol_clicked_cb (HdyDialer     *dialer,
                   gchar          symbol,
                   HdyDemoWindow *self)
191 192
{
  g_assert (HDY_IS_DIALER (dialer));
193
  g_assert (HDY_IS_DEMO_WINDOW (self));
194 195 196 197
  g_print ("clicked: %c\n", symbol);
}


198
static void
199
stack_visible_child_notify_cb (HdyDemoWindow *self,
200 201 202 203 204 205 206 207
                               gpointer       unused)
{
  if (gtk_stack_get_visible_child (GTK_STACK (self->stack)) == GTK_WIDGET (self->box_dialer)) {
    gtk_widget_grab_focus (GTK_WIDGET (self->dialer));
  }
}


208 209 210 211 212 213 214 215
static void
dialog_close_cb (GtkDialog *self)
{
  gtk_widget_destroy (GTK_WIDGET (self));
}

static void
dialog_clicked_cb (GtkButton     *btn,
216
                   HdyDemoWindow *self)
217 218 219 220 221 222 223
{
  GtkWidget *dlg;
  GtkWidget *lbl;

  dlg = hdy_dialog_new (GTK_WINDOW (self));
  gtk_window_set_title (GTK_WINDOW (dlg), "HdyDialog");
  lbl = gtk_label_new ("Hello, World!");
224
  g_object_set (lbl, "margin", 12, NULL);
225 226 227 228 229 230 231 232 233 234 235 236
  gtk_widget_set_vexpand (lbl, TRUE);
  gtk_widget_set_valign (lbl, GTK_ALIGN_CENTER);
  gtk_widget_set_halign (lbl, GTK_ALIGN_CENTER);
  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
                     lbl);

  gtk_widget_show (lbl);
  gtk_widget_show (dlg);
}

static void
dialog_action_clicked_cb (GtkButton     *btn,
237
                          HdyDemoWindow *self)
238 239 240 241 242 243 244 245 246 247 248 249 250
{
  GtkWidget *dlg;
  GtkWidget *lbl;

  dlg = hdy_dialog_new (GTK_WINDOW (self));
  gtk_window_set_title (GTK_WINDOW (dlg), "HdyDialog");
  gtk_dialog_add_buttons (GTK_DIALOG (dlg),
                          "Done", GTK_RESPONSE_ACCEPT,
                          "Cancel", GTK_RESPONSE_CANCEL,
                          NULL);
  gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_ACCEPT);
  g_signal_connect (G_OBJECT (dlg), "response", G_CALLBACK (dialog_close_cb), NULL);
  lbl = gtk_label_new ("Hello, World!");
251
  g_object_set (lbl, "margin", 12, NULL);
252 253 254 255 256 257 258 259 260
  gtk_widget_set_vexpand (lbl, TRUE);
  gtk_widget_set_valign (lbl, GTK_ALIGN_CENTER);
  gtk_widget_set_halign (lbl, GTK_ALIGN_CENTER);
  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
                     lbl);

  gtk_widget_show (lbl);
  gtk_widget_show (dlg);
}
Guido Gunther's avatar
Guido Gunther committed
261

262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
static void
dialog_complex_deeper_clicked_cb (GtkStack *stack)
{
  gtk_stack_set_visible_child_name (stack, "sub");
}

static void
dialog_complex_back_clicked_cb (GtkStack *stack)
{
  gtk_stack_set_visible_child_name (stack, "main");
}

static void
dialog_complex_clicked_cb (GtkButton     *btn,
                           HdyDemoWindow *self)
{
  g_autoptr (GtkBuilder) builder = gtk_builder_new_from_resource ("/sm/puri/handy/demo/ui/hdy-dialog-complex-example.ui");
  GtkWidget *dlg, *back, *deeper, *stack;

  dlg = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
  back = GTK_WIDGET (gtk_builder_get_object (builder, "back"));
  deeper = GTK_WIDGET (gtk_builder_get_object (builder, "deeper"));
  stack = GTK_WIDGET (gtk_builder_get_object (builder, "content_stack"));
  g_signal_connect_swapped (deeper, "clicked", G_CALLBACK (dialog_complex_deeper_clicked_cb), stack);
  g_signal_connect_swapped (back, "clicked", G_CALLBACK (dialog_complex_back_clicked_cb), stack);
  gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (self));

  gtk_widget_show (dlg);
}
291 292 293 294 295 296 297 298 299 300 301

static void
view_switcher_demo_clicked_cb (GtkButton     *btn,
                               HdyDemoWindow *self)
{
  HdyViewSwitcherDemoWindow *window = hdy_view_switcher_demo_window_new ();

  gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (self));
  gtk_widget_show (GTK_WIDGET (window));
}

302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
static gchar *
paginator_orientation_name (HdyEnumValueObject *value,
                            gpointer            user_data)
{
  g_return_val_if_fail (HDY_IS_ENUM_VALUE_OBJECT (value), NULL);

  switch (hdy_enum_value_object_get_value (value)) {
  case GTK_ORIENTATION_HORIZONTAL:
    return g_strdup (_("Horizontal"));
  case GTK_ORIENTATION_VERTICAL:
    return g_strdup (_("Vertical"));
  default:
    return NULL;
  }
}

318 319 320 321 322 323 324 325
static void
notify_paginator_position_cb (GObject       *sender,
                              GParamSpec    *pspec,
                              HdyDemoWindow *self)
{
  update_leaflet_swipe (self);
}

326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
static void
notify_paginator_orientation_cb (GObject       *sender,
                                 GParamSpec    *pspec,
                                 HdyDemoWindow *self)
{
  HdyComboRow *row = HDY_COMBO_ROW (sender);
  gboolean horizontal;

  g_assert (HDY_IS_COMBO_ROW (row));
  g_assert (HDY_IS_DEMO_WINDOW (self));

  horizontal = (hdy_combo_row_get_selected_index (row) == GTK_ORIENTATION_HORIZONTAL);
  g_object_set (self->paginator,
                "orientation", hdy_combo_row_get_selected_index (row),
                "margin-top", horizontal ? 6 : 0,
                "margin-bottom", horizontal ? 6 : 0,
                "margin-left", horizontal ? 0 : 6,
                "margin-right", horizontal ? 0 : 6,
                NULL);
}

static gchar *
paginator_indicator_style_name (HdyEnumValueObject *value,
                                gpointer            user_data)
{
  g_return_val_if_fail (HDY_IS_ENUM_VALUE_OBJECT (value), NULL);

  switch (hdy_enum_value_object_get_value (value)) {
  case HDY_PAGINATOR_INDICATOR_STYLE_NONE:
    return g_strdup (_("None"));
  case HDY_PAGINATOR_INDICATOR_STYLE_DOTS:
    return g_strdup (_("Dots"));
  case HDY_PAGINATOR_INDICATOR_STYLE_LINES:
    return g_strdup (_("Lines"));
  default:
    return NULL;
  }
}

static void
notify_paginator_indicator_style_cb (GObject       *sender,
                                     GParamSpec    *pspec,
                                     HdyDemoWindow *self)
{
  HdyComboRow *row = HDY_COMBO_ROW (sender);

  g_assert (HDY_IS_COMBO_ROW (row));
  g_assert (HDY_IS_DEMO_WINDOW (self));

  hdy_paginator_set_indicator_style (self->paginator, hdy_combo_row_get_selected_index (row));
}

static void
paginator_return_clicked_cb (GtkButton     *btn,
                             HdyDemoWindow *self)
{
  g_autoptr (GList) children;

  children = gtk_container_get_children (GTK_CONTAINER (self->paginator));
  hdy_paginator_scroll_to (self->paginator, GTK_WIDGET (children->data));
}

388 389
HdyDemoWindow *
hdy_demo_window_new (GtkApplication *application)
390
{
391
  return g_object_new (HDY_TYPE_DEMO_WINDOW, "application", application, NULL);
392 393
}

Guido Gunther's avatar
Guido Gunther committed
394 395

static void
396
hdy_demo_window_constructed (GObject *object)
Guido Gunther's avatar
Guido Gunther committed
397
{
398
  HdyDemoWindow *self = HDY_DEMO_WINDOW (object);
Guido Gunther's avatar
Guido Gunther committed
399

400
  G_OBJECT_CLASS (hdy_demo_window_parent_class)->constructed (object);
Guido Gunther's avatar
Guido Gunther committed
401 402 403 404 405

  g_signal_connect_swapped (self->dialer,
                            "notify::number",
                            G_CALLBACK (number_notify_cb),
                            self);
406 407 408 409 410 411

  g_signal_connect_swapped (self->stack,
                            "notify::visible-child",
                            G_CALLBACK (stack_visible_child_notify_cb),
                            self);

412
  hdy_search_bar_connect_entry (self->search_bar, self->search_entry);
Guido Gunther's avatar
Guido Gunther committed
413 414 415
}


416
static void
417
hdy_demo_window_class_init (HdyDemoWindowClass *klass)
418
{
Guido Gunther's avatar
Guido Gunther committed
419
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
420 421
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

422 423 424 425 426 427 428 429 430
  object_class->constructed = hdy_demo_window_constructed;

  gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/handy/demo/ui/hdy-demo-window.ui");
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, header_box);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, content_box);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, back);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, search_button);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, sidebar);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, stack);
Adrien Plazas's avatar
Adrien Plazas committed
431
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, leaflet_transition_row);
432 433
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, box_dialer);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, dialer);
434 435 436
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, box_keypad);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, keypad_listbox);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, keypad);
437 438 439 440 441 442 443 444
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, display);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, search_bar);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, search_entry);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, column_listbox);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, lists_listbox);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, combo_row);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, enum_combo_row);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, header_group);
445 446 447 448
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, paginator);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, paginator_listbox);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, paginator_orientation_row);
  gtk_widget_class_bind_template_child (widget_class, HdyDemoWindow, paginator_indicator_style_row);
449 450 451 452 453
  gtk_widget_class_bind_template_callback_full (widget_class, "key_pressed_cb", G_CALLBACK(hdy_demo_window_key_pressed_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_header_visible_child_cb", G_CALLBACK(hdy_demo_window_notify_header_visible_child_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_fold_cb", G_CALLBACK(hdy_demo_window_notify_fold_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_visible_child_cb", G_CALLBACK(hdy_demo_window_notify_visible_child_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "back_clicked_cb", G_CALLBACK(hdy_demo_window_back_clicked_cb));
Adrien Plazas's avatar
Adrien Plazas committed
454
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_leaflet_transition_cb", G_CALLBACK(notify_leaflet_transition_cb));
455
  gtk_widget_class_bind_template_callback_full (widget_class, "submitted_cb", G_CALLBACK(hdy_demo_window_submitted_cb));
456
  gtk_widget_class_bind_template_callback_full (widget_class, "symbol_clicked_cb", G_CALLBACK(symbol_clicked_cb));
457
  gtk_widget_class_bind_template_callback_full (widget_class, "deleted_cb", G_CALLBACK(deleted_cb));
458 459
  gtk_widget_class_bind_template_callback_full (widget_class, "dialog_clicked_cb", G_CALLBACK(dialog_clicked_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "dialog_action_clicked_cb", G_CALLBACK(dialog_action_clicked_cb));
460
  gtk_widget_class_bind_template_callback_full (widget_class, "dialog_complex_clicked_cb", G_CALLBACK(dialog_complex_clicked_cb));
461
  gtk_widget_class_bind_template_callback_full (widget_class, "view_switcher_demo_clicked_cb", G_CALLBACK(view_switcher_demo_clicked_cb));
462
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_paginator_position_cb", G_CALLBACK(notify_paginator_position_cb));
463 464 465
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_paginator_orientation_cb", G_CALLBACK(notify_paginator_orientation_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "notify_paginator_indicator_style_cb", G_CALLBACK(notify_paginator_indicator_style_cb));
  gtk_widget_class_bind_template_callback_full (widget_class, "paginator_return_clicked_cb", G_CALLBACK(paginator_return_clicked_cb));
466 467
}

Adrien Plazas's avatar
Adrien Plazas committed
468
static void
469
lists_page_init (HdyDemoWindow *self)
Adrien Plazas's avatar
Adrien Plazas committed
470 471
{
  GListStore *list_store;
472
  HdyValueObject *obj;
Adrien Plazas's avatar
Adrien Plazas committed
473 474 475

  gtk_list_box_set_header_func (self->lists_listbox, hdy_list_box_separator_header, NULL, NULL);

476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
  list_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT);

  obj = hdy_value_object_new_string ("Foo");
  g_list_store_insert (list_store, 0, obj);
  g_clear_object (&obj);

  obj = hdy_value_object_new_string ("Bar");
  g_list_store_insert (list_store, 1, obj);
  g_clear_object (&obj);

  obj = hdy_value_object_new_string ("Baz");
  g_list_store_insert (list_store, 2, obj);
  g_clear_object (&obj);

  hdy_combo_row_bind_name_model (self->combo_row, G_LIST_MODEL (list_store), (HdyComboRowGetNameFunc) hdy_value_object_dup_string, NULL, NULL);
Adrien Plazas's avatar
Adrien Plazas committed
491 492 493 494

  hdy_combo_row_set_for_enum (self->enum_combo_row, GTK_TYPE_LICENSE, hdy_enum_value_row_name, NULL, NULL);
}

495
static void
496
hdy_demo_window_init (HdyDemoWindow *self)
497 498
{
  gtk_widget_init_template (GTK_WIDGET (self));
Adrien Plazas's avatar
Adrien Plazas committed
499 500 501 502

  hdy_combo_row_set_for_enum (self->leaflet_transition_row, HDY_TYPE_LEAFLET_TRANSITION_TYPE, leaflet_transition_name, NULL, NULL);
  hdy_combo_row_set_selected_index (self->leaflet_transition_row, HDY_LEAFLET_TRANSITION_TYPE_OVER);

503
  gtk_list_box_set_header_func (self->column_listbox, hdy_list_box_separator_header, NULL, NULL);
504
  gtk_list_box_set_header_func (self->keypad_listbox, hdy_list_box_separator_header, NULL, NULL);
Adrien Plazas's avatar
Adrien Plazas committed
505

Adrien Plazas's avatar
Adrien Plazas committed
506 507
  lists_page_init (self);

508 509 510 511 512
  gtk_list_box_set_header_func (self->paginator_listbox, hdy_list_box_separator_header, NULL, NULL);
  hdy_combo_row_set_for_enum (self->paginator_orientation_row, GTK_TYPE_ORIENTATION, paginator_orientation_name, NULL, NULL);
  hdy_combo_row_set_for_enum (self->paginator_indicator_style_row, HDY_TYPE_PAGINATOR_INDICATOR_STYLE, paginator_indicator_style_name, NULL, NULL);
  hdy_combo_row_set_selected_index (self->paginator_indicator_style_row, HDY_PAGINATOR_INDICATOR_STYLE_DOTS);

513
  hdy_leaflet_set_visible_child_name (self->content_box, "content");
514
  update_header_bar (self);
515
}