summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-08-13 23:23:41 +0200
committerDavid Härdeman <david@hardeman.nu>2015-08-13 23:23:41 +0200
commitc58ea4eae74dc8f58c96b802a64f5008f282dfe0 (patch)
tree0ee27092b6fbc794fdbaa7b7274da06bdf766bc8
parent4b37e07e7c0ebfee00406617f40dc8bdbb9622f3 (diff)
Add hardware properties UI, make dialogs more consistent
-rw-r--r--rcm-client-hardware-list.c50
-rw-r--r--rcm-client.ui212
2 files changed, 239 insertions, 23 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index 12d0052..cf61d42 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -46,14 +46,43 @@ void rcng_client_hardware_list_remove(GDBusObject *hw)
}
static void
-on_hw_selected(GtkButton *button,
- gpointer user_data)
+edit_keymaps_cb(GtkButton *button, gpointer user_data)
{
GDBusObject *hw = user_data;
rcng_client_receive_init_ui(hw);
}
+static void
+hardware_properties_cb(GtkButton *button, gpointer user_data)
+{
+ RCDevice *object = user_data;
+ GtkWidget *dialog;
+ GtkLabel *dev;
+ GtkLabel *desc;
+ GtkLabel *driver;
+ GtkLabel *kernelmap;
+
+ dialog = GTK_WIDGET(gtk_builder_get_object(global->builder, "hardware_properties"));
+
+ dev = GTK_LABEL(gtk_builder_get_object(global->builder, "hardware_properties_dev_value"));
+ gtk_label_set_text(dev, rcdevice_get_sys_name(object));
+
+ desc = GTK_LABEL(gtk_builder_get_object(global->builder, "hardware_properties_desc_value"));
+ gtk_label_set_text(desc, rcdevice_get_description(object));
+
+ driver = GTK_LABEL(gtk_builder_get_object(global->builder, "hardware_properties_driver_value"));
+ gtk_label_set_text(driver, rcdevice_get_driver_name(object));
+
+ kernelmap = GTK_LABEL(gtk_builder_get_object(global->builder, "hardware_properties_kernelmap_value"));
+ gtk_label_set_text(kernelmap, rcdevice_get_kernel_keymap_name(object));
+
+ gtk_widget_show_all(dialog);
+
+ gtk_dialog_run(GTK_DIALOG(dialog));
+
+ gtk_widget_hide(dialog);
+}
void rcng_client_hardware_list_add(GDBusObject *hw)
{
@@ -98,9 +127,12 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gtk_widget_set_margin_bottom(box, 6);
gtk_widget_set_margin_start(box, 12);
gtk_widget_set_margin_end(box, 12);
+
icon = gtk_image_new_from_icon_name("input-dialpad-symbolic", GTK_ICON_SIZE_MENU);
gtk_widget_set_valign(icon, GTK_ALIGN_CENTER);
gtk_widget_set_halign(icon, GTK_ALIGN_START);
+ gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
+
labeltxt = g_strdup_printf("%s: %s (%s)",
rcdevice_get_sys_name(object),
rcdevice_get_description(object),
@@ -108,14 +140,20 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
label = gtk_label_new(labeltxt);
g_free(labeltxt);
gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
- //button = gtk_button_new_from_icon_name("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
+ 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);
+ 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);
+ gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);
+
button = gtk_button_new_from_icon_name("accessories-calculator-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(on_hw_selected), hw);
- gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
+ g_signal_connect(button, "clicked", G_CALLBACK(edit_keymaps_cb), hw);
gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);
+
gtk_container_add(GTK_CONTAINER(row), box);
gtk_widget_show_all(row);
diff --git a/rcm-client.ui b/rcm-client.ui
index 5a2495f..cd64a21 100644
--- a/rcm-client.ui
+++ b/rcm-client.ui
@@ -127,10 +127,10 @@ Currently connected receivers/transmitters</property>
<child internal-child="vbox">
<object class="GtkBox" id="edit_button_vbox">
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
+ <property name="margin_left">18</property>
+ <property name="margin_right">18</property>
+ <property name="margin_top">18</property>
+ <property name="margin_bottom">18</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
@@ -188,7 +188,7 @@ Currently connected receivers/transmitters</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">12</property>
- <property name="row_spacing">12</property>
+ <property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkImage" id="edit_button_icon">
@@ -207,8 +207,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="edit_button_keycode_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Keycode:</property>
+ <property name="label" translatable="yes">Keycode</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -219,8 +220,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="edit_button_comment_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Comment:</property>
+ <property name="label" translatable="yes">Comment</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -265,6 +267,177 @@ Currently connected receivers/transmitters</property>
<action-widget response="0">edit_button_cancel</action-widget>
</action-widgets>
</object>
+ <object class="GtkDialog" id="hardware_properties">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Hardware Properties</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">normal</property>
+ <property name="transient_for">main_window</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="hardware_properties_vbox">
+ <property name="can_focus">False</property>
+ <property name="margin_left">18</property>
+ <property name="margin_right">18</property>
+ <property name="margin_top">18</property>
+ <property name="margin_bottom">18</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="hardware_properties_action_area">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="hardware_properties_ok">
+ <property name="label" translatable="yes">OK</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="hardware_properties_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">12</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkImage" id="hardware_properties_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="icon_name">input-dialpad</property>
+ <property name="icon_size">6</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="height">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_dev_label">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Device</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_desc_label">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Description</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_driver_label">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Driver</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_kernelmap_label">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Kernel keymap</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_dev_value">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_desc_value">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_driver_value">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="hardware_properties_kernelmap_value">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">hardware_properties_ok</action-widget>
+ </action-widgets>
+ </object>
<object class="GtkDialog" id="keymap_properties">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Keymap Properties</property>
@@ -276,10 +449,10 @@ Currently connected receivers/transmitters</property>
<object class="GtkBox" id="keymap_properties_vbox">
<property name="can_focus">False</property>
<property name="halign">baseline</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
+ <property name="margin_left">18</property>
+ <property name="margin_right">18</property>
+ <property name="margin_top">18</property>
+ <property name="margin_bottom">18</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
@@ -324,7 +497,7 @@ Currently connected receivers/transmitters</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">12</property>
- <property name="row_spacing">12</property>
+ <property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkImage" id="keymap_properties_icon">
@@ -343,8 +516,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="keymap_properties_id_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">ID:</property>
+ <property name="label" translatable="yes">ID</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -355,8 +529,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="keymap_properties_name_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Name:</property>
+ <property name="label" translatable="yes">Name</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -367,8 +542,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="keymap_properties_description_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Description:</property>
+ <property name="label" translatable="yes">Description</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -379,8 +555,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="keymap_properties_width_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Width:</property>
+ <property name="label" translatable="yes">Width</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -391,8 +568,9 @@ Currently connected receivers/transmitters</property>
<child>
<object class="GtkLabel" id="keymap_properties_height_label">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Height:</property>
+ <property name="label" translatable="yes">Height</property>
<property name="xalign">1</property>
</object>
<packing>