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.c87
1 files changed, 19 insertions, 68 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index a1a3536..bf23e88 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -576,94 +576,45 @@ static void
properties_dialog(GtkButton *button, gpointer user_data)
{
struct remote *remote = user_data;
- GtkWindow *parent = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button)));
GtkWidget *dialog;
- GtkWidget *content_area;
- GtkWidget *grid;
- GtkWidget *icon;
- GtkWidget *id_label;
GtkWidget *id;
- GtkWidget *name_label;
GtkWidget *name_input;
- GtkWidget *desc_label;
GtkWidget *desc_input;
- GtkWidget *width_label;
- GtkAdjustment *width_adj;
GtkWidget *width_input;
- GtkWidget *height_label;
- GtkAdjustment *height_adj;
GtkWidget *height_input;
- gint r;
+ GtkAdjustment *width_adj;
+ GtkAdjustment *height_adj;
const gchar *name;
gchar *name_cpy;
const gchar *desc;
gchar *desc_cpy;
gint width;
gint height;
+ gint r;
- dialog = gtk_dialog_new_with_buttons("Keymap Properties", parent,
- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
- "OK", GTK_RESPONSE_ACCEPT,
- "Cancel", GTK_RESPONSE_REJECT,
- NULL);
-
- grid = gtk_grid_new();
- gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
- gtk_grid_set_row_spacing(GTK_GRID(grid), 12);
- gtk_container_set_border_width(GTK_CONTAINER(grid), 12);
+ dialog = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties"));
- icon = gtk_image_new_from_icon_name("document-page-setup", GTK_ICON_SIZE_DIALOG);
- gtk_widget_set_valign(icon, GTK_ALIGN_START);
- gtk_grid_attach(GTK_GRID(grid), icon, 0, 1, 1, 2);
+ id = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties_id_value"));
+ gtk_label_set_text(GTK_LABEL(id), remote->id);
- id_label = gtk_label_new("ID:");
- gtk_widget_set_halign(id_label, GTK_ALIGN_START);
- id = gtk_label_new(remote->id);
- gtk_widget_set_halign(id, GTK_ALIGN_START);
- gtk_grid_attach(GTK_GRID(grid), id_label, 1, 1, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), id, 2, 1, 1, 1);
-
- name_label = gtk_label_new("Name:");
- gtk_widget_set_halign(name_label, GTK_ALIGN_START);
- name_input = gtk_entry_new();
- gtk_widget_set_hexpand(name_input, true);
- gtk_entry_set_max_length(GTK_ENTRY(name_input), 100);
+ name_input = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties_name_value"));
gtk_entry_set_text(GTK_ENTRY(name_input), remote->name);
- gtk_grid_attach(GTK_GRID(grid), name_label, 1, 2, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), name_input, 2, 2, 1, 1);
-
- desc_label = gtk_label_new("Description:");
- gtk_widget_set_halign(desc_label, GTK_ALIGN_START);
- desc_input = gtk_entry_new();
- gtk_widget_set_hexpand(desc_input, true);
- gtk_entry_set_max_length(GTK_ENTRY(desc_input), 100);
+
+ desc_input = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties_description_value"));
gtk_entry_set_text(GTK_ENTRY(desc_input), remote->description);
- gtk_grid_attach(GTK_GRID(grid), desc_label, 1, 3, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), desc_input, 2, 3, 1, 1);
-
- width_label = gtk_label_new("Width");
- gtk_widget_set_halign(width_label, GTK_ALIGN_START);
- width_adj = gtk_adjustment_new(remote->width, 1.0, 100.0, 1.0, 5.0, 0.0);
- width_input = gtk_spin_button_new(width_adj, 1.0, 0);
- gtk_widget_set_hexpand(width_input, true);
- gtk_grid_attach(GTK_GRID(grid), width_label, 1, 4, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), width_input, 2, 4, 1, 1);
-
- height_label = gtk_label_new("Height:");
- gtk_widget_set_halign(height_label, GTK_ALIGN_START);
- height_adj = gtk_adjustment_new(remote->height, 1.0, 100.0, 1.0, 5.0, 0.0);
- height_input = gtk_spin_button_new(height_adj, 1.0, 0);
- gtk_widget_set_hexpand(height_input, true);
- gtk_grid_attach(GTK_GRID(grid), height_label, 1, 5, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), height_input, 2, 5, 1, 1);
- content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
- gtk_container_set_border_width(GTK_CONTAINER(content_area), 12);
- gtk_container_add(GTK_CONTAINER(content_area), grid);
+ width_input = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties_width_value"));
+ width_adj = GTK_ADJUSTMENT(gtk_builder_get_object(global->builder, "keymap_properties_width_adjustment"));
+ gtk_adjustment_set_value(width_adj, remote->width);
+
+ height_input = GTK_WIDGET(gtk_builder_get_object(global->builder, "keymap_properties_height_value"));
+ height_adj = GTK_ADJUSTMENT(gtk_builder_get_object(global->builder, "keymap_properties_height_adjustment"));
+ gtk_adjustment_set_value(height_adj, remote->height);
+
gtk_widget_show_all(dialog);
r = gtk_dialog_run(GTK_DIALOG(dialog));
- if (r != GTK_RESPONSE_ACCEPT)
+ if (r != 1)
goto out;
name = gtk_entry_get_text(GTK_ENTRY(name_input));
@@ -715,7 +666,7 @@ properties_dialog(GtkButton *button, gpointer user_data)
"RemoteControlClientRemoteLabel");
out:
- gtk_widget_destroy(dialog);
+ gtk_widget_hide(dialog);
}
static void