[Xfce4-commits] <xfce4-radio-plugin:master> Some more cleanup in the options dialog
Stefan Ott
noreply at xfce.org
Fri May 20 07:40:01 CEST 2011
Updating branch refs/heads/master
to e351cedd357daeea2d60f99c5622b9cd9786131c (commit)
from abd0435e70845797502da97dc74ab872f0d29b9a (commit)
commit e351cedd357daeea2d60f99c5622b9cd9786131c
Author: Stefan Ott <stefan at ott.net>
Date: Fri May 20 07:38:07 2011 +0200
Some more cleanup in the options dialog
panel-plugin/xfce4-radio.c | 175 +++++++++++++++++++++++++++-----------------
po/xfce4-radio-plugin.pot | 83 ++++++++++++---------
2 files changed, 158 insertions(+), 100 deletions(-)
diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 730fd4b..f0d3658 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -820,15 +820,11 @@ radio_auto_update_display_changed(GtkEditable* editable, void *pointer)
}
static void
-radio_scroll_type_changed(GtkEditable* button, void *pointer)
+radio_scroll_type_changed(GtkEditable* box, void *pointer)
{
radio_gui* data = (radio_gui*) pointer;
- gboolean frq = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-
- if (frq)
- data->scroll = CHANGE_FREQ;
- else
- data->scroll = CHANGE_PRESET;
+ gint selection = gtk_combo_box_get_active(GTK_COMBO_BOX(box));
+ data->scroll = selection == 0 ? CHANGE_FREQ : CHANGE_PRESET;
}
static void
@@ -1006,21 +1002,20 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
GtkWidget *show_signal; // show the signal when on
GtkWidget *show_label; // show the label when on
- GtkWidget *graphical_signal_strength;
+ GtkWidget *graphical_signal_strength; // show graphical signal level
GSList *auto_update_display_group = NULL;// auto update display:
GtkWidget *auto_update_display_yes; // - show
GtkWidget *auto_update_display_no; // - hide
GtkWidget *startup_command_entry; // post-down command
GtkWidget *shutdown_command_entry; // post-down command
- GtkWidget *device_entry; // v4l-device
- GSList *scroll_group = NULL; // scroll action:
- GtkWidget *frequency_button; // - change frequency
- GtkWidget *preset_button; // - change preset
+ GtkWidget *device_entry; // v4l device
+ GtkWidget *scrolling; // mouse-scrolling action
GtkWidget *preset_box;
GtkWidget *button_box;
GtkWidget *notebook;
- GtkWidget *label_properties;
+ GtkWidget *label_options;
GtkWidget *label_presets;
+ GtkWidget *label_ui_options;
GtkWidget *scrolled_window;
GtkWidget *list_view;
GtkTreeSelection *selection;
@@ -1124,25 +1119,32 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE);
- label_properties = gtk_label_new(_("Options"));
- label_presets = gtk_label_new(_("Presets"));
+
+ // Notebook tabs
+ label_presets = gtk_label_new(_("Presets"));
+ label_options = gtk_label_new(_("Options"));
+ label_ui_options = gtk_label_new(_("User interface"));
+
+ // Add the presets page
gtk_notebook_append_page
(GTK_NOTEBOOK(notebook), preset_box, label_presets);
gtk_box_pack_start
(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
gtk_widget_show(notebook);
+ // Add the options page
GtkWidget *align = gtk_alignment_new(0, 0, 0.5, 0.5);
gtk_widget_show(align);
gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 5, 5, 5);
+
gtk_notebook_append_page
- (GTK_NOTEBOOK(notebook), align, label_properties);
+ (GTK_NOTEBOOK(notebook), align, label_options);
GtkWidget *properties = gtk_vbox_new(FALSE, 0);
gtk_widget_show(properties);
gtk_container_add(GTK_CONTAINER(align), properties);
- // Device
+ // - Device
real_frame = gtk_frame_new(_("Device"));
frame = gtk_alignment_new(0, 0, 0.5, 0.5);
table = gtk_table_new(2, 2, FALSE);
@@ -1157,7 +1159,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_container_add(GTK_CONTAINER(real_frame), frame);
gtk_container_add(GTK_CONTAINER(frame), table);
- // V4L device
+ // -- V4L device
hbox = gtk_hbox_new(FALSE, 0);
label = gtk_label_new(_("V4L device"));
device_entry = gtk_entry_new_with_max_length(MAX_DEVICE_NAME_LENGTH);
@@ -1174,7 +1176,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_table_attach_defaults
(GTK_TABLE(table), device_entry, 1, 2, 0, 1);
- // Auto-update the display
+ // -- Auto-update the display
hbox = gtk_hbox_new(FALSE, 0);
label = gtk_label_new(_("Synchronize state with the card"));
auto_update_display_yes = gtk_radio_button_new_with_label
@@ -1211,44 +1213,20 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(auto_update_display_no), !data->auto_update_display);
- // Mouse-scrolling
- hbox = gtk_hbox_new(FALSE, 0);
- label = gtk_label_new(_("Mouse scrolling changes"));
-
- gtk_widget_show(hbox);
- gtk_widget_show(label);
-
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
- gtk_table_attach_defaults(GTK_TABLE(table), hbox, 1, 2, 2, 3);
-
- frequency_button = gtk_radio_button_new_with_label(NULL,
- _("frequency"));
- gtk_radio_button_set_group(GTK_RADIO_BUTTON(frequency_button),
- scroll_group);
- scroll_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON
- (frequency_button));
- preset_button = gtk_radio_button_new_with_label(NULL, _("preset"));
-
- gtk_box_pack_start(GTK_BOX(hbox), frequency_button, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), preset_button, FALSE, FALSE, 0);
-
- gtk_widget_show(frequency_button);
- gtk_widget_show(preset_button);
+ // Add the UI options page
+ align = gtk_alignment_new(0, 0, 0.5, 0.5);
+ gtk_widget_show(align);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 5, 5, 5);
- gtk_radio_button_set_group
- (GTK_RADIO_BUTTON(preset_button), scroll_group);
- scroll_group =
- gtk_radio_button_get_group(GTK_RADIO_BUTTON(preset_button));
+ gtk_notebook_append_page
+ (GTK_NOTEBOOK(notebook), align, label_ui_options);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frequency_button),
- data->scroll == CHANGE_FREQ);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(preset_button),
- data->scroll == CHANGE_PRESET);
+ GtkWidget *ui_page = gtk_vbox_new(FALSE, 0);
+ gtk_widget_show(ui_page);
+ gtk_container_add(GTK_CONTAINER(align), ui_page);
- // UI options
- real_frame = gtk_frame_new(_("User interface"));
+ // - Signal strength
+ real_frame = gtk_frame_new(_("Signal strength"));
frame = gtk_alignment_new(0, 0, 0.5, 0.5);
GtkWidget *ui_options = gtk_vbox_new(FALSE, 0);
@@ -1258,34 +1236,96 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
- gtk_box_pack_start(GTK_BOX(properties), real_frame, FALSE, FALSE, 9);
+ gtk_box_pack_start(GTK_BOX(ui_page), real_frame, FALSE, FALSE, 9);
gtk_container_add(GTK_CONTAINER(real_frame), frame);
gtk_container_add(GTK_CONTAINER(frame), ui_options);
- // Show the signal strength
+ // -- Show the signal strength
show_signal = gtk_check_button_new_with_label
- (_("Show signal strength"));
+ (_("Show the signal strength indicator"));
gtk_widget_show(show_signal);
gtk_container_add(GTK_CONTAINER(ui_options), show_signal);
- // Use graphics
+ // -- Use graphics
graphical_signal_strength = gtk_check_button_new_with_label
(_("Use graphics instead of text labels and progress bars"));
gtk_widget_show(graphical_signal_strength);
gtk_container_add(GTK_CONTAINER(ui_options), graphical_signal_strength);
- // Show the label
+ // - Current station
+ real_frame = gtk_frame_new(_("Current station"));
+ frame = gtk_alignment_new(0, 0, 0.5, 0.5);
+ ui_options = gtk_vbox_new(FALSE, 0);
+
+ gtk_widget_show(frame);
+ gtk_widget_show(ui_options);
+ gtk_widget_show(real_frame);
+
+ gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
+
+ gtk_box_pack_start(GTK_BOX(ui_page), real_frame, FALSE, FALSE, 9);
+ gtk_container_add(GTK_CONTAINER(real_frame), frame);
+ gtk_container_add(GTK_CONTAINER(frame), ui_options);
+
+ // -- Show the label
show_label = gtk_check_button_new_with_label
- (_("Show the label"));
+ (_("Show the current station"));
gtk_widget_show(show_label);
gtk_container_add(GTK_CONTAINER(ui_options), show_label);
- // Resolve presets
+ // -- Resolve presets
GtkWidget *resolve_presets = gtk_check_button_new_with_label
- (_("Show preset names in label"));
+ (_("Show preset names instead of frequencies"));
gtk_widget_show(resolve_presets);
gtk_container_add(GTK_CONTAINER(ui_options), resolve_presets);
+ // - Mouse
+ real_frame = gtk_frame_new(_("Mouse interaction"));
+ frame = gtk_alignment_new(0, 0, 0.5, 0.5);
+ ui_options = gtk_vbox_new(FALSE, 0);
+
+ gtk_widget_show(frame);
+ gtk_widget_show(ui_options);
+ gtk_widget_show(real_frame);
+
+ gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
+
+ gtk_box_pack_start(GTK_BOX(ui_page), real_frame, FALSE, FALSE, 9);
+ gtk_container_add(GTK_CONTAINER(real_frame), frame);
+ gtk_container_add(GTK_CONTAINER(frame), ui_options);
+
+ // -- Mouse-scrolling
+ hbox = gtk_hbox_new(FALSE, 0);
+ label = gtk_label_new(_("Mouse scrolling changes"));
+
+ gtk_widget_show(hbox);
+ gtk_widget_show(label);
+
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+
+ gtk_container_add(GTK_CONTAINER(ui_options), hbox);
+
+ GtkTreeIter iter;
+ GtkListStore *model = gtk_list_store_new(1, G_TYPE_STRING);
+ GtkCellRenderer *renderer;
+
+ scrolling = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(scrolling), renderer, TRUE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(scrolling), renderer,
+ "text", 0, NULL);
+
+ gtk_list_store_append(model, &iter);
+ gtk_list_store_set(model, &iter, 0, _("frequency"), -1);
+ gtk_list_store_append(model, &iter);
+ gtk_list_store_set(model, &iter, 0, _("station preset"), -1);
+
+ gtk_widget_show(scrolling);
+
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), scrolling, FALSE, FALSE, 5);
+
+ // set values
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(show_signal), data->show_signal);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
@@ -1294,8 +1334,10 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
(show_label), data->show_label);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(resolve_presets), data->resolve_presets_in_label);
+ gtk_combo_box_set_active(GTK_COMBO_BOX
+ (scrolling), data->scroll == CHANGE_FREQ ? 0 : 1);
- // Commands
+ // - Commands
real_frame = gtk_frame_new(_("Commands"));
frame = gtk_alignment_new(0, 0, 0.5, 0.5);
table = gtk_table_new(2, 2, FALSE);
@@ -1312,7 +1354,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_container_add(GTK_CONTAINER(real_frame), frame);
gtk_box_pack_start(GTK_BOX(properties), real_frame, FALSE, FALSE, 0);
- // Post-startup command
+ // -- Post-startup command
label = gtk_label_new(_("Run after startup"));
startup_command_entry = gtk_entry_new_with_max_length
(MAX_COMMAND_LENGTH);
@@ -1330,7 +1372,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_table_attach_defaults
(GTK_TABLE(table), startup_command_entry, 1, 2, 0, 1);
- // Post-shutdown command
+ // -- Post-shutdown command
label = gtk_label_new(_("Run after shutdown"));
shutdown_command_entry = gtk_entry_new_with_max_length
(MAX_COMMAND_LENGTH);
@@ -1348,6 +1390,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
gtk_table_attach_defaults
(GTK_TABLE(table), shutdown_command_entry, 1, 2, 1, 2);
+ // Connect signals
g_signal_connect((gpointer) startup_command_entry, "changed",
G_CALLBACK(radio_startup_command_changed), data);
g_signal_connect((gpointer) shutdown_command_entry, "changed",
@@ -1364,7 +1407,7 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
G_CALLBACK(radio_resolve_presets_changed), data);
g_signal_connect(G_OBJECT(auto_update_display_yes), "toggled",
G_CALLBACK(radio_auto_update_display_changed), data);
- g_signal_connect(G_OBJECT(frequency_button), "toggled",
+ g_signal_connect(G_OBJECT(scrolling), "changed",
G_CALLBACK(radio_scroll_type_changed), data);
gtk_widget_show(dialog);
diff --git a/po/xfce4-radio-plugin.pot b/po/xfce4-radio-plugin.pot
index cc639a8..68a3fa8 100644
--- a/po/xfce4-radio-plugin.pot
+++ b/po/xfce4-radio-plugin.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-20 05:32+0200\n"
+"POT-Creation-Date: 2011-05-20 07:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
@@ -59,7 +59,8 @@ msgstr ""
msgid "Illegal frequency."
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:500 ../panel-plugin/xfce4-radio.c:1125
+#. Notebook tabs
+#: ../panel-plugin/xfce4-radio.c:500 ../panel-plugin/xfce4-radio.c:1124
msgid "Presets"
msgstr ""
@@ -67,83 +68,97 @@ msgstr ""
msgid "Tune to frequency"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:866
+#: ../panel-plugin/xfce4-radio.c:867
msgid "unnamed"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1029
+#: ../panel-plugin/xfce4-radio.c:1027
msgid "Properties"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1124
+#: ../panel-plugin/xfce4-radio.c:1125
msgid "Options"
msgstr ""
-#. Device
-#: ../panel-plugin/xfce4-radio.c:1143
+#: ../panel-plugin/xfce4-radio.c:1126
+msgid "User interface"
+msgstr ""
+
+#. - Device
+#: ../panel-plugin/xfce4-radio.c:1148
msgid "Device"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1159
+#: ../panel-plugin/xfce4-radio.c:1164
msgid "V4L device"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1176
+#: ../panel-plugin/xfce4-radio.c:1181
msgid "Synchronize state with the card"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1178
+#: ../panel-plugin/xfce4-radio.c:1183
msgid "yes"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1196
+#: ../panel-plugin/xfce4-radio.c:1201
msgid "no"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1213
-msgid "Mouse scrolling changes"
+#. - Signal strength
+#: ../panel-plugin/xfce4-radio.c:1229
+msgid "Signal strength"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1224
-msgid "frequency"
+#: ../panel-plugin/xfce4-radio.c:1245
+msgid "Show the signal strength indicator"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1229
-msgid "preset"
+#: ../panel-plugin/xfce4-radio.c:1251
+msgid "Use graphics instead of text labels and progress bars"
msgstr ""
-#. UI options
-#: ../panel-plugin/xfce4-radio.c:1248
-msgid "User interface"
+#. - Current station
+#: ../panel-plugin/xfce4-radio.c:1256
+msgid "Current station"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1264
-msgid "Show signal strength"
+#: ../panel-plugin/xfce4-radio.c:1272
+msgid "Show the current station"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1271
-msgid "Use graphics instead of text labels and progress bars"
+#: ../panel-plugin/xfce4-radio.c:1278
+msgid "Show preset names instead of frequencies"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1278
-msgid "Show the label"
+#. - Mouse
+#: ../panel-plugin/xfce4-radio.c:1283
+msgid "Mouse interaction"
+msgstr ""
+
+#: ../panel-plugin/xfce4-radio.c:1299
+msgid "Mouse scrolling changes"
+msgstr ""
+
+#: ../panel-plugin/xfce4-radio.c:1319
+msgid "frequency"
msgstr ""
-#: ../panel-plugin/xfce4-radio.c:1284
-msgid "Show preset names in label"
+#: ../panel-plugin/xfce4-radio.c:1321
+msgid "station preset"
msgstr ""
-#. Commands
-#: ../panel-plugin/xfce4-radio.c:1300
+#. - Commands
+#: ../panel-plugin/xfce4-radio.c:1341
msgid "Commands"
msgstr ""
-#. Post-startup command
-#: ../panel-plugin/xfce4-radio.c:1317
+#. -- Post-startup command
+#: ../panel-plugin/xfce4-radio.c:1358
msgid "Run after startup"
msgstr ""
-#. Post-shutdown command
-#: ../panel-plugin/xfce4-radio.c:1335
+#. -- Post-shutdown command
+#: ../panel-plugin/xfce4-radio.c:1376
msgid "Run after shutdown"
msgstr ""
More information about the Xfce4-commits
mailing list