[Xfce4-commits] <xfce4-radio-plugin:master> Re-arranged the UI elements in the panel

Stefan Ott noreply at xfce.org
Fri May 20 05:46:03 CEST 2011


Updating branch refs/heads/master
         to bb122f3c2233fb61533b1ad134827818acdf2e84 (commit)
       from 04c10d1e10f7a43f8a7eeed97b7887e43643ce12 (commit)

commit bb122f3c2233fb61533b1ad134827818acdf2e84
Author: Stefan Ott <stefan at ott.net>
Date:   Fri May 20 01:22:57 2011 +0200

    Re-arranged the UI elements in the panel

 icons/signal.xpm           |   16 +------------
 panel-plugin/xfce4-radio.c |   51 ++++++++++++++++++++++++-------------------
 panel-plugin/xfce4-radio.h |    1 -
 3 files changed, 30 insertions(+), 38 deletions(-)

diff --git a/icons/signal.xpm b/icons/signal.xpm
index 3c3abe3..79a52e1 100644
--- a/icons/signal.xpm
+++ b/icons/signal.xpm
@@ -1,17 +1,11 @@
 /* XPM */
 static char * signal_xpm[] = {
-"100 24 5 1",
+"100 12 5 1",
 " 	c None",
 ".	c #D4D4D4",
 "+	c #00C264",
 "@	c #FFB300",
 "#	c #F40000",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
 "     ...............          ...............          ...............          +++++++++++++++     ",
 "     ...............          ...............          ...............          +++++++++++++++     ",
 "                                                                                                    ",
@@ -23,10 +17,4 @@ static char * signal_xpm[] = {
 "                                                                                                    ",
 "                                                                                                    ",
 "     ...............          ###############          @@@@@@@@@@@@@@@          +++++++++++++++     ",
-"     ...............          ###############          @@@@@@@@@@@@@@@          +++++++++++++++     ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    "};
+"     ...............          ###############          @@@@@@@@@@@@@@@          +++++++++++++++     "};
diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index bc3b580..3c9ac77 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -23,11 +23,11 @@
  * ,--[ ebox ]--------------------------------------------------.
  * |,--[ outer_box ] ------------------------------------------.|
  * ||                                                          ||
- * || ,--[ box ] ----------------------. ,--[ signal_image ]-. ||
- * || |                                | |                   | ||
- * || | [label]     [signal_bar]       | |                   | ||
- * || |                                | |                   | ||
- * || '--------------------------------' '-------------------' ||
+ * || ,--[label]----. ,--[ box ] ------. ,--[ signal_image ]-. ||
+ * || |             | |                | |                   | ||
+ * || |             | | [signal_bar]   | |                   | ||
+ * || |             | |                | |                   | ||
+ * || '-------------' '----------------' '-------------------' ||
  * |'----------------------------------------------------------'|
  * '------------------------------------------------------------'
  */
@@ -55,7 +55,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #define SIGNAL_WIDTH 25
-#define SIGNAL_HEIGHT 24
+#define SIGNAL_HEIGHT 12
 
 static void
 update_signal_image(radio_gui* data, gint signal)
@@ -69,15 +69,9 @@ update_signal_image(radio_gui* data, gint signal)
 	image = gdk_drawable_get_image(signal_s, SIGNAL_WIDTH * signal, 0,
 		SIGNAL_WIDTH, SIGNAL_HEIGHT);
 
-	gtk_widget_hide(data->signal_image);
 	gtk_image_set_from_image(GTK_IMAGE(data->signal_image), image, mask);
 	gtk_widget_show(data->signal_image);
 
-	if (GTK_WIDGET(data->signal_image)->parent == NULL)
-	{
-		gtk_box_pack_start(GTK_BOX(data->outer_box),
-			data->signal_image, FALSE, FALSE, 1);
-	}
 	g_object_unref(image);
 	g_object_unref(mask);
 	g_object_unref(signal_s);
@@ -313,7 +307,7 @@ xfce4_radio_start(radio_gui* data)
 	{
 		DBG("Failed!");
 		GtkWindow* win = GTK_WINDOW(gtk_widget_get_toplevel(
-								data->box));
+							data->outer_box));
 		GtkWidget* warn = gtk_message_dialog_new(win, 0,
 			GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
 			_("Error opening radio device"));
