summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-12 23:43:41 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-14 23:38:49 -0300
commit861541dd018675773db7983dbee45bab586cae25 (patch)
tree6d9dc639d8f1c6a8d375a81afdee2d006dda967d
parent68dd8bd3e1100e26d037de24416541df5525905d (diff)
Be prepared to advanced options on emixer
The advanced option is a view given by the backend to be shown on emixer application. The idea is allow advanced options of which backend to the user, for example something like paprefs for pulseaudio.
-rw-r--r--src/bin/main_window.c20
-rw-r--r--src/lib/backends/alsa/alsa.c3
-rw-r--r--src/lib/backends/pulseaudio/pulse.c3
-rw-r--r--src/lib/emix.c9
-rw-r--r--src/lib/emix.h5
5 files changed, 37 insertions, 3 deletions
diff --git a/src/bin/main_window.c b/src/bin/main_window.c
index 5399d4c..a620b2c 100644
--- a/src/bin/main_window.c
+++ b/src/bin/main_window.c
@@ -4,12 +4,15 @@
4#include "sinks_view.h" 4#include "sinks_view.h"
5#include "sources_view.h" 5#include "sources_view.h"
6 6
7#include <emix.h>
8
7#define MAIN_WINDOW_DATA "mainwindow.data" 9#define MAIN_WINDOW_DATA "mainwindow.data"
8 10
9enum MAIN_SUBVIEWS { 11enum MAIN_SUBVIEWS {
10 PLAYBACKS, 12 PLAYBACKS,
11 OUTPUTS, 13 OUTPUTS,
12 INPUTS 14 INPUTS,
15 ADVANCED
13}; 16};
14 17
15typedef struct _Main_Window Main_Window; 18typedef struct _Main_Window Main_Window;
@@ -22,6 +25,7 @@ struct _Main_Window
22 Evas_Object *playbacks; 25 Evas_Object *playbacks;
23 Evas_Object *inputs; 26 Evas_Object *inputs;
24 Evas_Object *outputs; 27 Evas_Object *outputs;
28 Evas_Object *advanced_options;
25 Elm_Object_Item *toolbar_items[3]; 29 Elm_Object_Item *toolbar_items[3];
26 Elm_Object_Item *views[3]; 30 Elm_Object_Item *views[3];
27}; 31};
@@ -155,6 +159,20 @@ main_window_add(void)
155 evas_object_size_hint_align_set(mw->inputs, EVAS_HINT_FILL, EVAS_HINT_FILL); 159 evas_object_size_hint_align_set(mw->inputs, EVAS_HINT_FILL, EVAS_HINT_FILL);
156 evas_object_show(mw->inputs); 160 evas_object_show(mw->inputs);
157 161
162 /* Creating the advanced view */
163 mw->advanced_options = emix_advanced_options_add(mw->win);
164 if (mw->advanced_options)
165 {
166 evas_object_size_hint_weight_set(mw->advanced_options, EVAS_HINT_EXPAND,
167 EVAS_HINT_EXPAND);
168 evas_object_size_hint_align_set(mw->advanced_options, EVAS_HINT_FILL,
169 EVAS_HINT_FILL);
170 evas_object_show(mw->advanced_options);
171
172 mw->views[ADVANCED] = elm_naviframe_item_simple_push(mw->naviframe,
173 mw->advanced_options);
174 }
175
158 mw->views[INPUTS] = elm_naviframe_item_simple_push(mw->naviframe, 176 mw->views[INPUTS] = elm_naviframe_item_simple_push(mw->naviframe,
159 mw->inputs); 177 mw->inputs);
160 mw->views[OUTPUTS] = elm_naviframe_item_simple_push(mw->naviframe, 178 mw->views[OUTPUTS] = elm_naviframe_item_simple_push(mw->naviframe,
diff --git a/src/lib/backends/alsa/alsa.c b/src/lib/backends/alsa/alsa.c
index efbe921..237ece2 100644
--- a/src/lib/backends/alsa/alsa.c
+++ b/src/lib/backends/alsa/alsa.c
@@ -626,7 +626,8 @@ _alsa_backend = {
626 NULL,/*sink input sink change*/ 626 NULL,/*sink input sink change*/
627 _alsa_sources_get,/*source*/ 627 _alsa_sources_get,/*source*/
628 _alsa_sources_mute_set,/* source mute set */ 628 _alsa_sources_mute_set,/* source mute set */
629 _alsa_sources_volume_set /* source volume set */ 629 _alsa_sources_volume_set, /* source volume set */
630 NULL /* advanced options */
630}; 631};
631 632
632EAPI Emix_Backend * 633EAPI Emix_Backend *
diff --git a/src/lib/backends/pulseaudio/pulse.c b/src/lib/backends/pulseaudio/pulse.c
index 5909807..b9caad3 100644
--- a/src/lib/backends/pulseaudio/pulse.c
+++ b/src/lib/backends/pulseaudio/pulse.c
@@ -999,7 +999,8 @@ _pulseaudio_backend = {
999 _sink_input_move, 999 _sink_input_move,
1000 _sources_get, 1000 _sources_get,
1001 _source_mute_set, 1001 _source_mute_set,
1002 _source_volume_set 1002 _source_volume_set,
1003 NULL
1003}; 1004};
1004 1005
1005EAPI Emix_Backend * 1006EAPI Emix_Backend *
diff --git a/src/lib/emix.c b/src/lib/emix.c
index 93d89dc..13eb17d 100644
--- a/src/lib/emix.c
+++ b/src/lib/emix.c
@@ -423,3 +423,12 @@ emix_source_volume_set(Emix_Source *source, Emix_Volume volume)
423 423
424 ctx->loaded->ebackend_source_volume_set(source, volume); 424 ctx->loaded->ebackend_source_volume_set(source, volume);
425} 425}
426
427Evas_Object *
428emix_advanced_options_add(Evas_Object *parent)
429{
430 EINA_SAFETY_ON_FALSE_RETURN_VAL((ctx && ctx->loaded && parent &&
431 ctx->loaded->ebackend_advanced_options_add), NULL);
432
433 return ctx->loaded->ebackend_advanced_options_add(parent);
434}
diff --git a/src/lib/emix.h b/src/lib/emix.h
index 0c40151..c43d31c 100644
--- a/src/lib/emix.h
+++ b/src/lib/emix.h
@@ -2,6 +2,7 @@
2#define EMIX_H 2#define EMIX_H
3 3
4#include <Eina.h> 4#include <Eina.h>
5#include <Evas.h>
5 6
6#define EMIX_VOLUME_MAX 100 7#define EMIX_VOLUME_MAX 100
7 8
@@ -96,6 +97,8 @@ typedef struct _Emix_Backend {
96 Eina_Bool bool); 97 Eina_Bool bool);
97 void (*ebackend_source_volume_set)(Emix_Source *source, 98 void (*ebackend_source_volume_set)(Emix_Source *source,
98 Emix_Volume volume); 99 Emix_Volume volume);
100
101 Evas_Object* (*ebackend_advanced_options_add)(Evas_Object *parent);
99} Emix_Backend; 102} Emix_Backend;
100 103
101 104
@@ -128,4 +131,6 @@ EAPI void emix_source_mute_set(Emix_Source *source,
128EAPI void emix_source_volume_set(Emix_Source *source, 131EAPI void emix_source_volume_set(Emix_Source *source,
129 Emix_Volume volume); 132 Emix_Volume volume);
130 133
134EAPI Evas_Object* emix_advanced_options_add(Evas_Object *parent);
135
131#endif /* EMIX_H */ 136#endif /* EMIX_H */