aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termcmd.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-08-23 02:41:57 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-08-23 02:41:57 +0000
commit8524aae983c76c84b4b33ae6c8af6a2d3351517a (patch)
treec27fb8f7309177b17b9f80c03d4d9597c72c65fa /src/bin/termcmd.c
parentrefactor cmd in separate functions, it's growing too big. (diff)
downloadterminology-8524aae983c76c84b4b33ae6c8af6a2d3351517a.tar.gz
termcmd: allow setting the background.
SVN revision: 75584
Diffstat (limited to 'src/bin/termcmd.c')
-rw-r--r--src/bin/termcmd.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bin/termcmd.c b/src/bin/termcmd.c
index fb64014..05acbb7 100644
--- a/src/bin/termcmd.c
+++ b/src/bin/termcmd.c
@@ -119,6 +119,31 @@ _termcmd_grid_size(Evas_Object *obj, Evas_Object *win __UNUSED__, Evas_Object *b
return EINA_TRUE;
}
+static Eina_Bool
+_termcmd_background(Evas_Object *obj, Evas_Object *win __UNUSED__, Evas_Object *bg __UNUSED__, const char *cmd)
+{
+ Config *config = termio_config_get(obj);
+
+ if (!config) return EINA_TRUE;
+
+ if (cmd[0] == 0)
+ {
+ config->temporary = EINA_TRUE;
+ eina_stringshare_replace(&(config->background), NULL);
+ main_media_update(config);
+ }
+ else if (ecore_file_can_read(cmd))
+ {
+ config->temporary = EINA_TRUE;
+ eina_stringshare_replace(&(config->background), cmd);
+ main_media_update(config);
+ }
+ else
+ ERR("Background file cannot be read: %s", cmd);
+
+ return EINA_TRUE;
+}
+
// called as u type
Eina_Bool
termcmd_watch(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd)
@@ -141,6 +166,8 @@ termcmd_do(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd)
return _termcmd_font_size(obj, win, bg, cmd + 1);
if ((cmd[0] == 'g') || (cmd[0] == 'G'))
return _termcmd_grid_size(obj, win, bg, cmd + 1);
+ if ((cmd[0] == 'b') || (cmd[0] == 'B'))
+ return _termcmd_background(obj, win, bg, cmd + 1);
return EINA_FALSE;
obj = win = bg = NULL;