mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: menuing work and use libdazzle
This commit is contained in:
@ -5,32 +5,38 @@
|
|||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">New Tab</attribute>
|
<attribute name="label" translatable="yes">New Tab</attribute>
|
||||||
<attribute name="action">win.new-tab</attribute>
|
<attribute name="action">win.new-tab</attribute>
|
||||||
|
<attribute name="accel"><primary>t</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">New Window</attribute>
|
<attribute name="label" translatable="yes">New Window</attribute>
|
||||||
<attribute name="action">app.new-window</attribute>
|
<attribute name="action">app.new-window</attribute>
|
||||||
|
<attribute name="accel"><primary>n</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section id="win-menu-open">
|
<section id="win-menu-open">
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Open Capture…</attribute>
|
<attribute name="label" translatable="yes">Open Capture…</attribute>
|
||||||
<attribute name="action">app.open-capture</attribute>
|
<attribute name="action">app.open-capture</attribute>
|
||||||
|
<attribute name="accel"><primary>o</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section id="win-menu-close">
|
<section id="win-menu-close">
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Close</attribute>
|
<attribute name="label" translatable="yes">Close</attribute>
|
||||||
<attribute name="action">win.close-tab</attribute>
|
<attribute name="action">win.close-tab</attribute>
|
||||||
|
<attribute name="accel"><primary>w</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section id="win-menu-misc">
|
<section id="win-menu-misc">
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
|
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
|
||||||
<attribute name="action">app.show-help-overlay</attribute>
|
<attribute name="action">app.show-help-overlay</attribute>
|
||||||
|
<attribute name="accel"><primary>question</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Help</attribute>
|
<attribute name="label" translatable="yes">Help</attribute>
|
||||||
<attribute name="action">app.help</attribute>
|
<attribute name="action">app.help</attribute>
|
||||||
|
<attribute name="accel">F1</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">About Sysprof</attribute>
|
<attribute name="label" translatable="yes">About Sysprof</attribute>
|
||||||
|
|||||||
@ -27,15 +27,18 @@
|
|||||||
|
|
||||||
struct _SysprofApplication
|
struct _SysprofApplication
|
||||||
{
|
{
|
||||||
GtkApplication parent_instance;
|
DzlApplication parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (SysprofApplication, sysprof_application, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (SysprofApplication, sysprof_application, DZL_TYPE_APPLICATION)
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
const gchar *action_name;
|
const gchar *action_name;
|
||||||
const gchar *accels[12];
|
const gchar *accels[12];
|
||||||
} default_accels[] = {
|
} default_accels[] = {
|
||||||
|
{ "app.help", { "F1", NULL } },
|
||||||
|
{ "app.new-window", { "<Primary>n", NULL } },
|
||||||
|
{ "app.open-capture", { "<Primary>o", NULL } },
|
||||||
{ "zoom.zoom-in", { "<Primary>plus", "<Primary>KP_Add", "<Primary>equal", "ZoomIn", NULL } },
|
{ "zoom.zoom-in", { "<Primary>plus", "<Primary>KP_Add", "<Primary>equal", "ZoomIn", NULL } },
|
||||||
{ "zoom.zoom-out", { "<Primary>minus", "<Primary>KP_Subtract", "ZoomOut", NULL } },
|
{ "zoom.zoom-out", { "<Primary>minus", "<Primary>KP_Subtract", "ZoomOut", NULL } },
|
||||||
{ "zoom.zoom-one", { "<Primary>0", "<Primary>KP_0", NULL } },
|
{ "zoom.zoom-one", { "<Primary>0", "<Primary>KP_0", NULL } },
|
||||||
|
|||||||
@ -16,19 +16,16 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SYSPROF_APPLICATION_H
|
#pragma once
|
||||||
#define SYSPROF_APPLICATION_H
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <dazzle.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define SYSPROF_TYPE_APPLICATION (sysprof_application_get_type())
|
#define SYSPROF_TYPE_APPLICATION (sysprof_application_get_type())
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, GtkApplication)
|
G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, DzlApplication)
|
||||||
|
|
||||||
SysprofApplication *sysprof_application_new (void);
|
SysprofApplication *sysprof_application_new (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* SYSPROF_APPLICATION_H */
|
|
||||||
|
|||||||
@ -105,34 +105,12 @@ close_tab_cb (GSimpleAction *action,
|
|||||||
sysprof_notebook_close_current (self->notebook);
|
sysprof_notebook_close_current (self->notebook);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
sysprof_window_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
SysprofWindow *self = (SysprofWindow *)object;
|
|
||||||
GApplication *app = g_application_get_default ();
|
|
||||||
GMenu *menu;
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (sysprof_window_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
menu = gtk_application_get_menu_by_id (GTK_APPLICATION (app), "win-menu");
|
|
||||||
gtk_menu_button_set_menu_model (self->menu_button, G_MENU_MODEL (menu));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
sysprof_window_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
G_OBJECT_CLASS (sysprof_window_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_window_class_init (SysprofWindowClass *klass)
|
sysprof_window_class_init (SysprofWindowClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
object_class->constructed = sysprof_window_constructed;
|
|
||||||
object_class->finalize = sysprof_window_finalize;
|
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-window.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-window.ui");
|
||||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, menu_button);
|
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, menu_button);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, notebook);
|
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, notebook);
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/sysprof">
|
<gresource prefix="/org/gnome/sysprof">
|
||||||
<!-- Automatic GTK resources -->
|
<!-- Automatic GTK resources -->
|
||||||
<file>gtk/help-overlay.ui</file>
|
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
||||||
<file>gtk/menus.ui</file>
|
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
|
||||||
|
|
||||||
<!-- Theme overrides -->
|
<!-- Theme overrides -->
|
||||||
<file compressed="true">theme/shared.css</file>
|
<file compressed="true">theme/shared.css</file>
|
||||||
<file compressed="true">theme/Adwaita-shared.css</file>
|
<file compressed="true">theme/Adwaita-shared.css</file>
|
||||||
|
|
||||||
<!-- UI Files -->
|
<!-- UI Files -->
|
||||||
<file compressed="true">ui/sysprof-window.ui</file>
|
<file preprocess="xml-stripblanks">ui/sysprof-window.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|||||||
@ -11,14 +11,14 @@
|
|||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<property name="title" translatable="yes">Sysprof</property>
|
<property name="title" translatable="yes">Sysprof</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton" id="menu_button">
|
<object class="DzlMenuButton" id="menu_button">
|
||||||
|
<property name="icon-name">open-menu-symbolic</property>
|
||||||
|
<property name="show-accels">true</property>
|
||||||
|
<property name="menu-id">win-menu</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<child>
|
<style>
|
||||||
<object class="GtkImage">
|
<class name="image-button"/>
|
||||||
<property name="icon-name">open-menu-symbolic</property>
|
</style>
|
||||||
<property name="visible">true</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="pack-type">end</property>
|
<property name="pack-type">end</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user