changeset 35529:8ad4d2fb46e8

Rebuild GUI directory structure. Rename and move ui/widgets.* to dialog/dialog.*.
author ib
date Thu, 06 Dec 2012 15:16:38 +0000
parents ab07b17fddfb
children cc6e25e348ee
files Makefile gui/dialog/about.c gui/dialog/dialog.c gui/dialog/dialog.h gui/dialog/equalizer.c gui/dialog/fileselect.c gui/dialog/menu.c gui/dialog/msgbox.c gui/dialog/playlist.c gui/dialog/preferences.c gui/dialog/skinbrowser.c gui/dialog/url.c gui/interface.c gui/skin/skin.c gui/ui/main.c gui/ui/menu.c gui/ui/playbar.c gui/ui/video.c gui/ui/widgets.c gui/ui/widgets.h gui/wm/ws.h
diffstat 21 files changed, 437 insertions(+), 437 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Dec 06 14:59:06 2012 +0000
+++ b/Makefile	Thu Dec 06 15:16:38 2012 +0000
@@ -500,6 +500,7 @@
 SRCS_MPLAYER-$(GUI_GTK)      += gui/app/app.c \
                                 gui/app/cfg.c \
                                 gui/dialog/about.c \
+                                gui/dialog/dialog.c \
                                 gui/dialog/equalizer.c \
                                 gui/dialog/fileselect.c \
                                 gui/dialog/menu.c \
@@ -518,7 +519,6 @@
                                 gui/ui/playbar.c \
                                 gui/ui/render.c \
                                 gui/ui/video.c \
-                                gui/ui/widgets.c \
                                 gui/util/cut.c \
                                 gui/wm/ws.c \
                                 gui/wm/wsxdnd.c \
--- a/gui/dialog/about.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/about.c	Thu Dec 06 15:16:38 2012 +0000
@@ -22,7 +22,7 @@
 #include "version.h"
 
 #include "pixmaps/emblem.xpm"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "about.h"
 #include "tools.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/dialog/dialog.c	Thu Dec 06 15:16:38 2012 +0000
