[Xfce4-commits] <xfce4-radio-plugin:master> Made the options UI look more Xfce-ish

Stefan Ott noreply at xfce.org
Sat May 21 03:14:01 CEST 2011


Updating branch refs/heads/master
         to b30ef213972f9f3b44b512ba77da47f77d55550a (commit)
       from 1f7dcd3c2f0b738d6b170300709d23b78fe8124e (commit)

commit b30ef213972f9f3b44b512ba77da47f77d55550a
Author: Stefan Ott <stefan at ott.net>
Date:   Sat May 21 03:12:05 2011 +0200

    Made the options UI look more Xfce-ish

 panel-plugin/xfce4-radio.c |   42 ++++++++++++++++++++++++-
 po/xfce4-radio-plugin.pot  |   72 ++++++++++++++++++++++++-------------------
 2 files changed, 80 insertions(+), 34 deletions(-)

diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 0788545..80fdb57 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -52,6 +52,7 @@
 #include <libxfcegui4/dialogs.h>
 #include <libxfcegui4/xfce-exec.h>
 #include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
 #include <gdk/gdkkeysyms.h>
 
 #define SIGNAL_WIDTH 25
@@ -991,6 +992,32 @@ freq_cell_edited_cb(GtkCellRendererText *cellrenderertext, gchar *path_str,
 }
 
 static void
+choose_command(GtkWidget *dialog)
+{
+	GtkWidget *dlg;
+	gchar *command;
+	const gchar *prev;
+
+	dlg = gtk_file_chooser_dialog_new(_("Select command"),
+				GTK_WINDOW(gtk_widget_get_toplevel(dialog)),
+				GTK_FILE_CHOOSER_ACTION_OPEN,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
+
+	prev = gtk_entry_get_text(GTK_ENTRY(dialog));
+	if (!strcmp(prev, "")) prev = "~"; // open home directory if not set
+	gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dlg), prev);
+
+	if (G_LIKELY(gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_OK))
+	{
+		command = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dlg));
+		gtk_entry_set_text(GTK_ENTRY(dialog), command);
+		g_free(command);
+	}
+	gtk_widget_destroy(dlg);
+}
+
+static void
 radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 {
 	GtkWidget *table;
@@ -1028,13 +1055,17 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 
 	xfce_panel_plugin_block_menu(plugin);
 
-	dialog = gtk_dialog_new_with_buttons(_("Properties"),
+	dialog = xfce_titled_dialog_new_with_buttons(_("Radio"),
 		GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(plugin))),
 		GTK_DIALOG_DESTROY_WITH_PARENT |
 		GTK_DIALOG_NO_SEPARATOR,
 		GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-		NULL);
+		NULL
+	);
 
+	xfce_titled_dialog_set_subtitle(XFCE_TITLED_DIALOG(dialog),
+					_("Configure the radio plugin"));
+	gtk_window_set_icon_name(GTK_WINDOW(dialog), "xfce-radio");
 	gtk_container_set_border_width(GTK_CONTAINER(dialog), 2);
 
 	g_signal_connect(dialog, "response",
@@ -1123,6 +1154,7 @@ 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);
+	gtk_container_set_border_width (GTK_CONTAINER (notebook), BORDER-3);
 
 	// Notebook tabs
 	label_presets = gtk_label_new(_("Presets"));
@@ -1341,6 +1373,9 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0);
 	gtk_widget_show(button);
 
+	g_signal_connect_swapped(button, "clicked",
+				G_CALLBACK(choose_command), startup_command);
+
 	// -- Post-shutdown command
 
 	align = gtk_alignment_new(0, 0, 0, 0);
@@ -1372,6 +1407,9 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0);
 	gtk_widget_show(button);
 
+	g_signal_connect_swapped(button, "clicked",
+				G_CALLBACK(choose_command), shutdown_command);
+
 	// set values
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
 		(show_signal), data->show_signal);
diff --git a/po/xfce4-radio-plugin.pot b/po/xfce4-radio-plugin.pot
index b7d88be..5b1d966 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 19:25+0200\n"
+"POT-Creation-Date: 2011-05-21 03:11+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"
@@ -25,131 +25,139 @@ msgstr ""
 msgid "V4l radio plugin"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:190
