summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rcm-client-receive.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index f9f1193..b744806 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -428,17 +428,24 @@ static gint own_page_num = -1;
/* FIXME: These two functions should probably move to the core */
static void
-create_header_button(const gchar *label, const gchar *icon_name,
+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);
- gtk_button_set_label(GTK_BUTTON(button), label);
- gtk_button_set_always_show_image(GTK_BUTTON(button), TRUE);
+
+ if (tooltip)
+ gtk_widget_set_tooltip_text(button, tooltip);
+
g_signal_connect(button, "clicked", callback, user_data);
gtk_widget_show_all(button);
- gtk_header_bar_pack_end(GTK_HEADER_BAR(global->header), 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);
+
state.header_buttons = g_list_prepend(state.header_buttons, button);
}
@@ -452,7 +459,6 @@ remove_header_buttons(void)
g_list_free(state.header_buttons);
state.header_buttons = NULL;
- gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL);
}
static void toggle_edit_keymap(GtkButton *button, gpointer user_data);
@@ -729,16 +735,23 @@ out:
}
static void
+show_hardware_list(GtkButton *button, gpointer user_data)
+{
+ gtk_notebook_set_current_page(global->notebook, 0);
+}
+
+static void
set_edit_keymap(bool editing)
{
GList *l;
remove_header_buttons();
+ create_header_button("Return to hardware list", "go-previous-symbolic", false, G_CALLBACK(show_hardware_list), NULL);
if (editing)
- create_header_button("Apply", "gtk-apply", G_CALLBACK(toggle_edit_keymap), NULL);
+ create_header_button("Save changes", "document-save-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL);
else
- create_header_button("Edit", "list-add", G_CALLBACK(toggle_edit_keymap), NULL);
+ 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;
@@ -786,6 +799,7 @@ on_notebook_page_change(GtkNotebook *notebook, GtkWidget *page, guint new_page_n
{
if (new_page_num != own_page_num) {
remove_header_buttons();
+ gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL);
state.editing = false;
state.active = false;
return;