Updating branch refs/heads/master
         to 46ad662913d5ff3b03aeeb1ddae83fb92cd60d48 (commit)
       from bb122f3c2233fb61533b1ad134827818acdf2e84 (commit)

commit 46ad662913d5ff3b03aeeb1ddae83fb92cd60d48
Author: Stefan Ott <[email protected]>
Date:   Fri May 20 03:36:35 2011 +0200

    Minor code reorganization
    
    Also, removed explicit option to configure whether to use a graphical 
indicator or a text label when the radio is off.
    
    Updated pot file accordingly.

 panel-plugin/xfce4-radio.c |   92 ++++++++++----------------------------------
 panel-plugin/xfce4-radio.h |    1 -
 po/xfce4-radio-plugin.pot  |   79 +++++++++++++++++--------------------
 3 files changed, 57 insertions(+), 115 deletions(-)

diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 3c9ac77..513d314 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -105,17 +105,22 @@ update_signal(radio_gui* data)
                gtk_widget_hide(data->signal_bar);
 
                if (data->on && !data->show_signal)
+               {
                        gtk_widget_hide(data->signal_image);
+               }
 
-               if (!data->on && data->show_label_when_off)
+               if (!data->on && !data->show_signal_graphical)
+               {
                        gtk_widget_hide(data->signal_image);
+               }
 
-               return FALSE;
+               return FALSE; // abort timer
        }
        else
        {
                double signal = radio_get_signal();
 
+               // schedule the next call to update_signal
                if (data->signal_timeout_id == 0)
                {
                        data->signal_timeout_id = g_timeout_add(500,
@@ -125,11 +130,13 @@ update_signal(radio_gui* data)
                if (data->show_signal_graphical)
                {
                        gtk_widget_hide(data->signal_bar);
+                       gtk_widget_show(data->signal_image);
                        update_signal_image(data, signal);
                }
                else
                {
                        gtk_widget_hide(data->signal_image);
+                       gtk_widget_show(data->signal_bar);
                        update_signal_bar(data, signal);
                }
                return TRUE;
@@ -195,7 +202,7 @@ update_tooltip(radio_gui* data)
 }
 
 static void
-update_label_radio_on(radio_gui *data)
+update_label_when_radio_on(radio_gui *data)
 {
        gchar *label;
 
@@ -224,9 +231,9 @@ update_label_radio_on(radio_gui *data)
 }
 
 static void
-update_label_radio_off(radio_gui *data)
+update_label_when_radio_off(radio_gui *data)
 {
-       if (data->show_label_when_off)
+       if (!data->show_signal_graphical)
        {
                gtk_widget_hide(data->signal_image);
                gtk_widget_show(data->label);
@@ -245,9 +252,9 @@ static void
 update_label(radio_gui *data)
 {
        if (data->on)
-               update_label_radio_on(data);
+               update_label_when_radio_on(data);
        else
-               update_label_radio_off(data);
+               update_label_when_radio_off(data);
 }
 
 static gboolean
@@ -339,9 +346,11 @@ xfce4_radio_stop(radio_gui* data)
                radio_stop();
        }
 
+       data->on = FALSE;
        gtk_tooltips_disable(data->tooltips);
 
-       if (data->show_signal) gtk_widget_hide(data->signal_bar);
+       gtk_widget_hide(data->signal_bar);
+       update_label(data);
 
        if (strcmp(data->shutdown_command, "") != 0)
        {
@@ -480,13 +489,10 @@ mouse_click(GtkWidget* src, GdkEventButton *event, 
radio_gui* data)
        DBG("Mouse button %d clicked", event->button);
        if (event->button == 1)
        {
-               if (!data->on)
-                       data->on = xfce4_radio_start(data);
-               else
-               {
-                       data->on = FALSE;
+               if (data->on)
                        xfce4_radio_stop(data);
-               }
+               else
+                       data->on = xfce4_radio_start(data);
        }
        else if (event->button == 2 && data->on)
        {
@@ -716,7 +722,6 @@ plugin_control_new(XfcePanelPlugin *plugin)
        plugin_data->show_signal = TRUE;
        plugin_data->show_signal_graphical = FALSE;
        plugin_data->show_label = TRUE;
-       plugin_data->show_label_when_off = TRUE;
        plugin_data->auto_update_display = FALSE;
        plugin_data->presets = NULL;
        plugin_data->presets = NULL;
@@ -728,8 +733,6 @@ plugin_control_new(XfcePanelPlugin *plugin)
        plugin_data->startup_command[0] = '\0';
        plugin_data->shutdown_command[0] = '\0';
 
-       update_label(plugin_data);
-
        gtk_container_add(GTK_CONTAINER(plugin), plugin_data->ebox);
 
        return plugin_data;
@@ -783,17 +786,6 @@ radio_show_label_changed(GtkEditable* editable, void 
*pointer)
        update_label(data);
 }
 
-#ifdef ENABLE_ANTENNA_ICON
-static void
-radio_show_label_when_off_changed(GtkEditable* editable, void *pointer)
-{
-       radio_gui* data = (radio_gui*) pointer;
-       data->show_label_when_off = gtk_toggle_button_get_active
-               (GTK_TOGGLE_BUTTON(editable));
-       update_label(data);
-}
-#endif
-
 static void
 radio_resolve_presets_changed(GtkEditable* editable, void *pointer)
 {
@@ -810,6 +802,7 @@ radio_signal_type_changed(GtkEditable* editable, void 
*pointer)
        radio_gui* data = (radio_gui*) pointer;
        data->show_signal_graphical = !gtk_toggle_button_get_active
                (GTK_TOGGLE_BUTTON(editable));
+
        update_signal(data);
 
        DBG("show_signal_graphical = %d", data->show_signal_graphical);
@@ -1259,43 +1252,6 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, 
radio_gui *data)
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(preset_button),
                data->scroll == CHANGE_PRESET);
 
-#ifdef ENABLE_ANTENNA_ICON
-       // When off
-       real_frame = gtk_frame_new(_("When radio is off"));
-       frame = gtk_alignment_new(0, 0, 0.5, 0.5);
-       GtkWidget *when_off = gtk_vbox_new(FALSE, 0);
-
-       gtk_widget_show(when_off);
-       gtk_widget_show(frame);
-       gtk_widget_show(real_frame);
-
-       gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
-
-       gtk_box_pack_start(GTK_BOX(properties), real_frame, FALSE, FALSE, 9);
-       gtk_container_add(GTK_CONTAINER(real_frame), frame);
-       gtk_container_add(GTK_CONTAINER(frame), when_off);
-
-       label_when_off = gtk_radio_button_new_with_label
-               (NULL, _("Show the label"));
-       gtk_radio_button_set_group(GTK_RADIO_BUTTON(label_when_off),
-                                                       show_when_off);
-       show_when_off = gtk_radio_button_get_group(GTK_RADIO_BUTTON
-                                                       (label_when_off));
-       graphics_when_off = gtk_radio_button_new_with_label
-               (show_when_off, _("Show graphics"));
-
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                       (label_when_off), data->show_label_when_off);
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                       (graphics_when_off), !data->show_label_when_off);
-
-       gtk_widget_show(label_when_off);
-       gtk_widget_show(graphics_when_off);
-
-       gtk_container_add(GTK_CONTAINER(when_off), label_when_off);
-       gtk_container_add(GTK_CONTAINER(when_off), graphics_when_off);
-#endif
-
        // When on
        real_frame = gtk_frame_new(_("When radio is running"));
        frame = gtk_alignment_new(0, 0, 0.5, 0.5);
@@ -1429,8 +1385,6 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, 
radio_gui *data)
        g_signal_connect(G_OBJECT(show_label), "toggled",
                        G_CALLBACK(radio_show_label_changed), data);
 #ifdef ENABLE_ANTENNA_ICON
