aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-06-24 09:54:54 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-06-24 09:54:54 +0200
commit6299c0d614575c6090e6cd2409397393405169e5 (patch)
tree5524fade7f376a0ed5107a3b5d5268417c563c1a
parent4e750f06dbffcae0bbebaae631fe521f711770cd (diff)
downloadvconsole-6299c0d614575c6090e6cd2409397393405169e5.tar.gz
file menu actions
-rw-r--r--main.ui3
-rw-r--r--vconsole.c56
2 files changed, 41 insertions, 18 deletions
diff --git a/main.ui b/main.ui
index 626d4ba..c10507f 100644
--- a/main.ui
+++ b/main.ui
@@ -35,6 +35,7 @@
<property name="label" translatable="yes">Connect ...</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">main.ConnectAsk</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
</object>
@@ -44,6 +45,7 @@
<property name="label" translatable="yes">Close _Tab</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">main.CloseTab</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
</object>
@@ -53,6 +55,7 @@
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">main.CloseApp</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
diff --git a/vconsole.c b/vconsole.c
index b6be027..86bf85d 100644
--- a/vconsole.c
+++ b/vconsole.c
@@ -149,9 +149,9 @@ static int gtk_getstring(GtkWidget *window, char *title, char *message,
/* ------------------------------------------------------------------ */
-#if 0
-
-static void menu_cb_connect_ask(GtkAction *action, gpointer userdata)
+static void menu_cb_connect_ask(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer userdata)
{
struct vconsole_window *win = userdata;
char uri[256] = "";
@@ -163,7 +163,11 @@ static void menu_cb_connect_ask(GtkAction *action, gpointer userdata)
connect_init(win, uri);
}
-static void menu_cb_connect_menu(GtkAction *action, gpointer userdata)
+#if 0
+
+static void menu_cb_connect_menu(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer userdata)
{
struct vconsole_window *win = userdata;
GError *err = NULL;
@@ -181,18 +185,26 @@ static void menu_cb_connect_menu(GtkAction *action, gpointer userdata)
}
}
-static void menu_cb_close_tab(GtkAction *action, gpointer userdata)
+#endif
+
+static void menu_cb_close_tab(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer userdata)
{
struct vconsole_window *win = userdata;
domain_close_current_tab(win);
}
-static void menu_cb_close_app(GtkAction *action, gpointer userdata)
+static void menu_cb_close_app(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer userdata)
{
struct vconsole_window *win = userdata;
gtk_widget_destroy(win->toplevel);
}
+#if 0
+
static gboolean terminal_font_filter(const PangoFontFamily *family,
const PangoFontFace *face,
gpointer data)
@@ -531,8 +543,11 @@ static void menu_cb_vm_logging(GtkToggleAction *action, gpointer userdata)
/* ------------------------------------------------------------------ */
-static const GtkActionEntry entries[] = {
+#endif
+
+static const GActionEntry entries[] = {
{
+#if 0
/* --- menu bar --- */
.name = "FileMenu",
.label = "_File",
@@ -551,23 +566,18 @@ static const GtkActionEntry entries[] = {
.name = "ConnectMenu",
.label = "_Recent",
},{
+#endif
/* --- file menu --- */
.name = "ConnectAsk",
- .stock_id = GTK_STOCK_CONNECT,
- .label = "_Connect ...",
- .callback = G_CALLBACK(menu_cb_connect_ask),
+ .activate = menu_cb_connect_ask,
},{
.name = "CloseTab",
- .stock_id = GTK_STOCK_CLOSE,
- .label = "Close _Tab",
- .tooltip = "Close Tab",
- .callback = G_CALLBACK(menu_cb_close_tab),
+ .activate = menu_cb_close_tab,
},{
.name = "CloseApp",
- .stock_id = GTK_STOCK_QUIT,
- .label = "_Quit",
- .callback = G_CALLBACK(menu_cb_close_app),
+ .activate = menu_cb_close_app,
+#if 0
},{
/* --- view menu --- */
@@ -657,9 +667,12 @@ static const GtkActionEntry entries[] = {
.stock_id = GTK_STOCK_HELP,
.label = "_Manual page",
.callback = G_CALLBACK(menu_cb_manual),
+#endif
},
};
+#if 0
+
static const GtkToggleActionEntry tentries[] = {
{
.name = "TerminalBlink",
@@ -891,7 +904,8 @@ static struct vconsole_window *vconsole_toplevel_create(void)
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), win->notebook, TRUE, TRUE, 0);
#else
- GtkBuilder *builder;
+ GtkBuilder *builder;
+ GSimpleActionGroup *ag;
win = g_new0(struct vconsole_window, 1);
@@ -905,6 +919,12 @@ static struct vconsole_window *vconsole_toplevel_create(void)
NULL);
gtk_builder_connect_signals(builder, win);
+ ag = g_simple_action_group_new();
+ g_action_map_add_action_entries(G_ACTION_MAP(ag),
+ entries, G_N_ELEMENTS(entries),
+ win);
+ gtk_widget_insert_action_group(win->toplevel, "main", G_ACTION_GROUP(ag));
+
g_object_unref(builder);
#endif