basic UI added
authorMaksym Veremeyenko <verem@m1stereo.tv>
Fri, 17 Jun 2011 10:37:20 +0000 (13:37 +0300)
committerMaksym Veremeyenko <verem@m1stereo.tv>
Fri, 17 Jun 2011 10:37:20 +0000 (13:37 +0300)
21 files changed:
pixmaps/Axialis_Team_item_add_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_add_from_library_16x16.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_block_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_delete_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_edit_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_loop_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_move_down_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_item_move_up_16x116.png [new file with mode: 0644]
pixmaps/Axialis_Team_library_refresh_16x16.png [new file with mode: 0644]
pixmaps/Axialis_Team_player_cue_32x32.png [new file with mode: 0644]
pixmaps/Axialis_Team_player_pause_32x32.png [new file with mode: 0644]
pixmaps/Axialis_Team_player_play_64x32.png [new file with mode: 0644]
pixmaps/Axialis_Team_player_stop_32x32.png [new file with mode: 0644]
pixmaps/Axialis_Team_playlist_open_16x16.png [new file with mode: 0644]
pixmaps/Axialis_Team_playlist_save_16x16.png [new file with mode: 0644]
src/Makefile.am
src/omnplay.h
src/ui.c
src/ui_buttons.c [new file with mode: 0644]
src/ui_buttons.h [new file with mode: 0644]
src/ui_utils.h [new file with mode: 0644]

diff --git a/pixmaps/Axialis_Team_item_add_16x116.png b/pixmaps/Axialis_Team_item_add_16x116.png
new file mode 100644 (file)
index 0000000..e936278
Binary files /dev/null and b/pixmaps/Axialis_Team_item_add_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_add_from_library_16x16.png b/pixmaps/Axialis_Team_item_add_from_library_16x16.png
new file mode 100644 (file)
index 0000000..597d887
Binary files /dev/null and b/pixmaps/Axialis_Team_item_add_from_library_16x16.png differ
diff --git a/pixmaps/Axialis_Team_item_block_16x116.png b/pixmaps/Axialis_Team_item_block_16x116.png
new file mode 100644 (file)
index 0000000..008cdae
Binary files /dev/null and b/pixmaps/Axialis_Team_item_block_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_delete_16x116.png b/pixmaps/Axialis_Team_item_delete_16x116.png
new file mode 100644 (file)
index 0000000..81c0758
Binary files /dev/null and b/pixmaps/Axialis_Team_item_delete_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_edit_16x116.png b/pixmaps/Axialis_Team_item_edit_16x116.png
new file mode 100644 (file)
index 0000000..1931780
Binary files /dev/null and b/pixmaps/Axialis_Team_item_edit_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_loop_16x116.png b/pixmaps/Axialis_Team_item_loop_16x116.png
new file mode 100644 (file)
index 0000000..51643ea
Binary files /dev/null and b/pixmaps/Axialis_Team_item_loop_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_move_down_16x116.png b/pixmaps/Axialis_Team_item_move_down_16x116.png
new file mode 100644 (file)
index 0000000..b80f6f6
Binary files /dev/null and b/pixmaps/Axialis_Team_item_move_down_16x116.png differ
diff --git a/pixmaps/Axialis_Team_item_move_up_16x116.png b/pixmaps/Axialis_Team_item_move_up_16x116.png
new file mode 100644 (file)
index 0000000..923d91d
Binary files /dev/null and b/pixmaps/Axialis_Team_item_move_up_16x116.png differ
diff --git a/pixmaps/Axialis_Team_library_refresh_16x16.png b/pixmaps/Axialis_Team_library_refresh_16x16.png
new file mode 100644 (file)
index 0000000..d0f3ec0
Binary files /dev/null and b/pixmaps/Axialis_Team_library_refresh_16x16.png differ
diff --git a/pixmaps/Axialis_Team_player_cue_32x32.png b/pixmaps/Axialis_Team_player_cue_32x32.png
new file mode 100644 (file)
index 0000000..8bafe99
Binary files /dev/null and b/pixmaps/Axialis_Team_player_cue_32x32.png differ
diff --git a/pixmaps/Axialis_Team_player_pause_32x32.png b/pixmaps/Axialis_Team_player_pause_32x32.png
new file mode 100644 (file)
index 0000000..095a157
Binary files /dev/null and b/pixmaps/Axialis_Team_player_pause_32x32.png differ
diff --git a/pixmaps/Axialis_Team_player_play_64x32.png b/pixmaps/Axialis_Team_player_play_64x32.png
new file mode 100644 (file)
index 0000000..b9d8900
Binary files /dev/null and b/pixmaps/Axialis_Team_player_play_64x32.png differ
diff --git a/pixmaps/Axialis_Team_player_stop_32x32.png b/pixmaps/Axialis_Team_player_stop_32x32.png
new file mode 100644 (file)
index 0000000..705169f
Binary files /dev/null and b/pixmaps/Axialis_Team_player_stop_32x32.png differ
diff --git a/pixmaps/Axialis_Team_playlist_open_16x16.png b/pixmaps/Axialis_Team_playlist_open_16x16.png
new file mode 100644 (file)
index 0000000..80008a7
Binary files /dev/null and b/pixmaps/Axialis_Team_playlist_open_16x16.png differ
diff --git a/pixmaps/Axialis_Team_playlist_save_16x16.png b/pixmaps/Axialis_Team_playlist_save_16x16.png
new file mode 100644 (file)
index 0000000..a742030
Binary files /dev/null and b/pixmaps/Axialis_Team_playlist_save_16x16.png differ
index 0e4ec86..014b1e5 100644 (file)
@@ -10,7 +10,8 @@ bin_PROGRAMS = omnplay
 omnplay_SOURCES = \
        main.c \
        support.c support.h \
