ui/gtk/container.c

changeset 100
d2bd73d28ff1
parent 75
73c8a3780c72
equal deleted inserted replaced
99:b9767cb5b06b 100:d2bd73d28ff1
889 return ui_headerbar_fallback_create(obj, args); 889 return ui_headerbar_fallback_create(obj, args);
890 } 890 }
891 891
892 #endif 892 #endif
893 893
894 /* -------------------- Sidebar -------------------- */
895
896 #ifdef UI_LIBADWAITA
897 UIWIDGET ui_sidebar_create(UiObject *obj, UiSidebarArgs args) {
898 GtkWidget *sidebar_toolbar_view = g_object_get_data(G_OBJECT(obj->widget), "ui_sidebar");
899 if(!sidebar_toolbar_view) {
900 fprintf(stderr, "Error: window is not configured for sidebar\n");
901 return NULL;
902 }
903
904 GtkWidget *box = ui_gtk_vbox_new(args.spacing);
905 ui_box_set_margin(box, args.margin);
906 adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(sidebar_toolbar_view), box);
907
908 UiObject *newobj = uic_object_new(obj, box);
909 newobj->container = ui_box_container(obj, box, UI_CONTAINER_VBOX);
910 uic_obj_add(obj, newobj);
911
912 return box;
913 }
914 #else
915 UIWIDGET ui_sidebar_create(UiObject *obj, UiSidebarArgs args) {
916 GtkWidget *sidebar_vbox = g_object_get_data(G_OBJECT(obj->widget), "ui_sidebar");
917
918 GtkWidget *box = ui_gtk_vbox_new(args.spacing);
919 ui_box_set_margin(box, args.margin);
920 BOX_ADD_EXPAND(sidebar_vbox, box);
921
922 UiObject *newobj = uic_object_new(obj, box);
923 newobj->container = ui_box_container(obj, box, UI_CONTAINER_VBOX);
924 uic_obj_add(obj, newobj);
925
926 return box;
927 }
928 #endif
929
894 /* -------------------- Splitpane -------------------- */ 930 /* -------------------- Splitpane -------------------- */
895 931
896 static GtkWidget* create_paned(UiOrientation orientation) { 932 static GtkWidget* create_paned(UiOrientation orientation) {
897 #if GTK_MAJOR_VERSION >= 3 933 #if GTK_MAJOR_VERSION >= 3
898 switch(orientation) { 934 switch(orientation) {

mercurial