diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-06-22 21:47:38 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-06-22 21:47:38 +0200 |
commit | e6e97fe6dbc05c5b0c2edf28652cc877923edf06 (patch) | |
tree | cfd53154ae999dc09881e7723275aecec38fd283 | |
parent | 67228fe95eb0c2681e09e29b20cb025720f238b6 (diff) | |
download | vconsole-e6e97fe6dbc05c5b0c2edf28652cc877923edf06.tar.gz |
initial builder version
-rw-r--r-- | main.ui (renamed from builder-main.ui) | 26 | ||||
-rw-r--r-- | meson.build | 12 | ||||
-rw-r--r-- | vconsole.c | 30 |
3 files changed, 48 insertions, 20 deletions
diff --git a/builder-main.ui b/main.ui index 95c272c..4159d66 100644 --- a/builder-main.ui +++ b/main.ui @@ -2,9 +2,11 @@ <!-- Generated with glade 3.22.1 --> <interface> <requires lib="gtk+" version="3.20"/> - <object class="GtkWindow"> + <object class="GtkWindow" id="toplevel"> <property name="can_focus">False</property> <property name="title" translatable="yes">vconsole</property> + <property name="default_width">800</property> + <property name="default_height">600</property> <child type="titlebar"> <placeholder/> </child> @@ -146,7 +148,27 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkNotebook" id="notebook"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <placeholder/> + </child> + <child type="tab"> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> </object> </child> diff --git a/meson.build b/meson.build index 781bcbc..0dbc454 100644 --- a/meson.build +++ b/meson.build @@ -25,14 +25,14 @@ add_global_arguments(['-include', 'config.h'], language : 'c') # build & install -stringify = find_program('./stringify.sh') -builder_main = custom_target('builder-main', - input : ['builder-main.ui'], - output : ['builder-main.h'], - command : [ stringify, '@INPUT@', '@OUTPUT@' ]) +stringify = find_program('./stringify.sh') +main_ui = custom_target('main-ui', + input : ['main.ui'], + output : ['main-ui.h'], + command : [ stringify, '@INPUT@', '@OUTPUT@' ]) vconsole_srcs = [ 'vconsole.c', 'connect.c', 'domain.c', 'libvirt-glib-event.c', - builder_main ] + main_ui ] vpublish_srcs = [ 'vpublish.c', 'mdns-publish.c', 'libvirt-glib-event.c' ] vconsole_deps = [ glib_dep, gthread_dep, gtk3_dep, vte_dep, libvirt_dep ] @@ -746,8 +746,8 @@ static char recent_xml[] = /* ------------------------------------------------------------------ */ -static char builder_main_xml[] = -#include "builder-main.h" +static char main_ui[] = +#include "main-ui.h" ""; /* ------------------------------------------------------------------ */ @@ -842,13 +842,11 @@ static void vconsole_build_recent(struct vconsole_window *win) static struct vconsole_window *vconsole_toplevel_create(void) { struct vconsole_window *win; - GtkWidget *vbox; + GError *err; #if 0 - GtkWidget *menubar, *toolbar, *item; + GtkWidget *vbox, *menubar, *toolbar, *item; GtkAccelGroup *accel; GtkActionGroup *ag; -#endif - GError *err; win = g_new0(struct vconsole_window, 1); win->toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -856,13 +854,10 @@ static struct vconsole_window *vconsole_toplevel_create(void) gtk_window_set_default_size(GTK_WINDOW(win->toplevel), 800, 600); g_signal_connect(G_OBJECT(win->toplevel), "destroy", G_CALLBACK(destroy), win); -#if 0 g_signal_connect(G_OBJECT(win->toplevel), "window-state-event", G_CALLBACK(window_state_cb), win); -#endif /* menu + toolbar */ -#if 0 win->ui = gtk_ui_manager_new(); ag = gtk_action_group_new("MenuActions"); gtk_action_group_add_actions(ag, entries, G_N_ELEMENTS(entries), win); @@ -878,7 +873,6 @@ static struct vconsole_window *vconsole_toplevel_create(void) g_error_free(err); exit(1); } -#endif /* main area */ win->notebook = gtk_notebook_new(); @@ -890,14 +884,26 @@ static struct vconsole_window *vconsole_toplevel_create(void) /* Make a vbox and put stuff in */ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); gtk_container_add(GTK_CONTAINER(win->toplevel), vbox); -#if 0 menubar = gtk_ui_manager_get_widget(win->ui, "/MainMenu"); gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0); toolbar = gtk_ui_manager_get_widget(win->ui, "/ToolBar"); if (toolbar) gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); -#endif gtk_box_pack_start(GTK_BOX(vbox), win->notebook, TRUE, TRUE, 0); +#else + GtkBuilder *builder; + + win = g_new0(struct vconsole_window, 1); + + builder = gtk_builder_new_from_string(main_ui, -1); + gtk_builder_connect_signals(builder, NULL); + win->toplevel = GTK_WIDGET(gtk_builder_get_object(builder, "toplevel")); + win->notebook = GTK_WIDGET(gtk_builder_get_object(builder, "notebook")); + fprintf(stderr, "%s: %p %p\n", __func__, + win->toplevel, win->notebook); + + g_object_unref(builder); +#endif /* read config */ err = NULL; |