[Xfce4-commits] <xfce4-radio-plugin:master> Some more code cleanup

Stefan Ott noreply at xfce.org
Sun May 22 04:50:01 CEST 2011


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

commit b32b292bca22496c90c241f50b557f2e82ffc680
Author: Stefan Ott <stefan at ott.net>
Date:   Sat May 21 04:11:47 2011 +0200

    Some more code cleanup

 panel-plugin/xfce4-radio.c |  111 +++++++++++++++++---------------------------
 1 files changed, 42 insertions(+), 69 deletions(-)

diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 80fdb57..c41e5dd 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -41,17 +41,12 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#include <sys/time.h>
-
 #include "xfce4-radio.h"
 #include "../icons/signal.xpm"
 
 #include "radio.h"
 #include "v4l2.h"
 
-#include <libxfcegui4/dialogs.h>
-#include <libxfcegui4/xfce-exec.h>
-#include <libxfce4util/libxfce4util.h>
 #include <libxfcegui4/libxfcegui4.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -1020,7 +1015,6 @@ choose_command(GtkWidget *dialog)
 static void
 radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 {
-	GtkWidget *table;
 	GtkWidget *label;
 	GtkWidget *hbox;
 	GtkWidget *dialog;
@@ -1038,10 +1032,6 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	GtkWidget *preset_box;
 	GtkWidget *button_box;
 	GtkWidget *notebook;
-	GtkWidget *label_presets;
-	GtkWidget *label_ui_options;
-	GtkWidget *label_radio_options;
-	GtkWidget *label_commands;
 	GtkWidget *scrolled_window;
 	GtkWidget *list_view;
 	GtkWidget *current_page;
@@ -1147,24 +1137,15 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	gtk_container_set_border_width(GTK_CONTAINER(preset_box), 4);
 	gtk_widget_show_all(preset_box);
 
-	table = gtk_table_new(4, 2, FALSE);
-	gtk_container_set_border_width(GTK_CONTAINER(table), 4);
-	gtk_widget_show(table);
-
+	// The tabbed "notebook"
 	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"));
-	label_ui_options = gtk_label_new(_("User interface"));
-	label_radio_options = gtk_label_new(_("Radio device"));
-	label_commands = gtk_label_new(_("Commands"));
-
 	// Add the presets page
-	gtk_notebook_append_page
-		(GTK_NOTEBOOK(notebook), preset_box, label_presets);
+	label = gtk_label_new(_("Presets"));
+	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), preset_box, label);
 	gtk_box_pack_start
 		(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
 	gtk_widget_show(notebook);
@@ -1174,8 +1155,8 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	gtk_widget_show(align);
 	gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 5, 5, 5);
 
-	gtk_notebook_append_page
-		(GTK_NOTEBOOK(notebook), align, label_ui_options);
+	label = gtk_label_new(_("User interface"));
+	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), align, label);
 
 	current_page = gtk_vbox_new(FALSE, 0);
 	gtk_widget_show(current_page);
@@ -1183,83 +1164,79 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 
 	// - 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);
-
-	gtk_widget_show(frame);
-	gtk_widget_show(ui_options);
+	gtk_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
 	gtk_widget_show(real_frame);
 
-	gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
+	align = gtk_alignment_new(0, 0, 1, 1);
+	gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 2, 2, 2);
+	gtk_container_add(GTK_CONTAINER(real_frame), align);
+	gtk_widget_show(align);
 
-	gtk_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
-	gtk_container_add(GTK_CONTAINER(real_frame), frame);
-	gtk_container_add(GTK_CONTAINER(frame), ui_options);
+	frame = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(align), frame);
+	gtk_widget_show(frame);
 
 	// -- Show the signal strength
 	show_signal = gtk_check_button_new_with_label
 		(_("Show the signal strength indicator"));
 	gtk_widget_show(show_signal);
-	gtk_container_add(GTK_CONTAINER(ui_options), show_signal);
+	gtk_container_add(GTK_CONTAINER(frame), show_signal);
 
 	// -- 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);
+	gtk_container_add(GTK_CONTAINER(frame), graphical_signal_strength);
 
 	// - 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_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
 	gtk_widget_show(real_frame);
 
