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.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index 4adfb7c..828d07e 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -378,27 +378,13 @@ new_button_add(struct remote *remote, const gchar *protocol, guint64 scancode,
return rcb;
}
-/* FIXME: These two functions should probably move to the core */
static void
-create_header_button(const gchar *tooltip, const gchar *icon_name, gboolean end,
- GCallback callback, gpointer user_data)
+local_create_header_button(const gchar *tooltip, const gchar *icon_name, gboolean end,
+ GCallback callback, gpointer user_data)
{
GtkWidget *button;
- button = gtk_button_new_from_icon_name(icon_name, GTK_ICON_SIZE_BUTTON);
-
- if (tooltip)
- 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)
- gtk_header_bar_pack_end(GTK_HEADER_BAR(global->header), button);
- else
- gtk_header_bar_pack_start(GTK_HEADER_BAR(global->header), button);
-
+ button = create_header_button(NULL, tooltip, icon_name, end, callback, user_data);
state.header_buttons = g_list_prepend(state.header_buttons, button);
}
@@ -642,7 +628,7 @@ static void
show_hardware_list(GtkButton *button, gpointer user_data)
{
remove_header_buttons();
- gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL);
+ gtk_header_bar_set_custom_title(GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "main_headerbar")), NULL);
gtk_stack_set_visible_child_name(global->stack, "hardware_page");
if (state.title)
@@ -663,11 +649,11 @@ set_edit_keymap(bool editing)
remove_header_buttons();
- create_header_button("Return to hardware list", "go-previous-symbolic", false, G_CALLBACK(show_hardware_list), NULL);
+ local_create_header_button("Return to hardware list", "go-previous-symbolic", false, G_CALLBACK(show_hardware_list), NULL);
if (editing)
- create_header_button("Save changes", "document-save-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL);
+ local_create_header_button("Save changes", "document-save-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL);
else
- create_header_button("Edit keymaps", "document-properties-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL);
+ local_create_header_button("Edit keymaps", "document-properties-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL);
for (l = state.remotes; l; l = l->next) {
struct remote *remote = l->data;
@@ -971,6 +957,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.title);
+ gtk_header_bar_set_custom_title(GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "main_headerbar")), state.title);
}