summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-09 00:29:07 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-14 23:38:49 -0300
commit77fb1afabb5721f785111d9ee12764cd742f23b5 (patch)
treef4100fab097c322600e785facb00246a8c292359 /src/bin
parentb68c9f556b594fadb7ac43520bb00b8376d418d3 (diff)
Removed all references to epulse
The stand alone application is called now emixer, it makes more sense since it was introduced multiple backends.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/common.c66
-rw-r--r--src/bin/common.h33
-rw-r--r--src/bin/main.c4
-rw-r--r--src/bin/main_window.c6
-rw-r--r--src/bin/main_window.h2
-rw-r--r--src/bin/playbacks_view.c2
-rw-r--r--src/bin/sinks_view.c2
-rw-r--r--src/bin/sources_view.c2
-rw-r--r--src/bin/translation.h14
9 files changed, 122 insertions, 9 deletions
diff --git a/src/bin/common.c b/src/bin/common.c
new file mode 100644
index 0000000..7907d05
--- /dev/null
+++ b/src/bin/common.c
@@ -0,0 +1,66 @@
1#include "common.h"
2
3int _log_domain = -1;
4
5Eina_Bool
6emixer_common_init(const char *domain)
7{
8 EINA_SAFETY_ON_NULL_RETURN_VAL(domain, EINA_FALSE);
9 if (!eina_init())
10 {
11 fprintf(stderr, "Could not init eina\n");
12 return EINA_FALSE;
13 }
14
15 _log_domain = eina_log_domain_register(domain, NULL);
16 if (_log_domain < 0)
17 {
18 EINA_LOG_CRIT("Could not create log domain '%s'", domain);
19 goto err_log;
20 }
21
22 if (!ecore_init())
23 {
24 CRIT("Could not init ecore");
25 goto err_ecore;
26 }
27
28 return EINA_TRUE;
29
30 err_ecore:
31 eina_log_domain_unregister(_log_domain);
32 _log_domain = -1;
33 err_log:
34 eina_shutdown();
35 return EINA_FALSE;
36}
37
38void
39emixer_common_shutdown(void)
40{
41 eina_shutdown();
42
43 eina_log_domain_unregister(_log_domain);
44 _log_domain = -1;
45
46 ecore_shutdown();
47}
48
49Evas_Object *
50emixer_layout_add(Evas_Object *parent, const char *group,
51 const char *style)
52{
53 EINA_SAFETY_ON_NULL_RETURN_VAL(group, NULL);
54 EINA_SAFETY_ON_NULL_RETURN_VAL(style, NULL);
55
56 Evas_Object *layout = elm_layout_add(parent);
57 if (!elm_layout_theme_set(layout, "layout", group, style))
58 {
59 CRIT("No theme for 'elm/layout/%s/%s' at %s", group, style,
60 EMIXER_THEME);
61 evas_object_del(layout);
62 return NULL;
63 }
64
65 return layout;
66}
diff --git a/src/bin/common.h b/src/bin/common.h
new file mode 100644
index 0000000..4a399f9
--- /dev/null
+++ b/src/bin/common.h
@@ -0,0 +1,33 @@
1#ifndef __COMMON_H__
2#define __COMMON_H__
3
4#ifndef _GNU_SOURCE
5#define _GNU_SOURCE
6#endif
7
8#include <Ecore.h>
9#include <Elementary.h>
10
11#include <stdlib.h>
12#include <stdio.h>
13#include <string.h>
14
15#include "translation.h"
16
17#define BASE_VOLUME_STEP 10
18#define EMIXER_THEME PACKAGE_DATA_DIR"/data/themes/default.edj"
19
20EAPI extern int _log_domain;
21
22#define CRIT(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
23#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
24#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
25#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
26#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
27
28Eina_Bool emixer_common_init(const char *domain);
29void emixer_common_shutdown(void);
30Evas_Object *emixer_layout_add(Evas_Object *parent, const char *group,
31 const char *style);
32
33#endif /* __COMMON_H__ */
diff --git a/src/bin/main.c b/src/bin/main.c
index 29f66ee..b74940b 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -10,7 +10,7 @@ elm_main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
10{ 10{
11 Evas_Object *win; 11 Evas_Object *win;
12 12
13 EINA_SAFETY_ON_FALSE_RETURN_VAL(epulse_common_init("emixer"), EXIT_FAILURE); 13 EINA_SAFETY_ON_FALSE_RETURN_VAL(emixer_common_init("emixer"), EXIT_FAILURE);
14 EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init() == EINA_TRUE, EXIT_FAILURE); 14 EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init() == EINA_TRUE, EXIT_FAILURE);
15 15
16 win = main_window_add(); 16 win = main_window_add();
@@ -20,7 +20,7 @@ elm_main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
20 emix_backend_set("PULSEAUDIO"); 20 emix_backend_set("PULSEAUDIO");
21 elm_run(); 21 elm_run();
22 22
23 epulse_common_shutdown(); 23 emixer_common_shutdown();
24 emix_shutdown(); 24 emix_shutdown();
25 return 0; 25 return 0;
26} 26}
diff --git a/src/bin/main_window.c b/src/bin/main_window.c
index 5b49b4a..5399d4c 100644
--- a/src/bin/main_window.c
+++ b/src/bin/main_window.c
@@ -68,7 +68,7 @@ main_window_add(void)
68 Evas_Object *tmp, *box, *icon; 68 Evas_Object *tmp, *box, *icon;
69 char buf[4096]; 69 char buf[4096];
70 70
71 elm_theme_extension_add(NULL, EPULSE_THEME); 71 elm_theme_extension_add(NULL, EMIXER_THEME);
72 mw = calloc(1, sizeof(Main_Window)); 72 mw = calloc(1, sizeof(Main_Window));
73 if (!mw) 73 if (!mw)
74 { 74 {
@@ -85,11 +85,11 @@ main_window_add(void)
85 mw->win = tmp; 85 mw->win = tmp;
86 86
87 icon = evas_object_image_add(evas_object_evas_get(mw->win)); 87 icon = evas_object_image_add(evas_object_evas_get(mw->win));
88 snprintf(buf, sizeof(buf), "%s/icons/terminology.png", 88 snprintf(buf, sizeof(buf), "%s/icons/emixer.png",
89 elm_app_data_dir_get()); 89 elm_app_data_dir_get());
90 evas_object_image_file_set(icon, buf, NULL); 90 evas_object_image_file_set(icon, buf, NULL);
91 elm_win_icon_object_set(mw->win, icon); 91 elm_win_icon_object_set(mw->win, icon);
92 elm_win_icon_name_set(mw->win, "epulse"); 92 elm_win_icon_name_set(mw->win, "emixer");
93 93
94 tmp = elm_bg_add(mw->win); 94 tmp = elm_bg_add(mw->win);
95 evas_object_size_hint_weight_set(tmp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 95 evas_object_size_hint_weight_set(tmp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
diff --git a/src/bin/main_window.h b/src/bin/main_window.h
index dd63ae7..b979a68 100644
--- a/src/bin/main_window.h
+++ b/src/bin/main_window.h
@@ -1,7 +1,7 @@
1#ifndef _MAIN_WINDOW_H_ 1#ifndef _MAIN_WINDOW_H_
2#define _MAIN_WINDOW_H_ 2#define _MAIN_WINDOW_H_
3 3
4#include <common.h> 4#include "common.h"
5 5
6#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
7#include "config.h" 7#include "config.h"
diff --git a/src/bin/playbacks_view.c b/src/bin/playbacks_view.c
index 5ac0a6c..9455e5a 100644
--- a/src/bin/playbacks_view.c
+++ b/src/bin/playbacks_view.c
@@ -254,7 +254,7 @@ playbacks_view_add(Evas_Object *parent)
254 pv = calloc(1, sizeof(struct Playbacks_View)); 254 pv = calloc(1, sizeof(struct Playbacks_View));
255 EINA_SAFETY_ON_NULL_RETURN_VAL(pv, NULL); 255 EINA_SAFETY_ON_NULL_RETURN_VAL(pv, NULL);
256 256
257 layout = epulse_layout_add(parent, "playbacks", "default"); 257 layout = emixer_layout_add(parent, "playbacks", "default");
258 EINA_SAFETY_ON_NULL_GOTO(layout, err); 258 EINA_SAFETY_ON_NULL_GOTO(layout, err);
259 259
260 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, pv); 260 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, pv);
diff --git a/src/bin/sinks_view.c b/src/bin/sinks_view.c
index 15cfba4..f5a7f70 100644
--- a/src/bin/sinks_view.c
+++ b/src/bin/sinks_view.c
@@ -224,7 +224,7 @@ sinks_view_add(Evas_Object *parent)
224 sv = calloc(1, sizeof(struct Sinks_View)); 224 sv = calloc(1, sizeof(struct Sinks_View));
225 EINA_SAFETY_ON_NULL_RETURN_VAL(sv, NULL); 225 EINA_SAFETY_ON_NULL_RETURN_VAL(sv, NULL);
226 226
227 layout = epulse_layout_add(parent, "sinks", "default"); 227 layout = emixer_layout_add(parent, "sinks", "default");
228 EINA_SAFETY_ON_NULL_GOTO(layout, err); 228 EINA_SAFETY_ON_NULL_GOTO(layout, err);
229 229
230 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, sv); 230 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, sv);
diff --git a/src/bin/sources_view.c b/src/bin/sources_view.c
index bbf4008..80edee2 100644
--- a/src/bin/sources_view.c
+++ b/src/bin/sources_view.c
@@ -188,7 +188,7 @@ sources_view_add(Evas_Object *parent)
188 sv = calloc(1, sizeof(struct Sources_View)); 188 sv = calloc(1, sizeof(struct Sources_View));
189 EINA_SAFETY_ON_NULL_RETURN_VAL(sv, NULL); 189 EINA_SAFETY_ON_NULL_RETURN_VAL(sv, NULL);
190 190
191 layout = epulse_layout_add(parent, "sources", "default"); 191 layout = emixer_layout_add(parent, "sources", "default");
192 EINA_SAFETY_ON_NULL_GOTO(layout, err); 192 EINA_SAFETY_ON_NULL_GOTO(layout, err);
193 193
194 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, sv); 194 evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _del_cb, sv);
diff --git a/src/bin/translation.h b/src/bin/translation.h
new file mode 100644
index 0000000..6877b33
--- /dev/null
+++ b/src/bin/translation.h
@@ -0,0 +1,14 @@
1#ifndef __TRANSLATION_H__
2#define __TRANSLATION_H__
3
4#include <libintl.h>
5
6
7#define _(str) gettext(str)
8#define d_(str, dom) dgettext(dom, str)
9#define P_(str, str_p, n) ngettext(str, str_p, n)
10#define dP_(str, str_p, n, dom) dngettext(dom, str, str_p, n)
11#define N_(str) str
12#define NP_(str, str_p) str, str_p
13
14#endif /* __TRANSLATION_H__ */