@@ -337,7 +331,9 @@ xfce4_radio_stop(radio_gui* data)
 	DBG("Stopping, auto_update_display=%d", data->auto_update_display);
 
 	if (data->auto_update_display)
+	{
 		radio_mute();
+	}
 	else
 	{
 		radio_stop();
@@ -406,7 +402,7 @@ static void
 radio_tune_gui(GtkEditable *menu_item, void *pointer)
 {
 	radio_gui* data = (radio_gui*) pointer;
-	GtkWindow* win = GTK_WINDOW(gtk_widget_get_toplevel(data->box));
+	GtkWindow* win = GTK_WINDOW(gtk_widget_get_toplevel(data->outer_box));
 	GtkWidget* dialog = gtk_dialog_new_with_buttons(_("Tune radio"),
 				NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
 				GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -601,27 +597,35 @@ add_boxes(radio_gui *gui)
 {
 	if (gui->orientation == GTK_ORIENTATION_HORIZONTAL)
 	{
-		gui->box = gtk_hbox_new(FALSE, 0);
 		gui->outer_box = gtk_hbox_new(FALSE, 0);
 	}
 	else
 	{
-		gui->box = gtk_vbox_new(FALSE, 0);
 		gui->outer_box = gtk_vbox_new(FALSE, 0);
 	}
 
-	gtk_container_set_border_width(GTK_CONTAINER(gui->box), BORDER / 2);
-
-	gtk_widget_show(gui->box);
 	gtk_widget_show(gui->outer_box);
-
-	gtk_container_add(GTK_CONTAINER(gui->outer_box), gui->box);
 	gtk_container_add(GTK_CONTAINER(gui->ebox), gui->outer_box);
 }
 
 static void
 add_signal_bar(radio_gui *gui)
 {
+	GtkWidget *box;
+
+	if (gui->orientation == GTK_ORIENTATION_HORIZONTAL)
+	{
+		box = gtk_hbox_new(FALSE, 0);
+	}
+	else
+	{
+		box = gtk_vbox_new(FALSE, 0);
+	}
+
+	gtk_widget_show(box);
+	gtk_container_add(GTK_CONTAINER(gui->outer_box), box);
+	gtk_container_set_border_width(GTK_CONTAINER(box), BORDER / 2);
+
 	GtkWidget *signal_bar = gtk_progress_bar_new();
 
 	if (gui->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -631,7 +635,7 @@ add_signal_bar(radio_gui *gui)
 		gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR
 			(signal_bar), GTK_PROGRESS_LEFT_TO_RIGHT);
 
-	gtk_box_pack_start(GTK_BOX(gui->box), signal_bar, FALSE, FALSE, 1);
+	gtk_box_pack_start(GTK_BOX(box), signal_bar, FALSE, FALSE, 1);
 	gui->signal_bar = signal_bar;
 }
 
@@ -639,13 +643,14 @@ static void
 add_label(radio_gui *gui)
 {
 	gui->label = gtk_label_new("");
-	gtk_box_pack_start(GTK_BOX(gui->box), gui->label, FALSE, FALSE, 1);
+	gtk_container_add(GTK_CONTAINER(gui->outer_box), gui->label);
 }
 
 static void
 add_image(radio_gui *gui)
 {
 	gui->signal_image = gtk_image_new();
+	gtk_container_add(GTK_CONTAINER(gui->outer_box), gui->signal_image);
 }
 
 static void
diff --git a/panel-plugin/xfce4-radio.h b/panel-plugin/xfce4-radio.h
index 290ff32..8303442 100644
--- a/panel-plugin/xfce4-radio.h
+++ b/panel-plugin/xfce4-radio.h
@@ -64,7 +64,6 @@ typedef struct radio_preset_st radio_preset;
 
 typedef struct {
 	GtkWidget*		outer_box;
-	GtkWidget*		box;
 	GtkWidget*		ebox;
 	GtkWidget*		label;
 	GtkWidget*		signal_bar;



More information about the Xfce4-commits mailing list