Skip to content

Commit

Permalink
Add initial shell based on GNOME Control Center code.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWiseNoob committed Apr 21, 2024
1 parent 5b8a96f commit f2b6342
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ compile_commands.json
omp
PKGBUILD
TODO
/src/clang-format
/subprojects/blueprint-compiler
23 changes: 14 additions & 9 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ omp_style_resources = gnome.compile_resources(
source_dir: 'resources'
)

sources = [
'app.c',
'sidebar.c',
'content.c',
'appwin.c',
'main.c',
omp_resources,
omp_style_resources
]

subdir('panels')

executable(
program_name, [
'app.c',
'sidebar.c',
'content.c',
'appwin.c',
'main.c',
omp_resources,
omp_style_resources,
],
program_name,
sources,
dependencies: [
gtk,
libadwaita,
Expand Down
26 changes: 26 additions & 0 deletions src/panels/context/context-panel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <adwaita.h>

#include "context-panel.h"

struct _OMPContextPanel {
AdwBin parent;
};

G_DEFINE_TYPE (OMPContextPanel, omp_context_panel, ADW_TYPE_BIN);

static void
omp_context_panel_class_init (OMPContextPanelClass* klass)
{
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);

gtk_widget_class_set_template_from_resource (
widget_class,
"/org/gnome/control-center/bluetooth/cc-bluetooth-panel.ui"
);
}

static void
omp_context_panel_init (OMPContextPanel* self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
13 changes: 13 additions & 0 deletions src/panels/context/context-panel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <adwaita.h>
#include <gtk/gtk.h>

G_BEGIN_DECLS

#define OMP_TYPE_CONTEXT_PANEL (omp_context_panel_get_type ())
G_DECLARE_FINAL_TYPE (
OMPContextPanel, omp_context_panel, OMP, CONTEXT_PANEL, AdwBin
)

G_END_DECLS
7 changes: 7 additions & 0 deletions src/panels/context/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
context_sources = [
'context-panel.c',
]

foreach context_source: context_sources
sources += 'panels/context/' + context_source
endforeach
10 changes: 10 additions & 0 deletions src/panels/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
panels = [
'context',
# 'collection',
# 'queue',
# 'playlists',
]

foreach panel: panels
subdir(panel)
endforeach
47 changes: 28 additions & 19 deletions src/resources/ui/content.blp
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,39 @@ template $OMPContent : Adw.Bin {
icon-name: "go-next-symbolic";
}
}
}

Gtk.CenterBox main_container {
[center]
Box main_box {
orientation: vertical;
Gtk.CenterBox main_container {
valign: center;

[start]
Label content_label {
label: "Content";
}
[center]
Box main_box {
orientation: vertical;

[end]
Label tag_label {
label: "";
}
[start]
Label content_label {
label: "Content";
}

[start]
Revealer context_revealer {
child: Label {
label: 'Context';
};
}

[end]
Label tag_label {
label: "";
}

[end]
Gtk.Button open_file_button {
can-shrink: true;
clicked => $omp_content_open_file_clicked();
[end]
Gtk.Button open_file_button {
can-shrink: true;
clicked => $omp_content_open_file_clicked();

Adw.ButtonContent {
label: "Open File";
}
Adw.ButtonContent {
label: "Open File";
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/sidebar.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "sidebar.h"

#include "app.h"
#include "appwin.h"
#include "content.h"

struct _OMPSidebar {
Expand Down Expand Up @@ -126,10 +125,10 @@ omp_sidebar_class_init (OMPSidebarClass* self)

// Bind children from template.
gtk_widget_class_bind_template_child (
GTK_WIDGET_CLASS (self), OMPSidebar, toggle_sidebar_button
GTK_WIDGET_CLASS (self), OMPSidebar, page_links
);
gtk_widget_class_bind_template_child (
GTK_WIDGET_CLASS (self), OMPSidebar, page_links
GTK_WIDGET_CLASS (self), OMPSidebar, toggle_sidebar_button
);

// Set style.
Expand Down

0 comments on commit f2b6342

Please sign in to comment.