浏览代码

Disable camera switch button if only one camera exists

Martijn Braam 4 年之前
父节点
当前提交
6b775ba1f9
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      main.c

+ 10 - 0
main.c

@@ -1598,6 +1598,16 @@ main(int argc, char *argv[])
 		goto failed;
 	}
 
+	// Disable the camera switch button if only one camera exists
+	int camera_count = 0;
+	for (int i=0; i<NUM_CAMERAS; i++) {
+		if(cameras[i].exists)
+			camera_count++;
+	}
+	if (camera_count < 2) {
+		gtk_widget_set_sensitive(switch_btn, FALSE);
+	}
+
 	// Setup first defined camera
 	for(int i=0;i<NUM_CAMERAS; i++) {
 		if(cameras[i].exists){