Prepare for direct mixer widget support
This commit is contained in:
parent
028ae3c5ec
commit
d61585b5cd
|
@ -20,7 +20,7 @@
|
|||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "mixer.h"
|
||||
#include "window.h"
|
||||
#include "../config.h"
|
||||
#define _(string) gettext(string)
|
||||
|
||||
|
@ -51,12 +51,12 @@ static int _usage(void);
|
|||
/* mixer */
|
||||
static int _mixer(char const * device, MixerLayout layout, gboolean embedded)
|
||||
{
|
||||
Mixer * mixer;
|
||||
MixerWindow * mixer;
|
||||
|
||||
if((mixer = mixer_new(device, layout, embedded)) == NULL)
|
||||
if((mixer = mixerwindow_new(device, layout, embedded)) == NULL)
|
||||
return 2;
|
||||
gtk_main();
|
||||
mixer_delete(mixer);
|
||||
mixerwindow_delete(mixer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,8 @@ static GtkWidget * _new_set(Mixer * mixer, int dev, struct audio_mixer_set * s);
|
|||
#endif
|
||||
static GtkWidget * _new_value(Mixer * mixer, int index, GtkWidget ** bbox);
|
||||
|
||||
Mixer * mixer_new(char const * device, MixerLayout layout, gboolean embedded)
|
||||
Mixer * mixer_new(GtkWidget * window, char const * device, MixerLayout layout,
|
||||
gboolean embedded)
|
||||
{
|
||||
Mixer * mixer;
|
||||
MixerProperties properties;
|
||||
|
|
|
@ -34,7 +34,8 @@ typedef struct _Mixer Mixer;
|
|||
|
||||
|
||||
/* functions */
|
||||
Mixer * mixer_new(char const * device, MixerLayout layout, gboolean embedded);
|
||||
Mixer * mixer_new(GtkWidget * window, char const * device, MixerLayout layout,
|
||||
gboolean embedded);
|
||||
void mixer_delete(Mixer * mixer);
|
||||
|
||||
/* accessors */
|
||||
|
|
|
@ -4,18 +4,21 @@ cflags_force=-W `pkg-config --cflags libDesktop`
|
|||
cflags=-Wall -g -O2 -pedantic
|
||||
ldflags_force=`pkg-config --libs libDesktop` -lintl
|
||||
ldflags=
|
||||
dist=Makefile,mixer.h,callbacks.h
|
||||
dist=Makefile,mixer.h,window.h,callbacks.h
|
||||
|
||||
[mixer]
|
||||
type=binary
|
||||
sources=mixer.c,callbacks.c,main.c
|
||||
sources=mixer.c,window.c,callbacks.c,main.c
|
||||
install=$(BINDIR)
|
||||
|
||||
[mixer.c]
|
||||
depends=callbacks.h,mixer.h,../config.h
|
||||
|
||||
[window.c]
|
||||
depends=mixer.h,window.h
|
||||
|
||||
[callbacks.c]
|
||||
depends=mixer.h,callbacks.h,../config.h
|
||||
|
||||
[main.c]
|
||||
depends=mixer.h,../config.h
|
||||
depends=mixer.h,window.h,../config.h
|
||||
|
|
114
src/window.c
Normal file
114
src/window.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2015 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mixer */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <System.h>
|
||||
#include "window.h"
|
||||
|
||||
|
||||
/* MixerWindow */
|
||||
/* private */
|
||||
/* types */
|
||||
struct _MixerWindow
|
||||
{
|
||||
Mixer * mixer;
|
||||
|
||||
/* widgets */
|
||||
GtkWidget * window;
|
||||
#ifndef EMBEDDED
|
||||
GtkWidget * menubar;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* prototypes */
|
||||
/* callbacks */
|
||||
|
||||
|
||||
/* public */
|
||||
/* functions */
|
||||
/* mixerwindow_new */
|
||||
MixerWindow * mixerwindow_new(char const * device, MixerLayout layout,
|
||||
gboolean embedded)
|
||||
{
|
||||
MixerWindow * mixer;
|
||||
GtkAccelGroup * group;
|
||||
|
||||
if((mixer = object_new(sizeof(*mixer))) == NULL)
|
||||
return NULL;
|
||||
group = gtk_accel_group_new();
|
||||
mixer->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
mixer->mixer = NULL;
|
||||
if(mixer->window != NULL)
|
||||
{
|
||||
gtk_widget_realize(mixer->window);
|
||||
mixer->mixer = mixer_new(mixer->window, device, layout,
|
||||
embedded);
|
||||
}
|
||||
if(mixer->mixer == NULL)
|
||||
{
|
||||
mixerwindow_delete(mixer);
|
||||
return NULL;
|
||||
}
|
||||
return mixer;
|
||||
}
|
||||
|
||||
|
||||
/* mixerwindow_delete */
|
||||
void mixerwindow_delete(MixerWindow * mixer)
|
||||
{
|
||||
if(mixer->mixer != NULL)
|
||||
mixer_delete(mixer->mixer);
|
||||
if(mixer->window != NULL)
|
||||
gtk_widget_destroy(mixer->window);
|
||||
object_delete(mixer);
|
||||
}
|
||||
|
||||
|
||||
/* useful */
|
||||
/* mixerwindow_about */
|
||||
void mixerwindow_about(MixerWindow * mixer)
|
||||
{
|
||||
mixer_about(mixer->mixer);
|
||||
}
|
||||
|
||||
|
||||
/* mixerwindow_properties */
|
||||
void mixerwindow_properties(MixerWindow * mixer)
|
||||
{
|
||||
mixer_properties(mixer->mixer);
|
||||
}
|
||||
|
||||
|
||||
/* mixerwindow_show */
|
||||
void mixerwindow_show(MixerWindow * mixer)
|
||||
{
|
||||
mixer_show(mixer->mixer);
|
||||
}
|
||||
|
||||
|
||||
/* mixerwindow_show_all */
|
||||
void mixerwindow_show_all(MixerWindow * mixer)
|
||||
{
|
||||
mixer_show_all(mixer->mixer);
|
||||
}
|
||||
|
||||
|
||||
/* mixerwindow_show_class */
|
||||
void mixerwindow_show_class(MixerWindow * mixer, char const * name)
|
||||
{
|
||||
mixer_show_class(mixer->mixer, name);
|
||||
}
|
43
src/window.h
Normal file
43
src/window.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2015 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Mixer */
|
||||
/* 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, version 3 of the License.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#ifndef MIXER_WINDOW_H
|
||||
# define MIXER_WINDOW_H
|
||||
|
||||
# include "mixer.h"
|
||||
|
||||
|
||||
/* MixerWindow */
|
||||
/* public */
|
||||
/* types */
|
||||
typedef struct _MixerWindow MixerWindow;
|
||||
|
||||
|
||||
/* functions */
|
||||
MixerWindow * mixerwindow_new(char const * device, MixerLayout layout,
|
||||
gboolean embedded);
|
||||
void mixerwindow_delete(MixerWindow * mixer);
|
||||
|
||||
/* useful */
|
||||
void mixerwindow_about(MixerWindow * mixer);
|
||||
void mixerwindow_properties(MixerWindow * mixer);
|
||||
|
||||
void mixerwindow_show(MixerWindow * mixer);
|
||||
void mixerwindow_show_all(MixerWindow * mixer);
|
||||
void mixerwindow_show_class(MixerWindow * mixer, char const * name);
|
||||
|
||||
#endif /* !MIXER_WINDOW_H */
|
Loading…
Reference in New Issue
Block a user