diff src/skins/ui_main.c @ 3159:1ffcad5f406c

import new skins plugin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 22 May 2009 23:18:48 +0900
parents 8b97f9560dc3
children
line wrap: on
line diff
--- a/src/skins/ui_main.c	Fri May 01 16:59:54 2009 -0400
+++ b/src/skins/ui_main.c	Fri May 22 23:18:48 2009 +0900
@@ -477,11 +477,31 @@
         gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->normal), GTK_WIDGET(mainwin_info), aud_active_skin->properties.mainwin_text_x,
                        aud_active_skin->properties.mainwin_text_y);
 
+
+#if 0
     if (aud_active_skin->properties.mainwin_text_width) {
         UI_SKINNED_TEXTBOX(mainwin_info)->width = aud_active_skin->properties.mainwin_text_width;
         gtk_widget_set_size_request (mainwin_info, aud_active_skin->properties.
          mainwin_text_width * MAINWIN_SCALE_FACTOR, -1);
     }
+#else
+    if (aud_active_skin->properties.mainwin_text_width)
+        UI_SKINNED_TEXTBOX(mainwin_info)->width =
+            aud_active_skin->properties.mainwin_text_width;
+
+    if (aud_active_skin->properties.mainwin_text_height)
+        UI_SKINNED_TEXTBOX(mainwin_info)->height =
+            aud_active_skin->properties.mainwin_text_height;
+
+    gtk_widget_set_size_request (mainwin_info,
+                                 aud_active_skin->properties.
+                                 mainwin_text_width * MAINWIN_SCALE_FACTOR,
+                                 aud_active_skin->properties.
+                                 mainwin_text_height * MAINWIN_SCALE_FACTOR);
+#endif
+
+
+
 
     if (aud_active_skin->properties.mainwin_infobar_x && aud_active_skin->properties.mainwin_infobar_y)
         gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->normal), GTK_WIDGET(mainwin_othertext), aud_active_skin->properties.mainwin_infobar_x,
@@ -1345,10 +1365,7 @@
 void
 mainwin_pl_pushed(gboolean toggled)
 {
-    if (toggled)
-        playlistwin_show();
-    else
-        playlistwin_hide();
+    playlistwin_show (toggled);
 }
 
 gint
@@ -1568,22 +1585,8 @@
     equalizerwin_set_balance_slider(b);
 }
 
-void
-mainwin_show(gboolean show)
+static void mainwin_real_show (void)
 {
-    if (show)
-        mainwin_real_show();
-    else
-        mainwin_real_hide();
-}
-
-void
-mainwin_real_show(void)
-{
-    config.player_visible = TRUE;
-
-    check_set( toggleaction_group_others , "show player" , TRUE );
-
     if (config.player_shaded)
         ui_vis_clear_data(mainwin_vis);
 
@@ -1602,20 +1605,33 @@
     gtk_window_present(GTK_WINDOW(mainwin));
 }
 
-void
-mainwin_real_hide(void)
+static void mainwin_real_hide (void)
 {
-
-    check_set( toggleaction_group_others , "show player", FALSE);
-
     if (config.player_shaded)
         ui_svis_clear_data(mainwin_svis);
 
     gtk_widget_hide(mainwin);
-
-    config.player_visible = FALSE;
 }
 
+void mainwin_show (gboolean show)
+{
+    GtkAction * a;
+
+    a = gtk_action_group_get_action (toggleaction_group_others, "show player");
+
+    if (a && gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (a)) != show)
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (a), show);
+    else
+    {
+        config.player_visible = show;
+        aud_cfg->player_visible = show;
+
+        if (show)
+           mainwin_real_show ();
+        else
+           mainwin_real_hide ();
+   }
+}
 
 void
 mainwin_set_stopaftersong(gboolean stop)
@@ -1699,16 +1715,10 @@
             mainwin_show(GTK_CHECK_MENU_ITEM(item)->active);
             break;
         case MAINWIN_GENERAL_SHOWPLWIN:
-            if (GTK_CHECK_MENU_ITEM(item)->active)
-                playlistwin_show();
-            else
-                playlistwin_hide();
+            playlistwin_show (GTK_CHECK_MENU_ITEM(item) ->active);
             break;
         case MAINWIN_GENERAL_SHOWEQWIN:
-            if (GTK_CHECK_MENU_ITEM(item)->active)
-                equalizerwin_real_show();
-            else
-                equalizerwin_real_hide();
+            equalizerwin_show (GTK_CHECK_MENU_ITEM (item)->active);
             break;
         case MAINWIN_GENERAL_PREV:
             aud_playlist_prev(playlist);
@@ -2430,8 +2440,6 @@
         g_free(time_str);
     }
 
-    time /= 1000;
-    length /= 1000;
     if (length > 0) {
         if (time > length) {
             ui_skinned_horizontal_slider_set_position(mainwin_position, 219);
@@ -2588,19 +2596,13 @@
 void
 action_show_equalizer( GtkToggleAction * action )
 {
-    if (gtk_toggle_action_get_active(action))
-        equalizerwin_real_show();
-    else
-        equalizerwin_real_hide();
+    equalizerwin_show (gtk_toggle_action_get_active (action));
 }
 
 void
 action_show_playlist_editor( GtkToggleAction * action )
 {
-    if (gtk_toggle_action_get_active(action))
-        playlistwin_show();
-    else
-        playlistwin_hide();
+    playlistwin_show (gtk_toggle_action_get_active (action));
 }
 
 void