summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-08-14 22:21:51 +0200
committerDavid Härdeman <david@hardeman.nu>2015-08-14 22:21:51 +0200
commit468ba7e90a5eec5213743b54aad03dde2f2f2a99 (patch)
treed80a9c07fb2589eb8ce09218b3336e0737df38a7
parent58c1f015c2ccd514ef854d97a1587439f4db8235 (diff)
Add UI for advanced hw actions (dummy functions so far)
-rw-r--r--rcm-client-hardware-list.c35
-rw-r--r--rcm-client.ui148
2 files changed, 178 insertions, 5 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);
diff --git a/rcm-client.ui b/rcm-client.ui
index 13ad0ad..ba5c893 100644
--- a/rcm-client.ui
+++ b/rcm-client.ui
@@ -2,6 +2,122 @@
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.16"/>
+ <object class="GtkImage" id="advanced_button_receive_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">network-receive-symbolic</property>
+ </object>
+ <object class="GtkImage" id="advanced_button_transmit_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">network-transmit-symbolic</property>
+ </object>
+ <object class="GtkWindow" id="advanced">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Advanced Actions</property>
+ <child>
+ <object class="GtkStack" id="advanced_stack">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="transition_type">crossfade</property>
+ <child>
+ <object class="GtkGrid" id="advanced_main_grid">
+ <property name="visible">True</property>
+ <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="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkImage" id="advanced_main_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <property name="xalign">1</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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="advanced_main_receive_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">end</property>
+ <property name="image">advanced_button_receive_image</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="advanced_main_transmit_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">end</property>
+ <property name="image">advanced_button_transmit_image</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="advanced_main_title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <property name="use_markup">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="advanced_main_receive_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Receive raw commands</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="advanced_main_transmit_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Transmit raw commands</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="name">page0</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
<object class="GtkAdjustment" id="keymap_properties_height_adjustment">
<property name="lower">1</property>
<property name="upper">100</property>
@@ -96,6 +212,32 @@ Currently connected receivers/transmitters</property>
<property name="width">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkButtonBox" id="hardware_page_action_area">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="hardware_page_action_advanced">
+ <property name="label" translatable="yes">Advanced</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</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="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="name">hardware_page</property>
@@ -122,7 +264,7 @@ Currently connected receivers/transmitters</property>
<property name="title" translatable="yes">Edit Button</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">normal</property>
+ <property name="type_hint">dialog</property>
<property name="transient_for">main_window</property>
<child internal-child="vbox">
<object class="GtkBox" id="edit_button_vbox">
@@ -272,7 +414,7 @@ Currently connected receivers/transmitters</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="type_hint">dialog</property>
<property name="transient_for">main_window</property>
<child internal-child="vbox">
<object class="GtkBox" id="hardware_properties_vbox">
@@ -443,7 +585,7 @@ Currently connected receivers/transmitters</property>
<property name="title" translatable="yes">Keymap Properties</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">normal</property>
+ <property name="type_hint">dialog</property>
<property name="transient_for">main_window</property>
<child internal-child="vbox">
<object class="GtkBox" id="keymap_properties_vbox">