summaryrefslogtreecommitdiff
path: root/rcm-client-hardware-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-client-hardware-list.c')
-rw-r--r--rcm-client-hardware-list.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index ec29b46..64a0236 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -84,6 +84,37 @@ hardware_properties_cb(GtkButton *button, gpointer user_data)
gtk_widget_hide(dialog);
}
+static void
+advanced_cb(GtkButton *button, gpointer user_data)
+{
+ RCDevice *object = user_data;
+ GtkWidget *dialog;
+ GtkWidget *title;
+ gchar *titlestr;
+
+ dialog = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced"));
+
+ title = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_main_title_label"));
+ titlestr = g_markup_printf_escaped("<b><big>Advanced Actions</big></b>\nFor device %s",
+ rcdevice_get_sys_name(object));
+ gtk_label_set_markup(GTK_LABEL(title), titlestr);
+ g_free(titlestr);
+
+ g_signal_connect_swapped(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), dialog);
+ gtk_widget_show(dialog);
+}
+
+static void
+hw_selected_cb(GtkListBox *box, GtkListBoxRow *row, gpointer user_data)
+{
+ RCDevice *object = user_data;
+ GtkWidget *advanced_button;
+
+ advanced_button = GTK_WIDGET(gtk_builder_get_object(global->builder, "hardware_page_action_advanced"));
+ g_signal_connect(advanced_button, "clicked", G_CALLBACK(advanced_cb), object);
+ gtk_widget_set_sensitive(advanced_button, row ? true : false);
+}
+
static gint
rcdev_sort(GtkListBoxRow *a, GtkListBoxRow *b, gpointer user_data)
{
@@ -150,7 +181,7 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
- button = gtk_button_new_from_icon_name("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
+ button = gtk_button_new_from_icon_name("dialog-information-symbolic", GTK_ICON_SIZE_MENU);
gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
gtk_widget_set_halign(button, GTK_ALIGN_END);
g_signal_connect(button, "clicked", G_CALLBACK(hardware_properties_cb), object);
@@ -173,7 +204,7 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
if (!hw_list_box) {
hw_list_box = gtk_list_box_new();
- gtk_list_box_set_selection_mode(GTK_LIST_BOX(hw_list_box), GTK_SELECTION_NONE);
+ g_signal_connect(hw_list_box, "row-selected", G_CALLBACK(hw_selected_cb), object);
gtk_list_box_set_sort_func(GTK_LIST_BOX(hw_list_box), rcdev_sort, NULL, NULL);
gtk_container_add(GTK_CONTAINER(hw_list_swin), hw_list_box);
gtk_widget_show_all(hw_list_swin);