Skip to content

Commit 9a93f56

Browse files
committedJul 10, 2024·
Add initial shell based on GNOME Control Center code.
1 parent 5b8a96f commit 9a93f56

File tree

8 files changed

+101
-31
lines changed

8 files changed

+101
-31
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ compile_commands.json
88
omp
99
PKGBUILD
1010
TODO
11+
/src/clang-format
1112
/subprojects/blueprint-compiler

‎src/meson.build

+14-9
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,21 @@ omp_style_resources = gnome.compile_resources(
2626
source_dir: 'resources'
2727
)
2828

29+
sources = [
30+
'app.c',
31+
'sidebar.c',
32+
'content.c',
33+
'appwin.c',
34+
'main.c',
35+
omp_resources,
36+
omp_style_resources
37+
]
38+
39+
subdir('panels')
40+
2941
executable(
30-
program_name, [
31-
'app.c',
32-
'sidebar.c',
33-
'content.c',
34-
'appwin.c',
35-
'main.c',
36-
omp_resources,
37-
omp_style_resources,
38-
],
42+
program_name,
43+
sources,
3944
dependencies: [
4045
gtk,
4146
libadwaita,

‎src/panels/context/context-panel.c

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <adwaita.h>
2+
3+
#include "context-panel.h"
4+
5+
struct _OMPContextPanel {
6+
AdwBin parent;
7+
};
8+
9+
G_DEFINE_TYPE (OMPContextPanel, omp_context_panel, ADW_TYPE_BIN);
10+
11+
static void
12+
omp_context_panel_class_init (OMPContextPanelClass* klass)
13+
{
14+
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
15+
16+
gtk_widget_class_set_template_from_resource (
17+
widget_class,
18+
"/org/gnome/control-center/bluetooth/cc-bluetooth-panel.ui"
19+
);
20+
}
21+
22+
static void
23+
omp_context_panel_init (OMPContextPanel* self)
24+
{
25+
gtk_widget_init_template (GTK_WIDGET (self));
26+
}

‎src/panels/context/context-panel.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <adwaita.h>
4+
#include <gtk/gtk.h>
5+
6+
G_BEGIN_DECLS
7+
8+
#define OMP_TYPE_CONTEXT_PANEL (omp_context_panel_get_type ())
9+
G_DECLARE_FINAL_TYPE (
10+
OMPContextPanel, omp_context_panel, OMP, CONTEXT_PANEL, AdwBin
11+
)
12+
13+
G_END_DECLS

‎src/panels/context/meson.build

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
context_sources = [
2+
'context-panel.c',
3+
]
4+
5+
foreach context_source: context_sources
6+
sources += 'panels/context/' + context_source
7+
endforeach

‎src/panels/meson.build

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
panels = [
2+
'context',
3+
# 'collection',
4+
# 'queue',
5+
# 'playlists',
6+
]
7+
8+
foreach panel: panels
9+
subdir(panel)
10+
endforeach

‎src/resources/ui/content.blp

+28-19
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,39 @@ template $OMPContent : Adw.Bin {
1818
icon-name: "go-next-symbolic";
1919
}
2020
}
21+
}
2122

22-
Gtk.CenterBox main_container {
23-
[center]
24-
Box main_box {
25-
orientation: vertical;
23+
Gtk.CenterBox main_container {
24+
valign: center;
2625

27-
[start]
28-
Label content_label {
29-
label: "Content";
30-
}
26+
[center]
27+
Box main_box {
28+
orientation: vertical;
3129

32-
[end]
33-
Label tag_label {
34-
label: "";
35-
}
30+
[start]
31+
Label content_label {
32+
label: "Content";
33+
}
34+
35+
[start]
36+
Revealer context_revealer {
37+
child: Label {
38+
label: 'Context';
39+
};
40+
}
41+
42+
[end]
43+
Label tag_label {
44+
label: "";
45+
}
3646

37-
[end]
38-
Gtk.Button open_file_button {
39-
can-shrink: true;
40-
clicked => $omp_content_open_file_clicked();
47+
[end]
48+
Gtk.Button open_file_button {
49+
can-shrink: true;
50+
clicked => $omp_content_open_file_clicked();
4151

42-
Adw.ButtonContent {
43-
label: "Open File";
44-
}
52+
Adw.ButtonContent {
53+
label: "Open File";
4554
}
4655
}
4756
}

‎src/sidebar.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "sidebar.h"
22

33
#include "app.h"
4-
#include "appwin.h"
54
#include "content.h"
65

76
struct _OMPSidebar {
@@ -126,10 +125,10 @@ omp_sidebar_class_init (OMPSidebarClass* self)
126125

127126
// Bind children from template.
128127
gtk_widget_class_bind_template_child (
129-
GTK_WIDGET_CLASS (self), OMPSidebar, toggle_sidebar_button
128+
GTK_WIDGET_CLASS (self), OMPSidebar, page_links
130129
);
131130
gtk_widget_class_bind_template_child (
132-
GTK_WIDGET_CLASS (self), OMPSidebar, page_links
131+
GTK_WIDGET_CLASS (self), OMPSidebar, toggle_sidebar_button
133132
);
134133

135134
// Set style.

0 commit comments

Comments
 (0)
Please sign in to comment.