@@ -0,0 +1,337 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+#include "config.h"
+#include "help_mp.h"
+#include "mp_msg.h"
+#include "libavutil/intreadwrite.h"
+#include "libvo/x11_common.h"
+
+#include "dialog.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
+#include "gui/interface.h"
+#include "gui/wm/ws.h"
+
+#include "gui/ui/actions.h"
+#include "fileselect.h"
+
+GtkWidget *PopUpMenu = NULL;
+
+GtkWidget *WarningPixmap;
+GtkWidget *ErrorPixmap;
+
+int gtkPopupMenu      = 0;
+int gtkPopupMenuParam = 0;
+int gtkInitialized    = False;
+
+#include "skinbrowser.h"
+#include "playlist.h"
+#include "msgbox.h"
+#include "about.h"
+#include "preferences.h"
+#include "menu.h"
+#include "url.h"
+#include "equalizer.h"
+
+static const char gui_icon_name[] = "mplayer";
+
+#define THRESHOLD 128   // transparency values equal to or above this will become
+                        // opaque, all values below this will become transparent
+
+/* init & close gtk */
+
+guiIcon_t guiIcon;
+
+static int gtkLoadIcon(GtkIconTheme *theme, gint size, GdkPixmap **gdkIcon, GdkBitmap **gdkIconMask)
+{
+    GdkPixbuf *pixbuf;
+    guchar *data;
+    int csize, i;
+
+    pixbuf = gtk_icon_theme_load_icon(theme, gui_icon_name, size, 0, NULL);
+
+    if (pixbuf)
+        gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, gdk_colormap_get_system(), gdkIcon, gdkIconMask, THRESHOLD);
+
+    if (pixbuf &&
+        gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB &&
+        gdk_pixbuf_get_n_channels(pixbuf) == 4 &&
+        gdk_pixbuf_get_bits_per_sample(pixbuf) == 8) {
+        csize = guiIcon.collection_size;
+        guiIcon.collection_size += 2 + gdk_pixbuf_get_width(pixbuf) * gdk_pixbuf_get_height(pixbuf);
+
+        guiIcon.collection = realloc(guiIcon.collection, guiIcon.collection_size * sizeof(*guiIcon.collection));
+
+        if (guiIcon.collection) {
+            guiIcon.collection[csize++] = gdk_pixbuf_get_width(pixbuf);
+            guiIcon.collection[csize++] = gdk_pixbuf_get_height(pixbuf);
+
+            data = gdk_pixbuf_get_pixels(pixbuf);
+
+            for (i = csize; i < guiIcon.collection_size; data += 4, i++)
+                guiIcon.collection[i] = (uint32_t)(data[3] << 24) | AV_RB24(data);  // RGBA -> ARGB
+        }
+
+        g_object_unref(pixbuf);
+    } else
+        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, gui_icon_name, size);
+
+    /* start up GTK which realizes the pixmaps */
+    gtk_main_iteration_do(FALSE);
+
+    return (pixbuf != NULL);
+}
+
+void gtkInit(void)
+{
+    int argc = 0;
+    char *arg[3], **argv = arg;
+    GtkIconTheme *theme;
+    GdkPixmap *gdkIcon;
+    GdkBitmap *gdkIconMask;
+
+    mp_msg(MSGT_GPLAYER, MSGL_V, "GTK init.\n");
+
+    arg[argc++] = GMPlayer;
+
+    if (mDisplayName) {            // MPlayer option '-display' was given
+        arg[argc++] = "--display"; // Pass corresponding command line arguments to GTK,
+        arg[argc++] = mDisplayName; // to open the requested display for the GUI, too.
+    }
+
+#ifdef CONFIG_GTK2
+    gtk_disable_setlocale();
+#endif
+
+    gtk_init(&argc, &argv);
+
+    theme = gtk_icon_theme_get_default();
+
+    if (gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask)) {
+        guiIcon.small      = GDK_PIXMAP_XID(gdkIcon);
+        guiIcon.small_mask = GDK_PIXMAP_XID(gdkIconMask);
+    }
+
+    if (gtkLoadIcon(theme, 32, &gdkIcon, &gdkIconMask)) {
+        guiIcon.normal      = GDK_PIXMAP_XID(gdkIcon);
+        guiIcon.normal_mask = GDK_PIXMAP_XID(gdkIconMask);
+    }
+
+    gtkLoadIcon(theme, 48, &gdkIcon, &gdkIconMask);
+
+    gtkInitialized = True;
+}
+
+void gtkAddIcon(GtkWidget *window)
+{
+    wsSetIcon(gdk_display, GDK_WINDOW_XWINDOW(window->window), &guiIcon);
+}
+
+void gtkClearList(GtkWidget *list)
+{
+    gtk_clist_clear(GTK_CLIST(list));
+}
+
+int gtkFindCList(GtkWidget *list, char *item)
+{
+    gint j;
+    gchar *tmpstr;
+
+    for (j = 0; j < GTK_CLIST(list)->rows; j++) {
+        gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr);
+
+        if (!strcmp(tmpstr, item))
+            return j;
+    }
+
+    return -1;
+}
+
+void gtkSetDefaultToCList(GtkWidget *list, char *item)
+{
+    gint i;
+
+    if ((i = gtkFindCList(list, item)) > -1)
+        gtk_clist_select_row(GTK_CLIST(list), i, 0);
+}
+
+void gtkEventHandling(void)
+{
+    int i;
+
+    for (i = 0; i < 25; i++)
+        gtk_main_iteration_do(0);
+}
+
+/* funcs */
+
+void gtkMessageBox(int type, const gchar *str)
+{
+    if (!gtkInitialized)
+        return;
+
+    ShowMessageBox(str);
+    gtk_label_set_text(GTK_LABEL(gtkMessageBoxText), str);
+
+    /* enable linewrapping by alex */
+// GTK_LABEL(gtkMessageBoxText)->max_width = 80;
+    if (strlen(str) > 80)
+        gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), TRUE);
+    else
+        gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), FALSE);
+
+    switch (type) {
+    case GTK_MB_FATAL:
+        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_FatalError);
+        gtk_widget_hide(WarningPixmap);
+        gtk_widget_show(ErrorPixmap);
+        break;
+
+    case GTK_MB_ERROR:
+        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_Error);
+        gtk_widget_hide(WarningPixmap);
+        gtk_widget_show(ErrorPixmap);
+        break;
+
+    case GTK_MB_WARNING:
+        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_Warning);
+        gtk_widget_show(WarningPixmap);
+        gtk_widget_hide(ErrorPixmap);
+        break;
+    }
+
+    gtk_widget_show(MessageBox);
+    gtkSetLayer(MessageBox);
+
+    if (type == GTK_MB_FATAL)
+        while (MessageBox)
+            gtk_main_iteration_do(0);
+}
+
+void gtkSetLayer(GtkWidget *wdg)
+{
+    wsSetLayer(gdk_display, GDK_WINDOW_XWINDOW(wdg->window), guiApp.videoWindow.isFullScreen);
+    gtkActive(wdg);
+}
+
+void gtkActive(GtkWidget *wdg)
+{
+    wsRaiseWindowTop(gdk_display, GDK_WINDOW_XWINDOW(wdg->window));
+}
+
+void gtkShow(int type, char *param)
+{
+    switch (type) {
+    case evEqualizer:
+        ShowEqualizer();
+        gtkSetLayer(Equalizer);
+        break;
+
+    case evSkinBrowser:
+        ShowSkinBrowser();
+
+//        gtkClearList( SkinList );
+        if (gtkFillSkinList(sbMPlayerPrefixDir) &&
+            gtkFillSkinList(sbMPlayerDirInHome)) {
+            gtkSetDefaultToCList(SkinList, param);
+            gtk_clist_sort(GTK_CLIST(SkinList));
+            gtk_widget_show(SkinBrowser);
+            gtkSetLayer(SkinBrowser);
+        } else {
+            gtk_widget_destroy(SkinBrowser);
+            gtkMessageBox(GTK_MB_ERROR, "Skin dirs not found ... Please install skins.");
+        }
+
+        break;
+
+    case evPreferences:
+        ShowPreferences();
+        break;
+
+    case evPlaylist:
+        ShowPlayList();
+        gtkSetLayer(PlayList);
+        break;
+
+    case evLoad:
+        ShowFileSelect(fsVideoSelector, 0);
+        gtkSetLayer(fsFileSelect);
+        break;
+
+    case evLoadSubtitle:
+        ShowFileSelect(fsSubtitleSelector, 0);
+        gtkSetLayer(fsFileSelect);
+        break;
+
+    case evLoadAudioFile:
+        ShowFileSelect(fsAudioSelector, 0);
+        gtkSetLayer(fsFileSelect);
+        break;
+
+    case evAbout:
+        ShowAboutBox();
+        gtkSetLayer(About);
+        break;
+
+    case ivShowPopUpMenu:
+        gtkPopupMenu      = evNone;
+        gtkPopupMenuParam = 0;
+
+        if (PopUpMenu) {
+            gtk_widget_hide(PopUpMenu);
+            gtk_widget_destroy(PopUpMenu);
+        }
+
+        PopUpMenu = create_PopUpMenu();
+        gtk_menu_popup(GTK_MENU(PopUpMenu), NULL, NULL, NULL, NULL, 0, 0);
+        break;
+
+    case ivHidePopUpMenu:
+
+        if (PopUpMenu) {
+            gtk_widget_hide(PopUpMenu);
+            gtk_widget_destroy(PopUpMenu);
+            PopUpMenu = NULL;
+        }
+
+        break;
+
+    case evLoadURL:
+        ShowURLDialogBox();
+        gtkSetLayer(URL);
+        break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/dialog/dialog.h	Thu Dec 06 15:16:38 2012 +0000
@@ -0,0 +1,83 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_GUI_DIALOG_H
+#define MPLAYER_GUI_DIALOG_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <X11/Xlib.h>
+#include <X11/Xproto.h>
+
+#include "osdep/shmem.h"
+#include "gui/ui/actions.h"
+#include "mplayer.h"
+
+#define GTK_MB_SIMPLE 0
+#define GTK_MB_MODAL 1
+#define GTK_MB_FATAL 2
+#define GTK_MB_ERROR 4
+#define GTK_MB_WARNING 8
+
+extern GtkWidget *PlayList;
+extern GtkWidget *Options;
+extern GtkWidget *PopUpMenu;
+
+extern GtkWidget *WarningPixmap;
+extern GtkWidget *ErrorPixmap;
+
+extern GtkWidget *SkinList;
+extern GtkWidget *gtkMessageBoxText;
+
+extern int gtkPopupMenu;
+extern int gtkPopupMenuParam;
+
+extern char *sbMPlayerDirInHome;
+extern char *sbMPlayerPrefixDir;
+
+typedef struct {
+    Pixmap small;
+    Pixmap small_mask;
+    Pixmap normal;
+    Pixmap normal_mask;
+    int collection_size;
+    long *collection;
+} guiIcon_t;
+
+extern guiIcon_t guiIcon;
+
+void widgetsCreate(void);
+
+void gtkInit(void);
+void gtkAddIcon(GtkWidget *window);
+
+int gtkFillSkinList(gchar *dir);
+void gtkClearList(GtkWidget *list);
+void gtkSetDefaultToCList(GtkWidget *list, char *item);
+int gtkFindCList(GtkWidget *list, char *item);
+
+void gtkEventHandling(void);
+
+void gtkShow(int type, char *param);
+void gtkMessageBox(int type, const gchar *str);
+void gtkSetLayer(GtkWidget *wdg);
+void gtkActive(GtkWidget *wdg);
+
+#endif /* MPLAYER_GUI_DIALOG_H */
--- a/gui/dialog/equalizer.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/equalizer.c	Thu Dec 06 15:16:38 2012 +0000
@@ -37,7 +37,7 @@
 #include "libmpdemux/demuxer.h"
 #include "libmpdemux/stheader.h"
 #include "libmpcodecs/dec_video.h"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "gui/util/mem.h"
 #include "gui/util/string.h"
 
--- a/gui/dialog/fileselect.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/fileselect.c	Thu Dec 06 15:16:38 2012 +0000
@@ -41,7 +41,7 @@
 #include "stream/stream.h"
 #include "libavutil/common.h"
 
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "fileselect.h"
 #include "preferences.h"
 #include "tools.h"
--- a/gui/dialog/menu.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/menu.c	Thu Dec 06 15:16:38 2012 +0000
@@ -27,7 +27,7 @@
 #include "mpcommon.h"
 
 #include "menu.h"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "gui/ui/ui.h"
 #include "gui/app/app.h"
 #include "gui/app/gui.h"
--- a/gui/dialog/msgbox.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/msgbox.c	Thu Dec 06 15:16:38 2012 +0000
@@ -24,7 +24,7 @@
 #include "pixmaps/error.xpm"
 #include "pixmaps/warning.xpm"
 
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "msgbox.h"
 #include "tools.h"
 
--- a/gui/dialog/playlist.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/playlist.c	Thu Dec 06 15:16:38 2012 +0000
@@ -33,7 +33,7 @@
 #include "gui/app/cfg.h"
 #include "gui/app/gui.h"
 #include "gui/interface.h"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "gui/util/list.h"
 #include "gui/util/mem.h"
 #include "gui/util/string.h"
--- a/gui/dialog/preferences.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/preferences.c	Thu Dec 06 15:16:38 2012 +0000
@@ -44,7 +44,7 @@
 #include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/ui/ui.h"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "gui/util/list.h"
 #include "gui/util/mem.h"
 #include "gui/util/string.h"
--- a/gui/dialog/skinbrowser.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/skinbrowser.c	Thu Dec 06 15:16:38 2012 +0000
@@ -32,7 +32,7 @@
 #include "gui/skin/skin.h"
 #include "help_mp.h"
 
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 
 GtkWidget * SkinList = NULL;
 char      * sbSelectedSkin=NULL;
--- a/gui/dialog/url.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/dialog/url.c	Thu Dec 06 15:16:38 2012 +0000
@@ -31,7 +31,7 @@
 #include "gui/interface.h"
 #include "gui/app/app.h"
 #include "gui/ui/ui.h"
-#include "gui/ui/widgets.h"
+#include "dialog.h"
 #include "gui/util/list.h"
 #include "gui/util/string.h"
 #include "help_mp.h"
--- a/gui/interface.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/interface.c	Thu Dec 06 15:16:38 2012 +0000
@@ -24,9 +24,9 @@
 #include "interface.h"
 #include "app/app.h"
 #include "app/gui.h"
+#include "dialog/dialog.h"
 #include "skin/skin.h"
 #include "ui/ui.h"
-#include "ui/widgets.h"
 #include "util/list.h"
 #include "util/mem.h"
 #include "util/string.h"
--- a/gui/skin/skin.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/skin/skin.c	Thu Dec 06 15:16:38 2012 +0000
@@ -28,8 +28,8 @@
 #include "font.h"
 #include "gui/app/app.h"
 #include "gui/app/gui.h"
+#include "gui/dialog/dialog.h"
 #include "gui/interface.h"
-#include "gui/ui/widgets.h"
 #include "gui/util/cut.h"
 #include "gui/util/string.h"
 
--- a/gui/ui/main.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/ui/main.c	Thu Dec 06 15:16:38 2012 +0000
@@ -60,7 +60,7 @@
 #define GUI_REDRAW_WAIT 375
 
 #include "actions.h"
-#include "widgets.h"
+#include "gui/dialog/dialog.h"
 
 unsigned int GetTimerMS( void );
 
--- a/gui/ui/menu.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/ui/menu.c	Thu Dec 06 15:16:38 2012 +0000
@@ -29,7 +29,7 @@
 #include "gui/app/gui.h"
 #include "ui.h"
 
-#include "widgets.h"
+#include "gui/dialog/dialog.h"
 
 unsigned char * menuDrawBuffer = NULL;
 int             menuRender = True;
--- a/gui/ui/playbar.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/ui/playbar.c	Thu Dec 06 15:16:38 2012 +0000
@@ -47,7 +47,7 @@
 
 #include "ui.h"
 #include "actions.h"
-#include "widgets.h"
+#include "gui/dialog/dialog.h"
 #include "render.h"
 
 unsigned int GetTimerMS( void );
--- a/gui/ui/video.c	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/ui/video.c	Thu Dec 06 15:16:38 2012 +0000
@@ -28,7 +28,7 @@
 #include "gui/app/app.h"
 #include "gui/app/gui.h"
 #include "gui/interface.h"
-#include "widgets.h"
+#include "gui/dialog/dialog.h"
 
 int             uiVideoRender = False;
 int             videoVisible = 0;
--- a/gui/ui/widgets.c	Thu Dec 06 14:59:06 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "mp_msg.h"
-#include "libavutil/intreadwrite.h"
-#include "libvo/x11_common.h"
-
-#include "widgets.h"
-#include "gui/app/app.h"
-#include "gui/app/gui.h"
-#include "gui/interface.h"
-#include "gui/wm/ws.h"
-
-#include "actions.h"
-#include "gui/dialog/fileselect.h"
-
-GtkWidget *PopUpMenu = NULL;
-
-GtkWidget *WarningPixmap;
-GtkWidget *ErrorPixmap;
-
-int gtkPopupMenu      = 0;
-int gtkPopupMenuParam = 0;
-int gtkInitialized    = False;
-
-#include "gui/dialog/skinbrowser.h"
-#include "gui/dialog/playlist.h"
-#include "gui/dialog/msgbox.h"
-#include "gui/dialog/about.h"
-#include "gui/dialog/preferences.h"
-#include "gui/dialog/menu.h"
-#include "gui/dialog/url.h"
-#include "gui/dialog/equalizer.h"
-
-static const char gui_icon_name[] = "mplayer";
-
-#define THRESHOLD 128   // transparency values equal to or above this will become
-                        // opaque, all values below this will become transparent
-
-/* init & close gtk */
-
-guiIcon_t guiIcon;
-
-static int gtkLoadIcon(GtkIconTheme *theme, gint size, GdkPixmap **gdkIcon, GdkBitmap **gdkIconMask)
-{
-    GdkPixbuf *pixbuf;
-    guchar *data;
-    int csize, i;
-
-    pixbuf = gtk_icon_theme_load_icon(theme, gui_icon_name, size, 0, NULL);
-
-    if (pixbuf)
-        gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, gdk_colormap_get_system(), gdkIcon, gdkIconMask, THRESHOLD);
-
-    if (pixbuf &&
-        gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB &&
-        gdk_pixbuf_get_n_channels(pixbuf) == 4 &&
-        gdk_pixbuf_get_bits_per_sample(pixbuf) == 8) {
-        csize = guiIcon.collection_size;
-        guiIcon.collection_size += 2 + gdk_pixbuf_get_width(pixbuf) * gdk_pixbuf_get_height(pixbuf);
-
-        guiIcon.collection = realloc(guiIcon.collection, guiIcon.collection_size * sizeof(*guiIcon.collection));
-
-        if (guiIcon.collection) {
-            guiIcon.collection[csize++] = gdk_pixbuf_get_width(pixbuf);
-            guiIcon.collection[csize++] = gdk_pixbuf_get_height(pixbuf);
-
-            data = gdk_pixbuf_get_pixels(pixbuf);
-
-            for (i = csize; i < guiIcon.collection_size; data += 4, i++)
-                guiIcon.collection[i] = (uint32_t)(data[3] << 24) | AV_RB24(data);  // RGBA -> ARGB
-        }
-
-        g_object_unref(pixbuf);
-    } else
-        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, gui_icon_name, size);
-
-    /* start up GTK which realizes the pixmaps */
-    gtk_main_iteration_do(FALSE);
-
-    return (pixbuf != NULL);
-}
-
-void gtkInit(void)
-{
-    int argc = 0;
-    char *arg[3], **argv = arg;
-    GtkIconTheme *theme;
-    GdkPixmap *gdkIcon;
-    GdkBitmap *gdkIconMask;
-
-    mp_msg(MSGT_GPLAYER, MSGL_V, "GTK init.\n");
-
-    arg[argc++] = GMPlayer;
-
-    if (mDisplayName) {            // MPlayer option '-display' was given
-        arg[argc++] = "--display"; // Pass corresponding command line arguments to GTK,
-        arg[argc++] = mDisplayName; // to open the requested display for the GUI, too.
-    }
-
-#ifdef CONFIG_GTK2
-    gtk_disable_setlocale();
-#endif
-
-    gtk_init(&argc, &argv);
-
-    theme = gtk_icon_theme_get_default();
-
-    if (gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask)) {
-        guiIcon.small      = GDK_PIXMAP_XID(gdkIcon);
-        guiIcon.small_mask = GDK_PIXMAP_XID(gdkIconMask);
-    }
-
-    if (gtkLoadIcon(theme, 32, &gdkIcon, &gdkIconMask)) {
-        guiIcon.normal      = GDK_PIXMAP_XID(gdkIcon);
-        guiIcon.normal_mask = GDK_PIXMAP_XID(gdkIconMask);
-    }
-
-    gtkLoadIcon(theme, 48, &gdkIcon, &gdkIconMask);
-
-    gtkInitialized = True;
-}
-
-void gtkAddIcon(GtkWidget *window)
-{
-    wsSetIcon(gdk_display, GDK_WINDOW_XWINDOW(window->window), &guiIcon);
-}
-
-void gtkClearList(GtkWidget *list)
-{
-    gtk_clist_clear(GTK_CLIST(list));
-}
-
-int gtkFindCList(GtkWidget *list, char *item)
-{
-    gint j;
-    gchar *tmpstr;
-
-    for (j = 0; j < GTK_CLIST(list)->rows; j++) {
-        gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr);
-
-        if (!strcmp(tmpstr, item))
-            return j;
-    }
-
-    return -1;
-}
-
-void gtkSetDefaultToCList(GtkWidget *list, char *item)
-{
-    gint i;
-
-    if ((i = gtkFindCList(list, item)) > -1)
-        gtk_clist_select_row(GTK_CLIST(list), i, 0);
-}
-
-void gtkEventHandling(void)
-{
-    int i;
-
-    for (i = 0; i < 25; i++)
-        gtk_main_iteration_do(0);
-}
-
-/* funcs */
-
-void gtkMessageBox(int type, const gchar *str)
-{
-    if (!gtkInitialized)
-        return;
-
-    ShowMessageBox(str);
-    gtk_label_set_text(GTK_LABEL(gtkMessageBoxText), str);
-
-    /* enable linewrapping by alex */
-// GTK_LABEL(gtkMessageBoxText)->max_width = 80;
-    if (strlen(str) > 80)
-        gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), TRUE);
-    else
-        gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), FALSE);
-
-    switch (type) {
-    case GTK_MB_FATAL:
-        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_FatalError);
-        gtk_widget_hide(WarningPixmap);
-        gtk_widget_show(ErrorPixmap);
-        break;
-
-    case GTK_MB_ERROR:
-        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_Error);
-        gtk_widget_hide(WarningPixmap);
-        gtk_widget_show(ErrorPixmap);
-        break;
-
-    case GTK_MB_WARNING:
-        gtk_window_set_title(GTK_WINDOW(MessageBox), MSGTR_MSGBOX_LABEL_Warning);
-        gtk_widget_show(WarningPixmap);
-        gtk_widget_hide(ErrorPixmap);
-        break;
-    }
-
-    gtk_widget_show(MessageBox);
-    gtkSetLayer(MessageBox);
-
-    if (type == GTK_MB_FATAL)
-        while (MessageBox)
-            gtk_main_iteration_do(0);
-}
-
-void gtkSetLayer(GtkWidget *wdg)
-{
-    wsSetLayer(gdk_display, GDK_WINDOW_XWINDOW(wdg->window), guiApp.videoWindow.isFullScreen);
-    gtkActive(wdg);
-}
-
-void gtkActive(GtkWidget *wdg)
-{
-    wsRaiseWindowTop(gdk_display, GDK_WINDOW_XWINDOW(wdg->window));
-}
-
-void gtkShow(int type, char *param)
-{
-    switch (type) {
-    case evEqualizer:
-        ShowEqualizer();
-        gtkSetLayer(Equalizer);
-        break;
-
-    case evSkinBrowser:
-        ShowSkinBrowser();
-
-//        gtkClearList( SkinList );
-        if (gtkFillSkinList(sbMPlayerPrefixDir) &&
-            gtkFillSkinList(sbMPlayerDirInHome)) {
-            gtkSetDefaultToCList(SkinList, param);
-            gtk_clist_sort(GTK_CLIST(SkinList));
-            gtk_widget_show(SkinBrowser);
-            gtkSetLayer(SkinBrowser);
-        } else {
-            gtk_widget_destroy(SkinBrowser);
-            gtkMessageBox(GTK_MB_ERROR, "Skin dirs not found ... Please install skins.");
-        }
-
-        break;
-
-    case evPreferences:
-        ShowPreferences();
-        break;
-
-    case evPlaylist:
-        ShowPlayList();
-        gtkSetLayer(PlayList);
-        break;
-
-    case evLoad:
-        ShowFileSelect(fsVideoSelector, 0);
-        gtkSetLayer(fsFileSelect);
-        break;
-
-    case evLoadSubtitle:
-        ShowFileSelect(fsSubtitleSelector, 0);
-        gtkSetLayer(fsFileSelect);
-        break;
-
-    case evLoadAudioFile:
-        ShowFileSelect(fsAudioSelector, 0);
-        gtkSetLayer(fsFileSelect);
-        break;
-
-    case evAbout:
-        ShowAboutBox();
-        gtkSetLayer(About);
-        break;
-
-    case ivShowPopUpMenu:
-        gtkPopupMenu      = evNone;
-        gtkPopupMenuParam = 0;
-
-        if (PopUpMenu) {
-            gtk_widget_hide(PopUpMenu);
-            gtk_widget_destroy(PopUpMenu);
-        }
-
-        PopUpMenu = create_PopUpMenu();
-        gtk_menu_popup(GTK_MENU(PopUpMenu), NULL, NULL, NULL, NULL, 0, 0);
-        break;
-
-    case ivHidePopUpMenu:
-
-        if (PopUpMenu) {
-            gtk_widget_hide(PopUpMenu);
-            gtk_widget_destroy(PopUpMenu);
-            PopUpMenu = NULL;
-        }
-
-        break;
-
-    case evLoadURL:
-        ShowURLDialogBox();
-        gtkSetLayer(URL);
-        break;
-    }
-}
--- a/gui/ui/widgets.h	Thu Dec 06 14:59:06 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_GUI_WIDGETS_H
-#define MPLAYER_GUI_WIDGETS_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include <X11/Xlib.h>
-#include <X11/Xproto.h>
-
-#include "osdep/shmem.h"
-#include "actions.h"
-#include "mplayer.h"
-
-#define GTK_MB_SIMPLE 0
-#define GTK_MB_MODAL 1
-#define GTK_MB_FATAL 2
-#define GTK_MB_ERROR 4
-#define GTK_MB_WARNING 8
-
-extern GtkWidget *PlayList;
-extern GtkWidget *Options;
-extern GtkWidget *PopUpMenu;
-
-extern GtkWidget *WarningPixmap;
-extern GtkWidget *ErrorPixmap;
-
-extern GtkWidget *SkinList;
-extern GtkWidget *gtkMessageBoxText;
-
-extern int gtkPopupMenu;
-extern int gtkPopupMenuParam;
-
-extern char *sbMPlayerDirInHome;
-extern char *sbMPlayerPrefixDir;
-
-typedef struct {
-    Pixmap small;
-    Pixmap small_mask;
-    Pixmap normal;
-    Pixmap normal_mask;
-    int collection_size;
-    long *collection;
-} guiIcon_t;
-
-extern guiIcon_t guiIcon;
-
-void widgetsCreate(void);
-
-void gtkInit(void);
-void gtkAddIcon(GtkWidget *window);
-
-int gtkFillSkinList(gchar *dir);
-void gtkClearList(GtkWidget *list);
-void gtkSetDefaultToCList(GtkWidget *list, char *item);
-int gtkFindCList(GtkWidget *list, char *item);
-
-void gtkEventHandling(void);
-
-void gtkShow(int type, char *param);
-void gtkMessageBox(int type, const gchar *str);
-void gtkSetLayer(GtkWidget *wdg);
-void gtkActive(GtkWidget *wdg);
-
-#endif /* MPLAYER_GUI_WIDGETS_H */
--- a/gui/wm/ws.h	Thu Dec 06 14:59:06 2012 +0000
+++ b/gui/wm/ws.h	Thu Dec 06 15:16:38 2012 +0000
@@ -22,7 +22,7 @@
 #ifndef MPLAYER_GUI_WS_H
 #define MPLAYER_GUI_WS_H
 
-#include "gui/ui/widgets.h"
+#include "gui/dialog/dialog.h"
 #include "config.h"
 
 #include <X11/Xlib.h>