Implement themed UI.
authorIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Mon, 22 Sep 2008 14:42:28 +0000 (17:42 +0300)
committerIlpo Ruotsalainen <ilpo.ruotsalainen@movial.fi>
Mon, 22 Sep 2008 14:42:28 +0000 (17:42 +0300)
16 files changed:
isatis-player/build.mk
isatis-player/images/fullscreen_button.png [new file with mode: 0644]
isatis-player/images/fullscreen_button_pressed.png [new file with mode: 0644]
isatis-player/images/pause_button.png [new file with mode: 0644]
isatis-player/images/pause_button_pressed.png [new file with mode: 0644]
isatis-player/images/play_button.png [new file with mode: 0644]
isatis-player/images/play_button_pressed.png [new file with mode: 0644]
isatis-player/images/stop_button.png [new file with mode: 0644]
isatis-player/images/stop_button_pressed.png [new file with mode: 0644]
isatis-player/images/timebar_bar.png [new file with mode: 0644]
isatis-player/images/timebar_empty.png [new file with mode: 0644]
isatis-player/images/timebar_left.png [new file with mode: 0644]
isatis-player/images/timebar_right.png [new file with mode: 0644]
isatis-player/isatis-gtkrc [new file with mode: 0644]
isatis-player/player.c
isatis-plugin/plugin.c