-	gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
+	align = gtk_alignment_new(0, 0, 1, 1);
+	gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 2, 2, 2);
+	gtk_container_add(GTK_CONTAINER(real_frame), align);
+	gtk_widget_show(align);
 
-	gtk_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
-	gtk_container_add(GTK_CONTAINER(real_frame), frame);
-	gtk_container_add(GTK_CONTAINER(frame), ui_options);
+	frame = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(align), frame);
+	gtk_widget_show(frame);
 
 	// -- Show the label
 	show_label = gtk_check_button_new_with_label
 		(_("Show the current station"));
 	gtk_widget_show(show_label);
-	gtk_container_add(GTK_CONTAINER(ui_options), show_label);
+	gtk_container_add(GTK_CONTAINER(frame), show_label);
 
 	// -- Resolve presets
 	GtkWidget *resolve_presets = gtk_check_button_new_with_label
 		(_("Show preset names instead of frequencies"));
 	gtk_widget_show(resolve_presets);
-	gtk_container_add(GTK_CONTAINER(ui_options), resolve_presets);
+	gtk_container_add(GTK_CONTAINER(frame), 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_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
 	gtk_widget_show(real_frame);
 
-	gtk_alignment_set_padding(GTK_ALIGNMENT(frame), 0, 2, 2, 2);
+	align = gtk_alignment_new(0, 0, 1, 1);
+	gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 2, 2, 2);
+	gtk_container_add(GTK_CONTAINER(real_frame), align);
+	gtk_widget_show(align);
 
-	gtk_box_pack_start(GTK_BOX(current_page), real_frame, FALSE, FALSE, 9);
-	gtk_container_add(GTK_CONTAINER(real_frame), frame);
-	gtk_container_add(GTK_CONTAINER(frame), ui_options);
+	frame = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(align), frame);
+	gtk_widget_show(frame);
 
 	// -- Mouse-scrolling
 	hbox = gtk_hbox_new(FALSE, 0);
-	label = gtk_label_new(_("Mouse scrolling changes"));
-
+	gtk_container_add(GTK_CONTAINER(frame), hbox);
 	gtk_widget_show(hbox);
-	gtk_widget_show(label);
 
+	label = gtk_label_new(_("Mouse scrolling changes"));
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-
-	gtk_container_add(GTK_CONTAINER(ui_options), hbox);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+	gtk_widget_show(label);
 
 	GtkTreeIter iter;
 	GtkListStore *model = gtk_list_store_new(1, G_TYPE_STRING);
@@ -1276,18 +1253,16 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	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);
+	gtk_widget_show(scrolling);
 
 	// Add the device 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_notebook_append_page
-		(GTK_NOTEBOOK(notebook), align, label_radio_options);
+	label = gtk_label_new(_("Radio device"));
+	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), align, label);
 
 	current_page = gtk_vbox_new(FALSE, 0);
 	gtk_widget_show(current_page);
@@ -1335,15 +1310,14 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 	gtk_widget_show(align);
 	gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 5, 5, 5);
 
-	gtk_notebook_append_page
-		(GTK_NOTEBOOK(notebook), align, label_commands);
+	label = gtk_label_new(_("Commands"));
+	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), align, label);
 
 	current_page = gtk_vbox_new(FALSE, 0);
 	gtk_widget_show(current_page);
 	gtk_container_add(GTK_CONTAINER(align), current_page);
 
 	// -- Post-startup command
-
 	align = gtk_alignment_new(0, 0, 0, 0);
 	gtk_box_pack_start(GTK_BOX(current_page), align, FALSE, FALSE, 9);
 	gtk_widget_show(align);
@@ -1377,7 +1351,6 @@ radio_plugin_create_options(XfcePanelPlugin *plugin, radio_gui *data)
 				G_CALLBACK(choose_command), startup_command);
 
 	// -- Post-shutdown command
-
 	align = gtk_alignment_new(0, 0, 0, 0);
 	gtk_box_pack_start(GTK_BOX(current_page), align, FALSE, FALSE, 9);
 	gtk_widget_show(align);



More information about the Xfce4-commits mailing list