Implemented an embedded mode
This commit is contained in:
parent
fdc139a0c1
commit
43d3fbeec1
24
po/fr.po
24
po/fr.po
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Mixer 0.0.1\n"
|
"Project-Id-Version: Mixer 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2012-03-12 12:17-0600\n"
|
"POT-Creation-Date: 2012-03-21 02:15+0100\n"
|
||||||
"PO-Revision-Date: 2010-04-23 04:08+0200\n"
|
"PO-Revision-Date: 2010-04-23 04:08+0200\n"
|
||||||
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
||||||
"Language-Team: French\n"
|
"Language-Team: French\n"
|
||||||
|
@ -18,17 +18,19 @@ msgstr ""
|
||||||
|
|
||||||
#: ../src/main.c:44
|
#: ../src/main.c:44
|
||||||
msgid ""
|
msgid ""
|
||||||
"Usage: mixer [-H|-T|-V][-d device]\n"
|
"Usage: mixer [-H|-T|-V][-d device][-x]\n"
|
||||||
" -H\tShow the classes next to each other\n"
|
" -H\tShow the classes next to each other\n"
|
||||||
" -V\tShow the classes in separate tabs\n"
|
" -V\tShow the classes in separate tabs\n"
|
||||||
" -V\tShow the classes on top of each other\n"
|
" -V\tShow the classes on top of each other\n"
|
||||||
" -d\tThe mixer device to use\n"
|
" -d\tThe mixer device to use\n"
|
||||||
|
" -x\tEnable embedded mode\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Usage: mixer [-H|-T|-V][-d périphérique]\n"
|
"Usage: mixer [-H|-T|-V][-d périphérique][-x]\n"
|
||||||
" -H\tAffichage horizontal des catégories\n"
|
" -H\tAffichage horizontal des catégories\n"
|
||||||
" -T\tAffichage en tabs des catégories\n"
|
" -T\tAffichage en tabs des catégories\n"
|
||||||
" -V\tAffichage vertical des catégories\n"
|
" -V\tAffichage vertical des catégories\n"
|
||||||
" -d\tChoix du périphérique sonore\n"
|
" -d\tChoix du périphérique sonore\n"
|
||||||
|
" -x\tActiver le mode embarqué\n"
|
||||||
|
|
||||||
#: ../src/mixer.c:140
|
#: ../src/mixer.c:140
|
||||||
msgid "_Properties"
|
msgid "_Properties"
|
||||||
|
@ -86,35 +88,35 @@ msgstr "_Vue"
|
||||||
msgid "_Help"
|
msgid "_Help"
|
||||||
msgstr "_Aide"
|
msgstr "_Aide"
|
||||||
|
|
||||||
#: ../src/mixer.c:314
|
#: ../src/mixer.c:331
|
||||||
msgid "All"
|
msgid "All"
|
||||||
msgstr "Tous"
|
msgstr "Tous"
|
||||||
|
|
||||||
#: ../src/mixer.c:545
|
#: ../src/mixer.c:565
|
||||||
msgid "Mute"
|
msgid "Mute"
|
||||||
msgstr "Muet"
|
msgstr "Muet"
|
||||||
|
|
||||||
#: ../src/mixer.c:616
|
#: ../src/mixer.c:636
|
||||||
msgid "Bind"
|
msgid "Bind"
|
||||||
msgstr "Lier"
|
msgstr "Lier"
|
||||||
|
|
||||||
#: ../src/mixer.c:777
|
#: ../src/mixer.c:797
|
||||||
msgid "translator-credits"
|
msgid "translator-credits"
|
||||||
msgstr "Pierre Pronchery <khorben@defora.org>"
|
msgstr "Pierre Pronchery <khorben@defora.org>"
|
||||||
|
|
||||||
#: ../src/mixer.c:810
|
#: ../src/mixer.c:830
|
||||||
msgid "Mixer properties"
|
msgid "Mixer properties"
|
||||||
msgstr "Propriétés du mixer"
|
msgstr "Propriétés du mixer"
|
||||||
|
|
||||||
#: ../src/mixer.c:826
|
#: ../src/mixer.c:846
|
||||||
msgid "Name: "
|
msgid "Name: "
|
||||||
msgstr "Nom : "
|
msgstr "Nom : "
|
||||||
|
|
||||||
#: ../src/mixer.c:836
|
#: ../src/mixer.c:856
|
||||||
msgid "Version: "
|
msgid "Version: "
|
||||||
msgstr "Version : "
|
msgstr "Version : "
|
||||||
|
|
||||||
#: ../src/mixer.c:846
|
#: ../src/mixer.c:866
|
||||||
msgid "Device: "
|
msgid "Device: "
|
||||||
msgstr "Carte : "
|
msgstr "Carte : "
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2010,2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2010-2012 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop Mixer */
|
/* This file is part of DeforaOS Desktop Mixer */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -38,6 +38,15 @@ gboolean on_closex(gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* on_embedded */
|
||||||
|
void on_embedded(gpointer data)
|
||||||
|
{
|
||||||
|
Mixer * mixer = data;
|
||||||
|
|
||||||
|
mixer_show(mixer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* file menu */
|
/* file menu */
|
||||||
/* on_file_properties */
|
/* on_file_properties */
|
||||||
void on_file_properties(gpointer data)
|
void on_file_properties(gpointer data)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2009-2010,2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009-2012 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop Mixer */
|
/* This file is part of DeforaOS Desktop Mixer */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
gboolean on_closex(gpointer data);
|
gboolean on_closex(gpointer data);
|
||||||
|
void on_embedded(gpointer data);
|
||||||
|
|
||||||
/* menubar */
|
/* menubar */
|
||||||
void on_file_properties(gpointer data);
|
void on_file_properties(gpointer data);
|
||||||
|
|
13
src/main.c
13
src/main.c
|
@ -41,11 +41,12 @@
|
||||||
/* usage */
|
/* usage */
|
||||||
static int _usage(void)
|
static int _usage(void)
|
||||||
{
|
{
|
||||||
fputs(_("Usage: mixer [-H|-T|-V][-d device]\n"
|
fputs(_("Usage: mixer [-H|-T|-V][-d device][-x]\n"
|
||||||
" -H Show the classes next to each other\n"
|
" -H Show the classes next to each other\n"
|
||||||
" -V Show the classes in separate tabs\n"
|
" -V Show the classes in separate tabs\n"
|
||||||
" -V Show the classes on top of each other\n"
|
" -V Show the classes on top of each other\n"
|
||||||
" -d The mixer device to use\n"), stderr);
|
" -d The mixer device to use\n"
|
||||||
|
" -x Enable embedded mode\n"), stderr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,12 +57,13 @@ int main(int argc, char * argv[])
|
||||||
int o;
|
int o;
|
||||||
char const * device = NULL;
|
char const * device = NULL;
|
||||||
MixerLayout ml = ML_TABBED;
|
MixerLayout ml = ML_TABBED;
|
||||||
|
gboolean embedded = FALSE;
|
||||||
Mixer * mixer;
|
Mixer * mixer;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
while((o = getopt(argc, argv, "HTVd:")) != -1)
|
while((o = getopt(argc, argv, "HTVd:x")) != -1)
|
||||||
switch(o)
|
switch(o)
|
||||||
{
|
{
|
||||||
case 'H':
|
case 'H':
|
||||||
|
@ -76,13 +78,16 @@ int main(int argc, char * argv[])
|
||||||
case 'd':
|
case 'd':
|
||||||
device = optarg;
|
device = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
embedded = TRUE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return _usage();
|
return _usage();
|
||||||
}
|
}
|
||||||
if(optind != argc)
|
if(optind != argc)
|
||||||
return _usage();
|
return _usage();
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
if((mixer = mixer_new(device, ml)) == NULL)
|
if((mixer = mixer_new(device, ml, embedded)) == NULL)
|
||||||
return 2;
|
return 2;
|
||||||
gtk_main();
|
gtk_main();
|
||||||
mixer_delete(mixer);
|
mixer_delete(mixer);
|
||||||
|
|
95
src/mixer.c
95
src/mixer.c
|
@ -185,9 +185,12 @@ static const DesktopMenubar _mixer_menubar[] =
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static int _mixer_error(Mixer * mixer, char const * message, int ret);
|
static int _mixer_error(Mixer * mixer, char const * message, int ret);
|
||||||
|
/* accessors */
|
||||||
static int _mixer_get_control(Mixer * mixer, int index, MixerControl * control);
|
static int _mixer_get_control(Mixer * mixer, int index, MixerControl * control);
|
||||||
static int _mixer_get_properties(Mixer * mixer, MixerProperties * properties);
|
static int _mixer_get_properties(Mixer * mixer, MixerProperties * properties);
|
||||||
static int _mixer_set_control(Mixer * mixer, int index, MixerControl * control);
|
static int _mixer_set_control(Mixer * mixer, int index, MixerControl * control);
|
||||||
|
/* useful */
|
||||||
|
static void _mixer_show_view(Mixer * mixer, int view);
|
||||||
|
|
||||||
|
|
||||||
/* public */
|
/* public */
|
||||||
|
@ -203,7 +206,7 @@ static GtkWidget * _new_set(Mixer * mixer, int dev, struct audio_mixer_set * s);
|
||||||
#endif
|
#endif
|
||||||
static GtkWidget * _new_value(Mixer * mixer, int index);
|
static GtkWidget * _new_value(Mixer * mixer, int index);
|
||||||
|
|
||||||
Mixer * mixer_new(char const * device, MixerLayout layout)
|
Mixer * mixer_new(char const * device, MixerLayout layout, gboolean embedded)
|
||||||
{
|
{
|
||||||
Mixer * mixer;
|
Mixer * mixer;
|
||||||
GtkAccelGroup * accel;
|
GtkAccelGroup * accel;
|
||||||
|
@ -250,20 +253,34 @@ Mixer * mixer_new(char const * device, MixerLayout layout)
|
||||||
}
|
}
|
||||||
/* widgets */
|
/* widgets */
|
||||||
accel = gtk_accel_group_new();
|
accel = gtk_accel_group_new();
|
||||||
mixer->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
if(embedded)
|
||||||
gtk_window_add_accel_group(GTK_WINDOW(mixer->window), accel);
|
{
|
||||||
gtk_window_set_default_size(GTK_WINDOW(mixer->window), 800, 200);
|
mixer->window = gtk_plug_new(0);
|
||||||
|
g_signal_connect_swapped(mixer->window, "embedded", G_CALLBACK(
|
||||||
|
on_embedded), mixer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mixer->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_add_accel_group(GTK_WINDOW(mixer->window), accel);
|
||||||
|
gtk_window_set_default_size(GTK_WINDOW(mixer->window), 800,
|
||||||
|
200);
|
||||||
#if GTK_CHECK_VERSION(2, 6, 0)
|
#if GTK_CHECK_VERSION(2, 6, 0)
|
||||||
gtk_window_set_icon_name(GTK_WINDOW(mixer->window), "stock_volume");
|
gtk_window_set_icon_name(GTK_WINDOW(mixer->window),
|
||||||
|
"stock_volume");
|
||||||
#endif
|
#endif
|
||||||
gtk_window_set_title(GTK_WINDOW(mixer->window), PACKAGE);
|
gtk_window_set_title(GTK_WINDOW(mixer->window), PACKAGE);
|
||||||
g_signal_connect_swapped(G_OBJECT(mixer->window), "delete-event",
|
g_signal_connect_swapped(mixer->window, "delete-event",
|
||||||
G_CALLBACK(on_closex), mixer);
|
G_CALLBACK(on_closex), mixer);
|
||||||
|
}
|
||||||
vbox = gtk_vbox_new(FALSE, 0);
|
vbox = gtk_vbox_new(FALSE, 0);
|
||||||
#ifndef EMBEDDED
|
#ifndef EMBEDDED
|
||||||
/* menubar */
|
/* menubar */
|
||||||
widget = desktop_menubar_create(_mixer_menubar, mixer, accel);
|
if(embedded == FALSE)
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
|
{
|
||||||
|
widget = desktop_menubar_create(_mixer_menubar, mixer, accel);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
desktop_accel_create(_mixer_accel, mixer, accel);
|
desktop_accel_create(_mixer_accel, mixer, accel);
|
||||||
#endif
|
#endif
|
||||||
|
@ -422,7 +439,10 @@ Mixer * mixer_new(char const * device, MixerLayout layout)
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
mixer_show_class(mixer, AudioCoutputs);
|
mixer_show_class(mixer, AudioCoutputs);
|
||||||
#endif
|
#endif
|
||||||
gtk_widget_show(mixer->window);
|
if(embedded)
|
||||||
|
printf("%u\n", gtk_plug_get_id(GTK_PLUG(mixer->window)));
|
||||||
|
else
|
||||||
|
gtk_widget_show(mixer->window);
|
||||||
return mixer;
|
return mixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,36 +884,16 @@ static gboolean _properties_on_closex(GtkWidget * widget)
|
||||||
|
|
||||||
|
|
||||||
/* mixer_show */
|
/* mixer_show */
|
||||||
void mixer_show(Mixer * mixer, int view)
|
void mixer_show(Mixer * mixer)
|
||||||
{
|
{
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
gtk_widget_show(mixer->window);
|
||||||
size_t u;
|
|
||||||
|
|
||||||
if(view < 0)
|
|
||||||
{
|
|
||||||
for(u = 0; u < mixer->mc_cnt; u++)
|
|
||||||
if(mixer->mc[u].hbox != NULL)
|
|
||||||
gtk_widget_show(mixer->mc[u].hbox);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
u = view;
|
|
||||||
if(u >= mixer->mc_cnt)
|
|
||||||
return;
|
|
||||||
for(u = 0; u < mixer->mc_cnt; u++)
|
|
||||||
if(mixer->mc[u].hbox == NULL)
|
|
||||||
continue;
|
|
||||||
else if(u == (size_t)view)
|
|
||||||
gtk_widget_show(mixer->mc[u].hbox);
|
|
||||||
else
|
|
||||||
gtk_widget_hide(mixer->mc[u].hbox);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mixer_show_all */
|
/* mixer_show_all */
|
||||||
void mixer_show_all(Mixer * mixer)
|
void mixer_show_all(Mixer * mixer)
|
||||||
{
|
{
|
||||||
mixer_show(mixer, -1);
|
_mixer_show_view(mixer, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -954,6 +954,7 @@ static int _error_text(char const * message, int ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* accessors */
|
||||||
/* mixer_get_control */
|
/* mixer_get_control */
|
||||||
static int _mixer_get_control(Mixer * mixer, int index, MixerControl * control)
|
static int _mixer_get_control(Mixer * mixer, int index, MixerControl * control)
|
||||||
{
|
{
|
||||||
|
@ -1082,3 +1083,31 @@ static int _mixer_set_control(Mixer * mixer, int index, MixerControl * control)
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* useful */
|
||||||
|
/* mixer_show_view */
|
||||||
|
static void _mixer_show_view(Mixer * mixer, int view)
|
||||||
|
{
|
||||||
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
|
size_t u;
|
||||||
|
|
||||||
|
if(view < 0)
|
||||||
|
{
|
||||||
|
for(u = 0; u < mixer->mc_cnt; u++)
|
||||||
|
if(mixer->mc[u].hbox != NULL)
|
||||||
|
gtk_widget_show(mixer->mc[u].hbox);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
u = view;
|
||||||
|
if(u >= mixer->mc_cnt)
|
||||||
|
return;
|
||||||
|
for(u = 0; u < mixer->mc_cnt; u++)
|
||||||
|
if(mixer->mc[u].hbox == NULL)
|
||||||
|
continue;
|
||||||
|
else if(u == (size_t)view)
|
||||||
|
gtk_widget_show(mixer->mc[u].hbox);
|
||||||
|
else
|
||||||
|
gtk_widget_hide(mixer->mc[u].hbox);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2009,2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009-2012 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop Mixer */
|
/* This file is part of DeforaOS Desktop Mixer */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -34,7 +34,7 @@ typedef struct _Mixer Mixer;
|
||||||
|
|
||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
Mixer * mixer_new(char const * device, MixerLayout layout);
|
Mixer * mixer_new(char const * device, MixerLayout layout, gboolean embedded);
|
||||||
void mixer_delete(Mixer * mixer);
|
void mixer_delete(Mixer * mixer);
|
||||||
|
|
||||||
/* accessors */
|
/* accessors */
|
||||||
|
@ -46,7 +46,7 @@ int mixer_set_value(Mixer * mixer, GtkWidget * widget, gdouble value);
|
||||||
void mixer_about(Mixer * mixer);
|
void mixer_about(Mixer * mixer);
|
||||||
void mixer_properties(Mixer * mixer);
|
void mixer_properties(Mixer * mixer);
|
||||||
|
|
||||||
void mixer_show(Mixer * mixer, int view);
|
void mixer_show(Mixer * mixer);
|
||||||
void mixer_show_all(Mixer * mixer);
|
void mixer_show_all(Mixer * mixer);
|
||||||
void mixer_show_class(Mixer * mixer, char const * name);
|
void mixer_show_class(Mixer * mixer, char const * name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user