summaryrefslogtreecommitdiff
path: root/rcm-client-receive.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-client-receive.c')
-rw-r--r--rcm-client-receive.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index f4b40d1..4adfb7c 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -54,7 +54,7 @@ struct state {
GList *header_buttons;
bool editing;
GtkWidget *stack;
- GtkWidget *stack_switch;
+ GtkWidget *title;
};
static struct state state;
@@ -391,6 +391,7 @@ create_header_button(const gchar *tooltip, const gchar *icon_name, gboolean end,
gtk_widget_set_tooltip_text(button, tooltip);
g_signal_connect(button, "clicked", callback, user_data);
+ gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
gtk_widget_show_all(button);
if (end)
@@ -644,14 +645,14 @@ show_hardware_list(GtkButton *button, gpointer user_data)
gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL);
gtk_stack_set_visible_child_name(global->stack, "hardware_page");
- if (state.stack_switch)
- gtk_widget_destroy(state.stack_switch);
+ if (state.title)
+ gtk_widget_destroy(state.title);
if (state.stack)
gtk_widget_destroy(state.stack);
- g_object_unref(state.stack_switch);
- state.stack_switch = NULL;
+ g_object_unref(state.title);
+ state.title = NULL;
state.stack = NULL;
}
@@ -906,16 +907,36 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw)
unsigned i;
GtkWidget *scrollda;
GtkWidget *label;
+ GtkWidget *stack_switch;
+ gchar *titlestr;
+ GDBusInterface *interface;
state.remotes = NULL;
state.header_buttons = NULL;
state.editing = false;
+ interface = g_dbus_object_get_interface(new_hw, "org.gnome.RemoteControlManager.Device");
+ if (!interface)
+ return;
+
+ /* FIXME: unref object */
+ state.object = RCDEVICE(interface);
+
state.stack = gtk_stack_new();
- state.stack_switch = gtk_stack_switcher_new();
- g_object_ref(state.stack_switch);
- gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(state.stack_switch), GTK_STACK(state.stack));
- gtk_widget_show_all(state.stack_switch);
+ state.title = gtk_grid_new();
+ gtk_grid_set_row_spacing(GTK_GRID(state.title), 6);
+ gtk_widget_set_margin_top(state.title, 6);
+ gtk_widget_set_margin_bottom(state.title, 6);
+ label = gtk_label_new(NULL);
+ titlestr = g_markup_printf_escaped("<b>Keymaps for %s</b>", rcdevice_get_sys_name(state.object));
+ gtk_label_set_markup(GTK_LABEL(label), titlestr);
+ g_free(titlestr);
+ stack_switch = gtk_stack_switcher_new();
+ gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(stack_switch), GTK_STACK(state.stack));
+ gtk_grid_attach(GTK_GRID(state.title), label, 1, 1, 1, 1);
+ gtk_grid_attach(GTK_GRID(state.title), stack_switch, 1, 2, 1, 1);
+ g_object_ref(state.title);
+ gtk_widget_show_all(state.title);
scrollda = gtk_scrolled_window_new(NULL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(scrollda), 12);
@@ -931,14 +952,7 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw)
gtk_grid_set_row_spacing(GTK_GRID(rgrid), 12);
gtk_container_add(GTK_CONTAINER(scrollda), rgrid);
- GDBusInterface *interface;
- interface = g_dbus_object_get_interface(new_hw, "org.gnome.RemoteControlManager.Device");
- if (!interface)
- return;
-
gchar **keymap_ids = NULL;
- /* FIXME: unref object */
- state.object = RCDEVICE(interface);
rcdevice_call_list_keymaps_sync(state.object, &keymap_ids, NULL, NULL);
for (i = 0; keymap_ids[i]; i++) {
struct remote *remote;
@@ -957,6 +971,6 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw)
gtk_stack_set_visible_child(global->stack, state.stack);
set_edit_keymap(state.editing);
- gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), state.stack_switch);
+ gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), state.title);
}