[Xfce4-commits] <xfce4-radio-plugin:master> Did some cleanup in the panel UI. Still not entirely convinced, but we're getting there.

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


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

commit cbd45fd36fc559c8112e16193a03f3160ee2d6f8
Author: Stefan Ott <stefan at ott.net>
Date:   Sat May 21 05:08:52 2011 +0200

    Did some cleanup in the panel UI. Still not entirely convinced, but we're getting there.

 icons/signal.xpm           |   26 +++++++++++++-------------
 panel-plugin/xfce4-radio.c |   32 +++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/icons/signal.xpm b/icons/signal.xpm
index 79a52e1..faebf6c 100644
--- a/icons/signal.xpm
+++ b/icons/signal.xpm
@@ -1,20 +1,20 @@
 /* XPM */
 static char * signal_xpm[] = {
-"100 12 5 1",
+"60 12 5 1",
 " 	c None",
 ".	c #D4D4D4",
 "+	c #00C264",
 "@	c #FFB300",
 "#	c #F40000",
-"     ...............          ...............          ...............          +++++++++++++++     ",
-"     ...............          ...............          ...............          +++++++++++++++     ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"     ...............          ...............          @@@@@@@@@@@@@@@          +++++++++++++++     ",
-"     ...............          ...............          @@@@@@@@@@@@@@@          +++++++++++++++     ",
-"                                                                                                    ",
-"                                                                                                    ",
-"                                                                                                    ",
-"     ...............          ###############          @@@@@@@@@@@@@@@          +++++++++++++++     ",
-"     ...............          ###############          @@@@@@@@@@@@@@@          +++++++++++++++     "};
+".............................................+++++++++++++++",
+".............................................+++++++++++++++",
+"                                                            ",
+"                                                            ",
+"                                                            ",
+"..............................@@@@@@@@@@@@@@@+++++++++++++++",
+"..............................@@@@@@@@@@@@@@@+++++++++++++++",
+"                                                            ",
+"                                                            ",
+"                                                            ",
+"...............###############@@@@@@@@@@@@@@@+++++++++++++++",
+"...............###############@@@@@@@@@@@@@@@+++++++++++++++"};
diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index c41e5dd..ff85e73 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -50,7 +50,7 @@
 #include <libxfcegui4/libxfcegui4.h>
 #include <gdk/gdkkeysyms.h>
 
-#define SIGNAL_WIDTH 25
+#define SIGNAL_WIDTH 15
 #define SIGNAL_HEIGHT 12
 
 static void
@@ -597,37 +597,43 @@ mouse_scroll(GtkWidget* src, GdkEventScroll *event, radio_gui* data)
 static void
 add_boxes(radio_gui *gui)
 {
+	GtkWidget *align = gtk_alignment_new(0.5, 0.5, 1, 1);
+	gtk_container_add(GTK_CONTAINER(gui->ebox), align);
+	gtk_widget_show(align);
+
 	if (gui->orientation == GTK_ORIENTATION_HORIZONTAL)
 	{
-		gui->outer_box = gtk_hbox_new(FALSE, 0);
+		gui->outer_box = gtk_hbox_new(FALSE, 4);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 0, 4, 4);
 	}
 	else
 	{
 		gui->outer_box = gtk_vbox_new(FALSE, 0);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(align), 4, 4, 0, 0);
 	}
 
 	gtk_widget_show(gui->outer_box);
-	gtk_container_add(GTK_CONTAINER(gui->ebox), gui->outer_box);
+	gtk_container_add(GTK_CONTAINER(align), gui->outer_box);
 }
 
 static void
 add_signal_bar(radio_gui *gui)
 {
-	GtkWidget *box;
+	GtkWidget *align = gtk_alignment_new(0, 0, 0, 0);
+	gtk_container_add(GTK_CONTAINER(gui->outer_box), align);
+	gtk_widget_show(align);
 
 	if (gui->orientation == GTK_ORIENTATION_HORIZONTAL)
 	{
-		box = gtk_hbox_new(FALSE, 0);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(align),
+			BORDER / 2, BORDER / 2, 0, 0);
 	}
 	else
 	{
-		box = gtk_vbox_new(FALSE, 0);
+		gtk_alignment_set_padding(GTK_ALIGNMENT(align),
+			0, 0, BORDER / 2, BORDER / 2);
 	}
 
-	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)
@@ -637,14 +643,14 @@ 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(box), signal_bar, FALSE, FALSE, 1);
+	gtk_container_add(GTK_CONTAINER(align), signal_bar);
 	gui->signal_bar = signal_bar;
 }
 
 static void
 add_label(radio_gui *gui)
 {
-	gui->label = gtk_label_new("");
+	gui->label = gtk_label_new(NULL);
 	gtk_container_add(GTK_CONTAINER(gui->outer_box), gui->label);
 }
 
@@ -1436,7 +1442,7 @@ radio_set_orientation(XfcePanelPlugin *plugin, GtkOrientation orientation,
 								radio_gui *gui)
 {
 	gui->orientation = orientation;
-	gtk_container_remove(GTK_CONTAINER(gui->ebox), gui->outer_box);
+	gtk_container_remove(GTK_CONTAINER(gui->ebox), gui->outer_box->parent);
 	add_gui_elements(gui);
 
 	update_label(gui);



More information about the Xfce4-commits mailing list