From 018efc8ef96a77529507b8a1614067821be8b90d Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 8 Jul 2015 23:16:06 +0200 Subject: Add simple test client embryo --- rcm-client-hardware-info.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 rcm-client-hardware-info.c (limited to 'rcm-client-hardware-info.c') diff --git a/rcm-client-hardware-info.c b/rcm-client-hardware-info.c new file mode 100644 index 0000000..662f526 --- /dev/null +++ b/rcm-client-hardware-info.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include +#include + +#include "generated.h" +#include "rcm-client-main.h" +#include "rcm-client-hardware-list.h" +#include "rcm-client-hardware-info.h" +#include "rcm-client-receive.h" +#include "rcm-client-transmit.h" + +static GtkWidget *info = NULL; +static GDBusObject *hw = NULL; + +void +rcng_client_hardware_init_info_ui(GDBusObject *new_hw) +{ + GtkWidget *icon; + GtkWidget *hbox; + GtkWidget *title; + GtkWidget *line; + + if (new_hw == hw) + return; + + hw = new_hw; + if (info) + gtk_widget_destroy(info); + info = NULL; + rcng_client_receive_destroy_ui(); + rcng_client_transmit_destroy_ui(); + + if (!hw) + return; + + icon = gtk_image_new_from_icon_name("gtk-harddisk", GTK_ICON_SIZE_DIALOG); + gtk_widget_set_valign(icon, GTK_ALIGN_START); + gtk_widget_set_halign(icon, GTK_ALIGN_START); + gtk_widget_set_margin_start(icon, 12); + gtk_widget_set_margin_end(icon, 12); + + hbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); + + title = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(title), "Hardware"); + gtk_widget_set_halign(title, GTK_ALIGN_START); + gtk_box_pack_start(GTK_BOX(hbox), title, FALSE, FALSE, 0); + + line = gtk_label_new("Apan 1"); + gtk_widget_set_halign(line, GTK_ALIGN_START); + gtk_box_pack_start(GTK_BOX(hbox), line, FALSE, FALSE, 0); + + line = gtk_label_new("Apan 2"); + line = gtk_label_new(g_dbus_object_get_object_path(hw)); + gtk_widget_set_halign(line, GTK_ALIGN_START); + gtk_box_pack_start(GTK_BOX(hbox), line, FALSE, FALSE, 0); + + info = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_margin_start(info, 12); + gtk_widget_set_margin_end(info, 12); + gtk_widget_set_margin_top(info, 12); + gtk_widget_set_margin_bottom(info, 12); + gtk_box_pack_start(GTK_BOX(info), icon, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(info), hbox, FALSE, FALSE, 0); + + gtk_widget_show_all(info); + gtk_notebook_append_page(global->notebook, info, gtk_label_new("Details")); + gtk_notebook_set_current_page(global->notebook, 1); + + rcng_client_receive_init_ui(new_hw); +} -- cgit v1.2.3