+#: ../panel-plugin/xfce4-radio.c:191
 #, c-format
 msgid "Tuned to station %s"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:195
+#: ../panel-plugin/xfce4-radio.c:196
 #, c-format
 msgid "Tuned to %s MHz"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:240
+#: ../panel-plugin/xfce4-radio.c:241
 msgid "- off -"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:247
+#: ../panel-plugin/xfce4-radio.c:248
 msgid "Radio is off"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:320
+#: ../panel-plugin/xfce4-radio.c:321
 msgid "Error opening radio device"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:415
+#: ../panel-plugin/xfce4-radio.c:416
 msgid "Tune radio"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:421
+#: ../panel-plugin/xfce4-radio.c:422
 msgid "Frequency [MHz]:"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:445
+#: ../panel-plugin/xfce4-radio.c:446
 msgid "Illegal frequency."
 msgstr ""
 
 #. Notebook tabs
-#: ../panel-plugin/xfce4-radio.c:500 ../panel-plugin/xfce4-radio.c:1128
+#: ../panel-plugin/xfce4-radio.c:501 ../panel-plugin/xfce4-radio.c:1160
 msgid "Presets"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:532
+#: ../panel-plugin/xfce4-radio.c:533
 msgid "Tune to frequency"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:867
+#: ../panel-plugin/xfce4-radio.c:868
 msgid "unnamed"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1031
-msgid "Properties"
+#: ../panel-plugin/xfce4-radio.c:1001
+msgid "Select command"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1129
+#: ../panel-plugin/xfce4-radio.c:1058
+msgid "Radio"
+msgstr ""
+
+#: ../panel-plugin/xfce4-radio.c:1067
+msgid "Configure the radio plugin"
+msgstr ""
+
+#: ../panel-plugin/xfce4-radio.c:1161
 msgid "User interface"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1130
+#: ../panel-plugin/xfce4-radio.c:1162
 msgid "Radio device"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1131
+#: ../panel-plugin/xfce4-radio.c:1163
 msgid "Commands"
 msgstr ""
 
 #. - Signal strength
-#: ../panel-plugin/xfce4-radio.c:1153
+#: ../panel-plugin/xfce4-radio.c:1185
 msgid "Signal strength"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1169
+#: ../panel-plugin/xfce4-radio.c:1201
 msgid "Show the signal strength indicator"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1175
+#: ../panel-plugin/xfce4-radio.c:1207
 msgid "Use graphics instead of text labels and progress bars"
 msgstr ""
 
 #. - Current station
-#: ../panel-plugin/xfce4-radio.c:1180
+#: ../panel-plugin/xfce4-radio.c:1212
 msgid "Current station"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1196
+#: ../panel-plugin/xfce4-radio.c:1228
 msgid "Show the current station"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1202
+#: ../panel-plugin/xfce4-radio.c:1234
 msgid "Show preset names instead of frequencies"
 msgstr ""
 
 #. - Mouse
-#: ../panel-plugin/xfce4-radio.c:1207
+#: ../panel-plugin/xfce4-radio.c:1239
 msgid "Mouse interaction"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1223
+#: ../panel-plugin/xfce4-radio.c:1255
 msgid "Mouse scrolling changes"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1243
+#: ../panel-plugin/xfce4-radio.c:1275
 msgid "frequency"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1245
+#: ../panel-plugin/xfce4-radio.c:1277
 msgid "station preset"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1266
+#: ../panel-plugin/xfce4-radio.c:1298
 msgid "Radio device:"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1280
+#: ../panel-plugin/xfce4-radio.c:1312
 msgid "Synchronize state with the card"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1290
+#: ../panel-plugin/xfce4-radio.c:1322
 msgid ""
 "This watches your radio card for changes done by other\n"
 "applications. Note that this may cause issues with some\n"
 "tuner cards."
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1319
+#: ../panel-plugin/xfce4-radio.c:1351
 msgid "Command to run after startup"
 msgstr ""
 
-#: ../panel-plugin/xfce4-radio.c:1350
+#: ../panel-plugin/xfce4-radio.c:1385
 msgid "Command to run after shutdown"
 msgstr ""



More information about the Xfce4-commits mailing list