index 95c9189..b6373f9 100644 (file)
@@ -1,7 +1,12 @@
 NAME           := isatis-player
 SOURCES                := $(wildcard isatis-player/*.c)
-CFLAGS         += -pthread
+CFLAGS         += -pthread -DDATADIR=\"$(DATADIR)/$(NAME)\"
 PKGS           := glib-2.0 gstreamer-0.10 gstreamer-plugins-base-0.10 gtk+-2.0
 LIBS           := -lgstinterfaces-0.10
 
+install::
+       mkdir -p $(DEST_DATADIR)/$(NAME)/images
+       install -m 644 isatis-player/isatis-gtkrc $(DEST_DATADIR)/$(NAME)/
+       install -m 644 isatis-player/images/*.png $(DEST_DATADIR)/$(NAME)/images/
+
 include build/binary.mk
diff --git a/isatis-player/images/fullscreen_button.png b/isatis-player/images/fullscreen_button.png
new file mode 100644 (file)
index 0000000..a28b968
Binary files /dev/null and b/isatis-player/images/fullscreen_button.png differ
diff --git a/isatis-player/images/fullscreen_button_pressed.png b/isatis-player/images/fullscreen_button_pressed.png
new file mode 100644 (file)
index 0000000..842782a
Binary files /dev/null and b/isatis-player/images/fullscreen_button_pressed.png differ
diff --git a/isatis-player/images/pause_button.png b/isatis-player/images/pause_button.png
new file mode 100644 (file)
index 0000000..2d851f6
Binary files /dev/null and b/isatis-player/images/pause_button.png differ
diff --git a/isatis-player/images/pause_button_pressed.png b/isatis-player/images/pause_button_pressed.png
new file mode 100644 (file)
index 0000000..c903f5b
Binary files /dev/null and b/isatis-player/images/pause_button_pressed.png differ
diff --git a/isatis-player/images/play_button.png b/isatis-player/images/play_button.png
new file mode 100644 (file)
index 0000000..1d16e00
Binary files /dev/null and b/isatis-player/images/play_button.png differ
diff --git a/isatis-player/images/play_button_pressed.png b/isatis-player/images/play_button_pressed.png
new file mode 100644 (file)
index 0000000..cfef532
Binary files /dev/null and b/isatis-player/images/play_button_pressed.png differ
diff --git a/isatis-player/images/stop_button.png b/isatis-player/images/stop_button.png
new file mode 100644 (file)
index 0000000..33aa2be
Binary files /dev/null and b/isatis-player/images/stop_button.png differ
diff --git a/isatis-player/images/stop_button_pressed.png b/isatis-player/images/stop_button_pressed.png
new file mode 100644 (file)
index 0000000..8aeb9f8
Binary files /dev/null and b/isatis-player/images/stop_button_pressed.png differ
diff --git a/isatis-player/images/timebar_bar.png b/isatis-player/images/timebar_bar.png
new file mode 100644 (file)
index 0000000..45a7e34
Binary files /dev/null and b/isatis-player/images/timebar_bar.png differ
diff --git a/isatis-player/images/timebar_empty.png b/isatis-player/images/timebar_empty.png
new file mode 100644 (file)
index 0000000..2b12e7f
Binary files /dev/null and b/isatis-player/images/timebar_empty.png differ
diff --git a/isatis-player/images/timebar_left.png b/isatis-player/images/timebar_left.png
new file mode 100644 (file)
index 0000000..6996d03
Binary files /dev/null and b/isatis-player/images/timebar_left.png differ
diff --git a/isatis-player/images/timebar_right.png b/isatis-player/images/timebar_right.png
new file mode 100644 (file)
index 0000000..882665c
Binary files /dev/null and b/isatis-player/images/timebar_right.png differ
diff --git a/isatis-player/isatis-gtkrc b/isatis-player/isatis-gtkrc
new file mode 100644 (file)
index 0000000..027e240
--- /dev/null
@@ -0,0 +1,149 @@
+style "isatis-play-button"
+{
+  GtkWidget::focus-line-width = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      state = NORMAL
+      function = BOX
+      file = "images/play_button.png"
+    }
+
+    image
+    {
+      state = PRELIGHT
+      function = BOX
+      file = "images/play_button.png"
+    }
+
+    image
+    {
+      state = ACTIVE
+      function = BOX
+      file = "images/play_button_pressed.png"
+    }
+  }
+}
+
+style "isatis-pause-button"
+{
+  GtkWidget::focus-line-width = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      state = NORMAL
+      function = BOX
+      file = "images/pause_button.png"
+    }
+
+    image
+    {
+      state = PRELIGHT
+      function = BOX
+      file = "images/pause_button.png"
+    }
+
+    image
+    {
+      state = ACTIVE
+      function = BOX
+      file = "images/pause_button_pressed.png"
+    }
+  }
+}
+
+style "isatis-stop-button"
+{
+  GtkWidget::focus-line-width = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      state = NORMAL
+      function = BOX
+      file = "images/stop_button.png"
+    }
+
+    image
+    {
+      state = PRELIGHT
+      function = BOX
+      file = "images/stop_button.png"
+    }
+
+    image
+    {
+      state = ACTIVE
+      function = BOX
+      file = "images/stop_button_pressed.png"
+    }
+  }
+}
+
+style "isatis-progress-left"
+{
+  GtkWidget::focus-line-width = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      function = BOX
+      file = "images/timebar_left.png"
+    }
+  }
+}
+
+style "isatis-progress-right"
+{
+  GtkWidget::focus-line-width = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      function = BOX
+      file = "images/timebar_right.png"
+    }
+  }
+}
+
+style "isatis-progress-bar"
+{
+  GtkWidget::focus-line-width = 0
+  xthickness = 1
+  ythickness = 0
+
+  engine "pixmap"
+  {
+    image
+    {
+      function = BOX
+      detail = "trough"
+      file = "images/timebar_empty.png"
+      border = { 1, 1, 0, 0 }
+    }
+
+    image
+    {
+      function = BOX
+      detail = "bar"
+      file = "images/timebar_bar.png"
+      border = { 0, 5, 0, 0 }
+    }
+  }
+}
+
+widget "isatis-player.*.play-button" style : highest "isatis-play-button"
+widget "isatis-player.*.pause-button" style : highest "isatis-pause-button"
+widget "isatis-player.*.stop-button" style : highest "isatis-stop-button"
+widget "isatis-player.*.progress-left" style : highest "isatis-progress-left"
+widget "isatis-player.*.progress-right" style : highest "isatis-progress-right"
+widget "isatis-player.*.progress-bar" style : highest "isatis-progress-bar"
+
+# vim: ft=gtkrc expandtab shiftwidth=2 smartindent
index 4ab15f3..7092001 100644 (file)
@@ -53,12 +53,31 @@ static gboolean parse_args(int *argc, char ***argv)
        return TRUE;
 }
 
+static gboolean paint_label_background(GtkWidget *widget, GdkEventExpose *event, void *unused)
+{
+       if (GTK_WIDGET_DRAWABLE(widget))
+       {
+               gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+                               &event->area, widget, NULL, widget->allocation.x, widget->allocation.y,
+                               widget->allocation.width, widget->allocation.height);
+       }
+
+       return FALSE;
+}
+
 static gboolean setup_ui(void)
 {
        GtkWidget *window;
        GtkWidget *vbox;
        GtkWidget *hbox;
        GtkWidget *darea;
+       GtkWidget *playbutton;
+       GtkWidget *stopbutton;
+       GtkWidget *progressleft;
+       GtkWidget *progressright;
+       GtkWidget *progressbar;
+
+       gtk_rc_parse(DATADIR "/isatis-gtkrc");
 
        if (xid == -1)
        {
@@ -77,19 +96,49 @@ static gboolean setup_ui(void)
                g_debug("plug->window = %p", GTK_PLUG(window)->socket_window);
        }
 
+       gtk_widget_set_name(GTK_WIDGET(window), "isatis-player");
 
-       vbox = gtk_vbox_new(FALSE, 0);
+       hbox = gtk_hbox_new(FALSE, 0);
+
+       playbutton = gtk_button_new();
+       gtk_widget_set_name(GTK_WIDGET(playbutton), "play-button");
+       gtk_widget_set_size_request(GTK_WIDGET(playbutton), 64, 44);
 
+       stopbutton = gtk_button_new();
+       gtk_widget_set_name(GTK_WIDGET(stopbutton), "stop-button");
+       gtk_widget_set_size_request(GTK_WIDGET(stopbutton), 64, 44);
+
+       progressleft = gtk_label_new("00:00");
+       gtk_widget_set_name(GTK_WIDGET(progressleft), "progress-left");
+       gtk_widget_set_size_request(GTK_WIDGET(progressleft), 60, 44);
+       g_signal_connect(progressleft, "expose-event", G_CALLBACK(paint_label_background), NULL);
+
+       progressright = gtk_label_new("--:--");
+       gtk_widget_set_name(GTK_WIDGET(progressright), "progress-right");
+       gtk_widget_set_size_request(GTK_WIDGET(progressright), 60, 44);
+       g_signal_connect(progressright, "expose-event", G_CALLBACK(paint_label_background), NULL);
+
+       progressbar = gtk_progress_bar_new();
+       gtk_widget_set_name(GTK_WIDGET(progressbar), "progress-bar");
+
+       gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), "testing123");
+       gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), 1.0);
+
+       gtk_box_pack_start(GTK_BOX(hbox), playbutton, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox), stopbutton, FALSE, FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(hbox), progressright, FALSE, FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(hbox), progressbar, TRUE, TRUE, 0);
+       gtk_box_pack_end(GTK_BOX(hbox), progressleft, FALSE, FALSE, 0);
+
+       vbox = gtk_vbox_new(FALSE, 0);
        darea = gtk_drawing_area_new();
+
        gtk_box_pack_start(GTK_BOX(vbox), darea, TRUE, TRUE, 0);
 
-       gtk_box_pack_end(GTK_BOX(vbox), gtk_button_new_with_label("foobar"), FALSE, FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-       gtk_container_set_border_width (GTK_CONTAINER (window), 0);
        gtk_container_add(GTK_CONTAINER(window), vbox);
 
-       gtk_widget_set_size_request(window, 120, 40);
-
        gtk_widget_show_all(window);
 
        gtk_widget_realize(darea);
index c71cc44..333efcf 100644 (file)
@@ -23,6 +23,7 @@
        "audio/ogg:ogg:OGG Audio;" \
        "video/mpeg:mpg, mpeg, mpe:MPEG Video;" \
        "video/quicktime:mov:QuickTime Video;" \
+       "video/x-ms-asf:asf:Advanced Systems Format;" \
        "video/x-ms-wmv:wmv:Windows Media Video;"
 
 struct plugin_private