Initial commit
Added basic UI
This commit is contained in:
7
src/main.c
Normal file
7
src/main.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "ui/ginput-application.h"
|
||||
|
||||
int main(gint argc, gchar** argv)
|
||||
{
|
||||
AdwApplication* application = ginput_application_new();
|
||||
return g_application_run(G_APPLICATION(application), argc, argv);
|
||||
}
|
87
src/ui/ginput-application.c
Normal file
87
src/ui/ginput-application.c
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "ginput-application.h"
|
||||
#include "ui/main-window.h"
|
||||
|
||||
struct _GinputApplication
|
||||
{
|
||||
AdwApplication parent;
|
||||
|
||||
MainWindow* window;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(GinputApplication, ginput_application, ADW_TYPE_APPLICATION)
|
||||
|
||||
/*
|
||||
* Special 'activate' trigger of the application, called when the application is launched
|
||||
* This shows the main window
|
||||
*/
|
||||
static void
|
||||
ginput_application_activate(GApplication* application)
|
||||
{
|
||||
GinputApplication* self = GINPUT_APPLICATION(application);
|
||||
gtk_window_present(GTK_WINDOW(self->window));
|
||||
}
|
||||
|
||||
static void
|
||||
ginput_application_startup(GApplication* application)
|
||||
{
|
||||
GinputApplication* self = GINPUT_APPLICATION(application);
|
||||
|
||||
G_APPLICATION_CLASS(ginput_application_parent_class)->startup(application);
|
||||
|
||||
self->window = main_window_new(ADW_APPLICATION(application));
|
||||
|
||||
GtkCssProvider* provider = gtk_css_provider_new();
|
||||
gtk_css_provider_load_from_resource(provider, "/v/ginput/style.css");
|
||||
gtk_style_context_add_provider_for_display(gdk_display_get_default(),
|
||||
GTK_STYLE_PROVIDER(provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
static void
|
||||
ginput_application_finalize(GObject* object)
|
||||
{
|
||||
G_OBJECT_CLASS(ginput_application_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
static GObject*
|
||||
ginput_application_constructor(GType type, guint n_construct_params, GObjectConstructParam* construct_params)
|
||||
{
|
||||
static GObject* self = NULL;
|
||||
|
||||
if(self == NULL)
|
||||
{
|
||||
self = G_OBJECT_CLASS(ginput_application_parent_class)->constructor(type, n_construct_params, construct_params);
|
||||
g_object_add_weak_pointer(self, (gpointer) &self);
|
||||
return self;
|
||||
}
|
||||
|
||||
return g_object_ref(self);
|
||||
}
|
||||
|
||||
static void
|
||||
ginput_application_class_init(GinputApplicationClass* klass)
|
||||
{
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
GApplicationClass* application_class = G_APPLICATION_CLASS(klass);
|
||||
|
||||
object_class->finalize = ginput_application_finalize;
|
||||
object_class->constructor = ginput_application_constructor;
|
||||
application_class->activate = ginput_application_activate;
|
||||
application_class->startup = ginput_application_startup;
|
||||
// application_class->command_line = ginput_application_command_line;
|
||||
// application_class->handle_local_options = ginput_application_handle_local_options;
|
||||
}
|
||||
|
||||
static void
|
||||
ginput_application_init(GinputApplication* self)
|
||||
{
|
||||
}
|
||||
|
||||
AdwApplication*
|
||||
ginput_application_new(void)
|
||||
{
|
||||
return g_object_new(ginput_application_get_type(),
|
||||
"application-id", "v.ginput",
|
||||
"flags", G_APPLICATION_DEFAULT_FLAGS,
|
||||
NULL);
|
||||
}
|
11
src/ui/ginput-application.h
Normal file
11
src/ui/ginput-application.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(GinputApplication, ginput_application, GINPUT, APPLICATION, AdwApplication)
|
||||
|
||||
AdwApplication* ginput_application_new(void);
|
||||
|
||||
G_END_DECLS
|
275
src/ui/main-window.c
Normal file
275
src/ui/main-window.c
Normal file
@@ -0,0 +1,275 @@
|
||||
#define G_LOG_DOMAIN "main-window"
|
||||
|
||||
#include "main-window.h"
|
||||
#include "panels/empty_panel.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct _MainWindow
|
||||
{
|
||||
AdwApplicationWindow parent;
|
||||
|
||||
AdwHeaderBar* header;
|
||||
AdwLeaflet* main_leaflet;
|
||||
// TODO LIST : CcPanelList *panel_list;
|
||||
GtkBox* sidebar_box;
|
||||
AdwWindowTitle* sidebar_title_widget;
|
||||
GtkStack* stack;
|
||||
|
||||
// GtkWidget *old_panel;
|
||||
GtkWidget* current_panel;
|
||||
char* current_panel_id;
|
||||
// GQueue *previous_panels;
|
||||
|
||||
GtkWidget* custom_titlebar;
|
||||
|
||||
// CcShellModel *store;
|
||||
|
||||
// CcPanel *active_panel;
|
||||
GSettings* settings;
|
||||
|
||||
gboolean folded;
|
||||
|
||||
// CcPanelListView previous_list_view;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(MainWindow, main_window, ADW_TYPE_APPLICATION_WINDOW)
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ACTIVE_PANEL,
|
||||
PROP_MODEL,
|
||||
PROP_FOLDED,
|
||||
};
|
||||
|
||||
static gboolean activate_panel(MainWindow* self, Panel* panel, const gchar* id)
|
||||
{
|
||||
self->current_panel = GTK_WIDGET(panel);
|
||||
gtk_stack_add_named(self->stack, self->current_panel, id);
|
||||
gtk_stack_set_visible_child_name (self->stack, id);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GtkWidget
|
||||
*/
|
||||
static void
|
||||
main_window_map(GtkWidget* widget)
|
||||
{
|
||||
MainWindow* self = (MainWindow*) widget;
|
||||
GTK_WIDGET_CLASS(main_window_parent_class)->map(widget);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GtkWidget
|
||||
*/
|
||||
static void
|
||||
main_window_unmap(GtkWidget* widget)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(widget);
|
||||
gboolean maximized;
|
||||
gint height;
|
||||
gint width;
|
||||
|
||||
maximized = gtk_window_is_maximized(GTK_WINDOW(self));
|
||||
gtk_window_get_default_size(GTK_WINDOW(self), &width, &height);
|
||||
|
||||
g_settings_set(self->settings,
|
||||
"window-state",
|
||||
"(iib)",
|
||||
width,
|
||||
height,
|
||||
maximized);
|
||||
|
||||
GTK_WIDGET_CLASS(main_window_parent_class)->unmap(widget);
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_get_property(GObject* object, guint property_id, GValue* value, GParamSpec* pspec)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(object);
|
||||
|
||||
switch(property_id)
|
||||
{
|
||||
// case PROP_ACTIVE_PANEL:
|
||||
// g_value_set_object (value, self->active_panel);
|
||||
// break;
|
||||
|
||||
// case PROP_MODEL:
|
||||
// g_value_set_object (value, self->store);
|
||||
// break;
|
||||
|
||||
case PROP_FOLDED:
|
||||
g_value_set_boolean(value, self->folded);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_set_property(GObject* object,
|
||||
guint property_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(object);
|
||||
|
||||
switch(property_id)
|
||||
{
|
||||
// case PROP_ACTIVE_PANEL:
|
||||
// set_active_panel(self, g_value_get_object(value));
|
||||
// break;
|
||||
|
||||
// case PROP_MODEL:
|
||||
// g_assert(self->store == NULL);
|
||||
// self->store = g_value_dup_object(value);
|
||||
// break;
|
||||
|
||||
case PROP_FOLDED:
|
||||
self->folded = g_value_get_boolean(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_window_state(MainWindow* self)
|
||||
{
|
||||
gint current_width = -1;
|
||||
gint current_height = -1;
|
||||
gboolean maximized = FALSE;
|
||||
|
||||
g_settings_get(self->settings,
|
||||
"window-state",
|
||||
"(iib)",
|
||||
¤t_width,
|
||||
¤t_height,
|
||||
&maximized);
|
||||
|
||||
if(current_width != -1 && current_height != -1)
|
||||
gtk_window_set_default_size(GTK_WINDOW(self), current_width, current_height);
|
||||
if(maximized)
|
||||
gtk_window_maximize(GTK_WINDOW(self));
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_constructed(GObject* object)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(object);
|
||||
|
||||
load_window_state(self);
|
||||
|
||||
/* Add the panels */
|
||||
// setup_model (self);
|
||||
|
||||
/* After everything is loaded, select the last used panel, if any,
|
||||
* or the first visible panel. We do that in an idle handler so we
|
||||
* have a chance to skip it when another panel has been explicitly
|
||||
* activated from commandline parameter or from DBus method */
|
||||
// g_idle_add_once ((GSourceOnceFunc) maybe_load_last_panel, self);
|
||||
|
||||
// g_signal_connect_swapped (self->panel_list,
|
||||
// "notify::view",
|
||||
// G_CALLBACK (update_headerbar_buttons),
|
||||
// self);
|
||||
|
||||
// update_headerbar_buttons (self);
|
||||
// adw_leaflet_set_visible_child (self->main_leaflet,
|
||||
// GTK_WIDGET (self->sidebar_box));
|
||||
|
||||
G_OBJECT_CLASS(main_window_parent_class)->constructed(object);
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_dispose(GObject* object)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(object);
|
||||
|
||||
g_clear_pointer(&self->current_panel_id, g_free);
|
||||
// g_clear_object (&self->store);
|
||||
// g_clear_object (&self->active_panel);
|
||||
|
||||
G_OBJECT_CLASS(main_window_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_finalize(GObject* object)
|
||||
{
|
||||
MainWindow* self = GINPUT_MAIN_WINDOW(object);
|
||||
|
||||
// if (self->previous_panels)
|
||||
// {
|
||||
// g_queue_free_full (self->previous_panels, g_free);
|
||||
// self->previous_panels = NULL;
|
||||
// }
|
||||
|
||||
g_clear_object(&self->settings);
|
||||
|
||||
G_OBJECT_CLASS(main_window_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_class_init(MainWindowClass* klass)
|
||||
{
|
||||
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
object_class->get_property = main_window_get_property;
|
||||
object_class->set_property = main_window_set_property;
|
||||
object_class->constructed = main_window_constructed;
|
||||
object_class->dispose = main_window_dispose;
|
||||
object_class->finalize = main_window_finalize;
|
||||
|
||||
widget_class->map = main_window_map;
|
||||
widget_class->unmap = main_window_unmap;
|
||||
|
||||
g_object_class_install_property(object_class, PROP_FOLDED,
|
||||
g_param_spec_boolean("folded", "Folded", "Whether the window is foled", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gtk_widget_class_set_template_from_resource(widget_class, "/v/ginput/main-window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child(widget_class, MainWindow, header);
|
||||
gtk_widget_class_bind_template_child(widget_class, MainWindow, main_leaflet);
|
||||
// gtk_widget_class_bind_template_child(widget_class, MainWindow, panel_list);
|
||||
gtk_widget_class_bind_template_child(widget_class, MainWindow, sidebar_box);
|
||||
gtk_widget_class_bind_template_child(widget_class, MainWindow, sidebar_title_widget);
|
||||
gtk_widget_class_bind_template_child(widget_class, MainWindow, stack);
|
||||
}
|
||||
|
||||
static void
|
||||
main_window_init(MainWindow* self)
|
||||
{
|
||||
gtk_widget_init_template(GTK_WIDGET(self));
|
||||
|
||||
self->settings = g_settings_new("v.ginput");
|
||||
// self->previous_panels = g_queue_new ();
|
||||
// self->previous_list_view = cc_panel_list_get_view (self->panel_list);
|
||||
|
||||
g_object_bind_property(self->main_leaflet,
|
||||
"folded",
|
||||
self,
|
||||
"folded",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
activate_panel(self, empty_panel_new(), "empty");
|
||||
}
|
||||
|
||||
// TODO use translation
|
||||
#define _(x) x
|
||||
|
||||
MainWindow*
|
||||
main_window_new(AdwApplication* application)
|
||||
{
|
||||
g_return_val_if_fail(GTK_IS_APPLICATION(application), NULL);
|
||||
|
||||
return g_object_new(main_window_get_type(),
|
||||
"application", application,
|
||||
"resizable", TRUE,
|
||||
"title", _("Input devices"),
|
||||
"icon-name", "input-devices",
|
||||
"show-menubar", FALSE,
|
||||
NULL);
|
||||
}
|
11
src/ui/main-window.h
Normal file
11
src/ui/main-window.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(MainWindow, main_window, GINPUT, MAIN_WINDOW, AdwApplicationWindow)
|
||||
|
||||
MainWindow* main_window_new(AdwApplication* application);
|
||||
|
||||
G_END_DECLS
|
206
src/ui/panel.c
Normal file
206
src/ui/panel.c
Normal file
@@ -0,0 +1,206 @@
|
||||
#include "panel.h"
|
||||
|
||||
/*
|
||||
* Abstract class representing a panel
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AdwBin* content_bin;
|
||||
GtkBox* main_box;
|
||||
AdwBin* titlebar_bin;
|
||||
AdwHeaderBar* titlebar;
|
||||
|
||||
GCancellable* cancellable;
|
||||
gboolean folded;
|
||||
gchar* title;
|
||||
} PanelPrivate;
|
||||
|
||||
static void panel_buildable_init(GtkBuildableIface* iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE(Panel, panel, ADW_TYPE_BIN,
|
||||
G_ADD_PRIVATE(Panel)
|
||||
G_IMPLEMENT_INTERFACE(GTK_TYPE_BUILDABLE, panel_buildable_init))
|
||||
|
||||
static GtkBuildableIface* parent_buildable_iface;
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PARAMETERS,
|
||||
PROP_FOLDED,
|
||||
PROP_TITLE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec* properties[N_PROPS];
|
||||
|
||||
static void
|
||||
panel_buildable_add_child(GtkBuildable* buildable, GtkBuilder* builder, GObject* child, const char* type)
|
||||
{
|
||||
PanelPrivate* priv = panel_get_instance_private(GINPUT_PANEL(buildable));
|
||||
|
||||
if(GTK_IS_WIDGET(child) && !priv->main_box)
|
||||
{
|
||||
adw_bin_set_child(ADW_BIN(buildable), GTK_WIDGET(child));
|
||||
return;
|
||||
}
|
||||
|
||||
if(g_strcmp0(type, "content") == 0)
|
||||
adw_bin_set_child(priv->content_bin, GTK_WIDGET(child));
|
||||
else if(g_strcmp0(type, "titlebar-start") == 0)
|
||||
adw_header_bar_pack_start(priv->titlebar, GTK_WIDGET(child));
|
||||
else if(g_strcmp0(type, "titlebar-end") == 0)
|
||||
adw_header_bar_pack_end(priv->titlebar, GTK_WIDGET(child));
|
||||
else if(g_strcmp0(type, "titlebar") == 0)
|
||||
adw_bin_set_child(priv->titlebar_bin, GTK_WIDGET(child));
|
||||
else
|
||||
parent_buildable_iface->add_child(buildable, builder, child, type);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GtkBuildableIface
|
||||
*/
|
||||
static void
|
||||
panel_buildable_init(GtkBuildableIface* iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent(iface);
|
||||
iface->add_child = panel_buildable_add_child;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GObject
|
||||
*/
|
||||
static void
|
||||
panel_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
|
||||
{
|
||||
PanelPrivate* priv = panel_get_instance_private(GINPUT_PANEL(object));
|
||||
|
||||
switch(prop_id)
|
||||
{
|
||||
case PROP_PARAMETERS:
|
||||
{
|
||||
g_autoptr(GVariant) v = NULL;
|
||||
GVariant* parameters;
|
||||
gsize n_parameters;
|
||||
|
||||
parameters = g_value_get_variant(value);
|
||||
|
||||
if(parameters == NULL)
|
||||
return;
|
||||
|
||||
n_parameters = g_variant_n_children(parameters);
|
||||
if(n_parameters == 0)
|
||||
return;
|
||||
|
||||
g_variant_get_child(parameters, 0, "v", &v);
|
||||
|
||||
if(!g_variant_is_of_type(v, G_VARIANT_TYPE_DICTIONARY))
|
||||
g_warning("Wrong type for the first argument GVariant, expected 'a{sv}' but got '%s'",
|
||||
(gchar*) g_variant_get_type(v));
|
||||
else if(g_variant_n_children(v) > 0)
|
||||
g_warning("Ignoring additional flags");
|
||||
|
||||
if(n_parameters > 1)
|
||||
g_warning("Ignoring additional parameters");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PROP_TITLE:
|
||||
priv->title = g_value_dup_string(value);
|
||||
break;
|
||||
|
||||
case PROP_FOLDED:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GObject
|
||||
*/
|
||||
static void
|
||||
panel_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
|
||||
{
|
||||
PanelPrivate* priv = panel_get_instance_private(GINPUT_PANEL(object));
|
||||
|
||||
switch(prop_id)
|
||||
{
|
||||
case PROP_FOLDED:
|
||||
g_value_set_boolean(value, priv->folded);
|
||||
break;
|
||||
|
||||
case PROP_TITLE:
|
||||
g_value_set_string(value, priv->title);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override from GObject
|
||||
*/
|
||||
static void
|
||||
panel_finalize(GObject* object)
|
||||
{
|
||||
PanelPrivate* priv = panel_get_instance_private(GINPUT_PANEL(object));
|
||||
|
||||
g_cancellable_cancel(priv->cancellable);
|
||||
g_clear_object(&priv->cancellable);
|
||||
|
||||
g_clear_pointer(&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS(panel_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_class_init(PanelClass* klass)
|
||||
{
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
|
||||
|
||||
object_class->get_property = panel_get_property;
|
||||
object_class->set_property = panel_set_property;
|
||||
object_class->finalize = panel_finalize;
|
||||
|
||||
// signals[SIDEBAR_ACTIVATED] = g_signal_new ("sidebar-activated",
|
||||
// G_TYPE_FROM_CLASS (object_class),
|
||||
// G_SIGNAL_RUN_LAST,
|
||||
// 0, NULL, NULL,
|
||||
// g_cclosure_marshal_VOID__VOID,
|
||||
// G_TYPE_NONE, 0);
|
||||
|
||||
properties[PROP_FOLDED] = g_param_spec_boolean("folded", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_PARAMETERS] = g_param_spec_variant("parameters",
|
||||
"Structured parameters",
|
||||
"Additional parameters passed externally (ie. command line, D-Bus activation)",
|
||||
G_VARIANT_TYPE("av"),
|
||||
NULL,
|
||||
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_TITLE] = g_param_spec_string("title", NULL, NULL, NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties(object_class, N_PROPS, properties);
|
||||
|
||||
gtk_widget_class_set_template_from_resource(widget_class, "/v/ginput/panel.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child_private(widget_class, Panel, content_bin);
|
||||
gtk_widget_class_bind_template_child_private(widget_class, Panel, main_box);
|
||||
gtk_widget_class_bind_template_child_private(widget_class, Panel, titlebar_bin);
|
||||
gtk_widget_class_bind_template_child_private(widget_class, Panel, titlebar);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_init(Panel* panel)
|
||||
{
|
||||
gtk_widget_init_template(GTK_WIDGET(panel));
|
||||
}
|
44
src/ui/panel.h
Normal file
44
src/ui/panel.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <adwaita.h>
|
||||
|
||||
G_DECLARE_DERIVABLE_TYPE(Panel, panel, GINPUT, PANEL, AdwBin)
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* PanelClass:
|
||||
*
|
||||
* The contents of this struct are private and should not be accessed directly.
|
||||
*/
|
||||
struct _PanelClass
|
||||
{
|
||||
/*< private >*/
|
||||
AdwBinClass parent_class;
|
||||
|
||||
const gchar* (*get_help_uri)(Panel* panel);
|
||||
|
||||
GtkWidget* (*get_sidebar_widget)(Panel* panel);
|
||||
};
|
||||
|
||||
GPermission* panel_get_permission(Panel* panel);
|
||||
|
||||
const gchar* panel_get_help_uri(Panel* panel);
|
||||
|
||||
GtkWidget* panel_get_sidebar_widget(Panel* panel);
|
||||
|
||||
GCancellable* panel_get_cancellable(Panel* panel);
|
||||
|
||||
gboolean panel_get_folded(Panel* panel);
|
||||
|
||||
GtkWidget* panel_get_content(Panel* panel);
|
||||
|
||||
void panel_set_content(Panel* panel, GtkWidget* content);
|
||||
|
||||
GtkWidget* panel_get_titlebar(Panel* panel);
|
||||
|
||||
void panel_set_titlebar(Panel* panel, GtkWidget* titlebar);
|
||||
|
||||
void panel_deactivate(Panel* panel);
|
||||
|
||||
G_END_DECLS
|
30
src/ui/panels/empty_panel.c
Normal file
30
src/ui/panels/empty_panel.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "empty_panel.h"
|
||||
|
||||
struct _EmptyPanel
|
||||
{
|
||||
Panel parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (EmptyPanel, empty_panel, panel_get_type())
|
||||
|
||||
static void
|
||||
empty_panel_class_init(EmptyPanelClass* klass)
|
||||
{
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
|
||||
PanelClass* panel_class = GINPUT_PANEL_CLASS(klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource(widget_class, "/v/ginput/panel-empty.ui");
|
||||
}
|
||||
|
||||
static void
|
||||
empty_panel_init(EmptyPanel* self)
|
||||
{
|
||||
gtk_widget_init_template(GTK_WIDGET(self));
|
||||
}
|
||||
|
||||
Panel*
|
||||
empty_panel_new(void)
|
||||
{
|
||||
return g_object_new(empty_panel_get_type(), NULL);
|
||||
}
|
11
src/ui/panels/empty_panel.h
Normal file
11
src/ui/panels/empty_panel.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui/panel.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(EmptyPanel, empty_panel, GINPUT, EMPTY_PANEL, Panel)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Panel* empty_panel_new(void);
|
Reference in New Issue
Block a user