summaryrefslogtreecommitdiff
path: root/rcm-client-hardware-info.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-07-08 23:16:06 +0200
committerDavid Härdeman <david@hardeman.nu>2015-07-08 23:16:06 +0200
commit018efc8ef96a77529507b8a1614067821be8b90d (patch)
treec9ddacf9f800a63131d7bfa9a241d379f389701c /rcm-client-hardware-info.c
parentce38f3d01c76327fcbeadccf125f7e7540ed4721 (diff)
Add simple test client embryo
Diffstat (limited to 'rcm-client-hardware-info.c')
-rw-r--r--rcm-client-hardware-info.c74
1 files changed, 74 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <math.h>
+#include <gtk/gtk.h>
+
+#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), "<b>Hardware</b>");
+ 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);
+}