-       g_signal_connect(G_OBJECT(label_when_off), "toggled",
-                       G_CALLBACK(radio_show_label_when_off_changed), data);
        g_signal_connect(G_OBJECT(signal_type_bar), "toggled",
                        G_CALLBACK(radio_signal_type_changed), data);
 #endif
@@ -1493,8 +1447,6 @@ write_config(radio_gui *data, gboolean save_presets)
        xfce_rc_write_bool_entry(rc, "update_display",
                                                data->auto_update_display);
        xfce_rc_write_bool_entry(rc, "show_label", data->show_label);
-       xfce_rc_write_bool_entry(rc, "show_label_when_off",
-                                               data->show_label_when_off);
        xfce_rc_write_bool_entry(rc, "resolve_presets_in_label",
                                                data->resolve_presets_in_label);
        xfce_rc_write_bool_entry(rc, "graphical_signal",
@@ -1629,8 +1581,6 @@ read_config(XfcePanelPlugin *plugin, radio_gui *data)
                                        (rc, "update_display", TRUE);
        data->show_label = xfce_rc_read_bool_entry
                                        (rc, "show_label", TRUE);
-       data->show_label_when_off = xfce_rc_read_bool_entry
-                                       (rc, "show_label_when_off", TRUE);
        data->resolve_presets_in_label = xfce_rc_read_bool_entry
                                        (rc, "resolve_presets_in_label", TRUE);
        data->show_signal_graphical = xfce_rc_read_bool_entry
diff --git a/panel-plugin/xfce4-radio.h b/panel-plugin/xfce4-radio.h
index 8303442..2f2ec31 100644
--- a/panel-plugin/xfce4-radio.h
+++ b/panel-plugin/xfce4-radio.h
@@ -77,7 +77,6 @@ typedef struct {
        gboolean                on;
        gboolean                show_label;
        gboolean                show_signal;
-       gboolean                show_label_when_off;
        gboolean                resolve_presets_in_label;
        gboolean                show_signal_graphical;
        gboolean                auto_update_display;
diff --git a/po/xfce4-radio-plugin.pot b/po/xfce4-radio-plugin.pot
index b549fce..600d44d 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-19 23:02+0200\n"
+"POT-Creation-Date: 2011-05-20 03:35+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <[email protected]>\n"
@@ -25,136 +25,129 @@ msgstr ""
 msgid "V4l radio plugin"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:189
+#: ../panel-plugin/xfce4-radio.c:190
+#, c-format
 msgid "Tuned to station %s"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:194
+#: ../panel-plugin/xfce4-radio.c:195
+#, c-format
 msgid "Tuned to %s MHz"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:239
+#: ../panel-plugin/xfce4-radio.c:240
 msgid "- off -"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:246
+#: ../panel-plugin/xfce4-radio.c:247
 msgid "Radio is off"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:319
+#: ../panel-plugin/xfce4-radio.c:320
 msgid "Error opening radio device"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:410
+#: ../panel-plugin/xfce4-radio.c:415
 msgid "Tune radio"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:416
+#: ../panel-plugin/xfce4-radio.c:421
 msgid "Frequency [MHz]:"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:440
+#: ../panel-plugin/xfce4-radio.c:445
 msgid "Illegal frequency."
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:498 ../panel-plugin/xfce4-radio.c:1137
+#: ../panel-plugin/xfce4-radio.c:500 ../panel-plugin/xfce4-radio.c:1133
 msgid "Presets"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:530
+#: ../panel-plugin/xfce4-radio.c:532
 msgid "Tune to frequency"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:873
+#: ../panel-plugin/xfce4-radio.c:869
 msgid "unnamed"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1041
+#: ../panel-plugin/xfce4-radio.c:1037
 msgid "Properties"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1136
+#: ../panel-plugin/xfce4-radio.c:1132
 msgid "Options"
 msgstr ""
 
 #. Device
-#: ../panel-plugin/xfce4-radio.c:1155
+#: ../panel-plugin/xfce4-radio.c:1151
 msgid "Device"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1171
+#: ../panel-plugin/xfce4-radio.c:1167
 msgid "V4L device"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1188
+#: ../panel-plugin/xfce4-radio.c:1184
 msgid "Synchronize state with the card"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1190
+#: ../panel-plugin/xfce4-radio.c:1186
 msgid "yes"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1208
+#: ../panel-plugin/xfce4-radio.c:1204
 msgid "no"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1225
+#: ../panel-plugin/xfce4-radio.c:1221
 msgid "Mouse scrolling changes"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1236
+#: ../panel-plugin/xfce4-radio.c:1232
 msgid "frequency"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1241
+#: ../panel-plugin/xfce4-radio.c:1237
 msgid "preset"
 msgstr ""
 
-#. When off
-#: ../panel-plugin/xfce4-radio.c:1261
-msgid "When radio is off"
-msgstr ""
-
-#: ../panel-plugin/xfce4-radio.c:1276 ../panel-plugin/xfce4-radio.c:1342
-msgid "Show the label"
-msgstr ""
-
-#: ../panel-plugin/xfce4-radio.c:1282
-msgid "Show graphics"
-msgstr ""
-
 #. When on
-#: ../panel-plugin/xfce4-radio.c:1297
+#: ../panel-plugin/xfce4-radio.c:1256
 msgid "When radio is running"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1316
+#: ../panel-plugin/xfce4-radio.c:1275
 msgid "Show signal strength"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1327
+#: ../panel-plugin/xfce4-radio.c:1286
 msgid "as a bar"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1331
+#: ../panel-plugin/xfce4-radio.c:1290
 msgid "graphically"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1348
+#: ../panel-plugin/xfce4-radio.c:1301
+msgid "Show the label"
+msgstr ""
+
+#: ../panel-plugin/xfce4-radio.c:1307
 msgid "Show preset names in label"
 msgstr ""
 
 #. Commands
-#: ../panel-plugin/xfce4-radio.c:1366
+#: ../panel-plugin/xfce4-radio.c:1325
 msgid "Commands"
 msgstr ""
 
 #. Post-startup command
-#: ../panel-plugin/xfce4-radio.c:1383
+#: ../panel-plugin/xfce4-radio.c:1342
 msgid "Run after startup"
 msgstr ""
 
 #. Post-shutdown command
-#: ../panel-plugin/xfce4-radio.c:1401
+#: ../panel-plugin/xfce4-radio.c:1360
 msgid "Run after shutdown"
 msgstr ""
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to