From 888b62e244add3b4b495427cd3e789b9e4dca70e Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Tue, 26 Jun 2012 15:57:12 +0300 Subject: [PATCH] rework for newer player --- configure.in | 2 +- src/Makefile.am | 22 ++++--- src/instance.c | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/instance.h | 93 ++++++++++++++-------------- src/main.c | 24 ++++---- src/opts.c | 53 ++++------------ src/opts.h | 10 ++-- src/playlist.h | 6 ++ src/ui.c | 58 +++++++++--------- src/ui.h | 6 +- src/ui_buttons.c | 2 +- src/ui_buttons.h | 4 +- 12 files changed, 310 insertions(+), 149 deletions(-) create mode 100644 src/instance.c create mode 100644 src/playlist.h diff --git a/configure.in b/configure.in index 335daad..088795b 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(configure.in) -AM_INIT_AUTOMAKE(omnplay, 0.1) +AM_INIT_AUTOMAKE(melted_gui, 0.1) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/src/Makefile.am b/src/Makefile.am index 9f3edd4..9e6d5ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,18 +5,20 @@ INCLUDES = \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ @GTHREAD_CFLAGS@ @GTK_CFLAGS@ @OM_CFLAGS@ @CURL_CFLAGS@ -bin_PROGRAMS = omnplay +bin_PROGRAMS = melted_gui -omnplay_SOURCES = \ - main.c \ +melted_gui_SOURCES = \ + timecode.c timecode.h \ support.c support.h \ + main.c \ + instance.c instance.h \ ui.c ui.h ui_utils.h \ ui_buttons.c ui_buttons.h \ - opts.c opts.h \ - playlist.c \ - library.c \ - whois.c \ - timecode.c timecode.h \ - omnplay.cpp omnplay.h + opts.c opts.h +# \ +# playlist.c \ +# library.c \ +# whois.c \ +# omnplay.cpp omnplay.h -omnplay_LDADD = @GTHREAD_LIBS@ @GTK_LIBS@ @OM_LIBS@ @CURL_LIBS@ -lpthread +melted_gui_LDADD = @GTHREAD_LIBS@ @GTK_LIBS@ @OM_LIBS@ @CURL_LIBS@ -lpthread diff --git a/src/instance.c b/src/instance.c new file mode 100644 index 0000000..62d955b --- /dev/null +++ b/src/instance.c @@ -0,0 +1,179 @@ +/* + * instance.c -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko + * + * 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 _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "instance.h" +#include "ui.h" +#include "opts.h" +#include "timecode.h" + +static gboolean on_main_window_delete_event( GtkWidget *widget, GdkEvent *event, gpointer user_data ) +{ + g_print ("delete event occurred [start]\n"); + gdk_threads_leave(); + instance_release((instance_t*)user_data); + gdk_threads_enter(); + g_print ("delete event occurred [finish]\n"); + + return FALSE; +} + +static void on_main_window_destroy( GtkWidget *widget, gpointer user_data ) +{ + g_print ("destroy occurred\n"); + gtk_main_quit(); +} + +instance_t* instance_create(int argc, char** argv) +{ + int i, c; + instance_t* app; + + /* prepare application instance */ + app = (instance_t*)malloc(sizeof(instance_t)); + memset(app, 0, sizeof(instance_t)); + + /* load parameters from command line */ + if(!instance_opt(argc, argv, app) && app->players.count) + app->window = ui_create(app); + else + instance_usage(); + + return app; +}; + +void instance_destroy(instance_t* app) +{ + free(app); +}; + +void instance_init(instance_t* app) +{ + int i; + pthread_mutexattr_t attr; + + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + + gtk_signal_connect( GTK_OBJECT( app->window ), "delete-event", + GTK_SIGNAL_FUNC(on_main_window_delete_event), app); + + gtk_signal_connect( GTK_OBJECT( app->window ), "destroy", + GTK_SIGNAL_FUNC(on_main_window_destroy), app); + +#if 0 + gtk_widget_add_events(app->playlist_grid, GDK_BUTTON_PRESS_MASK); + gtk_widget_add_events(app->playlist_grid, GDK_KEY_PRESS_MASK); + gtk_signal_connect(GTK_OBJECT(app->playlist_grid), "key-press-event", + GTK_SIGNAL_FUNC(on_playlist_grid_key), app); + + gtk_widget_add_events(app->library_grid, GDK_BUTTON_PRESS_MASK); + gtk_widget_add_events(app->library_grid, GDK_KEY_PRESS_MASK); + gtk_signal_connect(GTK_OBJECT(app->library_grid), "key-press-event", + GTK_SIGNAL_FUNC(on_library_grid_key), app); + + gtk_signal_connect(GTK_OBJECT(app->playlist_grid), "button-press-event", + GTK_SIGNAL_FUNC(on_playlist_grid_button), app); + + gtk_signal_connect(GTK_OBJECT(app->library_grid), "button-press-event", + GTK_SIGNAL_FUNC(on_library_grid_button), app); +#endif + + /* create lock */ + pthread_mutex_init(&app->players.lock, &attr); + pthread_mutex_init(&app->playlist.lock, &attr); + pthread_mutex_init(&app->library.lock, &attr); + pthread_mutexattr_destroy(&attr); + +#if 0 + /* create a status thread */ + for(i = 0; i < app->players.count; i++) + app->players.item[i].thread = g_thread_create( + omnplay_thread_proc, &app->players.item[i], TRUE, NULL); + + /* attach buttons click */ + for(i = 1; i < BUTTON_LAST; i++) + gtk_signal_connect(GTK_OBJECT(app->buttons[i]), "clicked", + GTK_SIGNAL_FUNC( on_button_click), app ); + + /* load library */ + omnplay_library_load(app); +#endif + +#if 0 + /* setup drag n drop source/target */ + static GtkTargetEntry drag_targets[] = { { (char*) "application/playlist_item_t", 0, 0 } }; + + gtk_drag_source_set(app->library_grid, GDK_BUTTON1_MASK, + drag_targets, 1, (GdkDragAction)(GDK_ACTION_COPY)); + + gtk_drag_source_set(app->playlist_grid, GDK_BUTTON1_MASK, + drag_targets, 1, (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE)); + + gtk_drag_dest_set(app->playlist_grid, (GtkDestDefaults)(GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP), + drag_targets, 1, (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE)); + + g_signal_connect (app->library_grid, "drag_data_get", G_CALLBACK(library_grid_drag_data_get_cb), app); + g_signal_connect (app->playlist_grid, "drag_data_get", G_CALLBACK(playlist_grid_drag_data_get_cb), app); + g_signal_connect (app->library_grid, "drag_begin", G_CALLBACK(library_grid_drag_begin_cb), app); + g_signal_connect (app->playlist_grid, "drag_begin", G_CALLBACK(playlist_grid_drag_begin_cb), app); + g_signal_connect (app->playlist_grid, "drag_data_received", G_CALLBACK (playlist_grid_drag_data_received), app); + g_signal_connect (app->playlist_grid, "drag_data_delete", G_CALLBACK (playlist_grid_drag_data_delete), app); + g_signal_connect (app->playlist_grid, "drag_motion", G_CALLBACK (playlist_grid_drag_motion), app); +#endif +}; + +void instance_release(instance_t* app) +{ + int i; + + app->f_exit = 1; + + for(i = 0; i < app->players.count; i++) + /* create a omneon status thread */ + g_thread_join(app->players.item[i].thread); + + /* destroy lock */ + pthread_mutex_destroy(&app->players.lock); + + /* destroy lock */ + pthread_mutex_destroy(&app->playlist.lock); + +#if 0 + /* load library */ + omnplay_library_save(app); +#endif + + /* destroy library lock */ + pthread_mutex_destroy(&app->library.lock); +}; diff --git a/src/instance.h b/src/instance.h index 22e2dff..8cd0378 100644 --- a/src/instance.h +++ b/src/instance.h @@ -1,6 +1,6 @@ /* - * omnplay.h -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * omnplay.h -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * 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 @@ -17,8 +17,8 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef OMNPLAY_H -#define OMNPLAY_H +#ifndef INSTANCE_H +#define INSTANCE_H #include @@ -27,6 +27,8 @@ extern "C" { #endif /* __cplusplus */ +#define PRODUCT_NAME "Melted GUI" + typedef enum control_buttons { BUTTON_PLAYLIST_ITEM_ADD = 1, @@ -58,37 +60,37 @@ typedef enum control_buttons BUTTON_LAST } control_buttons_t; -#define OMNPLAY_PLAYLIST_BLOCK_BEGIN 1 -#define OMNPLAY_PLAYLIST_BLOCK_BODY 0 -#define OMNPLAY_PLAYLIST_BLOCK_END 2 -#define OMNPLAY_PLAYLIST_BLOCK_LOOP 4 +#define PLAYLIST_BLOCK_BEGIN 1 +#define PLAYLIST_BLOCK_BODY 0 +#define PLAYLIST_BLOCK_END 2 +#define PLAYLIST_BLOCK_LOOP 4 typedef enum playlist_item_type { // 1 - OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN, + PLAYLIST_ITEM_BLOCK_BEGIN = PLAYLIST_BLOCK_BEGIN, // 0 - OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY, + PLAYLIST_ITEM_BLOCK_BODY = PLAYLIST_BLOCK_BODY, // 2 - OMNPLAY_PLAYLIST_ITEM_BLOCK_END = OMNPLAY_PLAYLIST_BLOCK_END, + PLAYLIST_ITEM_BLOCK_END = PLAYLIST_BLOCK_END, // 3 - OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE = OMNPLAY_PLAYLIST_BLOCK_BEGIN | - OMNPLAY_PLAYLIST_BLOCK_BODY | - OMNPLAY_PLAYLIST_BLOCK_END, + PLAYLIST_ITEM_BLOCK_SINGLE = PLAYLIST_BLOCK_BEGIN | + PLAYLIST_BLOCK_BODY | + PLAYLIST_BLOCK_END, // 5 - OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN | - OMNPLAY_PLAYLIST_BLOCK_LOOP, + PLAYLIST_ITEM_LOOP_BEGIN = PLAYLIST_BLOCK_BEGIN | + PLAYLIST_BLOCK_LOOP, // 4 - OMNPLAY_PLAYLIST_ITEM_LOOP_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY | - OMNPLAY_PLAYLIST_BLOCK_LOOP, + PLAYLIST_ITEM_LOOP_BODY = PLAYLIST_BLOCK_BODY | + PLAYLIST_BLOCK_LOOP, // 6 - OMNPLAY_PLAYLIST_ITEM_LOOP_END = OMNPLAY_PLAYLIST_BLOCK_END | - OMNPLAY_PLAYLIST_BLOCK_LOOP, + PLAYLIST_ITEM_LOOP_END = PLAYLIST_BLOCK_END | + PLAYLIST_BLOCK_LOOP, // 7 - OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE = OMNPLAY_PLAYLIST_BLOCK_BEGIN | - OMNPLAY_PLAYLIST_BLOCK_BODY | - OMNPLAY_PLAYLIST_BLOCK_END | - OMNPLAY_PLAYLIST_BLOCK_LOOP, + PLAYLIST_ITEM_LOOP_SINGLE = PLAYLIST_BLOCK_BEGIN | + PLAYLIST_BLOCK_BODY | + PLAYLIST_BLOCK_END | + PLAYLIST_BLOCK_LOOP, } playlist_item_type_t; #define MAX_PLAYLIST_ITEMS 1024 @@ -112,22 +114,22 @@ typedef struct playlist_item #define MAX_PLAYERS 4 -struct omnplay_instance; +struct instance_desc; -typedef struct omnplay_player +typedef struct player_desc { int idx; - char name[PATH_MAX]; - char host[PATH_MAX]; +// char name[PATH_MAX]; + int unit; void* handle; GThread* thread; GtkWidget *label_status, *label_state, *label_tc_cur, *label_tc_rem, *label_clip; - struct omnplay_instance *app; + struct instance_desc *app; int playlist_start; int playlist_length; -} omnplay_player_t; +} player_t; -typedef struct omnplay_instance +typedef struct instance_desc { GtkWidget *window; GtkWidget *playlist_grid; @@ -136,9 +138,9 @@ typedef struct omnplay_instance GtkWidget *status_label; struct { - omnplay_player_t item[MAX_PLAYERS]; + player_t item[MAX_PLAYERS]; int count; - char path[PATH_MAX]; + char host[PATH_MAX]; pthread_mutex_t lock; } players; int f_exit; @@ -169,22 +171,19 @@ typedef struct omnplay_instance playlist_item_t item[MAX_LIBRARY_ITEMS]; int count; } clipboard; -} omnplay_instance_t; - -omnplay_instance_t* omnplay_create(int argc, char** argv); -void omnplay_init(omnplay_instance_t* app); -void omnplay_release(omnplay_instance_t* app); -void omnplay_destroy(omnplay_instance_t* app); -void omnplay_playlist_load(omnplay_instance_t* app); -void omnplay_playlist_save(omnplay_instance_t* app); -void omnplay_playlist_relink(omnplay_instance_t* app); -void omnplay_playlist_draw(omnplay_instance_t* app); -void omnplay_playlist_draw_item(omnplay_instance_t* app, int idx); -void omnplay_playlist_draw_item_rem(omnplay_instance_t* app, int idx, char* rem); +} instance_t; + +instance_t* instance_create(int argc, char** argv); +void instance_init(instance_t* app); +void instance_release(instance_t* app); +void instance_destroy(instance_t* app); + +#if 0 void omnplay_library_load(omnplay_instance_t* app); void omnplay_library_save(omnplay_instance_t* app); void omnplay_library_refresh(omnplay_instance_t* app); void omnplay_library_draw(omnplay_instance_t* app); + typedef void (*omnplay_get_content_cb_proc)(omnplay_instance_t* app, playlist_item_t *items, void* data); int omnplay_get_content(omnplay_instance_t* app, playlist_item_t *items, int limit, omnplay_get_content_cb_proc proc, void* data); @@ -199,8 +198,10 @@ void omnplay_library_search(omnplay_instance_t* app, int next); void omnplay_set_status(omnplay_instance_t* app, char* str); int* omnplay_selected_idxs_playlist(omnplay_instance_t* app); +#endif + #ifdef __cplusplus }; #endif /* __cplusplus */ -#endif /* OMNPLAY_H */ +#endif /* INSTANCE_H */ diff --git a/src/main.c b/src/main.c index a6ce43d..5d7c6a3 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* - * main.c -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * main.c -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * 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 @@ -31,7 +31,7 @@ #include #include "ui.h" -#include "omnplay.h" +#include "instance.h" #include "support.h" #ifdef _WIN32 @@ -62,7 +62,7 @@ char *strcasestr(char *haystack, char *needle) int main(int argc, char **argv) { char path[ 512 ], *buf; - omnplay_instance_t *app = NULL; + instance_t *app = NULL; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); @@ -79,21 +79,21 @@ int main(int argc, char **argv) #ifdef _WIN32 GetModuleFileName(NULL, path, sizeof(path)); // g_warning("GetModuleFileName [%s]\n", path); - if((buf = strstr(path, "\\bin\\omnplay.exe"))) + if((buf = strstr(path, "\\bin\\" PACKAGE ".exe"))) { buf[0] = 0; - strcat(path, "\\share\\omnplay\\pixmaps"); + strcat(path, "\\share\\" PACKAGE "\\pixmaps"); } #else // Linux hack to determine path of the executable readlink( "/proc/self/exe", path, sizeof(path)); g_warning ("path=(%s)\n", path); - if((buf = strstr(path, "/bin/omnplay"))) + if((buf = strstr(path, "/bin/" PACKAGE))) { buf[0] = 0; - strcat(path, "/share/omnplay/pixmaps"); + strcat(path, "/share/" PACKAGE "/pixmaps"); } - else if((buf = strstr(path, "/src/omnplay"))) + else if((buf = strstr(path, "/src/" PACKAGE))) { buf[0] = 0; strcat( path, "/pixmaps" ); @@ -105,18 +105,18 @@ int main(int argc, char **argv) add_pixmap_directory( path ); g_warning ("add_pixmap_directory(%s)\n", path); - app = omnplay_create(argc, argv); + app = instance_create(argc, argv); if(app->window) { gtk_widget_show (app->window); gdk_threads_enter(); - omnplay_init(app); + instance_init(app); gtk_main (); gdk_threads_leave(); }; - omnplay_destroy(app); + instance_destroy(app); return 0; } diff --git a/src/opts.c b/src/opts.c index 4ae9206..e993080 100644 --- a/src/opts.c +++ b/src/opts.c @@ -1,6 +1,6 @@ /* - * opts.c -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * opts.c -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * 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 @@ -33,18 +33,15 @@ static const char short_options [] = "h"; static const struct option long_options [] = { - { "directory", required_argument, NULL, '0'}, + { "host", required_argument, NULL, '0'}, { "player", required_argument, NULL, '1'}, - { "library", required_argument, NULL, '2'}, - { "whois", required_argument, NULL, '3'}, - { "id-display-rate", required_argument, NULL, '4'}, { "help", no_argument, NULL, 'h'}, { 0, 0, 0, 0} }; -int omnplay_opt(int argc, char** argv, omnplay_instance_t* app) +int instance_opt(int argc, char** argv, instance_t* app) { char* p; int c, index = 0; @@ -66,38 +63,17 @@ int omnplay_opt(int argc, char** argv, omnplay_instance_t* app) { case 0: break; - /** --direcotry */ + /** --host */ case '0': - strncpy(app->players.path, optarg, PATH_MAX); + strncpy(app->players.host, optarg, PATH_MAX); break; /** --player */ case '1': - p = strchr(optarg, '@'); - if(p) - { - *p = 0; - strncpy(app->players.item[app->players.count].name, optarg, PATH_MAX); - strncpy(app->players.item[app->players.count].host, p + 1, PATH_MAX); - app->players.item[app->players.count].idx = app->players.count; - app->players.item[app->players.count].app = app; - app->players.count++; - }; - break; - - /** --library */ - case '2': - strncpy(app->library.filename, optarg, PATH_MAX); - break; - - /** --whois */ - case '3': - strncpy(app->library.whois, optarg, PATH_MAX); - break; - - /** --id-display-rate */ - case '4': - app->library.id_display_rate = atol(optarg); + app->players.item[app->players.count].unit = atol(optarg); + app->players.item[app->players.count].idx = app->players.count; + app->players.item[app->players.count].app = app; + app->players.count++; break; default: @@ -110,16 +86,13 @@ int omnplay_opt(int argc, char** argv, omnplay_instance_t* app) return 0; }; -void omnplay_usage(void) +void instance_usage(void) { fprintf ( stderr, "Usage:\n" - "\t--directory= Directory to override default\n" - "\t--player= Player to use in a form @\n" - "\t--whois= Whois service URL\n" - "\t--library= File used for library storage\n" - "\t--id-display-rate= Rate of id displaying during server content requesting\n" + "\t--host= Host name of melted server\n" + "\t--player= Player to use (e.g. unit number)\n" ); }; diff --git a/src/opts.h b/src/opts.h index 3fd8ffd..83e0b1f 100644 --- a/src/opts.h +++ b/src/opts.h @@ -1,6 +1,6 @@ /* - * opts.h -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * opts.h -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * 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 @@ -20,15 +20,15 @@ #ifndef OPTS_H #define OPTS_H -#include "omnplay.h" +#include "instance.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -int omnplay_opt(int argc, char** argv, omnplay_instance_t* app); -void omnplay_usage(); +int instance_opt(int argc, char** argv, instance_t* app); +void instance_usage(); #ifdef __cplusplus }; diff --git a/src/playlist.h b/src/playlist.h new file mode 100644 index 0000000..9a9ac58 --- /dev/null +++ b/src/playlist.h @@ -0,0 +1,6 @@ +void omnplay_playlist_load(omnplay_instance_t* app); +void omnplay_playlist_save(omnplay_instance_t* app); +void omnplay_playlist_relink(omnplay_instance_t* app); +void omnplay_playlist_draw(omnplay_instance_t* app); +void omnplay_playlist_draw_item(omnplay_instance_t* app, int idx); +void omnplay_playlist_draw_item_rem(omnplay_instance_t* app, int idx, char* rem); diff --git a/src/ui.c b/src/ui.c index ef4311f..c3d75d2 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1,6 +1,6 @@ /* - * ui.c -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * ui.c -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * 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 @@ -192,7 +192,7 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_ return treeview; }; -static GtkWidget* pane_library_grid(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_library_grid(GtkWidget* top, instance_t* app) { GtkWidget *scrolledwindow; @@ -207,7 +207,7 @@ static GtkWidget* pane_library_grid(GtkWidget* top, omnplay_instance_t* app) return scrolledwindow; } -static GtkWidget* pane_library_buttons(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_library_buttons(GtkWidget* top, instance_t* app) { GtkWidget* hbox; @@ -230,7 +230,7 @@ static GtkWidget* pane_library_buttons(GtkWidget* top, omnplay_instance_t* app) return hbox; } -static GtkWidget* pane_library_search_buttons(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_library_search_buttons(GtkWidget* top, instance_t* app) { GtkWidget* hbox; @@ -254,7 +254,7 @@ static GtkWidget* pane_library_search_buttons(GtkWidget* top, omnplay_instance_t return hbox; } -static GtkWidget* pane_library(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_library(GtkWidget* top, instance_t* app) { GtkWidget* vbox; @@ -280,17 +280,17 @@ static GtkWidget* pane_library(GtkWidget* top, omnplay_instance_t* app) return vbox; } -static GtkWidget* create_channel_status(GtkWidget* top, omnplay_instance_t* app, int idx) +static GtkWidget* create_channel_status(GtkWidget* top, instance_t* app, int idx) { GtkWidget* vbox; GtkWidget* hbox; GtkWidget* frame; char name[PATH_MAX]; - omnplay_player_t* player; + player_t* player; player = &app->players.item[idx]; - snprintf(name, sizeof(name), "%c [%s]", idx + 'A', player->name); + snprintf(name, sizeof(name), "unit %d [%c]", player->unit, idx + 'A'); frame = gtk_frame_new(name); gtk_widget_show(frame); @@ -353,7 +353,7 @@ static GtkWidget* create_channel_status(GtkWidget* top, omnplay_instance_t* app, return frame; } -static GtkWidget* pane_operate_status(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate_status(GtkWidget* top, instance_t* app) { int i; GtkWidget* vbox; @@ -382,7 +382,7 @@ static GtkWidget* pane_operate_status(GtkWidget* top, omnplay_instance_t* app) return vbox; } -static GtkWidget* pane_operate_buttons_playlist(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate_buttons_playlist(GtkWidget* top, instance_t* app) { GtkWidget* hbox; @@ -452,7 +452,7 @@ static GtkWidget* pane_operate_buttons_playlist(GtkWidget* top, omnplay_instance return hbox; } -static GtkWidget* pane_operate_grid(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate_grid(GtkWidget* top, instance_t* app) { GtkWidget *scrolledwindow; @@ -467,7 +467,7 @@ static GtkWidget* pane_operate_grid(GtkWidget* top, omnplay_instance_t* app) return scrolledwindow; } -static GtkWidget* pane_operate_buttons_operate(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate_buttons_operate(GtkWidget* top, instance_t* app) { GtkWidget* hbox; @@ -501,7 +501,7 @@ static GtkWidget* pane_operate_buttons_operate(GtkWidget* top, omnplay_instance_ return hbox; } -static GtkWidget* pane_operate_operate(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate_operate(GtkWidget* top, instance_t* app) { GtkWidget* vbox; @@ -527,7 +527,7 @@ static GtkWidget* pane_operate_operate(GtkWidget* top, omnplay_instance_t* app) } -static GtkWidget* pane_operate(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_operate(GtkWidget* top, instance_t* app) { GtkWidget* hbox; @@ -548,7 +548,7 @@ static GtkWidget* pane_operate(GtkWidget* top, omnplay_instance_t* app) }; -static GtkWidget* pane_top(GtkWidget* top, omnplay_instance_t* app) +static GtkWidget* pane_top(GtkWidget* top, instance_t* app) { GtkWidget* pane; @@ -568,15 +568,15 @@ static GtkWidget* pane_top(GtkWidget* top, omnplay_instance_t* app) return pane; } -GtkWidget* ui_omnplay (omnplay_instance_t* app) +GtkWidget* ui_create(instance_t* app) { GtkWidget *wnd; GtkWidget* vbox; wnd = gtk_window_new (GTK_WINDOW_TOPLEVEL); - GLADE_HOOKUP_OBJECT_NO_REF (wnd, wnd, "omnplay_window"); + GLADE_HOOKUP_OBJECT_NO_REF (wnd, wnd, PACKAGE "_window"); - gtk_window_set_title (GTK_WINDOW (wnd), _("Omneon Player")); + gtk_window_set_title (GTK_WINDOW (wnd), _(PRODUCT_NAME)); gtk_window_set_default_size (GTK_WINDOW (wnd), 1024, 768); vbox = gtk_vbox_new(FALSE, 0); @@ -588,30 +588,30 @@ GtkWidget* ui_omnplay (omnplay_instance_t* app) pane_top(wnd, app), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), - app->status_label = create_label(wnd, "omnplay started", NULL, GTK_JUSTIFY_LEFT), + app->status_label = create_label(wnd, "started", NULL, GTK_JUSTIFY_LEFT), FALSE, FALSE, 0); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN] = + app->playlist.block_icons[PLAYLIST_ITEM_BLOCK_BEGIN] = create_pixbuf("block_type_block_start_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY] = + app->playlist.block_icons[PLAYLIST_ITEM_BLOCK_BODY] = create_pixbuf("block_type_block_middle_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_END] = + app->playlist.block_icons[PLAYLIST_ITEM_BLOCK_END] = create_pixbuf("block_type_block_end_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE] = + app->playlist.block_icons[PLAYLIST_ITEM_BLOCK_SINGLE] = create_pixbuf("block_type_block_single_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN] = + app->playlist.block_icons[PLAYLIST_ITEM_LOOP_BEGIN] = create_pixbuf("block_type_loop_start_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_BODY] = + app->playlist.block_icons[PLAYLIST_ITEM_LOOP_BODY] = create_pixbuf("block_type_loop_middle_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_END] = + app->playlist.block_icons[PLAYLIST_ITEM_LOOP_END] = create_pixbuf("block_type_loop_end_16x16.png"); - app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE] = + app->playlist.block_icons[PLAYLIST_ITEM_LOOP_SINGLE] = create_pixbuf("block_type_block_loop_16x16.png"); return wnd; } -int ui_playlist_item_dialog(omnplay_instance_t* app, playlist_item_t* item) +int ui_playlist_item_dialog(instance_t* app, playlist_item_t* item) { int r, c; char tc[32]; diff --git a/src/ui.h b/src/ui.h index 0e313a1..475400d 100644 --- a/src/ui.h +++ b/src/ui.h @@ -20,15 +20,15 @@ #ifndef UI_H #define UI_H -#include "omnplay.h" +#include "instance.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -GtkWidget* ui_omnplay(omnplay_instance_t* app); -int ui_playlist_item_dialog(omnplay_instance_t* app, playlist_item_t* item); +GtkWidget* ui_create(instance_t* app); +//int ui_playlist_item_dialog(omnplay_instance_t* app, playlist_item_t* item); #ifdef __cplusplus }; diff --git a/src/ui_buttons.c b/src/ui_buttons.c index e3022cf..810c6b7 100644 --- a/src/ui_buttons.c +++ b/src/ui_buttons.c @@ -200,7 +200,7 @@ static const button_desc_t buttons[] = } }; -GtkWidget* ui_create_button(GtkWidget* top, omnplay_instance_t* app, control_buttons_t id) +GtkWidget* ui_create_button(GtkWidget* top, instance_t* app, control_buttons_t id) { int idx; GtkWidget *button, *alignment, *hbox, *image = NULL, *label; diff --git a/src/ui_buttons.h b/src/ui_buttons.h index c1123c2..c5b856d 100644 --- a/src/ui_buttons.h +++ b/src/ui_buttons.h @@ -20,14 +20,14 @@ #ifndef UI_BUTTONS_H #define UI_BUTTONS_H -#include "omnplay.h" +#include "instance.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -GtkWidget* ui_create_button(GtkWidget* top, omnplay_instance_t* app, control_buttons_t id); +GtkWidget* ui_create_button(GtkWidget* top, instance_t* app, control_buttons_t id); #ifdef __cplusplus }; -- 1.7.4.4