-       ui.c ui.h \
+       ui.c ui.h ui_utils.h \
+       ui_buttons.c ui_buttons.h \
        omnplay.cpp omnplay.h
 
 omnplay_LDADD = @GTHREAD_LIBS@ @GTK_LIBS@ @OM_LIBS@
index 9a95c21..0d1ab64 100644 (file)
@@ -25,10 +25,36 @@ extern "C"
 {
 #endif /* __cplusplus */
 
+typedef enum control_buttons
+{
+    BUTTON_PLAYLIST_ITEM_ADD = 1,
+    BUTTON_PLAYLIST_ITEM_DEL,
+    BUTTON_PLAYLIST_ITEM_EDIT,
+
+    BUTTON_PLAYLIST_LOAD,
+    BUTTON_PLAYLIST_SAVE,
+
+    BUTTON_PLAYLIST_BLOCK_SINGLE,
+    BUTTON_PLAYLIST_BLOCK_LOOP,
+
+    BUTTON_PLAYLIST_ITEM_UP,
+    BUTTON_PLAYLIST_ITEM_DOWN,
+
+    BUTTON_PLAYER_CUE,
+    BUTTON_PLAYER_PLAY,
+    BUTTON_PLAYER_PAUSE,
+    BUTTON_PLAYER_STOP,
+
+    BUTTON_LIBRARY_ADD,
+    BUTTON_LIBRARY_REFRESH,
+
+    BUTTON_LAST
+} control_buttons_t;
 
 typedef struct omnplay_instance
 {
     GtkWidget *window;
+    GtkWidget *buttons[BUTTON_LAST + 1];
 }
 omnplay_instance_t;
 
index b7b6b83..13aafc0 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
 #include <gtk/gtk.h>
 
 #include "ui.h"
+#include "ui_utils.h"
+#include "ui_buttons.h"
 #include "support.h"
 
-#define GLADE_HOOKUP_OBJECT(component,widget,name) \
-  g_object_set_data_full (G_OBJECT (component), name, \
-    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
-
-#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
-  g_object_set_data (G_OBJECT (component), name, widget)
-
 static GtkWidget* create_label(GtkWidget* top, char* text, char* reg, GtkJustification jtype)
 {
     GtkWidget* label;
@@ -95,7 +90,6 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const char* column
 
 static GtkWidget* pane_library_grid(GtkWidget* top, omnplay_instance_t* app)
 {
-//    static const char* columns[] = {"REM", "B", "CH", "ID", "IN", "DUR", "TITLE", NULL};
     static const char* columns[] = {"ID", "DUR", "TITLE", NULL};
     GtkWidget *scrolledwindow;
 
@@ -114,13 +108,21 @@ static GtkWidget* pane_library_buttons(GtkWidget* top, omnplay_instance_t* app)
 {
     GtkWidget* hbox;
 
-    hbox = gtk_vbox_new (FALSE, 0);
+    hbox = gtk_hbox_new (FALSE, 0);
     gtk_widget_show (hbox);
 
-    /* add buttons here: */
+    /* playlist modify buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_LIBRARY_ADD),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_LIBRARY_REFRESH),
+            FALSE, FALSE, 0);
+
+    /* spacer */
     gtk_box_pack_start (GTK_BOX (hbox),
-        create_label(top, "BUTTONS HERE", NULL, GTK_JUSTIFY_LEFT),
-            FALSE, TRUE, 0);
+        create_label(top, NULL, NULL, GTK_JUSTIFY_CENTER),
+            TRUE, TRUE, 0);
 
     return hbox;
 }
@@ -131,6 +133,7 @@ static GtkWidget* pane_library(GtkWidget* top, omnplay_instance_t* app)
 
     vbox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (vbox);
+    gtk_widget_set_size_request(vbox, 300, -1);
 
     /* add buttons box */
     gtk_box_pack_start (GTK_BOX (vbox),
@@ -159,9 +162,140 @@ static GtkWidget* pane_operate_status(GtkWidget* top, omnplay_instance_t* app)
     return frame;
 }
 
+static GtkWidget* pane_operate_buttons_playlist(GtkWidget* top, omnplay_instance_t* app)
+{
+    GtkWidget* hbox;
+
+    hbox = gtk_hbox_new (FALSE, 0);
+    gtk_widget_show (hbox);
+
+    /* playlist load/save buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_LOAD),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_SAVE),
+            FALSE, FALSE, 0);
+
+    /* spacer */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        create_label(top, "   ", NULL, GTK_JUSTIFY_CENTER),
+            FALSE, FALSE, 0);
+
+    /* playlist modify buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_ITEM_ADD),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_ITEM_EDIT),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_ITEM_DEL),
+            FALSE, FALSE, 0);
+
+    /* spacer */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        create_label(top, "   ", NULL, GTK_JUSTIFY_CENTER),
+            FALSE, FALSE, 0);
+
+    /* playlist block buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_BLOCK_SINGLE),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_BLOCK_LOOP),
+            FALSE, FALSE, 0);
+
+    /* spacer */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        create_label(top, "   ", NULL, GTK_JUSTIFY_CENTER),
+            FALSE, FALSE, 0);
+
+    /* playlist move items buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_ITEM_UP),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYLIST_ITEM_DOWN),
+            FALSE, FALSE, 0);
+
+    return hbox;
+}
+
+static GtkWidget* pane_operate_grid(GtkWidget* top, omnplay_instance_t* app)
+{
+    static const char* columns[] = {"REM", "B", "CH", "ID", "IN", "DUR", "TITLE", NULL};
+    GtkWidget *scrolledwindow;
+
+    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+    gtk_widget_show (scrolledwindow);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+    gtk_container_add (GTK_CONTAINER (scrolledwindow),
+        create_treeview(top, "treeview_playlist", columns));
+
+    return scrolledwindow;
+}
+
+static GtkWidget* pane_operate_buttons_operate(GtkWidget* top, omnplay_instance_t* app)
+{
+    GtkWidget* hbox;
+
+    hbox = gtk_hbox_new (FALSE, 0);
+    gtk_widget_show (hbox);
+
+    /* spacer */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        create_label(top, NULL, NULL, GTK_JUSTIFY_CENTER),
+            TRUE, TRUE, 0);
+
+    /* playlist modify buttons */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYER_CUE),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYER_PLAY),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYER_PAUSE),
+            FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox),
+        ui_create_button(top, app, BUTTON_PLAYER_STOP),
+            FALSE, FALSE, 0);
+
+    /* spacer */
+    gtk_box_pack_start (GTK_BOX (hbox),
+        create_label(top, NULL, NULL, GTK_JUSTIFY_CENTER),
+            TRUE, TRUE, 0);
+
+    return hbox;
+}
+
 static GtkWidget* pane_operate_operate(GtkWidget* top, omnplay_instance_t* app)
 {
-    return create_label(top, "pane_operate", NULL, GTK_JUSTIFY_CENTER);
+    GtkWidget* vbox;
+
+    vbox = gtk_vbox_new (FALSE, 0);
+    gtk_widget_show (vbox);
+
+    /* add buttons box #1 */
+    gtk_box_pack_start (GTK_BOX (vbox),
+        pane_operate_buttons_playlist(top, app),
+        FALSE, FALSE, 0);
+
+    /* add buttons box */
+    gtk_box_pack_start (GTK_BOX (vbox),
+        pane_operate_grid(top, app),
+        TRUE, TRUE, 0);
+
+    /* add buttons box #1 */
+    gtk_box_pack_start (GTK_BOX (vbox),
+        pane_operate_buttons_operate(top, app),
+        FALSE, FALSE, 0);
+
+    return vbox;
+
 }
 
 static GtkWidget* pane_operate(GtkWidget* top, omnplay_instance_t* app)
