summaryrefslogtreecommitdiff
path: root/src/bin/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/main.c')
-rw-r--r--src/bin/main.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 2bed6c1..8e0bcad 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -27,6 +27,30 @@ Eina_Bool multisense_available = EINA_TRUE;
27static Config *_main_config = NULL; 27static Config *_main_config = NULL;
28 28
29static void 29static void
30_set_instance_theme(Ipc_Instance *inst)
31{
32 char path[PATH_MAX];
33 char theme_name[PATH_MAX];
34 const char *theme_path = (const char *)&path;
35
36 if (!inst->theme)
37 return;
38
39 if (eina_str_has_suffix(inst->theme, ".edj"))
40 eina_strlcpy(theme_name, inst->theme, sizeof(theme_name));
41 else
42 snprintf(theme_name, sizeof(theme_name), "%s.edj", inst->theme);
43
44 if (strchr(theme_name, '/'))
45 eina_strlcpy(path, theme_name, sizeof(path));
46 else
47 theme_path = theme_path_get(theme_name);
48
49 eina_stringshare_replace(&(inst->config->theme), theme_path);
50 inst->config->temporary = EINA_TRUE;
51}
52
53static void
30_check_multisense(void) 54_check_multisense(void)
31{ 55{
32 int enabled; 56 int enabled;
@@ -94,6 +118,7 @@ main_ipc_new(Ipc_Instance *inst)
94 if (inst->xterm_256color) nargc += 1; 118 if (inst->xterm_256color) nargc += 1;
95 if (inst->active_links) nargc += 1; 119 if (inst->active_links) nargc += 1;
96 if (inst->cmd) nargc += 2; 120 if (inst->cmd) nargc += 2;
121 if (inst->theme) nargc += 2;
97 122
98 nargv = calloc(nargc + 1, sizeof(char *)); 123 nargv = calloc(nargc + 1, sizeof(char *));
99 if (!nargv) return; 124 if (!nargv) return;
@@ -115,6 +140,11 @@ main_ipc_new(Ipc_Instance *inst)
115 nargv[i++] = "-n"; 140 nargv[i++] = "-n";
116 nargv[i++] = (char *)inst->name; 141 nargv[i++] = (char *)inst->name;
117 } 142 }
143 if (inst->theme)
144 {
145 nargv[i++] = "-t";
146 nargv[i++] = (char *)inst->theme;
147 }
118 if (inst->role) 148 if (inst->role)
119 { 149 {
120 nargv[i++] = "-r"; 150 nargv[i++] = "-r";
@@ -247,6 +277,9 @@ main_ipc_new(Ipc_Instance *inst)
247 277
248 win = win_evas_object_get(wn); 278 win = win_evas_object_get(wn);
249 config = win_config_get(wn); 279 config = win_config_get(wn);
280 inst->config = config;
281
282 _set_instance_theme(inst);
250 283
251 if (inst->background) 284 if (inst->background)
252 { 285 {
@@ -697,7 +730,6 @@ exit:
697EAPI_MAIN int 730EAPI_MAIN int
698elm_main(int argc, char **argv) 731elm_main(int argc, char **argv)
699{ 732{
700 char *theme = NULL;
701 char *geometry = NULL; 733 char *geometry = NULL;
702 char *video_module = NULL; 734 char *video_module = NULL;
703 Eina_Bool video_mute = 0xff; /* unset */ 735 Eina_Bool video_mute = 0xff; /* unset */
@@ -717,7 +749,7 @@ elm_main(int argc, char **argv)
717 Ecore_Getopt_Value values[] = { 749 Ecore_Getopt_Value values[] = {
718 ECORE_GETOPT_VALUE_BOOL(cmd_options), 750 ECORE_GETOPT_VALUE_BOOL(cmd_options),
719 ECORE_GETOPT_VALUE_STR(instance.cd), 751 ECORE_GETOPT_VALUE_STR(instance.cd),
720 ECORE_GETOPT_VALUE_STR(theme), 752 ECORE_GETOPT_VALUE_STR(instance.theme),
721 ECORE_GETOPT_VALUE_STR(instance.background), 753 ECORE_GETOPT_VALUE_STR(instance.background),
722 ECORE_GETOPT_VALUE_STR(geometry), 754 ECORE_GETOPT_VALUE_STR(geometry),
723 ECORE_GETOPT_VALUE_STR(instance.name), 755 ECORE_GETOPT_VALUE_STR(instance.name),
@@ -849,25 +881,7 @@ elm_main(int argc, char **argv)
849 881
850 _check_multisense(); 882 _check_multisense();
851 883
852 if (theme) 884 _set_instance_theme(&instance);
853 {
854 char path[PATH_MAX];
855 char theme_name[PATH_MAX];
856 const char *theme_path = (const char *)&path;
857
858 if (eina_str_has_suffix(theme, ".edj"))
859 eina_strlcpy(theme_name, theme, sizeof(theme_name));
860 else
861 snprintf(theme_name, sizeof(theme_name), "%s.edj", theme);
862
863 if (strchr(theme_name, '/'))
864 eina_strlcpy(path, theme_name, sizeof(path));
865 else
866 theme_path = theme_path_get(theme_name);
867
868 eina_stringshare_replace(&(instance.config->theme), theme_path);
869 instance.config->temporary = EINA_TRUE;
870 }
871 885
872 if (instance.background) 886 if (instance.background)
873 { 887 {