summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--rcm-client-hardware-info.c74
-rw-r--r--rcm-client-hardware-info.h3
-rw-r--r--rcm-client-hardware-list.c17
-rw-r--r--rcm-client-receive.c1
5 files changed, 17 insertions, 82 deletions
diff --git a/Makefile b/Makefile
index 1ea58e6..23f5403 100644
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,8 @@ RCC_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCC
RCC_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCC_PACKAGES})
RCC_COMPILE = $(CC) $(RCC_CFLAGS)
RCC_LINK = $(CC) $(RCC_CFLAGS) $(RCC_LDFLAGS)
-RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-hardware-info.o rcm-client-receive.o rcm-client-transmit.o generated.o shared.o
-RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-hardware-info.h rcm-client-receive.h rcm-client-transmit.h generated.h $(COMMON_HEADERS)
+RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-receive.o rcm-client-transmit.o generated.o shared.o
+RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-receive.h rcm-client-transmit.h generated.h $(COMMON_HEADERS)
INSTALL = install -c
INSTALL_PROGRAM = ${INSTALL}
diff --git a/rcm-client-hardware-info.c b/rcm-client-hardware-info.c
deleted file mode 100644
index 662f526..0000000
--- a/rcm-client-hardware-info.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#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);
-}
diff --git a/rcm-client-hardware-info.h b/rcm-client-hardware-info.h
deleted file mode 100644
index 37e65f0..0000000
--- a/rcm-client-hardware-info.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-void rcng_client_hardware_init_info_ui(GDBusObject *);
-
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index eec0d03..9f55e82 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -8,7 +8,7 @@
#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"
static GtkWidget *status_msg;
static GtkWidget *hw_list_box;
@@ -64,6 +64,7 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
GtkWidget *icon;
GtkWidget *label;
struct hwentry *hwe;
+ gchar *labeltxt;
g_print(" - Object at %s\n", g_dbus_object_get_object_path(hw));
@@ -83,7 +84,10 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gtk_widget_set_halign(icon, GTK_ALIGN_START);
gtk_widget_set_margin_start(icon, 12);
gtk_widget_set_margin_end(icon, 12);
- label = gtk_label_new(g_dbus_object_get_object_path(hw));
+ labeltxt = g_strdup_printf("<b>Hardware</b>\n\ntest\ntest\ntest%s", g_dbus_object_get_object_path(hw));
+ label = gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), labeltxt);
+ g_free(labeltxt);
gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
gtk_widget_show_all(box);
@@ -96,6 +100,8 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
hw_list = g_list_append(hw_list, hwe);
}
+static struct hwentry *old_hwe = NULL;
+
static void
on_hw_selected(GtkListBox *box,
GtkListBoxRow *row,
@@ -109,7 +115,12 @@ on_hw_selected(GtkListBox *box,
entry = g_list_find_custom(hw_list, child, find_hwentry_by_widget);
hwe = entry ? entry->data : NULL;
- rcng_client_hardware_init_info_ui(hwe ? hwe->hw : NULL);
+ if (hwe == old_hwe)
+ return;
+
+ old_hwe = hwe;
+ rcng_client_receive_destroy_ui();
+ rcng_client_receive_init_ui(hwe ? hwe->hw : NULL);
}
void rcng_client_hardware_list_update_status(gchar *status)
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index ee8c941..f9f1193 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -1052,5 +1052,6 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw)
g_free(keymap_ids);
gtk_widget_show_all(state.stack);
+ gtk_notebook_set_current_page(global->notebook, own_page_num);
}