annotate src/lirc/interface.c @ 3063:6a6a731fdaf8

crossfade-ng: More sane defaults.
author William Pitcock <nenolod@atheme.org>
date Fri, 24 Apr 2009 06:24:24 -0500
parents 3134a0987162
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2279
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 #include <config.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 #include <sys/types.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 #include <sys/stat.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 #include <unistd.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 #include <string.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 #include <stdio.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 #include <gdk/gdkkeysyms.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 #include <gtk/gtk.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2279
diff changeset
12 #include <audlegacy/i18n.h>
2279
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 #include "common.h"
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 GtkWidget*
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 create_lirc_cfg (void)
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 {
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 GtkWidget *dialog_vbox1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 GtkWidget *notebook1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 GtkWidget *vbox2;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 GtkWidget *frame1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 GtkWidget *alignment1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 GtkWidget *vbox3;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 GtkWidget *hbox1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 GtkWidget *label3;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 GtkWidget *reconnectcheck;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 GtkWidget *reconnectspin;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 GtkObject *reconnectspin_adj;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 GtkWidget *label2;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 GtkWidget *label1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 GtkWidget *dialog_action_area1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 GtkWidget *cancelbutton1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 GtkWidget *okbutton1;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 lirc_cfg = gtk_dialog_new ();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 gtk_window_set_title (GTK_WINDOW (lirc_cfg), _("LIRC plugin settings"));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 gtk_window_set_position (GTK_WINDOW (lirc_cfg), GTK_WIN_POS_CENTER_ON_PARENT);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 gtk_window_set_resizable (GTK_WINDOW (lirc_cfg), FALSE);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 gtk_window_set_type_hint (GTK_WINDOW (lirc_cfg), GDK_WINDOW_TYPE_HINT_DIALOG);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 g_signal_connect(G_OBJECT(lirc_cfg),"destroy", G_CALLBACK(gtk_widget_destroyed), &lirc_cfg);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 dialog_vbox1 = GTK_DIALOG (lirc_cfg)->vbox;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 notebook1 = gtk_notebook_new ();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook1, TRUE, TRUE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 vbox2 = gtk_vbox_new (FALSE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 frame1 = gtk_frame_new (NULL);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52 gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 gtk_container_add (GTK_CONTAINER (frame1), alignment1);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 vbox3 = gtk_vbox_new (FALSE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 gtk_container_add (GTK_CONTAINER (alignment1), vbox3);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 reconnectcheck = gtk_check_button_new_with_mnemonic (_("Reconnect to LIRC server"));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 gtk_box_pack_start (GTK_BOX (vbox3), reconnectcheck, FALSE, FALSE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reconnectcheck), (gboolean)b_enable_reconnect);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65 hbox1 = gtk_hbox_new (FALSE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 gtk_box_pack_start (GTK_BOX (vbox3), hbox1, TRUE, TRUE, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 label3 = gtk_label_new (_("Timeout before reconnecting (seconds): "));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69 gtk_box_pack_start (GTK_BOX (hbox1), label3, FALSE, FALSE, 17);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 reconnectspin_adj = gtk_adjustment_new (reconnect_timeout, 1, 100, 1, 10, 10);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 reconnectspin = gtk_spin_button_new (GTK_ADJUSTMENT (reconnectspin_adj), 1, 0);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 gtk_box_pack_start (GTK_BOX (hbox1), reconnectspin, TRUE, TRUE, 15);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 label2 = gtk_label_new (_("Reconnect"));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77 gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 label1 = gtk_label_new (_("Connection"));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 dialog_action_area1 = GTK_DIALOG (lirc_cfg)->action_area;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 gtk_dialog_add_action_widget (GTK_DIALOG (lirc_cfg), cancelbutton1, GTK_RESPONSE_CANCEL);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 okbutton1 = gtk_button_new_from_stock ("gtk-ok");
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90 gtk_dialog_add_action_widget (GTK_DIALOG (lirc_cfg), okbutton1, GTK_RESPONSE_OK);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 g_signal_connect (G_OBJECT (reconnectcheck), "toggled",
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 G_CALLBACK (on_reconnectcheck_toggled),
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 G_OBJECT (reconnectspin));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96 g_signal_connect (G_OBJECT (cancelbutton1), "clicked",
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 G_CALLBACK (on_cancelbutton1_clicked),
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 NULL);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99 g_signal_connect (G_OBJECT (okbutton1), "clicked",
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 G_CALLBACK (on_okbutton1_clicked),
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101 NULL);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102 gtk_widget_set_sensitive(reconnectspin, (gboolean)b_enable_reconnect);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104 g_object_set_data(G_OBJECT(lirc_cfg), "reconnectcheck", G_OBJECT(reconnectcheck));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 g_object_set_data(G_OBJECT(lirc_cfg), "reconnectspin", G_OBJECT(reconnectspin));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107 return lirc_cfg;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108 }
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109