@@ -192,7 +326,7 @@ static GtkWidget* pane_top(GtkWidget* top, omnplay_instance_t* app)
     pane = gtk_hpaned_new ();
     gtk_widget_show (pane);
 
-    gtk_paned_set_position (GTK_PANED (pane), 300);
+    gtk_paned_set_position (GTK_PANED (pane), 800);
 
     gtk_paned_pack1 (GTK_PANED (pane),
         pane_operate(top, app),
diff --git a/src/ui_buttons.c b/src/ui_buttons.c
new file mode 100644 (file)
index 0000000..8af9ea6
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * ui_buttons.h -- GTK+ 2 omnplay
+ * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UI_BUTTONS_H
+#define UI_BUTTONS_H
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#include "ui.h"
+#include "ui_utils.h"
+#include "ui_buttons.h"
+#include "support.h"
+
+typedef struct button_desc
+{
+    control_buttons_t id;
+    char* tooltip;
+    char* stock;
+    char* label;
+    char* hookup;
+    char* filename;
+} button_desc_t;
+
+static const button_desc_t buttons[] =
+{
+    {
+        BUTTON_PLAYLIST_ITEM_ADD,
+        "Add item to playlist",
+        NULL,
+        NULL,
+        "button_playlist_add",
+        "Axialis_Team_item_add_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_ITEM_EDIT,
+        "Edit item in playlist",
+        NULL,
+        NULL,
+        "button_playlist_edit",
+        "Axialis_Team_item_edit_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_ITEM_DEL,
+        "Delete item from playlist",
+        NULL,
+        NULL,
+        "button_playlist_del",
+        "Axialis_Team_item_delete_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_ITEM_UP,
+        "Move item ebove",
+        NULL,
+        NULL,
+        "button_playlist_up",
+        "Axialis_Team_item_move_up_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_ITEM_DOWN,
+        "Move item below",
+        NULL,
+        NULL,
+        "button_playlist_down",
+        "Axialis_Team_item_move_down_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_LOAD,
+        "Load playlist",
+        NULL,
+        NULL,
+        "button_playlist_load",
+        "Axialis_Team_playlist_open_16x16.png"
+    },
+    {
+        BUTTON_PLAYLIST_SAVE,
+        "Save playlist",
+        NULL,
+        NULL,
+        "button_playlist_load",
+        "Axialis_Team_playlist_save_16x16.png"
+    },
+    {
+        BUTTON_PLAYLIST_BLOCK_LOOP,
+        "Make a loop block",
+        NULL,
+        NULL,
+        "button_playlist_block_loop",
+        "Axialis_Team_item_loop_16x116.png"
+    },
+    {
+        BUTTON_PLAYLIST_BLOCK_SINGLE,
+        "Make a single block",
+        NULL,
+        NULL,
+        "button_playlist_block_single",
+        "Axialis_Team_item_block_16x116.png"
+    },
+    {
+        BUTTON_PLAYER_CUE,
+        "Cue block",
+        NULL,
+        NULL,
+        "button_playlist_cue",
+        "Axialis_Team_player_cue_32x32.png"
+    },
+    {
+        BUTTON_PLAYER_PLAY,
+        "Play",
+        NULL,
+        NULL,
+        "button_playlist_play",
+        "Axialis_Team_player_play_64x32.png"
+    },
+    {
+        BUTTON_PLAYER_PAUSE,
+        "Pause",
+        NULL,
+        NULL,
+        "button_playlist_pause",
+        "Axialis_Team_player_pause_32x32.png"
+    },
+    {
+        BUTTON_PLAYER_STOP,
+        "STOP",
+        NULL,
+        NULL,
+        "button_playlist_stop",
+        "Axialis_Team_player_stop_32x32.png"
+    },
+    {
+        BUTTON_LIBRARY_ADD,
+        "Add to playlist",
+        NULL,
+        NULL,
+        "button_library_add",
+        "Axialis_Team_item_add_from_library_16x16.png"
+    },
+    {
+        BUTTON_LIBRARY_REFRESH,
+        "Refresh library",
+        NULL,
+        NULL,
+        "button_library_refresh",
+        "Axialis_Team_library_refresh_16x16.png"
+    },
+
+
+    {
+        BUTTON_LAST,
+    }
+};
+
+GtkWidget* ui_create_button(GtkWidget* top, omnplay_instance_t* app, control_buttons_t id)
+{
+    int idx;
+    GtkWidget *button, *alignment, *hbox, *image = NULL, *label;
+    const button_desc_t* info = NULL;
+
+    for(idx = 0; !info && buttons[idx].id != BUTTON_LAST; idx++)
+        if(buttons[idx].id == id)
+            info = &buttons[idx];
+
+    if(!info)
+        return NULL;
+
+    button = gtk_button_new();
+    gtk_widget_show(button);
+    GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
+    GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+    gtk_button_set_relief(GTK_BUTTON (button), GTK_RELIEF_NONE);
+    if(info->tooltip)
+        gtk_widget_set_tooltip_text(button, info->tooltip);
+
+    alignment = gtk_alignment_new(0, 0.5, 0, 0);
+    gtk_widget_show(alignment);
+    gtk_container_add(GTK_CONTAINER (button), alignment);
+
+    hbox = gtk_hbox_new(FALSE, 2);
+    gtk_widget_show(hbox);
+    gtk_container_add(GTK_CONTAINER(alignment), hbox);
+
+    if(info->stock)
+        image = gtk_image_new_from_stock(info->stock, GTK_ICON_SIZE_MENU);
+    else if(info->filename)
+        image = gtk_image_new_from_pixbuf(create_pixbuf(info->filename));
+    if(image)
+    {
+        gtk_widget_show(image);
+        gtk_box_pack_start(GTK_BOX (hbox), image, FALSE, FALSE, 0);
+    }
+
+    label = gtk_label_new_with_mnemonic("");
+    if(info->label)
+        gtk_label_set_text(GTK_LABEL (label), info->label);
+    gtk_widget_show(label);
+    gtk_box_pack_start(GTK_BOX (hbox), label, FALSE, FALSE, 0);
+    gtk_label_set_justify(GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+
+    if(info->hookup)
+        GLADE_HOOKUP_OBJECT (top, button, info->hookup);
+
+    app->buttons[id] = button;
+
+    return button;
+}
+
+
+#endif /* UI_BUTTONS_H */
diff --git a/src/ui_buttons.h b/src/ui_buttons.h
new file mode 100644 (file)
index 0000000..c1123c2
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * ui_buttons.h -- GTK+ 2 omnplay
+ * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UI_BUTTONS_H
+#define UI_BUTTONS_H
+
+#include "omnplay.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+GtkWidget* ui_create_button(GtkWidget* top, omnplay_instance_t* app, control_buttons_t id);
+
+#ifdef __cplusplus
+};
+#endif /* __cplusplus */
+
+
+#endif /* UI_BUTTONS_H */
diff --git a/src/ui_utils.h b/src/ui_utils.h
new file mode 100644 (file)
index 0000000..9ebfce7
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * ui_utils.h -- GTK+ 2 omnplay
+ * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UI_UTILS_H
+#define UI_UTILS_H
+
+#define GLADE_HOOKUP_OBJECT(component,widget,name)                      \
+    g_object_set_data_full (G_OBJECT (component), name,                 \
+        gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
+
+#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name)               \
+    g_object_set_data (G_OBJECT (component), name, widget)
+
+#endif /* UI_UTILS_H */