From b1b1bbb707374f65fb52273e0056af353c5edfec Mon Sep 17 00:00:00 2001 From: DJ Griffin Date: Sun, 10 Dec 2023 21:57:06 -0500 Subject: [PATCH] Cleanup. --- src/app.cc | 11 +++++------ src/meson.build | 10 +--------- src/resources/ui/sidebar.blp | 2 +- src/sidebar.cc | 26 ++++++++++---------------- src/sidebar.h | 2 -- 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/app.cc b/src/app.cc index 5812b38..342c9a9 100644 --- a/src/app.cc +++ b/src/app.cc @@ -7,14 +7,8 @@ struct _OMPApp { AdwApplication parent; }; - G_DEFINE_TYPE (OMPApp, omp_app, ADW_TYPE_APPLICATION); -static void -omp_app_init (OMPApp* app) -{ -} - static void omp_app_activate (GApplication* app) { @@ -43,6 +37,11 @@ omp_app_open (GApplication* app, GFile** files, int n_files, const char* hint) gtk_window_present (GTK_WINDOW (win)); } +static void +omp_app_init (OMPApp* app) +{ +} + static void omp_app_class_init (OMPAppClass* self) { diff --git a/src/meson.build b/src/meson.build index e06a942..507ccd8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,12 +1,4 @@ -add_project_arguments('-Wno-deprecated-declarations', language: 'cpp') -add_project_arguments('-Wno-parentheses', language: 'cpp') -add_project_arguments('-fconcepts', language: 'cpp') -add_project_arguments('-Wno-catch-value', language: 'cpp') -add_project_arguments('-Wno-return-type', language: 'cpp') -add_project_arguments('-Wno-unused-variable', language: 'cpp') -add_project_arguments('-Wno-write-strings', language: 'cpp') -add_project_arguments('-Wno-reorder', language: 'cpp') -add_project_arguments('-Wlogical-op', language: 'cpp') +add_project_arguments('-Wno-unused-parameter', language: 'cpp') gtk = dependency('gtk4', version: '>= 4.6.9') libadwaita = dependency('libadwaita-1', version: '>= 1.4.alpha') diff --git a/src/resources/ui/sidebar.blp b/src/resources/ui/sidebar.blp index ee3d1f6..6920f64 100644 --- a/src/resources/ui/sidebar.blp +++ b/src/resources/ui/sidebar.blp @@ -47,7 +47,7 @@ template $OMPSidebar : Adw.Bin { active: bind template.sidebar_button_active bidirectional; tooltip-text: _("Show Sidebar"); icon-name: "sidebar-show-symbolic"; - toggled => $output_state(); + toggled => $toggle_button_clicked(); } [end] diff --git a/src/sidebar.cc b/src/sidebar.cc index e4860d4..49c00db 100644 --- a/src/sidebar.cc +++ b/src/sidebar.cc @@ -7,30 +7,31 @@ struct _OMPSidebar { AdwBin parent; + // Widgets GtkWidget* show_sidebar_button; gboolean sidebar_button_active; }; +G_DEFINE_TYPE (OMPSidebar, omp_sidebar, ADW_TYPE_BIN); +// Properties enum { PROP_0, PROP_SIDEBAR_BUTTON_ACTIVE, NUM_PROPERTIES }; - -enum { SHOW_PANEL, LAST_SIGNAL }; - static GParamSpec* properties[NUM_PROPERTIES] = { NULL, }; +// Signals +enum { SHOW_PANEL, LAST_SIGNAL }; static gint signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (OMPSidebar, omp_sidebar, ADW_TYPE_BIN); - static void -output_state (GtkToggleButton* source, OMPSidebar* sidebar) +toggle_button_clicked (GtkToggleButton* source, OMPSidebar* sidebar) { g_signal_emit (sidebar, signals[SHOW_PANEL], 0); } +// Getter static void omp_sidebar_get_property ( GObject* object, guint property_id, GValue* value, GParamSpec* pspec @@ -49,6 +50,7 @@ omp_sidebar_get_property ( } } +// Setter static void omp_sidebar_set_property ( GObject* object, guint property_id, const GValue* value, GParamSpec* pspec @@ -67,6 +69,7 @@ omp_sidebar_set_property ( } } +// Inits static void omp_sidebar_init (OMPSidebar* sidebar) { @@ -85,13 +88,10 @@ omp_sidebar_class_init (OMPSidebarClass* self) ); gtk_widget_class_bind_template_callback ( - GTK_WIDGET_CLASS (self), output_state + GTK_WIDGET_CLASS (self), toggle_button_clicked ); GObjectClass* oclass; - GtkWidgetClass* widget_class; - - widget_class = GTK_WIDGET_CLASS (self); oclass = G_OBJECT_CLASS (self); oclass->get_property = omp_sidebar_get_property; oclass->set_property = omp_sidebar_set_property; @@ -108,9 +108,3 @@ omp_sidebar_class_init (OMPSidebarClass* self) g_object_class_install_properties (oclass, NUM_PROPERTIES, properties); } - -OMPSidebar* -omp_sidebar_new (void) -{ - return (OMPSidebar*)g_object_new (OMP_SIDEBAR_TYPE, NULL); -} diff --git a/src/sidebar.h b/src/sidebar.h index a3ba4ce..caeebc4 100644 --- a/src/sidebar.h +++ b/src/sidebar.h @@ -8,6 +8,4 @@ G_BEGIN_DECLS #define OMP_SIDEBAR_TYPE (omp_sidebar_get_type ()) G_DECLARE_FINAL_TYPE (OMPSidebar, omp_sidebar, OMP, APP_SIDEBAR, AdwBin) -OMPSidebar* omp_sidebar_new (void); - G_END_DECLS