diff options
-rw-r--r-- | src/adwaita/disfluid-adwaita.h | 33 | ||||
-rw-r--r-- | src/adwaita/disfluid-application.c | 25 | ||||
-rw-r--r-- | src/adwaita/disfluid-window.c | 10 | ||||
-rw-r--r-- | src/disfluid/main.c | 2 |
4 files changed, 44 insertions, 26 deletions
diff --git a/src/adwaita/disfluid-adwaita.h b/src/adwaita/disfluid-adwaita.h index 2c16899..c4c76fe 100644 --- a/src/adwaita/disfluid-adwaita.h +++ b/src/adwaita/disfluid-adwaita.h @@ -4,12 +4,33 @@ # include <stdlib.h> # include <glib-object.h> # include <gtk/gtk.h> +# include <adwaita.h> -struct DisfluidAdwApplication; +/* *INDENT-OFF* */ +G_BEGIN_DECLS +/* *INDENT-ON* */ -ATTRIBUTE_CONST GType disfluid_adw_application_get_type (void); +# define DISFLUID_ADW_TYPE_APPLICATION \ + disfluid_adw_application_get_type () -struct DisfluidAdwApplication *disfluid_adw_application_new (void); +# define DISFLUID_ADW_TYPE_WINDOW \ + disfluid_adw_window_get_type () + +/* *INDENT-OFF* */ +G_DECLARE_FINAL_TYPE (DisfluidAdwApplication, + disfluid_adw_application, + DISFLUID_ADW, APPLICATION, + AdwApplication) +G_DECLARE_FINAL_TYPE (DisfluidAdwWindow, + disfluid_adw_window, + DISFLUID_ADW, WINDOW, + AdwApplicationWindow) +G_END_DECLS +/* *INDENT-ON* */ + +DisfluidAdwApplication *disfluid_adw_application_new (void); + +GtkWidget *disfluid_adw_window_new (GtkApplication * app); ATTRIBUTE_CONST const char *disfluid_adw_application_id (void); @@ -19,10 +40,4 @@ GMenuItem *disfluid_adw_menu_item_about (void); GMenu *disfluid_adw_main_menu (void); -struct DisfluidAdwWindow; - -ATTRIBUTE_CONST GType disfluid_adw_window_get_type (void); - -GtkWidget *disfluid_adw_window_new (GtkApplication * app); - #endif /* not H_DISFLUID_ADWAITA_INCLUDED */ diff --git a/src/adwaita/disfluid-application.c b/src/adwaita/disfluid-application.c index 6814423..08af0c8 100644 --- a/src/adwaita/disfluid-application.c +++ b/src/adwaita/disfluid-application.c @@ -20,22 +20,16 @@ #include <adwaita.h> #include <gtk/gtk.h> -#define DISFLUID_ADW_TYPE_APPLICATION \ - disfluid_adw_application_get_type () - -struct DisfluidAdwApplication +struct _DisfluidAdwApplication { AdwApplication parent_instance; }; -struct DisfluidAdwApplicationClass +struct _DisfluidAdwApplicationClass { AdwApplicationClass parent_instance; }; -typedef struct DisfluidAdwApplication DisfluidAdwApplication; -typedef struct DisfluidAdwApplicationClass DisfluidAdwApplicationClass; - /* *INDENT-OFF* */ G_DEFINE_TYPE (DisfluidAdwApplication, disfluid_adw_application, ADW_TYPE_APPLICATION) /* *INDENT-ON* */ @@ -60,6 +54,16 @@ activated (GtkApplication * app) gtk_window_present (GTK_WINDOW (window)); } +static void +launch_about_window (GSimpleAction * action, GVariant * parameter, + gpointer user_data) +{ + (void) action; + (void) parameter; + DisfluidAdwApplication *self = user_data; + disfluid_adw_show_about (GTK_APPLICATION (self)); +} + DisfluidAdwApplication * disfluid_adw_application_new (void) { @@ -69,6 +73,11 @@ disfluid_adw_application_new (void) "application-id", disfluid_adw_application_id (), NULL); + static GActionEntry app_actions[] = { + {.name = "about",.activate = launch_about_window} + }; + g_action_map_add_action_entries (G_ACTION_MAP (self), app_actions, + G_N_ELEMENTS (app_actions), self); g_signal_connect (self, "activate", G_CALLBACK (activated), NULL); return self; } diff --git a/src/adwaita/disfluid-window.c b/src/adwaita/disfluid-window.c index a1b1813..c3d1053 100644 --- a/src/adwaita/disfluid-window.c +++ b/src/adwaita/disfluid-window.c @@ -20,22 +20,16 @@ #include <adwaita.h> #include <gtk/gtk.h> -#define DISFLUID_ADW_TYPE_WINDOW \ - disfluid_adw_window_get_type () - -struct DisfluidAdwWindow +struct _DisfluidAdwWindow { AdwApplicationWindow parent_instance; }; -struct DisfluidAdwWindowClass +struct _DisfluidAdwWindowClass { AdwApplicationWindowClass parent_instance; }; -typedef struct DisfluidAdwWindow DisfluidAdwWindow; -typedef struct DisfluidAdwWindowClass DisfluidAdwWindowClass; - /* *INDENT-OFF* */ G_DEFINE_TYPE (DisfluidAdwWindow, disfluid_adw_window, ADW_TYPE_APPLICATION_WINDOW) /* *INDENT-ON* */ diff --git a/src/disfluid/main.c b/src/disfluid/main.c index 19f610a..598cd36 100644 --- a/src/disfluid/main.c +++ b/src/disfluid/main.c @@ -18,7 +18,7 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, relocate (LOCALEDIR)); textdomain (PACKAGE); - struct DisfluidAdwApplication *app = disfluid_adw_application_new (); + DisfluidAdwApplication *app = disfluid_adw_application_new (); int status = g_application_run ((GApplication *) app, argc, argv); g_object_unref (app); return status; |