aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-18 12:43:59 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-18 12:43:59 -0300
commit2ba02b7f99a05655feca585c27bd2e55bcefe014 (patch)
tree271e3a744d46f6d6d3068ba62c5b31d47023dc13 /src
parent5e9cf9ad9a646921f36c49e9f2a40d3b66e0a49f (diff)
preserve last used resolution if not changed via command lineschemas
Store the last used resolution at Gconf's schema. This way, when camorama is restarted, it will re-use it. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/callbacks.c3
-rw-r--r--src/interface.h2
-rw-r--r--src/main.c12
3 files changed, 14 insertions, 3 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 1e81fba..7966014 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -394,6 +394,9 @@ void set_image_scale(cam_t *cam)
gtk_window_set_title(GTK_WINDOW(GTK_WIDGET(gtk_builder_get_object(cam->xml, "main_window"))),
title);
g_free(title);
+
+ gconf_client_set_int(cam->gc, GCONF_WIDTH, cam->width, NULL);
+ gconf_client_set_int(cam->gc, GCONF_HEIGHT, cam->height, NULL);
}
void on_change_size_activate(GtkWidget *widget, cam_t *cam)
diff --git a/src/interface.h b/src/interface.h
index 639b0a3..7083b38 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -2,6 +2,8 @@
#define GCONF_PREFS GCONF_PARENT "/preferences"
#define GCONF_DEVICE GCONF_PARENT "/device"
+#define GCONF_WIDTH GCONF_PARENT "/width"
+#define GCONF_HEIGHT GCONF_PARENT "/height"
#define GCONF_SAVE_DIR GCONF_PREFS "/save_dir"
#define GCONF_SAVE_FILE GCONF_PREFS "/save_file"
#define GCONF_FILE_TYPE GCONF_PREFS "/file_type"
diff --git a/src/main.c b/src/main.c
index 6447f51..d49e1f2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -129,9 +129,6 @@ static void activate(GtkApplication *app)
cam->debug = buggery;
- cam->width = x;
- cam->height = y;
-
get_geometry(cam);
if (ver) {
@@ -221,6 +218,15 @@ static void activate(GtkApplication *app)
NULL);
cam->show_effects = gconf_client_get_bool(cam->gc,
GCONF_SHOW_EFFECTS, NULL);
+ if (x)
+ cam->width = x;
+ else
+ cam->width = gconf_client_get_int(cam->gc, GCONF_WIDTH, NULL);
+
+ if (y)
+ cam->height = y;
+ else
+ cam->height = gconf_client_get_int(cam->gc, GCONF_HEIGHT, NULL);
if (use_read)
cam->dev = v4l2_open(cam->video_dev, O_RDWR);

Privacy Policy