[Nautilus-list] PATCH: Bug 3571 - FIXED



The following patch connects the signals for appearance_change, reset,
and settings_changed to a function that detects the darkness of the
music_view background and adjusts the label colors accordingly.

syncomm
-
Index: nautilus-music-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/music/nautilus-music-view.c,v
retrieving revision 1.72
diff -u -r1.72 nautilus-music-view.c
--- nautilus-music-view.c	2000/10/04 00:12:20	1.72
+++ nautilus-music-view.c	2000/10/11 22:38:01
@@ -79,6 +79,7 @@
 	
 	gboolean slider_dragging;
 	gboolean sound_enabled;
+	gboolean background_connected;
 	
 	GtkVBox   *album_container;
 	GtkWidget *album_title;
@@ -182,6 +183,8 @@
 static void go_to_next_track                       (NautilusMusicView      *music_view);
 static void play_current_file                      (NautilusMusicView      *music_view,
                                                     gboolean                from_start);
+static void nautilus_music_view_set_label_colors   (NautilusBackground     *background, 
+					    	    NautilusMusicView      *widget);
 
 NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusMusicView, nautilus_music_view, GTK_TYPE_EVENT_BOX)
 
@@ -205,6 +208,8 @@
 nautilus_music_view_initialize (NautilusMusicView *music_view)
 {
 	GtkWidget *scrollwindow;
+	NautilusBackground *widget_background;
+	
 	char *titles[] = {_("Track "), _("Title"), _("Artist"), _("Year"), _("Bitrate "), _("Time "), _("Album"),  _("Comment"), _("Channels"),  _("Sample Rate"),};
 	
 	music_view->details = g_new0 (NautilusMusicViewDetails, 1);
@@ -298,6 +303,23 @@
 	gtk_drag_dest_set (GTK_WIDGET (music_view),
 			   GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, 
 			   music_dnd_target_table, NAUTILUS_N_ELEMENTS (music_dnd_target_table), GDK_ACTION_COPY);
+	/* connect signal for appearance changes */
+	if (!music_view->details->background_connected) {
+		music_view->details->background_connected = TRUE;
+		widget_background = nautilus_get_widget_background(GTK_WIDGET(music_view));
+		gtk_signal_connect (GTK_OBJECT(widget_background), 
+			"reset", 
+			GTK_SIGNAL_FUNC(nautilus_music_view_set_label_colors), 
+			music_view);
+		gtk_signal_connect (GTK_OBJECT(widget_background), 
+			"settings_changed", 
+			GTK_SIGNAL_FUNC(nautilus_music_view_set_label_colors), 
+			music_view);
+		gtk_signal_connect (GTK_OBJECT(widget_background), 
+			"appearance_changed", 
+			GTK_SIGNAL_FUNC(nautilus_music_view_set_label_colors), 
+			music_view);
+	}
 
 	/* finally, show the view itself */	
 	gtk_widget_show (GTK_WIDGET (music_view));
@@ -1483,6 +1505,36 @@
         nautilus_view_report_load_underway (music_view->details->nautilus_view);
 	nautilus_music_view_load_uri (music_view, location);
         nautilus_view_report_load_complete (music_view->details->nautilus_view);
+}
+
+/* Flip Label Colors For Contrast */
+static void
+nautilus_music_view_set_label_colors (NautilusBackground *background, NautilusMusicView *widget)
+{
+	if (widget->details->album_title == NULL) return; 
+	if (widget->details->song_label == NULL) return; 
+	if (widget->details->playtime == NULL) return; 
+	if (widget->details->total_track_time == NULL) return; 
+	
+	if (nautilus_background_is_dark(background)) {
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->album_title), 
+			NAUTILUS_RGB_COLOR_WHITE);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->song_label), 
+			NAUTILUS_RGB_COLOR_WHITE);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->playtime), 
+			NAUTILUS_RGB_COLOR_WHITE);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->total_track_time), 
+			NAUTILUS_RGB_COLOR_WHITE);
+	} else {
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->album_title), 
+			NAUTILUS_RGB_COLOR_BLACK);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->song_label), 
+			NAUTILUS_RGB_COLOR_BLACK);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->playtime), 
+			NAUTILUS_RGB_COLOR_BLACK);
+		nautilus_label_set_text_color (NAUTILUS_LABEL (widget->details->total_track_time), 
+			NAUTILUS_RGB_COLOR_BLACK);
+	}
 }
 
 /* handle receiving dropped objects */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]