Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWiseNoob committed Dec 11, 2023
1 parent 25f3b41 commit b1b1bbb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
11 changes: 5 additions & 6 deletions src/app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
10 changes: 1 addition & 9 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/resources/ui/sidebar.blp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
26 changes: 10 additions & 16 deletions src/sidebar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -67,6 +69,7 @@ omp_sidebar_set_property (
}
}

// Inits
static void
omp_sidebar_init (OMPSidebar* sidebar)
{
Expand All @@ -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;
Expand All @@ -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);
}
2 changes: 0 additions & 2 deletions src/sidebar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b1b1bbb

Please sign in to comment.