[Goodies-commits] r6231 - in xfce4-radio-plugin/trunk: . panel-plugin
Stefan Ott
cockroach at xfce.org
Sun Nov 30 06:12:28 CET 2008
Author: cockroach
Date: 2008-11-30 05:12:28 +0000 (Sun, 30 Nov 2008)
New Revision: 6231
Modified:
xfce4-radio-plugin/trunk/NEWS
xfce4-radio-plugin/trunk/panel-plugin/radio.c
xfce4-radio-plugin/trunk/panel-plugin/radio.h
Log:
Added option to disable state synchronization with the card (fixes #4389)
Modified: xfce4-radio-plugin/trunk/NEWS
===================================================================
--- xfce4-radio-plugin/trunk/NEWS 2008-11-30 04:27:29 UTC (rev 6230)
+++ xfce4-radio-plugin/trunk/NEWS 2008-11-30 05:12:28 UTC (rev 6231)
@@ -6,6 +6,8 @@
* The "thanks for all the patches"-release
* We now use a clearly-defined name for the config file (xfce4/panel/radio.rc)
* Fixes for non-ASCII (eg. UTF8) station preset names
+ * We now learn the maximum signal strength for the card
+ * Can now disable the synchronization with external apps
v0.3.1 (18 Jun 2008):
=====================
Modified: xfce4-radio-plugin/trunk/panel-plugin/radio.c
===================================================================
--- xfce4-radio-plugin/trunk/panel-plugin/radio.c 2008-11-30 04:27:29 UTC (rev 6230)
+++ xfce4-radio-plugin/trunk/panel-plugin/radio.c 2008-11-30 05:12:28 UTC (rev 6231)
@@ -121,13 +121,18 @@
static gboolean
update_radio (radio_gui *data)
{
+ // We could just remove the timer, but then we would have to make sure
+ // to re-add it at all the appropriate places, thus we don't.
+ if (!data->auto_update_display)
+ return TRUE;
+
struct video_audio vid_aud;
long freq;
if (!data->on) {
data->fd = open (data->device, O_RDONLY);
- // should I return FALSE here to stop timer?
+ // We return TRUE to keep the timer alive, same reason as above
if (data->fd == -1)
return TRUE;
}
@@ -328,6 +333,7 @@
}
gtk_widget_destroy (dialog);
update_tooltip (data);
+ write_config (data->plugin, data);
}
static void
@@ -736,6 +742,7 @@
plugin_data->freqfact = 16;
}
plugin_data->show_signal = TRUE;
+ plugin_data->auto_update_display = TRUE;
plugin_data->presets = NULL;
plugin_data->scroll = CHANGE_FREQ;
plugin_data->signal_timeout_id = 0;
@@ -786,6 +793,14 @@
}
static void
+radio_auto_update_display_changed (GtkEditable* editable, void *pointer)
+{
+ radio_gui* data = (radio_gui*) pointer;
+ data->auto_update_display = gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (editable));
+}
+
+static void
radio_scroll_type_changed (GtkEditable* button, void *pointer)
{
radio_gui* data = (radio_gui*) pointer;
@@ -816,6 +831,9 @@
GSList *show_signal_group = NULL; // signal strength:
GtkWidget *signal_show; // - show
GtkWidget *signal_hide; // - hide
+ 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
@@ -843,12 +861,14 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table,
FALSE, TRUE, 0);
+ // V4L device
label = gtk_label_new (_("V4L device"));
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL,
0, 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ // Show the signal strength
label = gtk_label_new (_("Display signal strength"));
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL,
@@ -879,9 +899,42 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (signal_hide),
!data->show_signal);
+ // Auto-update the display
+ label = gtk_label_new (_("Synchronize state with the card"));
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL,
+ 0, 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox);
+ gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 2, 3, GTK_FILL,
+ GTK_FILL, 0, 0);
+ auto_update_display_yes = gtk_radio_button_new_with_label (NULL,
+ _("yes"));
+ gtk_widget_show (auto_update_display_yes);
+ gtk_box_pack_start (GTK_BOX (hbox), auto_update_display_yes, FALSE,
+ FALSE, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (auto_update_display_yes),
+ auto_update_display_group);
+ auto_update_display_group = gtk_radio_button_get_group
+ (GTK_RADIO_BUTTON (auto_update_display_yes));
+
+ auto_update_display_no = gtk_radio_button_new_with_label
+ (auto_update_display_group, _("no"));
+ gtk_widget_show (auto_update_display_no);
+
+ gtk_box_pack_start (GTK_BOX (hbox), auto_update_display_no, FALSE,
+ FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (auto_update_display_yes), data->auto_update_display);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (auto_update_display_no), !data->auto_update_display);
+
+ // Post-startup command
label = gtk_label_new (_("Execute command after startup"));
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL,
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL,
0, 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
@@ -890,12 +943,13 @@
gtk_entry_set_text (GTK_ENTRY (startup_command_entry),
data->startup_command);
gtk_widget_show (startup_command_entry);
- gtk_table_attach (GTK_TABLE (table), startup_command_entry, 1, 2, 3, 4,
+ gtk_table_attach (GTK_TABLE (table), startup_command_entry, 1, 2, 4, 5,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ // Post-shutdown command
label = gtk_label_new (_("Execute command after shutdown"));
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL,
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, GTK_FILL,
0, 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
@@ -904,18 +958,19 @@
gtk_entry_set_text (GTK_ENTRY (shutdown_command_entry),
data->shutdown_command);
gtk_widget_show (shutdown_command_entry);
- gtk_table_attach (GTK_TABLE (table), shutdown_command_entry, 1, 2, 4, 5,
+ gtk_table_attach (GTK_TABLE (table), shutdown_command_entry, 1, 2, 5, 6,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ // Mouse-scrolling
label = gtk_label_new (_("Mouse scrolling changes"));
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL,
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL,
0, 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
- gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 2, 3, GTK_FILL,
+ gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 3, 4, GTK_FILL,
GTK_FILL, 0, 0);
frequency_button = gtk_radio_button_new_with_label (NULL,
@@ -953,7 +1008,9 @@
g_signal_connect ((gpointer) device_entry, "changed",
G_CALLBACK (radio_device_changed), data);
g_signal_connect (G_OBJECT (signal_show), "toggled",
- G_CALLBACK(radio_show_signal_changed), data);
+ G_CALLBACK (radio_show_signal_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_CALLBACK (radio_scroll_type_changed), data);
@@ -981,6 +1038,8 @@
xfce_rc_write_int_entry (rc, "frq", data->freq);
xfce_rc_write_int_entry (rc, "scroll", data->scroll);
xfce_rc_write_bool_entry(rc, "show_signal", data->show_signal);
+ xfce_rc_write_bool_entry(rc, "update_display",
+ data->auto_update_display);
xfce_rc_set_group (rc, "presets");
@@ -1012,6 +1071,8 @@
data->freq = xfce_rc_read_int_entry (rc, "frq", FREQ_INIT);
data->scroll = xfce_rc_read_int_entry (rc, "scroll", CHANGE_FREQ);
data->show_signal = xfce_rc_read_bool_entry (rc, "show_signal", TRUE);
+ data->auto_update_display = xfce_rc_read_bool_entry
+ (rc, "update_display", TRUE);
if ((value = xfce_rc_read_entry (rc, "dev", NULL)) && *value) {
strncpy (data->device, value, MAX_DEVICE_NAME_LENGTH);
Modified: xfce4-radio-plugin/trunk/panel-plugin/radio.h
===================================================================
--- xfce4-radio-plugin/trunk/panel-plugin/radio.h 2008-11-30 04:27:29 UTC (rev 6230)
+++ xfce4-radio-plugin/trunk/panel-plugin/radio.h 2008-11-30 05:12:28 UTC (rev 6231)
@@ -69,6 +69,7 @@
gboolean on;
gboolean show_signal;
+ gboolean auto_update_display;
int freq;
int fd;
int freqfact;
More information about the Goodies-commits
mailing list