diff options
author | David Härdeman <david@hardeman.nu> | 2015-07-15 16:28:05 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2015-07-15 16:28:05 +0200 |
commit | 6b7f41a334a46c6149edbde31158bdd549f959a5 (patch) | |
tree | 5fe2b9d57efb3b54f13847d9de825e5660a51c87 | |
parent | b0f265ceb7a00a2921942b96e5dc0674853a4f27 (diff) |
Add tooltip to buttons
-rw-r--r-- | rcm-client-receive.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c index 6663f66..f88b453 100644 --- a/rcm-client-receive.c +++ b/rcm-client-receive.c @@ -160,22 +160,27 @@ out: } static struct rcbutton * -new_button_add(GtkGrid *grid, const char *name, GdkRGBA *color, +new_button_add(GtkGrid *grid, const gchar *protocol, guint64 scancode, + const char *keycode, GdkRGBA *color, guint x, guint y, guint w, guint h) { struct rcbutton *rcb; + gchar *tooltip; rcb = g_malloc0(sizeof(*rcb)); - rcb->name = strdup(name); + rcb->name = strdup(keycode); rcb->col = x; rcb->row = y; rcb->cols = w; rcb->rows = h; rcb->button = gtk_toggle_button_new(); gtk_widget_set_sensitive(rcb->button, false); + tooltip = g_strdup_printf("Protocol: %s\nScancode: 0x%08" PRIx64 "\nKeycode : %s", protocol, scancode, keycode); + gtk_widget_set_tooltip_text(rcb->button, tooltip); + g_free(tooltip); remote->buttons = g_list_append(remote->buttons, rcb); gtk_grid_attach(grid, rcb->button, x, y, w, h); - create_button_img(rcb->button, name); + create_button_img(rcb->button, keycode); return rcb; } @@ -402,7 +407,7 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) g_variant_lookup(item, "scancode", "t", &scancode); g_variant_lookup(item, "keycode", "s", &keycode); - new_button_add(GTK_GRID(grid), keycode, NULL, col, row, 1, 1); + new_button_add(GTK_GRID(grid), protocol, scancode, keycode, NULL, col, row, 1, 1); col++; if (col >= km_width) { |